]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-14598 Add the mono repo checkbox for Bitbucket Cloud bindings
authorPhilippe Perrin <philippe.perrin@sonarsource.com>
Wed, 17 Mar 2021 10:49:05 +0000 (11:49 +0100)
committersonartech <sonartech@sonarsource.com>
Mon, 22 Mar 2021 20:08:42 +0000 (20:08 +0000)
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/AlmSpecificForm-test.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__/AlmSpecificForm-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBinding-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/PRDecorationBindingRenderer-test.tsx.snap
server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts
server/sonar-web/src/main/js/types/alm-settings.ts

index 7e1ce81ba09ce4e1c99520fc33b722cfdf3f328e..d476039cc8bb0a8cfd09ff8f30f1beb88327059a 100644 (file)
@@ -115,37 +115,6 @@ function renderField(
   );
 }
 
-function renderMonoRepoField(props: {
-  monorepoEnabled: boolean;
-  value?: boolean;
-  docLink: string;
-  onFieldChange: (id: keyof ProjectAlmBindingResponse, value: string | boolean) => void;
-}) {
-  if (!props.monorepoEnabled) {
-    return null;
-  }
-
-  return renderBooleanField({
-    help: true,
-    helpParams: {
-      doc_link: (
-        <Link to={props.docLink} target="_blank">
-          {translate('learn_more')}
-        </Link>
-      )
-    },
-    id: 'monorepo',
-    onFieldChange: props.onFieldChange,
-    propKey: 'monorepo',
-    value: props.value ?? false,
-    inputExtra: props.value && (
-      <Alert className="no-margin-bottom spacer-left" variant="warning" display="inline">
-        {translate('settings.pr_decoration.binding.form.monorepo.warning')}
-      </Alert>
-    )
-  });
-}
-
 export default function AlmSpecificForm(props: AlmSpecificFormProps) {
   const {
     alm,
@@ -153,18 +122,11 @@ export default function AlmSpecificForm(props: AlmSpecificFormProps) {
     monorepoEnabled
   } = props;
 
-  const renderMonoRepoFieldWithDocLink = (docLink: string) => {
-    return renderMonoRepoField({
-      monorepoEnabled,
-      value: monorepo,
-      docLink,
-      onFieldChange: props.onFieldChange
-    });
-  };
+  let formFields: JSX.Element;
 
   switch (alm) {
     case AlmKeys.Azure:
-      return (
+      formFields = (
         <>
           {renderField({
             help: true,
@@ -180,11 +142,11 @@ export default function AlmSpecificForm(props: AlmSpecificFormProps) {
             propKey: 'repository',
             value: repository || ''
           })}
-          {renderMonoRepoFieldWithDocLink(ALM_DOCUMENTATION_PATHS[AlmKeys.Azure])}
         </>
       );
+      break;
     case AlmKeys.BitbucketServer:
-      return (
+      formFields = (
         <>
           {renderField({
             help: true,
@@ -218,11 +180,11 @@ export default function AlmSpecificForm(props: AlmSpecificFormProps) {
             propKey: 'slug',
             value: slug || ''
           })}
-          {renderMonoRepoFieldWithDocLink(ALM_DOCUMENTATION_PATHS[AlmKeys.BitbucketServer])}
         </>
       );
+      break;
     case AlmKeys.BitbucketCloud:
-      return (
+      formFields = (
         <>
           {renderField({
             help: true,
@@ -241,8 +203,9 @@ export default function AlmSpecificForm(props: AlmSpecificFormProps) {
           })}
         </>
       );
+      break;
     case AlmKeys.GitHub:
-      return (
+      formFields = (
         <>
           {renderField({
             help: true,
@@ -259,11 +222,11 @@ export default function AlmSpecificForm(props: AlmSpecificFormProps) {
             propKey: 'summaryCommentEnabled',
             value: summaryCommentEnabled === undefined ? true : summaryCommentEnabled
           })}
-          {renderMonoRepoFieldWithDocLink(ALM_DOCUMENTATION_PATHS[AlmKeys.GitHub])}
         </>
       );
+      break;
     case AlmKeys.GitLab:
-      return (
+      formFields = (
         <>
           {renderField({
             id: 'gitlab.repository',
@@ -271,10 +234,34 @@ export default function AlmSpecificForm(props: AlmSpecificFormProps) {
             propKey: 'repository',
             value: repository || ''
           })}
-          {renderMonoRepoFieldWithDocLink(ALM_DOCUMENTATION_PATHS[AlmKeys.GitLab])}
         </>
       );
-    default:
-      return null;
+      break;
   }
+
+  return (
+    <>
+      {formFields}
+      {monorepoEnabled &&
+        renderBooleanField({
+          help: true,
+          helpParams: {
+            doc_link: (
+              <Link to={ALM_DOCUMENTATION_PATHS[alm]} target="_blank">
+                {translate('learn_more')}
+              </Link>
+            )
+          },
+          id: 'monorepo',
+          onFieldChange: props.onFieldChange,
+          propKey: 'monorepo',
+          value: monorepo,
+          inputExtra: monorepo && (
+            <Alert className="no-margin-bottom spacer-left" variant="warning" display="inline">
+              {translate('settings.pr_decoration.binding.form.monorepo.warning')}
+            </Alert>
+          )
+        })}
+    </>
+  );
 }
index c00b8403d599463e44ce11abd400201167bca8bd..5636df54c9bb5111c4c3b9d171e176830dd865c9 100644 (file)
@@ -75,7 +75,7 @@ const REQUIRED_FIELDS_BY_ALM: {
 export class PRDecorationBinding extends React.PureComponent<Props & StateProps, State> {
   mounted = false;
   state: State = {
-    formData: { key: '' },
+    formData: { key: '', monorepo: false },
     instances: [],
     isChanged: false,
     isConfigured: false,
@@ -145,7 +145,8 @@ export class PRDecorationBinding extends React.PureComponent<Props & StateProps,
             formData: {
               key: '',
               repository: '',
-              slug: ''
+              slug: '',
+              monorepo: false
             },
             orignalData: undefined,
             isChanged: false,
@@ -202,7 +203,8 @@ export class PRDecorationBinding extends React.PureComponent<Props & StateProps,
         return setProjectBitbucketCloudBinding({
           almSetting,
           project,
-          repository
+          repository,
+          monorepo
         });
       }
       case AlmKeys.GitHub: {
@@ -285,7 +287,7 @@ export class PRDecorationBinding extends React.PureComponent<Props & StateProps,
       return {
         formData: newFormData,
         isValid: this.validateForm(newFormData),
-        isChanged: !this.isDataSame(newFormData, orignalData || { key: '' }),
+        isChanged: !this.isDataSame(newFormData, orignalData || { key: '', monorepo: false }),
         success: false
       };
     });
index 0bc17a08b699884e26786adab9852f788871d804..5f118c3f2252136ecb85815280f1a45e05fa008e 100644 (file)
@@ -23,23 +23,17 @@ import { AlmKeys } from '../../../../../types/alm-settings';
 import AlmSpecificForm, { AlmSpecificFormProps } from '../AlmSpecificForm';
 
 it.each([
-  [AlmKeys.Azure, false],
-  [AlmKeys.Azure, true],
-  [AlmKeys.BitbucketServer, false],
-  [AlmKeys.BitbucketServer, true],
-  [AlmKeys.BitbucketCloud, false],
-  [AlmKeys.GitHub, false],
-  [AlmKeys.GitHub, true],
-  [AlmKeys.GitLab, false],
-  [AlmKeys.GitLab, true]
-])('it should render correctly for %s and monorepo=%s', (alm, monorepoEnabled) => {
-  expect(shallowRender(alm, { monorepoEnabled })).toMatchSnapshot();
+  [AlmKeys.Azure],
+  [AlmKeys.BitbucketServer],
+  [AlmKeys.BitbucketCloud],
+  [AlmKeys.GitHub],
+  [AlmKeys.GitLab]
+])('it should render correctly for %s', alm => {
+  expect(shallowRender(alm)).toMatchSnapshot();
 });
 
-it('should render an alert for azure when the monorepo option is activated', () => {
-  expect(
-    shallowRender(AlmKeys.Azure, { monorepoEnabled: true, formData: { key: '', monorepo: true } })
-  ).toMatchSnapshot();
+it('should render the monorepo field when the feature is supported', () => {
+  expect(shallowRender(AlmKeys.Azure, { monorepoEnabled: true })).toMatchSnapshot();
 });
 
 function shallowRender(alm: AlmKeys, props: Partial<AlmSpecificFormProps> = {}) {
@@ -49,7 +43,8 @@ function shallowRender(alm: AlmKeys, props: Partial<AlmSpecificFormProps> = {})
       formData={{
         key: '',
         repository: '',
-        slug: ''
+        slug: '',
+        monorepo: false
       }}
       onFieldChange={jest.fn()}
       monorepoEnabled={false}
index 1232291c9930a5a70dadf13648dc06ce9c7f6976..4c1cc68e4a91da9ff74c7287c58e2009096ceabe 100644 (file)
@@ -79,7 +79,8 @@ it('should handle reset', async () => {
   wrapper.setState({
     formData: {
       key: 'whatever',
-      repository: 'something/else'
+      repository: 'something/else',
+      monorepo: false
     }
   });
 
@@ -87,7 +88,7 @@ it('should handle reset', async () => {
   await waitAndUpdate(wrapper);
 
   expect(deleteProjectAlmBinding).toBeCalledWith(PROJECT_KEY);
-  expect(wrapper.state().formData).toEqual({ key: '', repository: '', slug: '' });
+  expect(wrapper.state().formData).toEqual({ key: '', repository: '', slug: '', monorepo: false });
   expect(wrapper.state().isChanged).toBe(false);
 });
 
@@ -196,19 +197,21 @@ describe('handleSubmit', () => {
     await waitAndUpdate(wrapper);
     const bitbucketKey = 'bitbucketcloud';
     const repository = 'repoKey';
-    wrapper.setState({ formData: { key: bitbucketKey, repository }, instances: [] });
+    const monorepo = true;
+    wrapper.setState({ formData: { key: bitbucketKey, repository, monorepo }, instances: [] });
     wrapper.instance().handleSubmit();
     await waitAndUpdate(wrapper);
     expect(setProjectBitbucketCloudBinding).not.toBeCalled();
 
-    wrapper.setState({ formData: { key: bitbucketKey, repository }, instances });
+    wrapper.setState({ formData: { key: bitbucketKey, repository, monorepo }, instances });
     wrapper.instance().handleSubmit();
     await waitAndUpdate(wrapper);
 
     expect(setProjectBitbucketCloudBinding).toBeCalledWith({
       almSetting: bitbucketKey,
       project: PROJECT_KEY,
-      repository
+      repository,
+      monorepo
     });
     expect(wrapper.state().success).toBe(true);
   });
@@ -218,7 +221,8 @@ describe.each([[500], [404]])('For status %i', status => {
   it('should handle failures gracefully', async () => {
     const newFormData = {
       key: 'whatever',
-      repository: 'something/else'
+      repository: 'something/else',
+      monorepo: false
     };
 
     (getProjectAlmBinding as jest.Mock).mockRejectedValueOnce({ status });
@@ -256,20 +260,23 @@ it('should handle field changes', async () => {
   wrapper.instance().handleFieldChange('key', 'instance2');
   await waitAndUpdate(wrapper);
   expect(wrapper.state().formData).toEqual({
-    key: 'instance2'
+    key: 'instance2',
+    monorepo: false
   });
 
   wrapper.instance().handleFieldChange('repository', repository);
   await waitAndUpdate(wrapper);
   expect(wrapper.state().formData).toEqual({
     key: 'instance2',
-    repository
+    repository,
+    monorepo: false
   });
 
   wrapper.instance().handleFieldChange('summaryCommentEnabled', true);
   await waitAndUpdate(wrapper);
   expect(wrapper.state().formData).toEqual({
     key: 'instance2',
+    monorepo: false,
     repository,
     summaryCommentEnabled: true
   });
@@ -285,23 +292,26 @@ it('should handle field changes', async () => {
 });
 
 it.each([
-  [AlmKeys.Azure, {}],
-  [AlmKeys.Azure, { slug: 'test' }],
-  [AlmKeys.Azure, { repository: 'test' }],
-  [AlmKeys.BitbucketServer, {}],
-  [AlmKeys.BitbucketServer, { slug: 'test' }],
-  [AlmKeys.BitbucketServer, { repository: 'test' }],
-  [AlmKeys.BitbucketCloud, {}],
-  [AlmKeys.GitHub, {}],
-  [AlmKeys.GitLab, {}]
-])('should properly reject promise for %s & %s', async (almKey: AlmKeys, params: {}) => {
-  const wrapper = shallowRender();
+  [AlmKeys.Azure, { monorepo: false }],
+  [AlmKeys.Azure, { slug: 'test', monorepo: false }],
+  [AlmKeys.Azure, { repository: 'test', monorepo: false }],
+  [AlmKeys.BitbucketServer, { monorepo: false }],
+  [AlmKeys.BitbucketServer, { slug: 'test', monorepo: false }],
+  [AlmKeys.BitbucketServer, { repository: 'test', monorepo: false }],
+  [AlmKeys.BitbucketCloud, { monorepo: false }],
+  [AlmKeys.GitHub, { monorepo: false }],
+  [AlmKeys.GitLab, { monorepo: false }]
+])(
+  'should properly reject promise for %s & %s',
+  async (almKey: AlmKeys, params: { monorepo: boolean }) => {
+    const wrapper = shallowRender();
 
-  expect.assertions(1);
-  await expect(
-    wrapper.instance().submitProjectAlmBinding(almKey, 'binding', params)
-  ).rejects.toBeUndefined();
-});
+    expect.assertions(1);
+    await expect(
+      wrapper.instance().submitProjectAlmBinding(almKey, 'binding', params)
+    ).rejects.toBeUndefined();
+  }
+);
 
 it('should validate form', async () => {
   const wrapper = shallowRender();
@@ -309,8 +319,8 @@ it('should validate form', async () => {
 
   const validateMethod = wrapper.instance().validateForm;
 
-  expect(validateMethod({ key: '', repository: '' })).toBe(false);
-  expect(validateMethod({ key: '', repository: 'c' })).toBe(false);
+  expect(validateMethod({ key: '', repository: '', monorepo: false })).toBe(false);
+  expect(validateMethod({ key: '', repository: 'c', monorepo: false })).toBe(false);
 
   wrapper.setState({
     instances: [
@@ -323,17 +333,23 @@ it('should validate form', async () => {
   });
 
   [
-    { values: { key: 'azure', repository: 'rep' }, result: false },
-    { values: { key: 'azure', slug: 'project' }, result: false },
-    { values: { key: 'azure', repository: 'repo', slug: 'project' }, result: true },
-    { values: { key: 'github', repository: '' }, result: false },
-    { values: { key: 'github', repository: 'asdf' }, result: true },
-    { values: { key: 'bitbucket', repository: 'key' }, result: false },
-    { values: { key: 'bitbucket', repository: 'key', slug: 'slug' }, result: true },
-    { values: { key: 'bitbucketcloud', repository: '' }, result: false },
-    { values: { key: 'bitbucketcloud', repository: 'key' }, result: true },
-    { values: { key: 'gitlab' }, result: false },
-    { values: { key: 'gitlab', repository: 'key' }, result: true }
+    { values: { key: 'azure', monorepo: false, repository: 'rep' }, result: false },
+    { values: { key: 'azure', monorepo: false, slug: 'project' }, result: false },
+    {
+      values: { key: 'azure', monorepo: false, repository: 'repo', slug: 'project' },
+      result: true
+    },
+    { values: { key: 'github', monorepo: false, repository: '' }, result: false },
+    { values: { key: 'github', monorepo: false, repository: 'asdf' }, result: true },
+    { values: { key: 'bitbucket', monorepo: false, repository: 'key' }, result: false },
+    {
+      values: { key: 'bitbucket', monorepo: false, repository: 'key', slug: 'slug' },
+      result: true
+    },
+    { values: { key: 'bitbucketcloud', monorepo: false, repository: '' }, result: false },
+    { values: { key: 'bitbucketcloud', monorepo: false, repository: 'key' }, result: true },
+    { values: { key: 'gitlab', monorepo: false }, result: false },
+    { values: { key: 'gitlab', monorepo: false, repository: 'key' }, result: true }
   ].forEach(({ values, result }) => {
     expect(validateMethod(values)).toBe(result);
   });
index b0520110cf07221939f274f9fb27e85d32257799..859aeaf10a866e0855ed27957ffda6fdd55188f8 100644 (file)
@@ -82,7 +82,8 @@ it('should render multiple instances correctly', () => {
     shallowRender({
       formData: {
         key: 'i1',
-        repository: 'account/repo'
+        repository: 'account/repo',
+        monorepo: false
       },
       isChanged: false,
       isConfigured: true,
@@ -134,7 +135,8 @@ function shallowRender(props: Partial<PRDecorationBindingRendererProps> = {}) {
     <PRDecorationBindingRenderer
       formData={{
         key: '',
-        repository: ''
+        repository: '',
+        monorepo: false
       }}
       instances={[]}
       isChanged={false}
index 73200b8716060418204e1e1c0c78a2c0753273e6..1ce4d32cfe769e4a5c238544b3f70eb734b0d191 100644 (file)
@@ -1,6 +1,6 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`it should render correctly for azure and monorepo=false 1`] = `
+exports[`it should render correctly for azure 1`] = `
 <Fragment>
   <div
     className="form-field"
@@ -67,116 +67,7 @@ exports[`it should render correctly for azure and monorepo=false 1`] = `
 </Fragment>
 `;
 
-exports[`it should render correctly for azure and monorepo=true 1`] = `
-<Fragment>
-  <div
-    className="form-field"
-  >
-    <label
-      className="display-flex-center"
-      htmlFor="azure.project"
-    >
-      settings.pr_decoration.binding.form.azure.project
-      <MandatoryFieldMarker />
-      <HelpTooltip
-        className="spacer-left"
-        overlay={
-          <FormattedMessage
-            defaultMessage="settings.pr_decoration.binding.form.azure.project.help"
-            id="settings.pr_decoration.binding.form.azure.project.help"
-            values={Object {}}
-          />
-        }
-        placement="right"
-      />
-    </label>
-    <input
-      className="input-super-large"
-      id="azure.project"
-      maxLength={256}
-      name="azure.project"
-      onChange={[Function]}
-      type="text"
-      value=""
-    />
-  </div>
-  <div
-    className="form-field"
-  >
-    <label
-      className="display-flex-center"
-      htmlFor="azure.repository"
-    >
-      settings.pr_decoration.binding.form.azure.repository
-      <MandatoryFieldMarker />
-      <HelpTooltip
-        className="spacer-left"
-        overlay={
-          <FormattedMessage
-            defaultMessage="settings.pr_decoration.binding.form.azure.repository.help"
-            id="settings.pr_decoration.binding.form.azure.repository.help"
-            values={Object {}}
-          />
-        }
-        placement="right"
-      />
-    </label>
-    <input
-      className="input-super-large"
-      id="azure.repository"
-      maxLength={256}
-      name="azure.repository"
-      onChange={[Function]}
-      type="text"
-      value=""
-    />
-  </div>
-  <div
-    className="form-field"
-  >
-    <label
-      className="display-flex-center"
-      htmlFor="monorepo"
-    >
-      settings.pr_decoration.binding.form.monorepo
-      <HelpTooltip
-        className="spacer-left"
-        overlay={
-          <FormattedMessage
-            defaultMessage="settings.pr_decoration.binding.form.monorepo.help"
-            id="settings.pr_decoration.binding.form.monorepo.help"
-            values={
-              Object {
-                "doc_link": <Link
-                  onlyActiveOnIndex={false}
-                  style={Object {}}
-                  target="_blank"
-                  to="/documentation/analysis/azuredevops-integration/"
-                >
-                  learn_more
-                </Link>,
-              }
-            }
-          />
-        }
-        placement="right"
-      />
-    </label>
-    <div
-      className="display-flex-center"
-    >
-      <InputForBoolean
-        isDefault={true}
-        name="monorepo"
-        onChange={[Function]}
-        value={false}
-      />
-    </div>
-  </div>
-</Fragment>
-`;
-
-exports[`it should render correctly for bitbucket and monorepo=false 1`] = `
+exports[`it should render correctly for bitbucket 1`] = `
 <Fragment>
   <div
     className="form-field"
@@ -263,136 +154,7 @@ exports[`it should render correctly for bitbucket and monorepo=false 1`] = `
 </Fragment>
 `;
 
-exports[`it should render correctly for bitbucket and monorepo=true 1`] = `
-<Fragment>
-  <div
-    className="form-field"
-  >
-    <label
-      className="display-flex-center"
-      htmlFor="bitbucket.repository"
-    >
-      settings.pr_decoration.binding.form.bitbucket.repository
-      <MandatoryFieldMarker />
-      <HelpTooltip
-        className="spacer-left"
-        overlay={
-          <FormattedMessage
-            defaultMessage="settings.pr_decoration.binding.form.bitbucket.repository.help"
-            id="settings.pr_decoration.binding.form.bitbucket.repository.help"
-            values={
-              Object {
-                "example": <React.Fragment>
-                  .../projects/
-                  <strong>
-                    {KEY}
-                  </strong>
-                  /repos/{SLUG}/browse
-                </React.Fragment>,
-              }
-            }
-          />
-        }
-        placement="right"
-      />
-    </label>
-    <input
-      className="input-super-large"
-      id="bitbucket.repository"
-      maxLength={256}
-      name="bitbucket.repository"
-      onChange={[Function]}
-      type="text"
-      value=""
-    />
-  </div>
-  <div
-    className="form-field"
-  >
-    <label
-      className="display-flex-center"
-      htmlFor="bitbucket.slug"
-    >
-      settings.pr_decoration.binding.form.bitbucket.slug
-      <MandatoryFieldMarker />
-      <HelpTooltip
-        className="spacer-left"
-        overlay={
-          <FormattedMessage
-            defaultMessage="settings.pr_decoration.binding.form.bitbucket.slug.help"
-            id="settings.pr_decoration.binding.form.bitbucket.slug.help"
-            values={
-              Object {
-                "example": <React.Fragment>
-                  .../projects/{KEY}/repos/
-                  <strong>
-                    {SLUG}
-                  </strong>
-                  /browse
-                </React.Fragment>,
-              }
-            }
-          />
-        }
-        placement="right"
-      />
-    </label>
-    <input
-      className="input-super-large"
-      id="bitbucket.slug"
-      maxLength={256}
-      name="bitbucket.slug"
-      onChange={[Function]}
-      type="text"
-      value=""
-    />
-  </div>
-  <div
-    className="form-field"
-  >
-    <label
-      className="display-flex-center"
-      htmlFor="monorepo"
-    >
-      settings.pr_decoration.binding.form.monorepo
-      <HelpTooltip
-        className="spacer-left"
-        overlay={
-          <FormattedMessage
-            defaultMessage="settings.pr_decoration.binding.form.monorepo.help"
-            id="settings.pr_decoration.binding.form.monorepo.help"
-            values={
-              Object {
-                "doc_link": <Link
-                  onlyActiveOnIndex={false}
-                  style={Object {}}
-                  target="_blank"
-                  to="/documentation/analysis/bitbucket-integration/"
-                >
-                  learn_more
-                </Link>,
-              }
-            }
-          />
-        }
-        placement="right"
-      />
-    </label>
-    <div
-      className="display-flex-center"
-    >
-      <InputForBoolean
-        isDefault={true}
-        name="monorepo"
-        onChange={[Function]}
-        value={false}
-      />
-    </div>
-  </div>
-</Fragment>
-`;
-
-exports[`it should render correctly for bitbucketcloud and monorepo=false 1`] = `
+exports[`it should render correctly for bitbucketcloud 1`] = `
 <Fragment>
   <div
     className="form-field"
@@ -437,7 +199,7 @@ exports[`it should render correctly for bitbucketcloud and monorepo=false 1`] =
 </Fragment>
 `;
 
-exports[`it should render correctly for github and monorepo=false 1`] = `
+exports[`it should render correctly for github 1`] = `
 <Fragment>
   <div
     className="form-field"
@@ -508,120 +270,7 @@ exports[`it should render correctly for github and monorepo=false 1`] = `
 </Fragment>
 `;
 
-exports[`it should render correctly for github and monorepo=true 1`] = `
-<Fragment>
-  <div
-    className="form-field"
-  >
-    <label
-      className="display-flex-center"
-      htmlFor="github.repository"
-    >
-      settings.pr_decoration.binding.form.github.repository
-      <MandatoryFieldMarker />
-      <HelpTooltip
-        className="spacer-left"
-        overlay={
-          <FormattedMessage
-            defaultMessage="settings.pr_decoration.binding.form.github.repository.help"
-            id="settings.pr_decoration.binding.form.github.repository.help"
-            values={
-              Object {
-                "example": "SonarSource/sonarqube",
-              }
-            }
-          />
-        }
-        placement="right"
-      />
-    </label>
-    <input
-      className="input-super-large"
-      id="github.repository"
-      maxLength={256}
-      name="github.repository"
-      onChange={[Function]}
-      type="text"
-      value=""
-    />
-  </div>
-  <div
-    className="form-field"
-  >
-    <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 {}}
-          />
-        }
-        placement="right"
-      />
-    </label>
-    <div
-      className="display-flex-center"
-    >
-      <InputForBoolean
-        isDefault={true}
-        name="github.summary_comment_setting"
-        onChange={[Function]}
-        value={true}
-      />
-    </div>
-  </div>
-  <div
-    className="form-field"
-  >
-    <label
-      className="display-flex-center"
-      htmlFor="monorepo"
-    >
-      settings.pr_decoration.binding.form.monorepo
-      <HelpTooltip
-        className="spacer-left"
-        overlay={
-          <FormattedMessage
-            defaultMessage="settings.pr_decoration.binding.form.monorepo.help"
-            id="settings.pr_decoration.binding.form.monorepo.help"
-            values={
-              Object {
-                "doc_link": <Link
-                  onlyActiveOnIndex={false}
-                  style={Object {}}
-                  target="_blank"
-                  to="/documentation/analysis/github-integration/"
-                >
-                  learn_more
-                </Link>,
-              }
-            }
-          />
-        }
-        placement="right"
-      />
-    </label>
-    <div
-      className="display-flex-center"
-    >
-      <InputForBoolean
-        isDefault={true}
-        name="monorepo"
-        onChange={[Function]}
-        value={false}
-      />
-    </div>
-  </div>
-</Fragment>
-`;
-
-exports[`it should render correctly for gitlab and monorepo=false 1`] = `
+exports[`it should render correctly for gitlab 1`] = `
 <Fragment>
   <div
     className="form-field"
@@ -646,74 +295,7 @@ exports[`it should render correctly for gitlab and monorepo=false 1`] = `
 </Fragment>
 `;
 
-exports[`it should render correctly for gitlab and monorepo=true 1`] = `
-<Fragment>
-  <div
-    className="form-field"
-  >
-    <label
-      className="display-flex-center"
-      htmlFor="gitlab.repository"
-    >
-      settings.pr_decoration.binding.form.gitlab.repository
-      <MandatoryFieldMarker />
-    </label>
-    <input
-      className="input-super-large"
-      id="gitlab.repository"
-      maxLength={256}
-      name="gitlab.repository"
-      onChange={[Function]}
-      type="text"
-      value=""
-    />
-  </div>
-  <div
-    className="form-field"
-  >
-    <label
-      className="display-flex-center"
-      htmlFor="monorepo"
-    >
-      settings.pr_decoration.binding.form.monorepo
-      <HelpTooltip
-        className="spacer-left"
-        overlay={
-          <FormattedMessage
-            defaultMessage="settings.pr_decoration.binding.form.monorepo.help"
-            id="settings.pr_decoration.binding.form.monorepo.help"
-            values={
-              Object {
-                "doc_link": <Link
-                  onlyActiveOnIndex={false}
-                  style={Object {}}
-                  target="_blank"
-                  to="/documentation/analysis/gitlab-integration/"
-                >
-                  learn_more
-                </Link>,
-              }
-            }
-          />
-        }
-        placement="right"
-      />
-    </label>
-    <div
-      className="display-flex-center"
-    >
-      <InputForBoolean
-        isDefault={true}
-        name="monorepo"
-        onChange={[Function]}
-        value={false}
-      />
-    </div>
-  </div>
-</Fragment>
-`;
-
-exports[`should render an alert for azure when the monorepo option is activated 1`] = `
+exports[`should render the monorepo field when the feature is supported 1`] = `
 <Fragment>
   <div
     className="form-field"
@@ -815,15 +397,8 @@ exports[`should render an alert for azure when the monorepo option is activated
         isDefault={true}
         name="monorepo"
         onChange={[Function]}
-        value={true}
+        value={false}
       />
-      <Alert
-        className="no-margin-bottom spacer-left"
-        display="inline"
-        variant="warning"
-      >
-        settings.pr_decoration.binding.form.monorepo.warning
-      </Alert>
     </div>
   </div>
 </Fragment>
index 35bf2eecea1420e9b9542a97665c3b2a96001f12..cd949808fd37f4bba53bf03b3a9ab60f489ab2df 100644 (file)
@@ -421,6 +421,7 @@ exports[`should render multiple instances correctly 2`] = `
       formData={
         Object {
           "key": "i1",
+          "monorepo": false,
           "repository": "account/repo",
         }
       }
index cff3a5b4ff4cf2eddc606ebdab852cb5f18e8922..93aa836d8ee850e7adae852e10a36b3d279fe178 100644 (file)
@@ -107,6 +107,7 @@ export function mockProjectAlmBindingResponse(
   return {
     alm: AlmKeys.GitHub,
     key: 'foo',
+    monorepo: false,
     ...overrides
   };
 }
index 7a546ccbbb91fd4ff89f671bacd9da15a4d2c3b9..dff01841cfa644291daa4b2ad0ad133ba95d8c33 100644 (file)
@@ -65,7 +65,7 @@ export interface ProjectAlmBindingResponse {
   repository?: string;
   slug?: string;
   summaryCommentEnabled?: boolean;
-  monorepo?: boolean;
+  monorepo: boolean;
 }
 
 export interface ProjectAzureBindingResponse extends ProjectAlmBindingResponse {
@@ -73,44 +73,39 @@ export interface ProjectAzureBindingResponse extends ProjectAlmBindingResponse {
   repository: string;
   slug: string;
   url: string;
-  monorepo: boolean;
 }
 
 export interface ProjectBitbucketBindingResponse extends ProjectAlmBindingResponse {
   alm: AlmKeys.BitbucketServer;
   repository: string;
   slug: string;
-  monorepo: boolean;
 }
 
 export interface ProjectGitHubBindingResponse extends ProjectAlmBindingResponse {
   alm: AlmKeys.GitHub;
   repository: string;
-  monorepo: boolean;
 }
 
 export interface ProjectGitLabBindingResponse extends ProjectAlmBindingResponse {
   alm: AlmKeys.GitLab;
   repository: string;
   url: string;
-  monorepo: boolean;
 }
 
 export interface ProjectAlmBindingParams {
   almSetting: string;
   project: string;
+  monorepo: boolean;
 }
 
 export interface AzureProjectAlmBindingParams extends ProjectAlmBindingParams {
   projectName: string;
   repositoryName: string;
-  monorepo: boolean;
 }
 
 export interface BitbucketProjectAlmBindingParams extends ProjectAlmBindingParams {
   repository: string;
   slug: string;
-  monorepo: boolean;
 }
 
 export interface BitbucketCloudProjectAlmBindingParams extends ProjectAlmBindingParams {
@@ -120,12 +115,10 @@ export interface BitbucketCloudProjectAlmBindingParams extends ProjectAlmBinding
 export interface GithubProjectAlmBindingParams extends ProjectAlmBindingParams {
   repository: string;
   summaryCommentEnabled: boolean;
-  monorepo: boolean;
 }
 
 export interface GitlabProjectAlmBindingParams extends ProjectAlmBindingParams {
   repository?: string;
-  monorepo: boolean;
 }
 
 export interface AlmSettingsInstance {