From ca77eb057b0ed8b59f5743e8ccca3deb677068ca Mon Sep 17 00:00:00 2001 From: Jorge Padilla Date: Fri, 24 Mar 2023 14:41:18 -0500 Subject: [PATCH] fix(frontend): remove settings confirmation modal (#2238) --- web/cypress/support/commands.ts | 3 +-- .../providers/Settings/Settings.provider.tsx | 19 +++++-------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/web/cypress/support/commands.ts b/web/cypress/support/commands.ts index 0bbc98d6b6..ef55f7b012 100644 --- a/web/cypress/support/commands.ts +++ b/web/cypress/support/commands.ts @@ -82,7 +82,7 @@ Cypress.Commands.add('createTestWithAuth', (authMethod: string, keys: string[]): cy.selectTestFromDemoList(); cy.get('[data-cy=auth-type-select]').click(); cy.get(`[data-cy=auth-type-select-option-${authMethod}]`).click(); - keys.forEach(key => cy.get(`[data-cy=${authMethod}-${key}]`).type(key)); + keys.forEach(key => cy.get(`[data-cy=${authMethod}-${key}] [contenteditable]`).first().type('key')); return cy.wrap(PokeshopDemo[0].name); }); @@ -265,7 +265,6 @@ Cypress.Commands.add('enableDemo', () => { cy.get('#demo_pokeshop_enabled').click(); cy.get('#demo_pokeshop_pokeshop_httpEndpoint').type('http://demo-pokemon-api.demo.svc.cluster.local'); cy.get('[data-cy=demo-form-save-button]').click(); - cy.get('[data-cy=confirmation-modal] .ant-btn-primary').click(); } cy.visit(`/`); diff --git a/web/src/providers/Settings/Settings.provider.tsx b/web/src/providers/Settings/Settings.provider.tsx index dd33ccbb4f..b095899a18 100644 --- a/web/src/providers/Settings/Settings.provider.tsx +++ b/web/src/providers/Settings/Settings.provider.tsx @@ -3,7 +3,6 @@ import {createContext, useCallback, useContext, useMemo} from 'react'; import {useCreateSettingMutation, useUpdateSettingMutation} from 'redux/apis/TraceTest.api'; import {TDraftResource} from 'types/Settings.types'; -import {useConfirmationModal} from '../ConfirmationModal/ConfirmationModal.provider'; import {useNotification} from '../Notification/Notification.provider'; interface IContext { @@ -23,7 +22,6 @@ const SettingsProvider = ({children}: IProps) => { const {showNotification} = useNotification(); const [createSetting, {isLoading: isLoadingCreate}] = useCreateSettingMutation(); const [updateSetting, {isLoading: isLoadingUpdate}] = useUpdateSettingMutation(); - const {onOpen: onOpenConfirmation} = useConfirmationModal(); const onSaveResource = useCallback( async (resource: TDraftResource) => { @@ -37,19 +35,12 @@ const SettingsProvider = ({children}: IProps) => { ); const onSubmit = useCallback( - (resources: TDraftResource[]) => { - onOpenConfirmation({ - title:

Are you sure you want to save this Setting?

, - heading: 'Save Confirmation', - okText: 'Save', - onConfirm: async () => { - await Promise.all(resources.map(resource => onSaveResource(resource))); - - showNotification({type: 'success', title: 'Settings saved', description: 'Your settings were saved'}); - }, - }); + async (resources: TDraftResource[]) => { + await Promise.all(resources.map(resource => onSaveResource(resource))); + + showNotification({type: 'success', title: 'Settings saved', description: 'Your settings were saved'}); }, - [onOpenConfirmation, onSaveResource, showNotification] + [onSaveResource, showNotification] ); const value = useMemo(