]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13646 Gitlab repository field is now mandatory
authorPhilippe Perrin <philippe.perrin@sonarsource.com>
Tue, 28 Jul 2020 06:57:20 +0000 (08:57 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 17 Aug 2020 20:06:22 +0000 (20:06 +0000)
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBindingRenderer-test.tsx
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBindingRenderer-test.tsx.snap
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 9d5e2fa471f366dd172302c4a458abeb9dff8c6f..0b4dc3e2a06af50becda02a863bf88800b1fbda1 100644 (file)
@@ -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> {
index bebbde1d0202a0edd8bcad862d539d9ebdb4fae5..efebc487226b0afcd23ce550c7b37f210a2e6197 100644 (file)
@@ -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 || ''
           })}
index fc6a64ba9dff847b9d732dd96492dd600ce3d4cd..bbdbf6f7da061844158bfc38df0bd92d7d73e661 100644 (file)
@@ -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);
 });
 
index a9940e730e25f3571d8285df044276331dfad398..735fe355f7ca44541ab65e537abc81dcae9783d0 100644 (file)
@@ -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();
 });
 
index 9b9f4ddfb4968a62bf17cdcfa02c394b75926ab2..c3008a52d0cceb534e3aa32dbf1b7921011d33f6 100644 (file)
@@ -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`] = `
index e051a4109cab5db1abf259323c41775ad37cf0ae..dcf07e58c1a364bf1b761ea66f7cef506f7ea462 100644 (file)
@@ -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