@@ -42,7 +42,7 @@ interface State { | |||
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 | |||
}; | |||
@@ -86,7 +86,11 @@ export class ProjectCreationMenu extends React.PureComponent<Props, State> { | |||
} 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) { |
@@ -22,6 +22,7 @@ import { Link } from 'react-router'; | |||
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; | |||
@@ -29,6 +30,10 @@ export interface ProjectCreationMenuItemProps { | |||
export default function ProjectCreationMenuItem(props: ProjectCreationMenuItemProps) { | |||
const { alm } = props; | |||
let almIcon = alm; | |||
if (alm === AlmKeys.BitbucketCloud) { | |||
almIcon = 'bitbucket'; | |||
} | |||
return ( | |||
<Link | |||
className="display-flex-center" | |||
@@ -40,7 +45,7 @@ export default function ProjectCreationMenuItem(props: ProjectCreationMenuItemPr | |||
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)} |
@@ -57,7 +57,6 @@ it('should filter alm bindings appropriately', async () => { | |||
.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([ | |||
@@ -67,6 +66,13 @@ it('should filter alm bindings appropriately', async () => { | |||
{ 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' }, | |||
@@ -100,6 +106,15 @@ it('should filter alm bindings appropriately', async () => { | |||
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]); |
@@ -28,8 +28,8 @@ import DeleteIcon from 'sonar-ui-common/components/icons/DeleteIcon'; | |||
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, | |||
@@ -103,6 +103,7 @@ function getPRDecorationFeatureStatus( | |||
} | |||
function getImportFeatureStatus( | |||
alm: AlmKeys, | |||
definition: AlmBindingDefinition, | |||
multipleDefinitions: boolean, | |||
type: AlmSettingsBindingStatusType.Success | AlmSettingsBindingStatusType.Failure | |||
@@ -121,7 +122,7 @@ function getImportFeatureStatus( | |||
); | |||
} | |||
if (!definition.url) { | |||
if (!definition.url && alm !== AlmKeys.BitbucketCloud) { | |||
return ( | |||
<div className="display-inline-flex-center"> | |||
<strong className="spacer-left"> | |||
@@ -194,7 +195,7 @@ export default function AlmBindingDefinitionBox(props: AlmBindingDefinitionBoxPr | |||
{translate('settings.almintegration.feature.alm_repo_import.title')} | |||
</span> | |||
</Tooltip> | |||
{getImportFeatureStatus(definition, multipleDefinitions, status.type)} | |||
{getImportFeatureStatus(alm, definition, multipleDefinitions, status.type)} | |||
</div> | |||
)} | |||
</div> |
@@ -332,6 +332,18 @@ exports[`should render correctly: success for Bitbucket Cloud 1`] = ` | |||
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" |
@@ -74,6 +74,7 @@ export const ALM_DOCUMENTATION_PATHS = { | |||
export const IMPORT_COMPATIBLE_ALMS = [ | |||
AlmKeys.Azure, | |||
AlmKeys.BitbucketServer, | |||
AlmKeys.BitbucketCloud, | |||
AlmKeys.GitHub, | |||
AlmKeys.GitLab | |||
]; |
@@ -1916,6 +1916,7 @@ my_account.add_project=Add Project | |||
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 |