]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13494 Prevent ALM binding table from blinking when showing the delete modal
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Fri, 29 May 2020 15:03:57 +0000 (17:03 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 9 Jun 2020 20:04:40 +0000 (20:04 +0000)
27 files changed:
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmBindingDefinitionsTable.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegration.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmIntegrationRenderer.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTab.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AlmTabRenderer.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/AzureTab.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/BitbucketTab.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/GithubTab.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/GitlabTab.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmBindingDefinitionsTable-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegration-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmIntegrationRenderer-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTab-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AlmTabRenderer-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/AzureTab-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/BitbucketTab-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/GithubTab-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/GitlabTab-test.tsx
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmBindingDefinitionsTable-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegration-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmIntegrationRenderer-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTab-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AlmTabRenderer-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/AzureTab-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/BitbucketTab-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GithubTab-test.tsx.snap
server/sonar-web/src/main/js/apps/settings/components/almIntegration/__tests__/__snapshots__/GitlabTab-test.tsx.snap

index 65253c4d6e0addd5a6dd095450026526b8e7d0ba..c1bcc5bb36ffbffc857b73b27fdb2e46ef11fc42 100644 (file)
@@ -31,13 +31,14 @@ export interface AlmBindingDefinitionsTableProps {
     key: string;
     additionalColumns: Array<string>;
   }>;
+  loading: boolean;
   onCreate: () => void;
   onDelete: (definitionKey: string) => void;
   onEdit: (definitionKey: string) => void;
 }
 
 export default function AlmBindingDefinitionsTable(props: AlmBindingDefinitionsTableProps) {
-  const { additionalColumnsHeaders, additionalTableInfo, alm, definitions } = props;
+  const { additionalColumnsHeaders, additionalTableInfo, alm, definitions, loading } = props;
 
   return (
     <>
@@ -45,7 +46,7 @@ export default function AlmBindingDefinitionsTable(props: AlmBindingDefinitionsT
         <h2 className="settings-sub-category-name">
           {translate('settings.almintegration.table.title')}
         </h2>
-        <Button data-test="settings__alm-create" onClick={props.onCreate}>
+        <Button data-test="settings__alm-create" disabled={loading} onClick={props.onCreate}>
           {translate('settings.almintegration.table.create')}
         </Button>
       </div>
@@ -86,12 +87,12 @@ export default function AlmBindingDefinitionsTable(props: AlmBindingDefinitionsT
                   </td>
                 ))}
                 <td className="text-center" data-test="settings__alm-table-row-edit">
-                  <ButtonIcon onClick={() => props.onEdit(key)}>
+                  <ButtonIcon disabled={loading} onClick={() => props.onEdit(key)}>
                     <EditIcon />
                   </ButtonIcon>
                 </td>
                 <td className="text-center" data-test="settings__alm-table-row-delete">
-                  <DeleteButton onClick={() => props.onDelete(key)} />
+                  <DeleteButton disabled={loading} onClick={() => props.onDelete(key)} />
                 </td>
               </tr>
             ))
index ee060e8f2bf66721d1206989c1fc3e5e8cdb4033..247abe17d20ca4e4a182a3142aa33404f12dac59 100644 (file)
@@ -36,7 +36,8 @@ interface State {
   currentAlm: AlmKeys;
   definitionKeyForDeletion?: string;
   definitions: AlmSettingsBindingDefinitions;
-  loading: boolean;
+  loadingAlmDefinitions: boolean;
+  loadingProjectCount: boolean;
   projectCount?: number;
 }
 
@@ -50,7 +51,8 @@ export class AlmIntegration extends React.PureComponent<Props, State> {
       [AlmKeys.GitHub]: [],
       [AlmKeys.GitLab]: []
     },
-    loading: true
+    loadingAlmDefinitions: true,
+    loadingProjectCount: false
   };
 
   componentDidMount() {
@@ -81,19 +83,19 @@ export class AlmIntegration extends React.PureComponent<Props, State> {
       return Promise.resolve();
     }
 
-    this.setState({ loading: true });
+    this.setState({ loadingAlmDefinitions: true });
     return getAlmDefinitions()
       .then(definitions => {
         if (this.mounted) {
           this.setState({
             definitions,
-            loading: false
+            loadingAlmDefinitions: false
           });
         }
       })
       .catch(() => {
         if (this.mounted) {
-          this.setState({ loading: false });
+          this.setState({ loadingAlmDefinitions: false });
         }
       });
   };
@@ -107,20 +109,20 @@ export class AlmIntegration extends React.PureComponent<Props, State> {
   };
 
   handleDelete = (definitionKey: string) => {
-    this.setState({ loading: true });
+    this.setState({ loadingProjectCount: true });
     return countBindedProjects(definitionKey)
       .then(projectCount => {
         if (this.mounted) {
           this.setState({
             definitionKeyForDeletion: definitionKey,
-            loading: false,
+            loadingProjectCount: false,
             projectCount
           });
         }
       })
       .catch(() => {
         if (this.mounted) {
-          this.setState({ loading: false });
+          this.setState({ loadingProjectCount: false });
         }
       });
   };
