Skip to content

Commit

Permalink
Add Dynamic Plugins nav item
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamilto committed Nov 21, 2024
1 parent c444b63 commit 16c6473
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
17 changes: 17 additions & 0 deletions frontend/packages/console-app/console-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2018,5 +2018,22 @@
"component": { "$codeRef": "consolePluginProxyDetail" },
"sortWeight": 5
}
},
{
"type": "console.flag/hookProvider",
"properties": {
"handler": { "$codeRef": "getConsoleOperatorConfigFlag" }
}
},
{
"type": "console.navigation/href",
"properties": {
"perspective": "admin",
"section": "administration",
"id": "consoleplugins",
"name": "%console-app~Dynamic Plugins%",
"href": "/k8s/cluster/operator.openshift.io~v1~Console/cluster/console-plugins"
},
"flags": { "required": ["CAN_GET_CONSOLE_OPERATOR_CONFIG"] }
}
]
3 changes: 2 additions & 1 deletion frontend/packages/console-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"consolePluginEnabledStatusDetail": "src/components/console-operator/ConsolePluginEnabledStatusDetail",
"consolePluginCSPStatusDetail": "src/components/console-operator/ConsolePluginCSPStatusDetail",
"consolePluginBackendDetail": "src/components/console-operator/ConsolePluginBackendDetail",
"consolePluginProxyDetail": "src/components/console-operator/ConsolePluginProxyDetail"
"consolePluginProxyDetail": "src/components/console-operator/ConsolePluginProxyDetail",
"getConsoleOperatorConfigFlag": "src/hooks/useCanGetConsoleOperatorConfig"
}
}
}
1 change: 1 addition & 0 deletions frontend/packages/console-app/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export const HIDE_USER_WORKLOAD_NOTIFICATIONS_USER_SETTINGS_KEY =
export const FLAG_DEVELOPER_PERSPECTIVE = 'DEVELOPER_PERSPECTIVE';
export const ACM_PERSPECTIVE_ID = 'acm';
export const ADMIN_PERSPECTIVE_ID = 'admin';
export const FLAG_CAN_GET_CONSOLE_OPERATOR_CONFIG = 'CAN_GET_CONSOLE_OPERATOR_CONFIG';
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { SetFeatureFlag, useAccessReview } from '@console/dynamic-plugin-sdk';
import { ConsoleOperatorConfigModel } from '@console/internal/models';
import { CONSOLE_OPERATOR_CONFIG_NAME } from '@console/shared/src';
import { FLAG_CAN_GET_CONSOLE_OPERATOR_CONFIG } from '../consts';

const useCanGetConsoleOperatorConfig = (setFeatureFlag: SetFeatureFlag) => {
const canGetConsoleOperatorConfig = useAccessReview({
group: ConsoleOperatorConfigModel.apiGroup,
resource: ConsoleOperatorConfigModel.plural,
verb: 'get',
name: CONSOLE_OPERATOR_CONFIG_NAME,
});

setFeatureFlag(FLAG_CAN_GET_CONSOLE_OPERATOR_CONFIG, canGetConsoleOperatorConfig[0]);
};

export default useCanGetConsoleOperatorConfig;

0 comments on commit 16c6473

Please sign in to comment.