aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx
diff options
context:
space:
mode:
authorJeremy Davis <jeremy.davis@sonarsource.com>2021-01-28 18:24:21 +0100
committersonartech <sonartech@sonarsource.com>2021-02-04 20:07:08 +0000
commit18a62058532e9c898a8a4972f2bd7347bf9f51b9 (patch)
treeac21ff9e458ce07793ef364b64051c59c05d19ef /server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx
parent82cb7dc9959679aeaacc5c3d8244fba9199b62ce (diff)
downloadsonarqube-18a62058532e9c898a8a4972f2bd7347bf9f51b9.tar.gz
sonarqube-18a62058532e9c898a8a4972f2bd7347bf9f51b9.zip
SONAR-14364 Enable project import in CE
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx')
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx13
1 files changed, 4 insertions, 9 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx
index 9ead04d60cc..4a406a6a36f 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCreationMenu.tsx
@@ -23,14 +23,12 @@ import Dropdown from 'sonar-ui-common/components/controls/Dropdown';
import DropdownIcon from 'sonar-ui-common/components/icons/DropdownIcon';
import { translate } from 'sonar-ui-common/helpers/l10n';
import { getAlmSettings } from '../../../api/alm-settings';
-import { withAppState } from '../../../components/hoc/withAppState';
import { withCurrentUser } from '../../../components/hoc/withCurrentUser';
import { hasGlobalPermission } from '../../../helpers/users';
import { AlmKeys, AlmSettingsInstance } from '../../../types/alm-settings';
import ProjectCreationMenuItem from './ProjectCreationMenuItem';
interface Props {
- appState: Pick<T.AppState, 'branchesEnabled'>;
className?: string;
currentUser: T.LoggedInUser;
}
@@ -71,18 +69,15 @@ export class ProjectCreationMenu extends React.PureComponent<Props, State> {
};
fetchAlmBindings = async () => {
- const {
- appState: { branchesEnabled },
- currentUser
- } = this.props;
+ const { currentUser } = this.props;
const canCreateProject = hasGlobalPermission(currentUser, PROJECT_CREATION_PERMISSION);
// getAlmSettings requires branchesEnabled
- if (!canCreateProject || !branchesEnabled) {
+ if (!canCreateProject) {
return;
}
- const almSettings = await getAlmSettings();
+ const almSettings: AlmSettingsInstance[] = await getAlmSettings().catch(() => []);
// Import is only available if exactly one binding is configured
const boundAlms = IMPORT_COMPATIBLE_ALMS.filter(key => {
@@ -129,4 +124,4 @@ export class ProjectCreationMenu extends React.PureComponent<Props, State> {
}
}
-export default withAppState(withCurrentUser(ProjectCreationMenu));
+export default withCurrentUser(ProjectCreationMenu);