index c5c64310a4f9de7ce3f4bd3ec65c690a8920588c..16e8f95b1e5d98eed742f79152c23b4f7d54f967 100644 (file)
@@ -34,7 +34,8 @@ export interface AlmIntegrationRendererProps {
   currentAlm: AlmKeys;
   definitionKeyForDeletion?: string;
   definitions: AlmSettingsBindingDefinitions;
-  loading: boolean;
+  loadingAlmDefinitions: boolean;
+  loadingProjectCount: boolean;
   multipleAlmEnabled: boolean;
   onCancel: () => void;
   onConfirmDelete: (definitionKey: string) => void;
@@ -111,7 +112,8 @@ export default function AlmIntegrationRenderer(props: AlmIntegrationRendererProp
     definitionKeyForDeletion,
     definitions,
     currentAlm,
-    loading,
+    loadingAlmDefinitions,
+    loadingProjectCount,
     branchesEnabled,
     multipleAlmEnabled,
     projectCount
@@ -135,7 +137,8 @@ export default function AlmIntegrationRenderer(props: AlmIntegrationRendererProp
       {currentAlm === AlmKeys.Azure && (
         <AzureTab
           definitions={definitions.azure}
-          loading={loading}
+          loadingAlmDefinitions={loadingAlmDefinitions}
+          loadingProjectCount={loadingProjectCount}
           multipleAlmEnabled={multipleAlmEnabled}
           onDelete={props.onDelete}
           onUpdateDefinitions={props.onUpdateDefinitions}
@@ -144,7 +147,8 @@ export default function AlmIntegrationRenderer(props: AlmIntegrationRendererProp
       {currentAlm === AlmKeys.Bitbucket && (
         <BitbucketTab
           definitions={definitions.bitbucket}
-          loading={loading}
+          loadingAlmDefinitions={loadingAlmDefinitions}
+          loadingProjectCount={loadingProjectCount}
           multipleAlmEnabled={multipleAlmEnabled}
           onDelete={props.onDelete}
           onUpdateDefinitions={props.onUpdateDefinitions}
@@ -155,7 +159,8 @@ export default function AlmIntegrationRenderer(props: AlmIntegrationRendererProp
           branchesEnabled={branchesEnabled}
           component={component}
           definitions={definitions.github}
-          loading={loading}
+          loadingAlmDefinitions={loadingAlmDefinitions}
+          loadingProjectCount={loadingProjectCount}
           multipleAlmEnabled={multipleAlmEnabled}
           onDelete={props.onDelete}
           onUpdateDefinitions={props.onUpdateDefinitions}
@@ -165,7 +170,8 @@ export default function AlmIntegrationRenderer(props: AlmIntegrationRendererProp
         <GitlabTab
           branchesEnabled={branchesEnabled}
           definitions={definitions.gitlab}
-          loading={loading}
+          loadingAlmDefinitions={loadingAlmDefinitions}
+          loadingProjectCount={loadingProjectCount}
           multipleAlmEnabled={multipleAlmEnabled}
           onDelete={props.onDelete}
           onUpdateDefinitions={props.onUpdateDefinitions}
index c335671f6bae1b66631bd22ca690626c022d0e8f..ff6783180ab6fb7a3fae8f6cda4e2385eddb1cb2 100644 (file)
@@ -34,7 +34,8 @@ interface Props<B> {
   features?: AlmIntegrationFeatureBoxProps[];
   form: (props: AlmBindingDefinitionFormChildrenProps<B>) => React.ReactNode;
   help?: React.ReactNode;
-  loading: boolean;
+  loadingAlmDefinitions: boolean;
+  loadingProjectCount: boolean;
   multipleAlmEnabled: boolean;
   onDelete: (definitionKey: string) => void;
   onUpdateDefinitions: () => void;
@@ -112,7 +113,8 @@ export default class AlmTab<B extends AlmBindingDefinition> extends React.PureCo
       features,
       form,
       help,
-      loading,
+      loadingAlmDefinitions,
+      loadingProjectCount,
       multipleAlmEnabled,
       optionalFields
     } = this.props;
@@ -130,7 +132,8 @@ export default class AlmTab<B extends AlmBindingDefinition> extends React.PureCo
         features={features}
         form={form}
         help={help}
-        loading={loading || submitting}
+        loadingAlmDefinitions={loadingAlmDefinitions}
+        loadingProjectCount={loadingProjectCount}
         multipleAlmEnabled={multipleAlmEnabled}
         onCancel={this.handleCancel}
         onCreate={this.handleCreate}
@@ -138,6 +141,7 @@ export default class AlmTab<B extends AlmBindingDefinition> extends React.PureCo
         onEdit={this.handleEdit}
         onSubmit={this.handleSubmit}
         optionalFields={optionalFields}
+        submitting={submitting}
         success={success}
       />
     );
index 8f9feeabbed8f6c0e9b9ccde731b8fc6bcce4a30..7e946452002413575d87caaf3f7169c36d56752c 100644 (file)
@@ -42,7 +42,8 @@ export interface AlmTabRendererProps<B> {
   features?: AlmIntegrationFeatureBoxProps[];
   form: (props: AlmBindingDefinitionFormChildrenProps<B>) => React.ReactNode;
   help?: React.ReactNode;
-  loading: boolean;
+  loadingAlmDefinitions: boolean;
+  loadingProjectCount: boolean;
   multipleAlmEnabled: boolean;
   onCancel: () => void;
   onCreate: () => void;
@@ -50,6 +51,7 @@ export interface AlmTabRendererProps<B> {
   onEdit: (definitionKey: string) => void;
   onSubmit: (config: B, originalKey: string) => void;
   optionalFields?: Array<keyof B>;
+  submitting: boolean;
   success: boolean;
 }
 
@@ -66,9 +68,11 @@ export default function AlmTabRenderer<B extends AlmBindingDefinition>(
     editedDefinition,
     features = [],
     form,
-    loading,
+    loadingAlmDefinitions,
+    loadingProjectCount,
     multipleAlmEnabled,
     optionalFields,
+    submitting,
     success,
     help = (
       <FormattedMessage
@@ -108,12 +112,13 @@ export default function AlmTabRenderer<B extends AlmBindingDefinition>(
   return (
     <div className="big-padded">
       {multipleAlmEnabled ? (
-        <DeferredSpinner loading={loading}>
+        <DeferredSpinner loading={loadingAlmDefinitions}>
           <AlmBindingDefinitionsTable
             additionalColumnsHeaders={additionalColumnsHeaders}
             additionalTableInfo={additionalTableInfo}
             alm={alm}
             definitions={mappedDefinitions}
+            loading={loadingProjectCount}
             onCreate={props.onCreate}
             onDelete={props.onDelete}
             onEdit={props.onEdit}
@@ -136,7 +141,7 @@ export default function AlmTabRenderer<B extends AlmBindingDefinition>(
           bindingDefinition={definition || defaultBinding}
           help={help}
           hideKeyField={true}
-          loading={loading}
+          loading={loadingAlmDefinitions || loadingProjectCount || submitting}
           onCancel={props.onCancel}
           onDelete={definition ? props.onDelete : undefined}
           onEdit={showEdit ? props.onEdit : undefined}
index bf2607a2396d95772274f5ce7d3bdb82e5936839..b2d211ba78788658fd1ba2148880d8add7d3984a 100644 (file)
@@ -26,14 +26,15 @@ import AzureForm from './AzureForm';
 
 export interface AzureTabProps {
   definitions: AzureBindingDefinition[];
-  loading: boolean;
+  loadingAlmDefinitions: boolean;
+  loadingProjectCount: boolean;
   multipleAlmEnabled: boolean;
   onDelete: (definitionKey: string) => void;
   onUpdateDefinitions: () => void;
 }
 
 export default function AzureTab(props: AzureTabProps) {
-  const { multipleAlmEnabled, definitions, loading } = props;
+  const { multipleAlmEnabled, definitions, loadingAlmDefinitions, loadingProjectCount } = props;
 
   return (
     <div className="bordered">
@@ -51,7 +52,8 @@ export default function AzureTab(props: AzureTabProps) {
           }
         ]}
         form={childProps => <AzureForm {...childProps} />}
-        loading={loading}
+        loadingAlmDefinitions={loadingAlmDefinitions}
+        loadingProjectCount={loadingProjectCount}
         multipleAlmEnabled={multipleAlmEnabled}
         onDelete={props.onDelete}
         onUpdateDefinitions={props.onUpdateDefinitions}
index e7bf53d56e5dd1301b44e3031741ff82cd7198e4..46a7f3d3548cf58563861f2075b746ab38f33338 100644 (file)
@@ -32,14 +32,15 @@ import BitbucketForm from './BitbucketForm';
 
 export interface BitbucketTabProps {
   definitions: BitbucketBindingDefinition[];
-  loading: boolean;
+  loadingAlmDefinitions: boolean;
+  loadingProjectCount: boolean;
   multipleAlmEnabled: boolean;
   onDelete: (definitionKey: string) => void;
   onUpdateDefinitions: () => void;
 }
 
 export default function BitbucketTab(props: BitbucketTabProps) {
-  const { multipleAlmEnabled, definitions, loading } = props;
+  const { multipleAlmEnabled, definitions, loadingAlmDefinitions, loadingProjectCount } = props;
 
   return (
     <div className="bordered">
@@ -103,7 +104,8 @@ export default function BitbucketTab(props: BitbucketTabProps) {
             </p>
           </>
         }
-        loading={loading}
+        loadingAlmDefinitions={loadingAlmDefinitions}
+        loadingProjectCount={loadingProjectCount}
         multipleAlmEnabled={multipleAlmEnabled}
         onDelete={props.onDelete}
         onUpdateDefinitions={props.onUpdateDefinitions}
index 07818aa6c8d3011973b525b9822e2c37382043dc..bdeb29f3c896860d1128a45ba087bc75a26f3c50 100644 (file)
@@ -30,14 +30,22 @@ export interface GithubTabProps {
   branchesEnabled: boolean;
   component?: T.Component;
   definitions: GithubBindingDefinition[];
-  loading: boolean;
+  loadingAlmDefinitions: boolean;
+  loadingProjectCount: boolean;
   multipleAlmEnabled: boolean;
   onDelete: (definitionKey: string) => void;
   onUpdateDefinitions: () => void;
 }
 
 export default function GithubTab(props: GithubTabProps) {
-  const { branchesEnabled, component, multipleAlmEnabled, definitions, loading } = props;
+  const {
+    branchesEnabled,
+    component,
+    multipleAlmEnabled,
+    definitions,
+    loadingAlmDefinitions,
+    loadingProjectCount
+  } = props;
 
   return (
     <div className="bordered">
@@ -62,7 +70,8 @@ export default function GithubTab(props: GithubTabProps) {
               }
             ]}
             form={childProps => <GithubForm {...childProps} />}
-            loading={loading}
+            loadingAlmDefinitions={loadingAlmDefinitions}
+            loadingProjectCount={loadingProjectCount}
             multipleAlmEnabled={multipleAlmEnabled}
             onDelete={props.onDelete}
             onUpdateDefinitions={props.onUpdateDefinitions}
index 7ca66c1ac51a1e0f22519cb5c0389104ea92226c..e334f5d398b847587a6b7676409a5cae915cd146 100644 (file)
@@ -30,14 +30,22 @@ export interface GitlabTabProps {
   branchesEnabled: boolean;
   component?: T.Component;
   definitions: GitlabBindingDefinition[];
-  loading: boolean;
+  loadingAlmDefinitions: boolean;
+  loadingProjectCount: boolean;
   multipleAlmEnabled: boolean;
   onDelete: (definitionKey: string) => void;
   onUpdateDefinitions: () => void;
 }
 
 export default function GitlabTab(props: GitlabTabProps) {
-  const { branchesEnabled, component, multipleAlmEnabled, definitions, loading } = props;
+  const {
+    branchesEnabled,
+    component,
+    multipleAlmEnabled,
+    definitions,
+    loadingAlmDefinitions,
+    loadingProjectCount
+  } = props;
 
   return (
     <div className="bordered">
@@ -61,7 +69,8 @@ export default function GitlabTab(props: GitlabTabProps) {
               }
             ]}
             form={childProps => <GitlabForm {...childProps} />}
-            loading={loading}
+            loadingAlmDefinitions={loadingAlmDefinitions}
+            loadingProjectCount={loadingProjectCount}
             multipleAlmEnabled={multipleAlmEnabled}
             onDelete={props.onDelete}
             onUpdateDefinitions={props.onUpdateDefinitions}
index b75674c56c2f8b44710fbafcfee5c9554816230f..ab0455f10a9304a919ced20f32ff57400d1da3cb 100644 (file)
@@ -36,6 +36,7 @@ it('should render correctly', () => {
       ]
     })
   ).toMatchSnapshot('additional columns');
+  expect(shallowRender()).toMatchSnapshot('loading');
   expect(shallowRender({ alm: AlmKeys.GitLab })).toMatchSnapshot('title adjusts for GitLab');
 });
 
@@ -69,6 +70,7 @@ function shallowRender(props: Partial<AlmBindingDefinitionsTableProps> = {}) {
       additionalColumnsHeaders={[]}
       alm={AlmKeys.Azure}
       definitions={[]}
+      loading={false}
       onCreate={jest.fn()}
       onDelete={jest.fn()}
       onEdit={jest.fn()}
index 1e6a791f8b501496e1ad004d0453c57d6e3cbc76..4940b4370ab3808c19c40dbfef0add4b392b0d54 100644 (file)
@@ -85,7 +85,7 @@ it('should fetch settings', async () => {
     .then(() => {
       expect(getAlmDefinitions).toBeCalled();
       expect(wrapper.state().definitions).toEqual({ github: [] });
-      expect(wrapper.state().loading).toBe(false);
+      expect(wrapper.state().loadingAlmDefinitions).toBe(false);
     });
 });
 
index 1752860997ff3fd9c84a489a46b51b54d3ebac46..c23e364d9c4a916a54f3600833247b515649fd17 100644 (file)
@@ -24,7 +24,9 @@ import AlmIntegrationRenderer, { AlmIntegrationRendererProps } from '../AlmInteg
 
 it('should render correctly', () => {
   expect(shallowRender()).toMatchSnapshot('default');
-  expect(shallowRender({ loading: true })).toMatchSnapshot('loading');
+  expect(shallowRender({ loadingAlmDefinitions: true, loadingProjectCount: true })).toMatchSnapshot(
+    'loading'
+  );
   expect(shallowRender({ definitionKeyForDeletion: 'keyToDelete' })).toMatchSnapshot(
     'delete modal'
   );
@@ -39,7 +41,8 @@ function shallowRender(props: Partial<AlmIntegrationRendererProps> = {}) {
       branchesEnabled={true}
       currentAlm={AlmKeys.GitHub}
       definitions={{ azure: [], bitbucket: [], github: [], gitlab: [] }}
-      loading={false}
+      loadingAlmDefinitions={false}
+      loadingProjectCount={false}
       multipleAlmEnabled={false}
       onCancel={jest.fn()}
       onConfirmDelete={jest.fn()}
index a6172bb85bb2934138fe556f4e80f6433bb14fc3..2b1a6c458353130d26581d9676c893aa0ccb4b58 100644 (file)
@@ -98,7 +98,8 @@ function shallowRender(props: Partial<AlmTab<AzureBindingDefinition>['props']> =
       defaultBinding={DEFAULT_BINDING}
       definitions={[mockAzureBindingDefinition()]}
       form={jest.fn()}
-      loading={false}
+      loadingAlmDefinitions={false}
+      loadingProjectCount={false}
       multipleAlmEnabled={true}
       onDelete={jest.fn()}
       onUpdateDefinitions={jest.fn()}
index 4514ccf263fe91b39e270f55847e320bf595cd9a..63b1a2b02587741c02f0035e210db9786629a9bd 100644 (file)
@@ -24,7 +24,9 @@ import { AlmKeys, GithubBindingDefinition } from '../../../../../types/alm-setti
 import AlmTabRenderer, { AlmTabRendererProps } from '../AlmTabRenderer';
 
 it('should render correctly for multi-ALM binding', () => {
-  expect(shallowRender({ loading: true })).toMatchSnapshot('loading');
+  expect(shallowRender({ loadingAlmDefinitions: true })).toMatchSnapshot('loading ALM definitions');
+  expect(shallowRender({ loadingProjectCount: true })).toMatchSnapshot('loading project count');
+  expect(shallowRender({ submitting: true })).toMatchSnapshot('submitting');
   expect(shallowRender()).toMatchSnapshot('loaded');
   expect(shallowRender({ editedDefinition: mockGithubBindingDefinition() })).toMatchSnapshot(
     'editing a definition'
@@ -48,7 +50,9 @@ it('should render correctly for multi-ALM binding', () => {
 });
 
 it('should render correctly for single-ALM binding', () => {
-  expect(shallowRender({ loading: true, multipleAlmEnabled: false })).toMatchSnapshot();
+  expect(
+    shallowRender({ loadingAlmDefinitions: true, multipleAlmEnabled: false })
+  ).toMatchSnapshot();
   expect(shallowRender({ multipleAlmEnabled: false })).toMatchSnapshot();
   expect(
     shallowRender({ definitions: [mockGithubBindingDefinition()], multipleAlmEnabled: false })
@@ -64,13 +68,15 @@ function shallowRender(props: Partial<AlmTabRendererProps<GithubBindingDefinitio
       defaultBinding={mockGithubBindingDefinition()}
       definitions={[mockGithubBindingDefinition()]}
       form={jest.fn()}
-      loading={false}
+      loadingAlmDefinitions={false}
+      loadingProjectCount={false}
       multipleAlmEnabled={true}
       onCancel={jest.fn()}
       onCreate={jest.fn()}
       onDelete={jest.fn()}
       onEdit={jest.fn()}
       onSubmit={jest.fn()}
+      submitting={true}
       success={false}
       {...props}
     />
index 5b2389dda7ca94b9e9c4f52211ee994693909ee5..ef7fe85ee3de261d7f6157e10db4d4ebe3b67d2b 100644 (file)
@@ -30,7 +30,8 @@ function shallowRender(props: Partial<AzureTabProps> = {}) {
   return shallow(
     <AzureTab
       definitions={[mockAzureBindingDefinition()]}
-      loading={false}
+      loadingAlmDefinitions={false}
+      loadingProjectCount={false}
       multipleAlmEnabled={true}
       onDelete={jest.fn()}
       onUpdateDefinitions={jest.fn()}
index d1bfdcc5d499cac77b76d307c896918a5c812b25..6f2854c2eefcdcbaf9040773e7ea5a88a83cc9bc 100644 (file)
@@ -30,7 +30,8 @@ function shallowRender(props: Partial<BitbucketTabProps> = {}) {
   return shallow(
     <BitbucketTab
       definitions={[mockBitbucketBindingDefinition()]}
-      loading={false}
+      loadingAlmDefinitions={false}
+      loadingProjectCount={false}
       multipleAlmEnabled={true}
       onDelete={jest.fn()}
       onUpdateDefinitions={jest.fn()}
index 51f3ec73ee0c97359921aa0721f964b7c775740e..8aca94e7bd8dbb3b6c3b846831834fa0e4df0caf 100644 (file)
@@ -32,7 +32,8 @@ function shallowRender(props: Partial<GithubTabProps> = {}) {
     <GithubTab
       branchesEnabled={true}
       definitions={[mockGithubBindingDefinition()]}
-      loading={false}
+      loadingAlmDefinitions={false}
+      loadingProjectCount={false}
       multipleAlmEnabled={true}
       onDelete={jest.fn()}
       onUpdateDefinitions={jest.fn()}
index 7d8d70c3b3cdb6052a416e77fdea60c36f71ed5e..619777dd30a56c0f8c3fdb1dad40a84571b0a5e6 100644 (file)
@@ -32,7 +32,8 @@ function shallowRender(props: Partial<GitlabTabProps> = {}) {
     <GitlabTab
       branchesEnabled={true}
       definitions={[mockGitlabBindingDefinition()]}
-      loading={false}
+      loadingAlmDefinitions={false}
+      loadingProjectCount={false}
       multipleAlmEnabled={true}
       onDelete={jest.fn()}
       onUpdateDefinitions={jest.fn()}
index ff5dc35a333782d07e8e0b8a7811bcb12a3c8bf8..3f2d55a204cbff0eb425922e84138034b2e9cfab 100644 (file)
@@ -12,6 +12,7 @@ exports[`should render correctly 1`] = `
     </h2>
     <Button
       data-test="settings__alm-create"
+      disabled={false}
       onClick={[MockFunction]}
     >
       settings.almintegration.table.create
@@ -64,6 +65,7 @@ exports[`should render correctly: additional columns 1`] = `
     </h2>
     <Button
       data-test="settings__alm-create"
+      disabled={false}
       onClick={[MockFunction]}
     >
       settings.almintegration.table.create
@@ -129,6 +131,7 @@ exports[`should render correctly: additional columns 1`] = `
           data-test="settings__alm-table-row-edit"
         >
           <ButtonIcon
+            disabled={false}
             onClick={[Function]}
           >
             <EditIcon />
@@ -139,6 +142,7 @@ exports[`should render correctly: additional columns 1`] = `
           data-test="settings__alm-table-row-delete"
         >
           <DeleteButton
+            disabled={false}
             onClick={[Function]}
           />
         </td>
@@ -172,6 +176,7 @@ exports[`should render correctly: additional columns 1`] = `
           data-test="settings__alm-table-row-edit"
         >
           <ButtonIcon
+            disabled={false}
             onClick={[Function]}
           >
             <EditIcon />
@@ -182,6 +187,7 @@ exports[`should render correctly: additional columns 1`] = `
           data-test="settings__alm-table-row-delete"
         >
           <DeleteButton
+            disabled={false}
             onClick={[Function]}
           />
         </td>
@@ -191,6 +197,59 @@ exports[`should render correctly: additional columns 1`] = `
 </Fragment>
 `;
 
+exports[`should render correctly: loading 1`] = `
+<Fragment>
+  <div
+    className="spacer-top big-spacer-bottom display-flex-space-between"
+  >
+    <h2
+      className="settings-sub-category-name"
+    >
+      settings.almintegration.table.title
+    </h2>
+    <Button
+      data-test="settings__alm-create"
+      disabled={false}
+      onClick={[MockFunction]}
+    >
+      settings.almintegration.table.create
+    </Button>
+  </div>
+  <table
+    className="data zebra fixed spacer-bottom"
+  >
+    <thead>
+      <tr>
+        <th>
+          settings.almintegration.table.column.name
+        </th>
+        <th
+          className="action-small text-center"
+        >
+          settings.almintegration.table.column.edit
+        </th>
+        <th
+          className="action text-center"
+        >
+          settings.almintegration.table.column.delete
+        </th>
+      </tr>
+    </thead>
+    <tbody>
+      <tr
+        data-test="settings__alm-empty-table"
+      >
+        <td
+          colSpan={3}
+        >
+          settings.almintegration.table.empty.azure
+        </td>
+      </tr>
+    </tbody>
+  </table>
+</Fragment>
+`;
+
 exports[`should render correctly: title adjusts for GitLab 1`] = `
 <Fragment>
   <div
@@ -203,6 +262,7 @@ exports[`should render correctly: title adjusts for GitLab 1`] = `
     </h2>
     <Button
       data-test="settings__alm-create"
+      disabled={false}
       onClick={[MockFunction]}
     >
       settings.almintegration.table.create
index a056a472a840ff9c441dbd728256b334a292cace..c3ce1fad8ad6d176c62646e6f20dd957bb529754 100644 (file)
@@ -12,7 +12,8 @@ exports[`should render correctly 1`] = `
       "gitlab": Array [],
     }
   }
-  loading={true}
+  loadingAlmDefinitions={true}
+  loadingProjectCount={false}
   multipleAlmEnabled={false}
   onCancel={[Function]}
   onConfirmDelete={[Function]}
index 62430cb14710efae45421dfa12c4d4d1309adcbe..8be88f64c3bf77c5d278e0550b65239ef363b868 100644 (file)
@@ -76,7 +76,8 @@ exports[`should render correctly: azure 1`] = `
   />
   <AzureTab
     definitions={Array []}
-    loading={false}
+    loadingAlmDefinitions={false}
+    loadingProjectCount={false}
     multipleAlmEnabled={false}
     onDelete={[MockFunction]}
     onUpdateDefinitions={[MockFunction]}
@@ -160,7 +161,8 @@ exports[`should render correctly: bitbucket 1`] = `
   />
   <BitbucketTab
     definitions={Array []}
-    loading={false}
+    loadingAlmDefinitions={false}
+    loadingProjectCount={false}
     multipleAlmEnabled={false}
     onDelete={[MockFunction]}
     onUpdateDefinitions={[MockFunction]}
@@ -245,7 +247,8 @@ exports[`should render correctly: default 1`] = `
   <GithubTab
     branchesEnabled={true}
     definitions={Array []}
-    loading={false}
+    loadingAlmDefinitions={false}
+    loadingProjectCount={false}
     multipleAlmEnabled={false}
     onDelete={[MockFunction]}
     onUpdateDefinitions={[MockFunction]}
@@ -330,7 +333,8 @@ exports[`should render correctly: delete modal 1`] = `
   <GithubTab
     branchesEnabled={true}
     definitions={Array []}
-    loading={false}
+    loadingAlmDefinitions={false}
+    loadingProjectCount={false}
     multipleAlmEnabled={false}
     onDelete={[MockFunction]}
     onUpdateDefinitions={[MockFunction]}
@@ -420,7 +424,8 @@ exports[`should render correctly: gitlab 1`] = `
   <GitlabTab
     branchesEnabled={true}
     definitions={Array []}
-    loading={false}
+    loadingAlmDefinitions={false}
+    loadingProjectCount={false}
     multipleAlmEnabled={false}
     onDelete={[MockFunction]}
     onUpdateDefinitions={[MockFunction]}
@@ -505,7 +510,8 @@ exports[`should render correctly: loading 1`] = `
   <GithubTab
     branchesEnabled={true}
     definitions={Array []}
-    loading={true}
+    loadingAlmDefinitions={true}
+    loadingProjectCount={true}
     multipleAlmEnabled={false}
     onDelete={[MockFunction]}
     onUpdateDefinitions={[MockFunction]}
index 5d3f8507f613f8920fe7fd14f22af76598e2a831..e0e95f11057b7061775aaca5e274fb8fda75e182 100644 (file)
@@ -20,13 +20,15 @@ exports[`should render correctly 1`] = `
     ]
   }
   form={[MockFunction]}
-  loading={false}
+  loadingAlmDefinitions={false}
+  loadingProjectCount={false}
   multipleAlmEnabled={true}
   onCancel={[Function]}
   onCreate={[Function]}
   onDelete={[MockFunction]}
   onEdit={[Function]}
   onSubmit={[Function]}
+  submitting={false}
   success={false}
 />
 `;
index 64f7ac5fa045e6721435ad094fd05332c3a0927c..5f59a757faa3c86a36b87d5db45ebc564ff24a79 100644 (file)
@@ -27,6 +27,7 @@ exports[`should render correctly for multi-ALM binding: editing a definition 1`]
           },
         ]
       }
+      loading={false}
       onCreate={[MockFunction]}
       onDelete={[MockFunction]}
       onEdit={[MockFunction]}
@@ -95,6 +96,7 @@ exports[`should render correctly for multi-ALM binding: loaded 1`] = `
           },
         ]
       }
+      loading={false}
       onCreate={[MockFunction]}
       onDelete={[MockFunction]}
       onEdit={[MockFunction]}
@@ -103,7 +105,7 @@ exports[`should render correctly for multi-ALM binding: loaded 1`] = `
 </div>
 `;
 
-exports[`should render correctly for multi-ALM binding: loading 1`] = `
+exports[`should render correctly for multi-ALM binding: loading ALM definitions 1`] = `
 <div
   className="big-padded"
 >
@@ -130,6 +132,79 @@ exports[`should render correctly for multi-ALM binding: loading 1`] = `
           },
         ]
       }
+      loading={false}
+      onCreate={[MockFunction]}
+      onDelete={[MockFunction]}
+      onEdit={[MockFunction]}
+    />
+  </DeferredSpinner>
+</div>
+`;
+
+exports[`should render correctly for multi-ALM binding: loading project count 1`] = `
+<div
+  className="big-padded"
+>
+  <DeferredSpinner
+    loading={false}
+    timeout={100}
+  >
+    <AlmBindingDefinitionsTable
+      additionalColumnsHeaders={
+        Array [
+          "url",
+          "app_id",
+        ]
+      }
+      alm="github"
+      definitions={
+        Array [
+          Object {
+            "additionalColumns": Array [
+              "http://github.enterprise.com",
+              "123456",
+            ],
+            "key": "key",
+          },
+        ]
+      }
+      loading={true}
+      onCreate={[MockFunction]}
+      onDelete={[MockFunction]}
+      onEdit={[MockFunction]}
+    />
+  </DeferredSpinner>
+</div>
+`;
+
+exports[`should render correctly for multi-ALM binding: submitting 1`] = `
+<div
+  className="big-padded"
+>
+  <DeferredSpinner
+    loading={false}
+    timeout={100}
+  >
+    <AlmBindingDefinitionsTable
+      additionalColumnsHeaders={
+        Array [
+          "url",
+          "app_id",
+        ]
+      }
+      alm="github"
+      definitions={
+        Array [
+          Object {
+            "additionalColumns": Array [
+              "http://github.enterprise.com",
+              "123456",
+            ],
+            "key": "key",
+          },
+        ]
+      }
+      loading={false}
       onCreate={[MockFunction]}
       onDelete={[MockFunction]}
       onEdit={[MockFunction]}
@@ -165,6 +240,7 @@ exports[`should render correctly for multi-ALM binding: with features 1`] = `
           },
         ]
       }
+      loading={false}
       onCreate={[MockFunction]}
       onDelete={[MockFunction]}
       onEdit={[MockFunction]}
@@ -275,7 +351,7 @@ exports[`should render correctly for single-ALM binding 2`] = `
       />
     }
     hideKeyField={true}
-    loading={false}
+    loading={true}
     onCancel={[MockFunction]}
     onDelete={[MockFunction]}
     onEdit={[MockFunction]}
@@ -320,7 +396,7 @@ exports[`should render correctly for single-ALM binding 3`] = `
       />
     }
     hideKeyField={true}
-    loading={false}
+    loading={true}
     onCancel={[MockFunction]}
     onDelete={[MockFunction]}
     onEdit={[MockFunction]}
index b5eda86fe1757302cabfae1ef43b095324a8fca1..35b9a582a2323a3d14305bb7be68415e47fcc148 100644 (file)
@@ -32,7 +32,8 @@ exports[`should render correctly 1`] = `
       ]
     }
     form={[Function]}
-    loading={false}
+    loadingAlmDefinitions={false}
+    loadingProjectCount={false}
     multipleAlmEnabled={true}
     onDelete={[MockFunction]}
     onUpdateDefinitions={[MockFunction]}
index 352798750668875b5cba46529b1dfe3f91c02131..c09ac23275d7a12bd07cab61154327d00c9c8c5e 100644 (file)
@@ -102,7 +102,8 @@ exports[`should render correctly 1`] = `
         </p>
       </React.Fragment>
     }
-    loading={false}
+    loadingAlmDefinitions={false}
+    loadingProjectCount={false}
     multipleAlmEnabled={true}
     onDelete={[MockFunction]}
     onUpdateDefinitions={[MockFunction]}
index aaf2b45033d6c33d50f954158de0738c2df1c92f..bab4629b9d0f5712e6892a4e3708437738191962 100644 (file)
@@ -48,7 +48,8 @@ exports[`should render correctly: with branch support 1`] = `
       ]
     }
     form={[Function]}
-    loading={false}
+    loadingAlmDefinitions={false}
+    loadingProjectCount={false}
     multipleAlmEnabled={true}
     onDelete={[MockFunction]}
     onUpdateDefinitions={[MockFunction]}
index 92b5d755cddcb4e0a942257903f4855b14d85ea3..a039ff5b3eee111846afafdfa84252082f63507c 100644 (file)
@@ -43,7 +43,8 @@ exports[`should render correctly: with branch support 1`] = `
       ]
     }
     form={[Function]}
-    loading={false}
+    loadingAlmDefinitions={false}
+    loadingProjectCount={false}
     multipleAlmEnabled={true}
     onDelete={[MockFunction]}
     onUpdateDefinitions={[MockFunction]}