const almSettingsValidators = {
[AlmKeys.Azure]: (settings: AlmSettingsInstance) => !!settings.url,
[AlmKeys.BitbucketServer]: (_: AlmSettingsInstance) => true,
- [AlmKeys.BitbucketCloud]: (_: AlmSettingsInstance) => false,
+ [AlmKeys.BitbucketCloud]: (_: AlmSettingsInstance) => true,
[AlmKeys.GitHub]: (_: AlmSettingsInstance) => true,
[AlmKeys.GitLab]: (settings: AlmSettingsInstance) => !!settings.url
};
} else {
currentAlmSettings = almSettings.filter(s => s.alm === key);
}
- return currentAlmSettings.length === 1 && this.almSettingIsValid(currentAlmSettings[0]);
+ return (
+ currentAlmSettings.length === 1 &&
+ key === currentAlmSettings[0].alm &&
+ this.almSettingIsValid(currentAlmSettings[0])
+ );
});
if (this.mounted) {
import ChevronsIcon from 'sonar-ui-common/components/icons/ChevronsIcon';
import { translate } from 'sonar-ui-common/helpers/l10n';
import { getBaseUrl } from 'sonar-ui-common/helpers/urls';
+import { AlmKeys } from '../../../types/alm-settings';
export interface ProjectCreationMenuItemProps {
alm: string;
export default function ProjectCreationMenuItem(props: ProjectCreationMenuItemProps) {
const { alm } = props;
+ let almIcon = alm;
+ if (alm === AlmKeys.BitbucketCloud) {
+ almIcon = 'bitbucket';
+ }
return (
<Link
className="display-flex-center"
alt={alm}
className="spacer-right"
width={16}
- src={`${getBaseUrl()}/images/alm/${alm}.svg`}
+ src={`${getBaseUrl()}/images/alm/${almIcon}.svg`}
/>
)}
{translate('my_account.add_project', alm)}
.mockResolvedValueOnce([
// Only faulty configs.
{ alm: AlmKeys.Azure }, // Missing some configuration; will be ignored.
- { alm: AlmKeys.BitbucketCloud }, // Bitbucket Cloud isn't supported.
{ alm: AlmKeys.GitLab } // Missing some configuration; will be ignored.
])
.mockResolvedValueOnce([
{ alm: AlmKeys.GitHub },
{ alm: AlmKeys.GitLab, url: 'gitlab.com' }
])
+ .mockResolvedValueOnce([
+ // All correct configs.
+ { alm: AlmKeys.Azure, url: 'http://ado.example.com' },
+ { alm: AlmKeys.BitbucketCloud },
+ { alm: AlmKeys.GitHub },
+ { alm: AlmKeys.GitLab, url: 'gitlab.com' }
+ ])
.mockResolvedValueOnce([
// Special case for BBS with BBC
{ alm: AlmKeys.Azure, url: 'http://ado.example.com' },
AlmKeys.GitLab
]);
+ wrapper = shallowRender();
+ await waitAndUpdate(wrapper);
+ expect(wrapper.state().boundAlms).toEqual([
+ AlmKeys.Azure,
+ AlmKeys.BitbucketCloud,
+ AlmKeys.GitHub,
+ AlmKeys.GitLab
+ ]);
+
wrapper = shallowRender();
await waitAndUpdate(wrapper);
expect(wrapper.state().boundAlms).toEqual([AlmKeys.Azure, AlmKeys.GitHub, AlmKeys.GitLab]);
import EditIcon from 'sonar-ui-common/components/icons/EditIcon';
import { Alert } from 'sonar-ui-common/components/ui/Alert';
import { translate } from 'sonar-ui-common/helpers/l10n';
-import { getEdition, getEditionUrl } from '../../../../helpers/editions';
import { IMPORT_COMPATIBLE_ALMS } from '../../../../helpers/constants';
+import { getEdition, getEditionUrl } from '../../../../helpers/editions';
import {
AlmBindingDefinition,
AlmKeys,
}
function getImportFeatureStatus(
+ alm: AlmKeys,
definition: AlmBindingDefinition,
multipleDefinitions: boolean,
type: AlmSettingsBindingStatusType.Success | AlmSettingsBindingStatusType.Failure
);
}
- if (!definition.url) {
+ if (!definition.url && alm !== AlmKeys.BitbucketCloud) {
return (
<div className="display-inline-flex-center">
<strong className="spacer-left">
{translate('settings.almintegration.feature.alm_repo_import.title')}
</span>
</Tooltip>
- {getImportFeatureStatus(definition, multipleDefinitions, status.type)}
+ {getImportFeatureStatus(alm, definition, multipleDefinitions, status.type)}
</div>
)}
</div>
className="spacer-left"
/>
</div>
+ <div>
+ <Tooltip
+ overlay="settings.almintegration.feature.alm_repo_import.description"
+ >
+ <span>
+ settings.almintegration.feature.alm_repo_import.title
+ </span>
+ </Tooltip>
+ <AlertSuccessIcon
+ className="spacer-left"
+ />
+ </div>
</div>
<div
className="width-50"
export const IMPORT_COMPATIBLE_ALMS = [
AlmKeys.Azure,
AlmKeys.BitbucketServer,
+ AlmKeys.BitbucketCloud,
AlmKeys.GitHub,
AlmKeys.GitLab
];
my_account.add_project.manual=Manually
my_account.add_project.azure=Azure DevOps
my_account.add_project.bitbucket=Bitbucket
+my_account.add_project.bitbucketcloud=Bitbucket
my_account.add_project.github=GitHub
my_account.add_project.gitlab=GitLab
my_account.reset_password=Update your password