diff --git a/build_ts/.dev-server/compiled-types/src/react/ShellHooksContext.d.ts b/build_ts/.dev-server/compiled-types/src/react/ShellHooksContext.d.ts index bd4b75dac..fd1454f3b 100644 --- a/build_ts/.dev-server/compiled-types/src/react/ShellHooksContext.d.ts +++ b/build_ts/.dev-server/compiled-types/src/react/ShellHooksContext.d.ts @@ -1,23 +1,2 @@ -import { FC, ReactNode } from 'react'; -import { NavigateOptions, To } from 'react-router-dom'; -import { ShellAlerts, ShellHooks } from 'shell/compiled-types/src/hooks/useShellHooks'; -type Listener = () => void; -export declare const shellHooksStore: { - getShellHooks: () => any; - subscribe: (listener: Listener) => () => void; - setShellHooks: (newHooks: ShellHooks) => void; -}; -export declare const shellAlertsStore: { - getShellAlerts: () => any; - subscribe: (listener: Listener) => () => void; - setShellAlerts: (newAlerts: ShellAlerts) => void; -}; -export declare const useShellHooks: () => ShellHooks; -export declare const useShellAlerts: () => ShellAlerts; -export declare const ShellHooksProvider: FC<{ - shellHooks: ShellHooks; - shellAlerts: ShellAlerts; - children: ReactNode; -}>; +import { NavigateOptions, To } from 'react-router'; export declare const useBasenameRelativeNavigate: () => (to: To, options?: NavigateOptions) => void | Promise; -export {}; diff --git a/package-lock.json b/package-lock.json index 70eb780c8..582d317c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@hookform/resolvers": "^2.8.8", "@monaco-editor/react": "^4.4.5", "@scality/core-ui": "git+https://github.com/scality/core-ui#feature/ARTESCA-13970", - "@scality/module-federation": "git+https://github.com/scality/module-federation#b78866fd7429ba2dd1bdd0fd75b25b6097803880", + "@scality/module-federation": "git+https://github.com/scality/module-federation#f4105131e3488a025632e9542edf8fb3c8ed6262", "@types/react-table": "^7.7.10", "@types/react-virtualized": "^9.21.20", "@types/react-window": "^1.8.5", @@ -4018,8 +4018,8 @@ }, "node_modules/@scality/module-federation": { "version": "1.3.4", - "resolved": "git+ssh://git@github.com/scality/module-federation.git#b78866fd7429ba2dd1bdd0fd75b25b6097803880", - "integrity": "sha512-FvMdZUFscZypun/2A4xRFgPDpYGxkQDuhaEdzXpNd+lvYDO5V3sOz+Hya4URJNCIFdvvaSdkPf9cTrnqL34mtA==", + "resolved": "git+ssh://git@github.com/scality/module-federation.git#f4105131e3488a025632e9542edf8fb3c8ed6262", + "integrity": "sha512-oApl7a1sO6JvYGXXJuwc3rvYwoAxTYyxzH1kTn1v+RbZ5hPvJDx61bf/ULNadTcrnxnLG9MS/piqg9fv80NXCw==", "license": "SEE LICENSE IN LICENSE", "peerDependencies": { "react": "^18.3.1", diff --git a/package.json b/package.json index 1d6ccbe98..6321ecafa 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "@hookform/resolvers": "^2.8.8", "@monaco-editor/react": "^4.4.5", "@scality/core-ui": "git+https://github.com/scality/core-ui#feature/ARTESCA-13970", - "@scality/module-federation": "git+https://github.com/scality/module-federation#b78866fd7429ba2dd1bdd0fd75b25b6097803880", + "@scality/module-federation": "git+https://github.com/scality/module-federation#0395e64598165d4156a55b94194d21e70e1cc608", "@types/react-table": "^7.7.10", "@types/react-virtualized": "^9.21.20", "@types/react-window": "^1.8.5", diff --git a/src/js/mutations.ts b/src/js/mutations.ts index 66edd9ed2..7bb133ca9 100644 --- a/src/js/mutations.ts +++ b/src/js/mutations.ts @@ -10,7 +10,7 @@ import { TagSetItem } from '../types/s3'; import { notFalsyTypeGuard } from '../types/typeGuards'; import { MULTIPART_UPLOAD } from './S3Client'; import { EndpointV1 } from './managementClient/api'; -import { useShellHooks } from '../react/ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; export const useWaitForRunningConfigurationVersionToBeUpdated = () => { const managementClient = useManagementClient(); diff --git a/src/react/DataServiceRoleProvider.tsx b/src/react/DataServiceRoleProvider.tsx index 4425a9f7b..4e7849142 100644 --- a/src/react/DataServiceRoleProvider.tsx +++ b/src/react/DataServiceRoleProvider.tsx @@ -12,7 +12,7 @@ import { import Loader from './ui-elements/Loader'; import { PromiseResult } from 'aws-sdk/lib/request'; import { AWSError, STS } from 'aws-sdk'; -import { useShellHooks } from './ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; export const _DataServiceRoleContext = createContext void; - -const createShellHooksStore = () => { - let shellHooks: ShellHooks | null = null; - - const listeners: Set = new Set(); - - return { - getShellHooks: () => shellHooks, - - subscribe: (listener: Listener) => { - listeners.add(listener); - return () => { - listeners.delete(listener); - }; - }, - - setShellHooks: (newHooks: ShellHooks) => { - if (shellHooks !== newHooks) { - shellHooks = newHooks; - listeners.forEach((listener) => listener()); - } - }, - }; -}; - -const createShellAlertsStore = () => { - let shellAlerts: ShellAlerts | null = null; - const listeners: Set = new Set(); - - return { - getShellAlerts: () => shellAlerts, - - subscribe: (listener: Listener) => { - listeners.add(listener); - return () => { - listeners.delete(listener); - }; - }, - - setShellAlerts: (newAlerts: ShellAlerts) => { - if (shellAlerts !== newAlerts) { - shellAlerts = newAlerts; - listeners.forEach((listener) => listener()); - } - }, - }; -}; - -export const shellHooksStore = createShellHooksStore(); -export const shellAlertsStore = createShellAlertsStore(); - -export const useShellHooks = (): ShellHooks => { - const hooks = useSyncExternalStore( - shellHooksStore.subscribe, - shellHooksStore.getShellHooks, - ); - - if (!hooks) { - throw new Error( - 'useShellHooks must be used within a ShellHooksProvider and initialized with valid hooks.', - ); - } - - return hooks; -}; - -export const useShellAlerts = (): ShellAlerts => { - const alerts = useSyncExternalStore( - shellAlertsStore.subscribe, - shellAlertsStore.getShellAlerts, - ); - - if (!alerts) { - throw new Error( - 'useShellAlerts must be used within a ShellHooksProvider and initialized with valid alerts.', - ); - } - - return alerts; -}; - -export const ShellHooksProvider: FC<{ - shellHooks: ShellHooks; - shellAlerts: ShellAlerts; - children: ReactNode; -}> = ({ shellHooks, shellAlerts, children }) => { - useMemo(() => { - shellHooksStore.setShellHooks(shellHooks); - shellAlertsStore.setShellAlerts(shellAlerts); - }, [shellHooks, shellAlerts]); - return <>{children}; -}; export const useBasenameRelativeNavigate = () => { const originalNavigate = useNavigate(); diff --git a/src/react/ZenkoUI.tsx b/src/react/ZenkoUI.tsx index 50bd562a7..69e2f5bb3 100644 --- a/src/react/ZenkoUI.tsx +++ b/src/react/ZenkoUI.tsx @@ -9,7 +9,7 @@ import Loader from './ui-elements/Loader'; import Routes from './Routes'; import { loadAppConfig } from './actions'; import { useConfig } from './next-architecture/ui/ConfigProvider'; -import { useShellHooks } from './ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; function ZenkoUI() { const isConfigLoaded = useSelector( diff --git a/src/react/account/details/properties/AccountInfo.tsx b/src/react/account/details/properties/AccountInfo.tsx index 56152d85a..a6e4e1f46 100644 --- a/src/react/account/details/properties/AccountInfo.tsx +++ b/src/react/account/details/properties/AccountInfo.tsx @@ -25,10 +25,8 @@ import Table, * as T from '../../../ui-elements/TableKeyValue'; import { useAuthGroups, useRolePathName } from '../../../utils/hooks'; import { removeRoleArnStored } from '../../../utils/localStorage'; import SecretKeyModal from './SecretKeyModal'; -import { - useBasenameRelativeNavigate, - useShellHooks, -} from '../../../ShellHooksContext'; +import { useBasenameRelativeNavigate } from '../../../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; const TableContainer = styled.div` display: flex; diff --git a/src/react/endpoint/DeleteEndpoint.tsx b/src/react/endpoint/DeleteEndpoint.tsx index 725581fac..5f05d3436 100644 --- a/src/react/endpoint/DeleteEndpoint.tsx +++ b/src/react/endpoint/DeleteEndpoint.tsx @@ -9,7 +9,7 @@ import { useAccountsLocationsEndpointsAdapter } from '../next-architecture/ui/Ac import { useInstanceId } from '../next-architecture/ui/AuthProvider'; import DeleteConfirmation from '../ui-elements/DeleteConfirmation'; import * as T from '../ui-elements/Table'; -import { useShellHooks } from '../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; export const DeleteEndpoint = ({ hostname, diff --git a/src/react/locations/LocationEditor.tsx b/src/react/locations/LocationEditor.tsx index 739995b10..c387c2b2f 100644 --- a/src/react/locations/LocationEditor.tsx +++ b/src/react/locations/LocationEditor.tsx @@ -39,10 +39,8 @@ import { newLocationForm, } from './utils'; import { Loader as LoaderCoreUI } from '@scality/core-ui'; -import { - useBasenameRelativeNavigate, - useShellHooks, -} from '../ShellHooksContext'; +import { useBasenameRelativeNavigate } from '../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; //Temporary hack waiting for the layout const StyledForm = styled(Form)` diff --git a/src/react/locations/LocationsList.tsx b/src/react/locations/LocationsList.tsx index 7924259e4..c47afb897 100644 --- a/src/react/locations/LocationsList.tsx +++ b/src/react/locations/LocationsList.tsx @@ -40,11 +40,9 @@ import { PauseAndResume } from './PauseAndResume'; import { getLocationDeletionBlocker } from './utils'; import styled from 'styled-components'; import { TableHeaderWrapper } from '../ui-elements/Table'; -import { - useBasenameRelativeNavigate, - useShellHooks, -} from '../ShellHooksContext'; +import { useBasenameRelativeNavigate } from '../ShellHooksContext'; import { useConfig } from '../next-architecture/ui/ConfigProvider'; +import { useShellHooks } from '@scality/module-federation'; const ActionButtons = ({ rowValues, diff --git a/src/react/locations/PauseAndResume.tsx b/src/react/locations/PauseAndResume.tsx index ecdf957bc..4b7fdc4c1 100644 --- a/src/react/locations/PauseAndResume.tsx +++ b/src/react/locations/PauseAndResume.tsx @@ -10,7 +10,7 @@ import { EmptyCell } from '@scality/core-ui/dist/components/tablev2/Tablev2.comp import { useInstanceId } from '../next-architecture/ui/AuthProvider'; import { handleClientError } from '../actions'; import { ApiError } from '../../types/actions'; -import { useShellHooks } from '../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; export const PauseAndResume = ({ locationName }: { locationName: string }) => { const [isPollingEnabled, setIsPollingEnabled] = useState(false); diff --git a/src/react/next-architecture/domain/business/locations.test.tsx b/src/react/next-architecture/domain/business/locations.test.tsx index 8d08e40b0..3d1c159d3 100644 --- a/src/react/next-architecture/domain/business/locations.test.tsx +++ b/src/react/next-architecture/domain/business/locations.test.tsx @@ -24,7 +24,7 @@ import { WrapperAsStorageManager, } from '../../../utils/testUtil'; import { QueryClientProvider } from '../../../../QueryClientProvider'; -import { ShellHooksProvider } from '../../../ShellHooksContext'; +import { ShellHooksProvider } from '@scality/module-federation'; const defaultUsedCapacity = { status: 'success' as const, @@ -57,7 +57,6 @@ const Wrapper = ({ children }: PropsWithChildren>) => { return ( diff --git a/src/react/next-architecture/ui/AccountsLocationsEndpointsAdapterProvider.tsx b/src/react/next-architecture/ui/AccountsLocationsEndpointsAdapterProvider.tsx index f23ecd60f..165624f6d 100644 --- a/src/react/next-architecture/ui/AccountsLocationsEndpointsAdapterProvider.tsx +++ b/src/react/next-architecture/ui/AccountsLocationsEndpointsAdapterProvider.tsx @@ -3,7 +3,7 @@ import { IAccountsLocationsEndpointsAdapter } from '../adapters/accounts-locatio import { PensieveAccountsLocationsAdapter } from '../adapters/accounts-locations/PensieveAccountsLocationsAdapter'; import { useInstanceId } from './AuthProvider'; import { useConfig } from './ConfigProvider'; -import { useShellHooks } from '../../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; const _AccountsLocationsEndpointsAdapterContext = createContext { return (alerts?.[0] && alerts[0].severity) || 'healthy'; diff --git a/src/react/next-architecture/ui/AuthProvider.tsx b/src/react/next-architecture/ui/AuthProvider.tsx index a21617515..c2e8127fc 100644 --- a/src/react/next-architecture/ui/AuthProvider.tsx +++ b/src/react/next-architecture/ui/AuthProvider.tsx @@ -1,6 +1,6 @@ import { createContext } from 'react'; import { AuthUser } from '../../../types/auth'; -import { useShellHooks } from '../../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; //exported for testing purposes only // TO BE DELETED diff --git a/src/react/next-architecture/ui/CertificateDownloadButton.tsx b/src/react/next-architecture/ui/CertificateDownloadButton.tsx index 3d616f7f5..ea6c0bd36 100644 --- a/src/react/next-architecture/ui/CertificateDownloadButton.tsx +++ b/src/react/next-architecture/ui/CertificateDownloadButton.tsx @@ -1,5 +1,5 @@ import { FederatedComponent } from '@scality/module-federation'; -import { useShellHooks } from '../../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; export const CertificateDownloadButton = () => { const { useDeployedApps, useConfigRetriever } = useShellHooks(); diff --git a/src/react/next-architecture/ui/ConfigProvider.tsx b/src/react/next-architecture/ui/ConfigProvider.tsx index 7e7ed8d79..a84e658a0 100644 --- a/src/react/next-architecture/ui/ConfigProvider.tsx +++ b/src/react/next-architecture/ui/ConfigProvider.tsx @@ -5,14 +5,14 @@ import { RuntimeWebFinger, } from 'shell/moduleFederation/ConfigurationProvider'; import { AppConfig } from '../../../types/entities'; -import { useShellHooks } from '../../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; export const _ConfigContext = createContext(null); export function useConfig(): AppConfig { const { name } = useCurrentApp(); const { useConfig } = useShellHooks(); - return useConfig({ + return useConfig({ configType: 'run', name, }).spec.selfConfiguration; @@ -45,14 +45,13 @@ export function useXcoreRuntimeConfig(): RuntimeWebFinger | const instances = useDeployedXcoreInstances(); if (instances.length) { - return retrieveConfiguration({ + return retrieveConfiguration({ configType: 'run', name: instances[0].name, }); - } else { - console.log('There is no Xcore instance deployed yet.'); - return null; } + console.log('There is no Xcore instance deployed yet.'); + return null; } export function useXcoreBuildtimeConfig(): BuildtimeWebFinger | null { @@ -61,14 +60,13 @@ export function useXcoreBuildtimeConfig(): BuildtimeWebFinger | null { const instances = useDeployedXcoreInstances(); if (instances.length) { - return retrieveConfiguration<'build'>({ + return retrieveConfiguration({ configType: 'build', name: instances[0].name, }); - } else { - console.log('There is no Xcore instance deployed yet.'); - return null; } + console.log('There is no Xcore instance deployed yet.'); + return null; } // FIXME this is a temporary (hopefully) solution to get the Grafana URL @@ -82,13 +80,12 @@ export function useGrafanaURL() { if (instances.length) { const baseUrl = new URL(instances[0].url).origin; - const runTimeConfig = retrieveConfiguration({ + const runTimeConfig = retrieveConfiguration({ configType: 'run', name: instances[0].name, }); return baseUrl + runTimeConfig.spec.selfConfiguration.url_grafana; - } else { - console.log('There is no Metalk8s instance deployed yet.'); - return ''; } + console.log('There is no Metalk8s instance deployed yet.'); + return ''; } diff --git a/src/react/next-architecture/ui/LocationAdapterProvider.tsx b/src/react/next-architecture/ui/LocationAdapterProvider.tsx index 2a9adc93c..9422b22ce 100644 --- a/src/react/next-architecture/ui/LocationAdapterProvider.tsx +++ b/src/react/next-architecture/ui/LocationAdapterProvider.tsx @@ -3,7 +3,7 @@ import { ILocationsAdapter } from '../adapters/accounts-locations/ILocationsAdap import { PensieveAccountsLocationsAdapter } from '../adapters/accounts-locations/PensieveAccountsLocationsAdapter'; import { useInstanceId } from './AuthProvider'; import { useConfig } from './ConfigProvider'; -import { useShellHooks } from '../../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; const _LocationAdapterContext = createContext(null); const ZenkoClientContext = createContext(null); diff --git a/src/react/ui-elements/Editor.tsx b/src/react/ui-elements/Editor.tsx index 81e2ddba9..8ed764f2f 100644 --- a/src/react/ui-elements/Editor.tsx +++ b/src/react/ui-elements/Editor.tsx @@ -2,7 +2,7 @@ import MonacoEditor, { EditorProps, loader } from '@monaco-editor/react'; import React, { useMemo, useState } from 'react'; import { useConfig } from '../next-architecture/ui/ConfigProvider'; -import { useShellHooks } from '../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; type Props = { width?: string; diff --git a/src/react/ui-elements/Veeam/VeeamCapacityFormSection.tsx b/src/react/ui-elements/Veeam/VeeamCapacityFormSection.tsx index 74cf3486c..0c559ac91 100644 --- a/src/react/ui-elements/Veeam/VeeamCapacityFormSection.tsx +++ b/src/react/ui-elements/Veeam/VeeamCapacityFormSection.tsx @@ -6,7 +6,7 @@ import { ListItem } from './VeeamTable'; import { useCapacityUnit } from './useCapacityUnit'; import { useEffect } from 'react'; import { useXcoreRuntimeConfig } from '../../next-architecture/ui/ConfigProvider'; -import { useShellHooks } from '../../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; type XCoreConfig = { spec: { diff --git a/src/react/ui-elements/Veeam/VeeamWelcomeModal.test.tsx b/src/react/ui-elements/Veeam/VeeamWelcomeModal.test.tsx index 73fe30ea7..df7dc5a05 100644 --- a/src/react/ui-elements/Veeam/VeeamWelcomeModal.test.tsx +++ b/src/react/ui-elements/Veeam/VeeamWelcomeModal.test.tsx @@ -17,8 +17,7 @@ import { VEEAM_DEFAULT_ACCOUNT_NAME } from './VeeamConstants'; import { useNextLogin } from './useNextLogin'; import { useAlerts } from '../../next-architecture/ui/AlertProvider'; import { QueryClientProvider } from '../../../QueryClientProvider'; -import { ShellHooksProvider } from '../../ShellHooksContext'; -import { debug } from 'jest-preview'; +import { ShellHooksProvider } from '@scality/module-federation'; jest.mock('./useNextLogin', () => ({ useNextLogin: jest.fn(), @@ -69,7 +68,6 @@ describe('VeeamWelcomeModal', () => { const VeeamWelcomeModalComponent = ( diff --git a/src/react/ui-elements/Veeam/VeeamWelcomeModal.tsx b/src/react/ui-elements/Veeam/VeeamWelcomeModal.tsx index e23f9c377..bdbab5ca5 100644 --- a/src/react/ui-elements/Veeam/VeeamWelcomeModal.tsx +++ b/src/react/ui-elements/Veeam/VeeamWelcomeModal.tsx @@ -13,7 +13,7 @@ import { useNextLogin } from './useNextLogin'; import AlertProvider, { useAlerts, } from '../../next-architecture/ui/AlertProvider'; -import { useShellHooks } from '../../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; const CustomModal = styled(Modal)` background-color: ${(props) => props.theme.backgroundLevel1}; diff --git a/src/react/ui-elements/Veeam/useMutationTableData.ts b/src/react/ui-elements/Veeam/useMutationTableData.ts index f7c47703f..51f0770ea 100644 --- a/src/react/ui-elements/Veeam/useMutationTableData.ts +++ b/src/react/ui-elements/Veeam/useMutationTableData.ts @@ -26,7 +26,7 @@ import { VEEAM_XML_PREFIX, } from './VeeamConstants'; import { useCreateBucket } from '../../next-architecture/domain/business/buckets'; -import { useShellHooks } from '../../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; export const actions = [ 'Create an Account', diff --git a/src/react/ui-elements/Veeam/useNextLogin.ts b/src/react/ui-elements/Veeam/useNextLogin.ts index 4237f923b..9d9d7e1ea 100644 --- a/src/react/ui-elements/Veeam/useNextLogin.ts +++ b/src/react/ui-elements/Veeam/useNextLogin.ts @@ -1,5 +1,5 @@ import { getSessionState } from '../../utils/localStorage'; -import { useShellHooks } from '../../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; export const useNextLogin = () => { const { useAuth } = useShellHooks(); diff --git a/src/react/ui-elements/__tests__/SelectAccountIAMRole.test.tsx b/src/react/ui-elements/__tests__/SelectAccountIAMRole.test.tsx index ce1e858d4..9dc411b30 100644 --- a/src/react/ui-elements/__tests__/SelectAccountIAMRole.test.tsx +++ b/src/react/ui-elements/__tests__/SelectAccountIAMRole.test.tsx @@ -23,7 +23,7 @@ import { ToastProvider } from '@scality/core-ui'; import { coreUIAvailableThemes } from '@scality/core-ui/src/lib/style/theme'; import { ThemeProvider } from 'styled-components'; import { QueryClientProvider } from '../../../QueryClientProvider'; -import { ShellHooksProvider } from '../../ShellHooksContext'; +import { ShellHooksProvider } from '@scality/module-federation'; const testAccountId1 = '064609833007'; const testAccountId2 = '377232323695'; @@ -283,7 +283,6 @@ const LocalWrapper = ({ children }) => { diff --git a/src/react/utils/hooks.ts b/src/react/utils/hooks.ts index c2af1b799..670adc184 100644 --- a/src/react/utils/hooks.ts +++ b/src/react/utils/hooks.ts @@ -13,7 +13,7 @@ import { ApiError } from '../../types/actions'; import { Account, WebIdentityRoles } from '../../types/iam'; import { notFalsyTypeGuard } from '../../types/typeGuards'; import { useDataServiceRole } from '../DataServiceRoleProvider'; -import { useShellHooks } from '../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; import { handleApiError, handleClientError, diff --git a/src/react/utils/testUtil.tsx b/src/react/utils/testUtil.tsx index 5e42558a1..d470a0dca 100644 --- a/src/react/utils/testUtil.tsx +++ b/src/react/utils/testUtil.tsx @@ -20,7 +20,6 @@ import { UiFacingApiWrapper } from '../../js/managementClient'; import { Configuration } from '../../js/managementClient/configuration'; import { _DataServiceRoleContext } from '../DataServiceRoleProvider'; import { _ManagementContext } from '../ManagementProvider'; -import { ShellHooksProvider } from '../ShellHooksContext'; import { authenticatedUserState } from '../actions/__tests__/utils/testUtil'; import { AccessibleAccountsAdapterProvider } from '../next-architecture/ui/AccessibleAccountsAdapterProvider'; import { AccountsLocationsEndpointsAdapterProvider } from '../next-architecture/ui/AccountsLocationsEndpointsAdapterProvider'; @@ -36,6 +35,7 @@ import zenkoUIReducer from '../reducers'; import Activity from '../ui-elements/Activity'; import ErrorHandlerModal from '../ui-elements/ErrorHandlerModal'; import ReauthDialog from '../ui-elements/ReauthDialog'; +import { ShellHooksProvider } from '@scality/module-federation'; export const theme = coreUIAvailableThemes.darkRebrand; export const configuration = { @@ -267,7 +267,6 @@ export const Wrapper = ({ children }: { children: ReactNode }): ReactNode => { @@ -505,7 +504,6 @@ export function renderWithRouterMatch( @@ -574,7 +572,6 @@ export const renderWithCustomRoute = ( @@ -661,7 +658,6 @@ export const NewWrapper = diff --git a/src/react/workflow/ConfigurationTab.tsx b/src/react/workflow/ConfigurationTab.tsx index db02d6fce..2f496f714 100644 --- a/src/react/workflow/ConfigurationTab.tsx +++ b/src/react/workflow/ConfigurationTab.tsx @@ -64,10 +64,8 @@ import { removeEmptyTagKeys, } from './utils'; import { useWorkflows } from './Workflows'; -import { - useBasenameRelativeNavigate, - useShellHooks, -} from '../ShellHooksContext'; +import { useBasenameRelativeNavigate } from '../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; type Props = { wfSelected: Workflow; diff --git a/src/react/workflow/CreateWorkflow.tsx b/src/react/workflow/CreateWorkflow.tsx index 50e653e99..ecde79ee3 100644 --- a/src/react/workflow/CreateWorkflow.tsx +++ b/src/react/workflow/CreateWorkflow.tsx @@ -67,11 +67,9 @@ import { prepareTransitionQuery, removeEmptyTagKeys, } from './utils'; -import { - useBasenameRelativeNavigate, - useShellHooks, -} from '../ShellHooksContext'; +import { useBasenameRelativeNavigate } from '../ShellHooksContext'; import { useParams } from 'react-router'; +import { useShellHooks } from '@scality/module-federation'; const OptionIcon = ({ icon }: { icon: IconName }) => ( diff --git a/src/react/workflow/ReplicationForm.tsx b/src/react/workflow/ReplicationForm.tsx index 0373bd80a..aa49a8771 100644 --- a/src/react/workflow/ReplicationForm.tsx +++ b/src/react/workflow/ReplicationForm.tsx @@ -56,7 +56,7 @@ import { } from './utils'; import { useInstanceId } from '../next-architecture/ui/AuthProvider'; import { ReplicationStreamInternalV1 } from '../../js/managementClient/api'; -import { useShellHooks } from '../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; type Props = { isCreateMode?: boolean; diff --git a/src/react/workflow/Workflows.tsx b/src/react/workflow/Workflows.tsx index 6e8b98fd8..ecc87af47 100644 --- a/src/react/workflow/Workflows.tsx +++ b/src/react/workflow/Workflows.tsx @@ -34,7 +34,7 @@ import { useMetricsAdapter } from '../next-architecture/ui/MetricsAdapterProvide import { makeWorkflows, workflowListQuery } from '../queries'; import { Breadcrumb } from '../ui-elements/Breadcrumb'; -import { useShellHooks } from '../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; import { AuthorizedAdvancedMetricsButton, replicationDashboard, diff --git a/src/react/workflow/useDeleteWorkflow.ts b/src/react/workflow/useDeleteWorkflow.ts index c2eb9fedd..e2f43d6ab 100644 --- a/src/react/workflow/useDeleteWorkflow.ts +++ b/src/react/workflow/useDeleteWorkflow.ts @@ -12,7 +12,7 @@ import { useInstanceId } from '../next-architecture/ui/AuthProvider'; import { workflowListQuery } from '../queries'; import { errorParser } from '../utils'; import { useRolePathName } from '../utils/hooks'; -import { useShellHooks } from '../ShellHooksContext'; +import { useShellHooks } from '@scality/module-federation'; export enum WorkflowRule { Replication = 'replication',