diff options
author | Philippe Perrin <philippe.perrin@sonarsource.com> | 2020-07-28 08:57:20 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-08-17 20:06:22 +0000 |
commit | b94a9fb8dd3c4c441536f714c66a241fe2486d35 (patch) | |
tree | f2fc1e0d4d50b45336ddad7b5c7dd47712a1086c | |
parent | 07003b40b65ddf43263882c8331f73c83c0f6001 (diff) | |
download | sonarqube-b94a9fb8dd3c4c441536f714c66a241fe2486d35.tar.gz sonarqube-b94a9fb8dd3c4c441536f714c66a241fe2486d35.zip |
SONAR-13646 Gitlab repository field is now mandatory
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<Props, State> { 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`] = ` -<div> - <header - className="page-header" - > - <h1 - className="page-title" - > - settings.pr_decoration.binding.title - </h1> - </header> - <div - className="markdown small spacer-top big-spacer-bottom" - > - settings.pr_decoration.binding.description - </div> - <form - onSubmit={[Function]} - > - <div - className="form-field" - > - <label - htmlFor="name" - > - settings.pr_decoration.binding.form.name - <em - className="mandatory spacer-right" - > - * - </em> - </label> - <Select - autosize={true} - className="abs-width-400" - clearable={false} - id="name" - menuContainerStyle={ - Object { - "maxWidth": "210%", - "width": "auto", - } - } - onChange={[Function]} - optionRenderer={[Function]} - options={ - Array [ - Object { - "alm": "gitlab", - "key": "key", - "url": "http://example.com", - }, - ] - } - searchable={false} - value="key" - valueKey="key" - valueRenderer={[Function]} +<label + className="display-flex-center" + htmlFor="github.summary_comment_setting" +> + settings.pr_decoration.binding.form.github.summary_comment_setting + <HelpTooltip + className="spacer-left" + overlay={ + <FormattedMessage + defaultMessage="settings.pr_decoration.binding.form.github.summary_comment_setting.help" + id="settings.pr_decoration.binding.form.github.summary_comment_setting.help" + values={Object {}} /> - </div> - <div - className="form-field" - > - <label - className="display-flex-center" - htmlFor="gitlab.repository" - > - settings.pr_decoration.binding.form.gitlab.repository - <HelpTooltip - className="spacer-left" - overlay={ - <FormattedMessage - defaultMessage="settings.pr_decoration.binding.form.gitlab.repository.help" - id="settings.pr_decoration.binding.form.gitlab.repository.help" - values={Object {}} - /> - } - placement="right" - /> - </label> - <input - className="input-super-large" - id="gitlab.repository" - maxLength={256} - name="gitlab.repository" - onChange={[Function]} - type="text" - value="" - /> - </div> - <div - className="display-flex-center" - > - <DeferredSpinner - className="spacer-right" - loading={false} - timeout={100} - /> - <SubmitButton - className="spacer-right button-success" - disabled={true} - > - <span - data-test="project-settings__alm-save" - > - save - </span> - </SubmitButton> - </div> - </form> -</div> + } + placement="right" + /> +</label> `; 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 |