All files / framework/featureStore FeatureDescriptor.tsx

100% Statements 7/7
100% Branches 2/2
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43              585x 585x       585x                           585x                 585x       585x 54x    
/*
 * Copyright 2021 Harness Inc. All rights reserved.
 * Use of this source code is governed by the PolyForm Shield 1.0.0 license
 * that can be found in the licenses directory at the root of this repository, also available at
 * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt.
 */
 
import React from 'react'
import { String } from 'framework/strings'
import type { UseStringsReturn } from 'framework/strings'
import type { StringsMap } from 'stringTypes'
 
export const FeatureDescriptor: { [key: string]: React.ReactElement } = {
  MULTIPLE_ORGANIZATIONS: <String stringID="projectsOrgs.multipleOrganizations" />,
  MULTIPLE_PROJECTS: <String stringID="projectsOrgs.multipleProjects" />,
  SECRET_MANAGERS: <String stringID="secretManagers" />,
  TEMPLATE_SERVICE: <String stringID="templatesLibrary.addNewTemplate" />,
  SAML_SUPPORT: <String stringID="authSettings.samlSupport" />,
  OAUTH_SUPPORT: <String stringID="authSettings.oauthSupport" />,
  TWO_FACTOR_AUTH_SUPPORT: <String stringID="authSettings.twoFactorAuthSupport" />,
  CUSTOM_ROLES: <String stringID="rbac.customRoles" />,
  CUSTOM_RESOURCE_GROUPS: <String stringID="rbac.customResourceGroups" />,
  DEPLOYMENTS_PER_MONTH: <String stringID="deploymentsText" />,
  INTEGRATED_APPROVALS_WITH_JIRA: <String stringID="pipeline.featureRestriction.integratedApprovalsJira" />
}
 
const CustomFeatureDescriptorMap: Record<string, keyof StringsMap> = {
  TEST_INTELLIGENCE: 'pipeline.testsReports.tiCallToAction.requiresEnterprisePlan',
  BUILDS: 'pipeline.featureRestriction.maxBuildsPerMonth100PercentLimit',
  MONTHLY_ACTIVE_USERS: 'cf.planEnforcement.upgradeRequiredMau',
  DEVELOPERS: 'cf.planEnforcement.upgradeRequiredDev',
  CCM_AUTOSTOPPING_RULES: 'ce.enforcementMessage.autoStoppingRules',
  PERSPECTIVES: 'ce.enforcementMessage.perspectivesLimitMsg'
}
 
export const customFeatureDescriptor: (
  key: string,
  getString: UseStringsReturn['getString'],
  args?: Record<string, any>
) => string = (key, getString, args) => {
  return CustomFeatureDescriptorMap[key] ? getString(CustomFeatureDescriptorMap[key], args) : ''
}