From b94a9fb8dd3c4c441536f714c66a241fe2486d35 Mon Sep 17 00:00:00 2001 From: Philippe Perrin Date: Tue, 28 Jul 2020 08:57:20 +0200 Subject: [PATCH] SONAR-13646 Gitlab repository field is now mandatory --- .../PRDecorationBinding.tsx | 2 +- .../PRDecorationBindingRenderer.tsx | 2 - .../__tests__/PRDecorationBinding-test.tsx | 2 +- .../PRDecorationBindingRenderer-test.tsx | 4 +- .../PRDecorationBindingRenderer-test.tsx.snap | 125 +++--------------- .../resources/org/sonar/l10n/core.properties | 1 - 6 files changed, 20 insertions(+), 116 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx index 9d5e2fa471f..0b4dc3e2a06 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx @@ -59,7 +59,7 @@ const REQUIRED_FIELDS_BY_ALM: { [AlmKeys.Azure]: [], [AlmKeys.Bitbucket]: ['repository', 'slug'], [AlmKeys.GitHub]: ['repository'], - [AlmKeys.GitLab]: [] + [AlmKeys.GitLab]: ['repository'] }; export default class PRDecorationBinding extends React.PureComponent { diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx index bebbde1d020..efebc487226 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx @@ -272,10 +272,8 @@ export default function PRDecorationBindingRenderer(props: PRDecorationBindingRe {alm === AlmKeys.GitLab && renderField({ - help: true, id: 'gitlab.repository', onFieldChange: props.onFieldChange, - optional: true, propKey: 'repository', value: repository || '' })} diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx index fc6a64ba9df..bbdbf6f7da0 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx @@ -272,7 +272,7 @@ it('should validate form', async () => { wrapper.instance().validateForm({ key: 'bitbucket', repository: 'key', slug: 'slug' }) ).toBe(true); - expect(wrapper.instance().validateForm({ key: 'gitlab' })).toBe(true); + expect(wrapper.instance().validateForm({ key: 'gitlab' })).toBe(false); expect(wrapper.instance().validateForm({ key: 'gitlab', repository: 'key' })).toBe(true); }); diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBindingRenderer-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBindingRenderer-test.tsx index a9940e730e2..735fe355f7c 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBindingRenderer-test.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBindingRenderer-test.tsx @@ -137,9 +137,9 @@ it('should render optional fields correctly', () => { }, isChanged: true, isConfigured: false, - instances: [{ key: 'key', url: 'http://example.com', alm: AlmKeys.GitLab }], + instances: [{ key: 'key', url: 'http://example.com', alm: AlmKeys.GitHub }], loading: false - }) + }).find('label[htmlFor="github.summary_comment_setting"]') ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBindingRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBindingRenderer-test.tsx.snap index 9b9f4ddfb49..c3008a52d0c 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBindingRenderer-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBindingRenderer-test.tsx.snap @@ -509,116 +509,23 @@ exports[`should render multiple instances correctly 2`] = ` `; exports[`should render optional fields correctly 1`] = ` -
-
-

- settings.pr_decoration.binding.title -

-
-
- settings.pr_decoration.binding.description -
-
-
- - -
-
- - - - save - - -
-
-
+ } + placement="right" + /> + `; exports[`should render select options correctly 1`] = ` diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index e051a4109ca..dcf07e58c1a 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -1102,7 +1102,6 @@ settings.pr_decoration.binding.form.bitbucket.repository.help=The project key is settings.pr_decoration.binding.form.bitbucket.slug=Repository SLUG settings.pr_decoration.binding.form.bitbucket.slug.help=The Repository Slug is part of your Bitbucket Server repository URL. Example: ({example}) settings.pr_decoration.binding.form.gitlab.repository=Project ID -settings.pr_decoration.binding.form.gitlab.repository.help=If you are using GitLab CI, you do not have to provide this value. For any other CI, provide the project's numerical ID. property.category.general=General property.category.general.email=Email -- 2.39.5