Skip to content

Commit

Permalink
Refactor history type definitions and update package versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hervedombya committed Dec 5, 2024
1 parent fcfd42e commit dfd30e6
Show file tree
Hide file tree
Showing 43 changed files with 1,074 additions and 1,402 deletions.
97 changes: 76 additions & 21 deletions shell-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions shell-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"ts-node": "^10.9.2"
},
"dependencies": {
"@scality/core-ui": "git+https://github.com/scality/core-ui#33e22729ee7317f5afecb79f06b4f873dc3e376d",
"@scality/core-ui": "git+https://github.com/scality/core-ui#62aef0b544c50e47c5a8ceb3697fe090eb3c6a9f",
"@scality/module-federation": "git+https://github.com/scality/module-federation#c571388783a2a51ae3bf5d36ae66753c8b014bb5",
"downshift": "^8.0.0",
"history": "^5.3.0",
Expand All @@ -57,8 +57,8 @@
"react-error-boundary": "^4.0.2",
"react-intl": "^5.15.3",
"react-query": "^3.34.0",
"react-router": "^6.28.0",
"react-router-dom": "^6.28.0",
"react-router": "^7.0.1",
"react-router-dom": "^7.0.1",
"styled-components": "^5.3.11",
"typescript": "^5.6.3"
}
Expand Down
3 changes: 2 additions & 1 deletion shell-ui/src/FederatedApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ function InternalRouter() {

.map(({ app, view, groups }) => ({
path: app.appHistoryBasePath + view.path,
basename: app.appHistoryBasePath,
exact: view.exact,
strict: view.strict,
sensitive: view.sensitive,
Expand Down Expand Up @@ -213,7 +214,7 @@ function InternalRouter() {
{routes.map((route) => (
<Route
key={route.path}
path={`${route.path}*`}
path={`${route.basename}/*`}
element={route.element}
/>
))}
Expand Down
3 changes: 2 additions & 1 deletion shell-ui/src/navbar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const useNavbarLinksToActions = (
const location = useLocation();
const doesRouteMatch = useCallback(
(path: RouteProps) => {
return matchPath(location.pathname, path.path);
return matchPath(path.path + '*', location.pathname);
},
[location],
);
Expand Down Expand Up @@ -300,6 +300,7 @@ export const Navbar = ({
const url = link.view.isFederated
? link.view.app.appHistoryBasePath + link.view.view.path
: (link.view as NonFederatedView).url;

navigate(url, { replace: true });
}
}, [navbarMainActions]);
Expand Down
66 changes: 6 additions & 60 deletions ui/@mf-types/shell/compiled-types/src/FederatedApp.d.ts
Original file line number Diff line number Diff line change
@@ -1,67 +1,13 @@
import React from 'react';
import { QueryClient } from 'react-query';
import { NotificationCenterContextType } from './NotificationCenterProvider';
import { useAuthConfig } from './auth/AuthConfigProvider';
import { useAuth } from './auth/AuthProvider';
import { ShellAlerts, ShellHooks } from './hooks/useShellHooks';
import './index.css';
import { useConfigRetriever, useConfig, useDiscoveredViews, useLinkOpener, BuildtimeWebFinger, RuntimeWebFinger } from './initFederation/ConfigurationProviders';
import { useShellConfig } from './initFederation/ShellConfigProvider';
import { useShellThemeSelector } from './initFederation/ShellThemeSelectorProvider';
import { useDeployedApps } from './initFederation/UIListProvider';
import { useLanguage } from './navbar/lang';
import AlertProvider from './alerts/AlertProvider';
import { getAlertingAlertSelectors, getAuthenticationAlertSelectors, getBootstrapAlertSelectors, getDashboardingAlertSelectors, getIngressControllerAlertSelectors, getK8SMasterAlertSelectors, getLoggingAlertSelectors, getMonitoringAlertSelectors, getNetworksAlertSelectors, getNodesAlertSelectors, getPlatformAlertSelectors, getServicesAlertSelectors, getVolumesAlertSelectors, useAlerts, useHighestSeverityAlerts } from './alerts';
import { useHistory } from 'react-router';
import { UseQueryResult } from 'react-query';
export declare const queryClient: QueryClient;
export type ShellTypes = {
shellHooks: {
useAuthConfig: typeof useAuthConfig;
useAuth: typeof useAuth;
useConfigRetriever: typeof useConfigRetriever;
useDiscoveredViews: typeof useDiscoveredViews;
useShellConfig: typeof useShellConfig;
useLanguage: typeof useLanguage;
useConfig: typeof useConfig;
useLinkOpener: typeof useLinkOpener;
useDeployedApps: typeof useDeployedApps;
useShellThemeSelector: typeof useShellThemeSelector;
};
shellAlerts: {
AlertsProvider: typeof AlertProvider;
hooks: {
useAlerts: typeof useAlerts;
useHighestSeverityAlerts: typeof useHighestSeverityAlerts;
};
alertSelectors: {
getPlatformAlertSelectors: typeof getPlatformAlertSelectors;
getNodesAlertSelectors: typeof getNodesAlertSelectors;
getVolumesAlertSelectors: typeof getVolumesAlertSelectors;
getNetworksAlertSelectors: typeof getNetworksAlertSelectors;
getServicesAlertSelectors: typeof getServicesAlertSelectors;
getK8SMasterAlertSelectors: typeof getK8SMasterAlertSelectors;
getBootstrapAlertSelectors: typeof getBootstrapAlertSelectors;
getMonitoringAlertSelectors: typeof getMonitoringAlertSelectors;
getAlertingAlertSelectors: typeof getAlertingAlertSelectors;
getLoggingAlertSelectors: typeof getLoggingAlertSelectors;
getDashboardingAlertSelectors: typeof getDashboardingAlertSelectors;
getIngressControllerAlertSelectors: typeof getIngressControllerAlertSelectors;
getAuthenticationAlertSelectors: typeof getAuthenticationAlertSelectors;
};
};
export type FederatedAppProps = {
shellHooks: ShellHooks;
shellAlerts: ShellAlerts;
};
declare global {
interface Window {
shellContexts: {
ShellHistoryContext: React.Context<ReturnType<typeof useHistory> | null>;
NotificationContext: React.Context<null | NotificationCenterContextType>;
WebFingersContext: React.Context<null | UseQueryResult<BuildtimeWebFinger | RuntimeWebFinger<Record<string, unknown>>, unknown>[]>;
};
shellHooks: ShellTypes['shellHooks'];
shellAlerts: ShellTypes['shellAlerts'];
}
}
export declare function WithInitFederationProviders({ children, }: {
children: React.ReactNode;
}): JSX.Element;
export default function App(): JSX.Element;
}): import("react/jsx-runtime").JSX.Element;
export default function App(): import("react/jsx-runtime").JSX.Element;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Dispatch } from 'react';
import { Dispatch, FC, ReactNode } from 'react';
export type Notification = {
id: string;
title: string;
Expand All @@ -14,7 +14,10 @@ export type NotificationCenterContextType = {
notifications: InternalNotification[];
dispatch: Dispatch<NotificationCenterActions>;
};
export declare const NotificationCenterContext: React.Context<NotificationCenterContextType>;
export declare const NotificationCenterContext: import("react").Context<NotificationCenterContextType>;
type NotificationCenterProviderProps = {
children: ReactNode;
};
export declare enum NotificationActionType {
PUBLISH = 0,
UNPUBLISH = 1,
Expand All @@ -29,7 +32,5 @@ export type NotificationCenterActions = {
} | {
type: NotificationActionType.READ_ALL;
};
declare const NotificationCenterProvider: ({ children }: {
children: any;
}) => JSX.Element;
declare const NotificationCenterProvider: FC<NotificationCenterProviderProps>;
export default NotificationCenterProvider;
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ export declare const useHighestSeverityAlerts: (filters: FilterLabels) => Alert[
*
* @returns react query result
*/
export declare function useAlerts(filters: FilterLabels): any;
export declare function useAlerts(filters?: FilterLabels): any;
45 changes: 45 additions & 0 deletions ui/@mf-types/shell/compiled-types/src/hooks/useShellHooks.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { useAlerts, getPlatformAlertSelectors, getNodesAlertSelectors, getVolumesAlertSelectors, getNetworksAlertSelectors, getServicesAlertSelectors, getK8SMasterAlertSelectors, getBootstrapAlertSelectors, getMonitoringAlertSelectors, getAlertingAlertSelectors, getLoggingAlertSelectors, getDashboardingAlertSelectors, getIngressControllerAlertSelectors, getAuthenticationAlertSelectors, useHighestSeverityAlerts } from '../alerts';
import AlertProvider from '../alerts/AlertProvider';
import { useAuthConfig } from '../auth/AuthConfigProvider';
import { useAuth } from '../auth/AuthProvider';
import { useConfig, useConfigRetriever, useDiscoveredViews, useLinkOpener } from '../initFederation/ConfigurationProviders';
import { useShellConfig } from '../initFederation/ShellConfigProvider';
import { useShellThemeSelector } from '../initFederation/ShellThemeSelectorProvider';
import { useDeployedApps } from '../initFederation/UIListProvider';
import { useLanguage } from '../navbar/lang';
export type ShellHooks = {
useAuthConfig: typeof useAuthConfig;
useAuth: typeof useAuth;
useConfigRetriever: typeof useConfigRetriever;
useDiscoveredViews: typeof useDiscoveredViews;
useShellConfig: typeof useShellConfig;
useLanguage: typeof useLanguage;
useConfig: typeof useConfig;
useLinkOpener: typeof useLinkOpener;
useDeployedApps: typeof useDeployedApps;
useShellThemeSelector: typeof useShellThemeSelector;
};
export type ShellAlerts = {
AlertsProvider: typeof AlertProvider;
alertHooks: {
useAlerts: typeof useAlerts;
useHighestSeverityAlerts: typeof useHighestSeverityAlerts;
};
alertSelectors: {
getPlatformAlertSelectors: typeof getPlatformAlertSelectors;
getNodesAlertSelectors: typeof getNodesAlertSelectors;
getVolumesAlertSelectors: typeof getVolumesAlertSelectors;
getNetworksAlertSelectors: typeof getNetworksAlertSelectors;
getServicesAlertSelectors: typeof getServicesAlertSelectors;
getK8SMasterAlertSelectors: typeof getK8SMasterAlertSelectors;
getBootstrapAlertSelectors: typeof getBootstrapAlertSelectors;
getMonitoringAlertSelectors: typeof getMonitoringAlertSelectors;
getAlertingAlertSelectors: typeof getAlertingAlertSelectors;
getLoggingAlertSelectors: typeof getLoggingAlertSelectors;
getDashboardingAlertSelectors: typeof getDashboardingAlertSelectors;
getIngressControllerAlertSelectors: typeof getIngressControllerAlertSelectors;
getAuthenticationAlertSelectors: typeof getAuthenticationAlertSelectors;
};
};
export declare const shellHooks: ShellHooks;
export declare const shellAlerts: ShellAlerts;
Loading

0 comments on commit dfd30e6

Please sign in to comment.