Skip to content

Commit

Permalink
use discoverview
Browse files Browse the repository at this point in the history
  • Loading branch information
hervedombya committed Nov 6, 2023
1 parent 5797f21 commit 7c98689
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/react/next-architecture/ui/ConfigProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export function useDiscoveredViews() {
return configGlobal.hooks.useDiscoveredViews();
}

export function useDeployedApps() {
return deployedInstancesGlobal.hooks.useDeployedApps();
}

export function useDeployedMetalk8sInstances(): SolutionUI[] {
return deployedInstancesGlobal.hooks.useDeployedApps({
kind: 'metalk8s-ui',
Expand Down
29 changes: 24 additions & 5 deletions src/react/ui-elements/Veeam/VeeamWelcomeModal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Icon, Modal, Stack, Text, Wrap } from '@scality/core-ui';
import { Button } from '@scality/core-ui/dist/next';
import { useState } from 'react';
import { useHistory } from 'react-router-dom';
import styled from 'styled-components';
import {
ConfigProvider,
useConfig,
useDeployedApps,
useLinkOpener,
} from '../../next-architecture/ui/ConfigProvider';
import { ArtescaLogo } from './ArtescaLogo';
import { VeeamLogo } from './VeeamLogo';
Expand All @@ -16,13 +17,31 @@ const CustomModal = styled(Modal)`

export const VeeamWelcomeModalInternal = () => {
const [isOpen, setIsOpen] = useState<boolean>(true);
const history = useHistory();

const { features, basePath } = useConfig();
const { features } = useConfig();
if (!features.includes('Veeam')) {
return <></>;
}

const { openLink } = useLinkOpener();
const deployedApps = useDeployedApps();
const zenkoUI = deployedApps.find(
(app: { kind: string }) => app.kind === 'zenko-ui',
);
const zenkoUIVeeamConfigurationView = {
path: '/veeam/configuration',
label: {
en: 'Veeam Configuration',
fr: 'Configuration Veeam',
},
module: './FederableApp',
scope: 'zenko',
};
const veeamConfigurationView = {
view: zenkoUIVeeamConfigurationView,
app: zenkoUI,
isFederated: true,
};

return (
<CustomModal
isOpen={isOpen}
Expand All @@ -48,7 +67,7 @@ export const VeeamWelcomeModalInternal = () => {
label={'Continue'}
onClick={() => {
setIsOpen(false);
history.push(`${basePath}/veeam/configuration`);
openLink(veeamConfigurationView);
}}
/>
</Stack>
Expand Down

0 comments on commit 7c98689

Please sign in to comment.