Skip to content

Commit

Permalink
Add Console Plugins nav item
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamilto committed Nov 20, 2024
1 parent c444b63 commit 1ec05ea
Show file tree
Hide file tree
Showing 5 changed files with 38 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~Console Plugins%",
"href": "/k8s/cluster/operator.openshift.io~v1~Console/cluster/console-plugins"
},
"flags": { "required": ["FLAG_CAN_GET_CONSOLE_OPERATOR_CONFIG"] }
}
]
1 change: 1 addition & 0 deletions frontend/packages/console-app/locales/en/console-app.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
"Whether or not the plugin might have violated the Console Content Security Policy.": "Whether or not the plugin might have violated the Console Content Security Policy.",
"Backend Service": "Backend Service",
"Proxy Services": "Proxy Services",
"Console Plugins": "Console Plugins",
"Delete {{kind}}": "Delete {{kind}}",
"Edit {{kind}}": "Edit {{kind}}",
"Edit labels": "Edit labels",
Expand Down
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 = 'FLAG_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 1ec05ea

Please sign in to comment.