Skip to content

Commit

Permalink
Merge pull request #2867 from Hyperkid123/disable-ocp-ins-va
Browse files Browse the repository at this point in the history
Hide OpenShift VA behind a feature flag.
  • Loading branch information
Hyperkid123 authored Jun 18, 2024
2 parents 24026e7 + 6891edb commit 45d02dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/components/RootApp/ScalprumRoot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jest.mock('@unleash/proxy-client-react', () => {
...unleash,
useFlag: () => false,
useFlagsStatus: () => ({ flagsReady: true }),
useFlags: () => [],
};
});

Expand Down
20 changes: 11 additions & 9 deletions src/components/Routes/VirtualAssistant.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import React, { Fragment } from 'react';
import { Route, Routes } from 'react-router-dom';
import { ScalprumComponent } from '@scalprum/react-core';
import { useFlags } from '@unleash/proxy-client-react';

import './virtual-assistant.scss';

const viableRoutes = [
'/',
'/insights/*',
'/settings/*',
'/subscriptions/overview/*',
'/subscriptions/inventory/*',
'/subscriptions/usage/*',
'/openshift/insights/*',
];
const flaggedRoutes: { [flagName: string]: string } = { 'platform.va.openshift.insights': '/openshift/insights/*' };

const VirtualAssistant = () => {
const viableRoutes = ['/', '/insights/*', '/settings/*', '/subscriptions/overview/*', '/subscriptions/inventory/*', '/subscriptions/usage/*'];

const allFlags = useFlags();
allFlags.forEach((flag) => {
if (flaggedRoutes[flag.name] && flag.enabled) {
viableRoutes.push(flaggedRoutes[flag.name]);
}
});

return (
<Routes>
{viableRoutes.map((route) => (
Expand Down

0 comments on commit 45d02dc

Please sign in to comment.