diff options
author | Jeremy Davis <jeremy.davis@sonarsource.com> | 2022-09-23 17:15:08 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-09-27 20:03:17 +0000 |
commit | 57a8a41fa35a7949e9cb3582b60e368bd5253e2d (patch) | |
tree | 9ed87872c8d3268065a1f36735a333f2898b8bcc /server/sonar-web | |
parent | a42eb5b4853a8ae8349e5348a9e179c2aec0e70a (diff) | |
download | sonarqube-57a8a41fa35a7949e9cb3582b60e368bd5253e2d.tar.gz sonarqube-57a8a41fa35a7949e9cb3582b60e368bd5253e2d.zip |
SONAR-17115 Migrate Multiple ALM feature
Diffstat (limited to 'server/sonar-web')
7 files changed, 12 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AdditionalCategories-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AdditionalCategories-test.tsx.snap index 8a48cd3c24d..e9f366fc6fe 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AdditionalCategories-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/AdditionalCategories-test.tsx.snap @@ -63,7 +63,7 @@ exports[`should render additional categories component correctly 3`] = ` `; exports[`should render additional categories component correctly 4`] = ` -<withRouter(withAppStateContext(AlmIntegration)) +<withRouter(withAppStateContext(withAvailableFeaturesContext(AlmIntegration))) categories={Array []} component={ Object { diff --git a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/SettingsAppRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/SettingsAppRenderer-test.tsx.snap index 7de14af9ca2..d251c34105f 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/SettingsAppRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/__tests__/__snapshots__/SettingsAppRenderer-test.tsx.snap @@ -51,7 +51,7 @@ exports[`should render almintegration correctly 1`] = ` className="big-padded" key="almintegration" > - <withRouter(withAppStateContext(AlmIntegration)) + <withRouter(withAppStateContext(withAvailableFeaturesContext(AlmIntegration))) categories={ Array [ "foo category", diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx index bb471ee144e..f92b709abca 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx @@ -25,6 +25,7 @@ import { validateAlmSettings } from '../../../../api/alm-settings'; import withAppStateContext from '../../../../app/components/app-state/withAppStateContext'; +import withAvailableFeatures from '../../../../app/components/available-features/withAvailableFeatures'; import { Location, Router, withRouter } from '../../../../components/hoc/withRouter'; import { AlmBindingDefinitionBase, @@ -34,11 +35,13 @@ import { AlmSettingsBindingStatusType } from '../../../../types/alm-settings'; import { AppState } from '../../../../types/appstate'; +import { Feature } from '../../../../types/features'; import { Dict } from '../../../../types/types'; import AlmIntegrationRenderer from './AlmIntegrationRenderer'; interface Props { appState: AppState; + hasFeature: (feature: Feature) => boolean; location: Location; router: Router; } @@ -210,7 +213,8 @@ export class AlmIntegration extends React.PureComponent<Props, State> { render() { const { - appState: { branchesEnabled, multipleAlmEnabled } + appState: { branchesEnabled }, + hasFeature } = this.props; const { currentAlmTab, @@ -225,7 +229,7 @@ export class AlmIntegration extends React.PureComponent<Props, State> { return ( <AlmIntegrationRenderer branchesEnabled={Boolean(branchesEnabled)} - multipleAlmEnabled={Boolean(multipleAlmEnabled)} + multipleAlmEnabled={hasFeature(Feature.MultipleAlm)} onCancelDelete={this.handleCancelDelete} onConfirmDelete={this.handleConfirmDelete} onCheckConfiguration={this.handleCheck} @@ -244,4 +248,4 @@ export class AlmIntegration extends React.PureComponent<Props, State> { } } -export default withRouter(withAppStateContext(AlmIntegration)); +export default withRouter(withAppStateContext(withAvailableFeatures(AlmIntegration))); diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-test.tsx index 4b3fad35c24..e8ec58bb592 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-test.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-test.tsx @@ -191,6 +191,7 @@ function shallowRender(props: Partial<AlmIntegration['props']> = {}) { <AlmIntegration appState={mockAppState({ branchesEnabled: true })} location={mockLocation()} + hasFeature={jest.fn()} router={mockRouter()} {...props} /> diff --git a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegration-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegration-test.tsx.snap index 193dfaf0360..c84b2fc9fc2 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegration-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegration-test.tsx.snap @@ -16,7 +16,6 @@ exports[`should render correctly 1`] = ` } loadingAlmDefinitions={true} loadingProjectCount={false} - multipleAlmEnabled={false} onCancelDelete={[Function]} onCheckConfiguration={[Function]} onConfirmDelete={[Function]} diff --git a/server/sonar-web/src/main/js/types/appstate.ts b/server/sonar-web/src/main/js/types/appstate.ts index 8124f143bb1..d90558d0021 100644 --- a/server/sonar-web/src/main/js/types/appstate.ts +++ b/server/sonar-web/src/main/js/types/appstate.ts @@ -30,7 +30,6 @@ export interface AppState { edition?: EditionKey; globalPages?: Extension[]; instanceUsesDefaultAdminCredentials?: boolean; - multipleAlmEnabled?: boolean; needIssueSync?: boolean; productionDatabase: boolean; qualifiers: string[]; diff --git a/server/sonar-web/src/main/js/types/features.ts b/server/sonar-web/src/main/js/types/features.ts index 87363ff5c2f..768e51e41ca 100644 --- a/server/sonar-web/src/main/js/types/features.ts +++ b/server/sonar-web/src/main/js/types/features.ts @@ -21,5 +21,6 @@ export enum Feature { MonoRepositoryPullRequestDecoration = 'monorepo', RegulatoryReport = 'regulatory-reports', - ProjectImport = 'project-import' + ProjectImport = 'project-import', + MultipleAlm = 'multiple-alm' } |