Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion web/src/components/health/network-health.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AlertStates, Rule } from '@openshift-console/dynamic-plugin-sdk';
import { AlertStates, FeatureFlagHandler, Rule, SetFeatureFlag } from '@openshift-console/dynamic-plugin-sdk';
import { Button, Flex, FlexItem, PageSection, Tab, Tabs, TextVariants, Title } from '@patternfly/react-core';
import { SyncAltIcon } from '@patternfly/react-icons';
import * as _ from 'lodash';
Expand All @@ -18,6 +18,7 @@ import { HealthGlobal } from './health-global';
import { buildStats, isSilenced } from './health-helper';
import { HealthSummary } from './health-summary';
import { HealthTabTitle } from './tab-title';
import { loadConfig } from '../../utils/config';

import './health.css';

Expand Down Expand Up @@ -175,5 +176,14 @@ export const NetworkHealth: React.FC<{}> = ({}) => {
);
};

export const featureFlagHandler: FeatureFlagHandler = (setFeatureFlag: SetFeatureFlag) => {
loadConfig().then(({ config }) => {
if (config) {
const enabled = config.features.includes('experimentalAlertsHealth');
setFeatureFlag('NETOBSERV_NETWORK_HEALTH', enabled);
}
});
};

NetworkHealth.displayName = 'NetworkHealth';
export default NetworkHealth;
3 changes: 2 additions & 1 deletion web/src/model/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export type Feature =
| 'udnMapping'
| 'packetTranslation'
| 'networkEvents'
| 'ipsec';
| 'ipsec'
| 'experimentalAlertsHealth';

export type Config = {
buildVersion: string;
Expand Down
12 changes: 10 additions & 2 deletions web/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ module.exports = {
},
},
extensions: [
{
"type": "console.flag",
"properties": {
"handler": { "$codeRef": "networkHealth.featureFlagHandler" }
}
},
{
type: "console.navigation/href",
properties: {
Expand All @@ -108,7 +114,8 @@ module.exports = {
"section": "observe",
name: "%plugin__netobserv-plugin~Network Health%",
"href": "/network-health"
}
},
"flags": { "required": ["NETOBSERV_NETWORK_HEALTH"] }
},
{
type: "console.navigation/href",
Expand Down Expand Up @@ -147,7 +154,8 @@ module.exports = {
component: {
"$codeRef": "networkHealth.default"
}
}
},
"flags": { "required": ["NETOBSERV_NETWORK_HEALTH"] }
},
{
type: "console.tab/horizontalNav",
Expand Down
Loading