Browse Source

[ISSUE-1210] Change of the Global Comp Level updates the list of schemas (#1307)

Oleg Shur 3 years ago
parent
commit
6351361c38

+ 0 - 1
kafka-ui-react-app/package-lock.json

@@ -3159,7 +3159,6 @@
       "version": "5.1.18",
       "resolved": "https://registry.npmjs.org/@types/styled-components/-/styled-components-5.1.18.tgz",
       "integrity": "sha512-xPTYmWP7Mxk5TAD3pYsqjwA9G5fAI8e/S51QUJEl7EQD1siKCdiYXIWiH2lzoHRl+QqbQCJMcGv3YTF3OmyPdQ==",
-      "dev": true,
       "requires": {
         "@types/hoist-non-react-statics": "*",
         "@types/react": "*",

+ 4 - 7
kafka-ui-react-app/src/components/Schemas/List/GlobalSchemaSelector/GlobalSchemaSelector.tsx

@@ -1,5 +1,4 @@
 import ConfirmationModal from 'components/common/ConfirmationModal/ConfirmationModal';
-import PageLoader from 'components/common/PageLoader/PageLoader';
 import Select from 'components/common/Select/Select';
 import { CompatibilityLevelCompatibilityEnum } from 'generated-sources';
 import React from 'react';
@@ -48,6 +47,7 @@ const GlobalSchemaSelector: React.FC<GlobalSchemaSelectorProps> = ({
           selectSize="M"
           defaultValue={globalSchemaCompatibilityLevel}
           onChange={() => setUpdateCompatibilityConfirmationVisible(true)}
+          disabled={methods.formState.isSubmitting}
         >
           {Object.keys(CompatibilityLevelCompatibilityEnum).map(
             (level: string) => (
@@ -61,13 +61,10 @@ const GlobalSchemaSelector: React.FC<GlobalSchemaSelectorProps> = ({
           isOpen={isUpdateCompatibilityConfirmationVisible}
           onCancel={() => setUpdateCompatibilityConfirmationVisible(false)}
           onConfirm={methods.handleSubmit(onCompatibilityLevelUpdate)}
+          isConfirming={methods.formState.isSubmitting}
         >
-          {methods.formState.isSubmitting ? (
-            <PageLoader />
-          ) : (
-            `Are you sure you want to update the global compatibility level?
-                  This may affect the compatibility levels of the schemas.`
-          )}
+          Are you sure you want to update the global compatibility level? This
+          may affect the compatibility levels of the schemas.
         </ConfirmationModal>
       </GlobalSchemaSelectorWrapper>
     </FormProvider>

+ 3 - 0
kafka-ui-react-app/src/redux/actions/__test__/thunks/schemas.spec.ts

@@ -227,6 +227,8 @@ describe('Thunks', () => {
         `/api/clusters/${clusterName}/schemas/compatibility`,
         200
       );
+      fetchMock.getOnce(`/api/clusters/${clusterName}/schemas`, 200);
+
       await store.dispatch(
         thunks.updateGlobalSchemaCompatibilityLevel(
           clusterName,
@@ -235,6 +237,7 @@ describe('Thunks', () => {
       );
       expect(store.getActions()).toEqual([
         actions.updateGlobalSchemaCompatibilityLevelAction.request(),
+        actions.fetchSchemasByClusterNameAction.request(),
         actions.updateGlobalSchemaCompatibilityLevelAction.success(
           CompatibilityLevelCompatibilityEnum.FORWARD
         ),

+ 1 - 0
kafka-ui-react-app/src/redux/actions/thunks/schemas.ts

@@ -78,6 +78,7 @@ export const updateGlobalSchemaCompatibilityLevel =
         clusterName,
         compatibilityLevel: { compatibility: compatibilityLevel },
       });
+      dispatch(fetchSchemasByClusterName(clusterName));
       dispatch(
         actions.updateGlobalSchemaCompatibilityLevelAction.success(
           compatibilityLevel