Kaynağa Gözat

SONAR-14932 Add support for Bibucket Cloud project creation

tags/9.0.0.45539
Philippe Perrin 3 yıl önce
ebeveyn
işleme
cd8105d3ac

+ 12
- 6
server/sonar-web/src/main/js/apps/create/project/CreateProjectModeSelection.tsx Dosyayı Görüntüle

@@ -31,10 +31,7 @@ import { CreateProjectModes } from './types';

export interface CreateProjectModeSelectionProps {
almCounts: {
[AlmKeys.Azure]: number;
[AlmKeys.BitbucketServer]: number;
[AlmKeys.GitLab]: number;
[AlmKeys.GitHub]: number;
[k in AlmKeys]: number;
};
appState: Pick<T.AppState, 'canAdmin'>;
loadingBindings: boolean;
@@ -54,7 +51,12 @@ function renderAlmOption(
loadingBindings
} = props;

const count = almCounts[alm];
const hasBitbucketCloud = almCounts[AlmKeys.BitbucketCloud] > 0;
const isBitbucket = alm === AlmKeys.BitbucketServer;

const count = isBitbucket
? almCounts[AlmKeys.BitbucketServer] + almCounts[AlmKeys.BitbucketCloud]
: almCounts[alm];
const disabled = count !== 1 || loadingBindings;

const tooltipLinks = [];
@@ -86,7 +88,11 @@ function renderAlmOption(
{ disabled }
)}
disabled={disabled}
onClick={() => props.onSelectMode(mode)}
onClick={() =>
props.onSelectMode(
isBitbucket && hasBitbucketCloud ? CreateProjectModes.BitbucketCloud : mode
)
}
type="button">
<img
alt="" // Should be ignored by screen readers

+ 1
- 0
server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx Dosyayı Görüntüle

@@ -190,6 +190,7 @@ export class CreateProjectPage extends React.PureComponent<Props, State> {
const almCounts = {
[AlmKeys.Azure]: azureSettings.length,
[AlmKeys.BitbucketServer]: bitbucketSettings.length,
[AlmKeys.BitbucketCloud]: bitbucketCloudSettings.length,
[AlmKeys.GitHub]: githubSettings.length,
[AlmKeys.GitLab]: gitlabSettings.length
};

+ 8
- 1
server/sonar-web/src/main/js/apps/create/project/__tests__/CreateProjectModeSelection-test.tsx Dosyayı Görüntüle

@@ -43,7 +43,7 @@ it('should render correctly', () => {

it('should correctly pass the selected mode up', () => {
const onSelectMode = jest.fn();
const wrapper = shallowRender({ onSelectMode });
let wrapper = shallowRender({ onSelectMode });

const almButton = 'button.create-project-mode-type-alm';

@@ -66,6 +66,12 @@ it('should correctly pass the selected mode up', () => {
click(wrapper.find(almButton).at(3));
expect(onSelectMode).toBeCalledWith(CreateProjectModes.GitLab);
onSelectMode.mockClear();

wrapper = shallowRender({ onSelectMode }, { [AlmKeys.BitbucketCloud]: 1 });

click(wrapper.find(almButton).at(1));
expect(onSelectMode).toBeCalledWith(CreateProjectModes.BitbucketCloud);
onSelectMode.mockClear();
});

function shallowRender(
@@ -74,6 +80,7 @@ function shallowRender(
) {
const almCounts = {
[AlmKeys.Azure]: 0,
[AlmKeys.BitbucketCloud]: 0,
[AlmKeys.BitbucketServer]: 1,
[AlmKeys.GitHub]: 0,
[AlmKeys.GitLab]: 0,

+ 1
- 0
server/sonar-web/src/main/js/apps/create/project/__tests__/__snapshots__/CreateProjectPage-test.tsx.snap Dosyayı Görüntüle

@@ -20,6 +20,7 @@ exports[`should render correctly 1`] = `
Object {
"azure": 0,
"bitbucket": 0,
"bitbucketcloud": 0,
"github": 0,
"gitlab": 0,
}

+ 3
- 3
sonar-core/src/main/resources/org/sonar/l10n/core.properties Dosyayı Görüntüle

@@ -3247,7 +3247,7 @@ onboarding.create_project.help_set_up_x=Learn more on how to set up {0}
onboarding.create_project.setup_manually=Create a project
onboarding.create_project.select_method.manual=Manually
onboarding.create_project.select_method.azure=From Azure DevOps
onboarding.create_project.select_method.bitbucket=From Bitbucket Server
onboarding.create_project.select_method.bitbucket=From Bitbucket
onboarding.create_project.select_method.github=From GitHub
onboarding.create_project.select_method.gitlab=From GitLab
onboarding.create_project.alm_not_configured=Currently not active
@@ -3288,12 +3288,12 @@ onboarding.create_project.pat_form.pat_required=Please enter a personal access t
onboarding.create_project.pat_form.list_repositories=List repositories
onboarding.create_project.select_method=How do you want to create your project?
onboarding.create_project.too_many_alm_instances.azure=You must have exactly 1 Azure DevOps instance configured in order to use this method.
onboarding.create_project.too_many_alm_instances.bitbucket=You must have exactly 1 Bitbucket Server instance configured in order to use this method.
onboarding.create_project.too_many_alm_instances.bitbucket=You must have exactly 1 Bitbucket instance configured in order to use this method.
onboarding.create_project.too_many_alm_instances.github=You must have exactly 1 GitHub instance configured in order to use this method.
onboarding.create_project.too_many_alm_instances.gitlab=You must have exactly 1 GitLab instance configured in order to use this method.
onboarding.create_project.alm_instances_count_X=You currently have {0}.
onboarding.create_project.zero_alm_instances.azure=You must first configure an Azure DevOps instance.
onboarding.create_project.zero_alm_instances.bitbucket=You must first configure a Bitbucket Server instance.
onboarding.create_project.zero_alm_instances.bitbucket=You must first configure a Bitbucket instance.
onboarding.create_project.zero_alm_instances.github=You must first configure a GitHub instance.
onboarding.create_project.zero_alm_instances.gitlab=You must first configure a GitLab instance.
onboarding.create_project.wrong_binding_count=You must have exactly 1 {alm} instance configured in order to use this method, but none were found. Either create the project manually, or contact your system administrator.

Loading…
İptal
Kaydet