diff --git a/.gitignore b/.gitignore index 244b9b05..027ba14c 100644 --- a/.gitignore +++ b/.gitignore @@ -108,4 +108,5 @@ cypress/screenshots ## Helm gitignore -tmp/ \ No newline at end of file +tmp/ +.DS_Store \ No newline at end of file diff --git a/plugin-manifest.ts b/plugin-manifest.ts index 079dd70b..0e7824ed 100644 --- a/plugin-manifest.ts +++ b/plugin-manifest.ts @@ -1,10 +1,11 @@ import type { EncodedExtension } from '@openshift/dynamic-plugin-sdk'; -import type { ConsolePluginMetadata } from '@openshift-console/dynamic-plugin-sdk-webpack/lib/schema/plugin-package'; +import { FeatureFlag } from '@openshift-console/dynamic-plugin-sdk'; +import type { ConsolePluginBuildMetadata } from '@openshift-console/dynamic-plugin-sdk-webpack'; import { PolicyExposedModules, PolicyExtensions } from './src/views/policies/manifest'; import { StateExposedModules, StateExtensions } from './src/views/states/manifest'; -export const pluginMetadata = { +export const pluginMetadata: ConsolePluginBuildMetadata = { name: 'nmstate-console-plugin', version: '0.0.1', displayName: 'OpenShift Console Plugin For NMState', @@ -13,10 +14,20 @@ export const pluginMetadata = { exposedModules: { ...PolicyExposedModules, ...StateExposedModules, + nmstateFlags: './utils/flags', }, dependencies: { '@console/pluginAPI': '*', }, -} as ConsolePluginMetadata; +}; -export const extensions: EncodedExtension[] = [...PolicyExtensions, ...StateExtensions]; +export const extensions: EncodedExtension[] = [ + { + properties: { + handler: { $codeRef: 'nmstateFlags.enableNMStateDynamicFlag' }, + }, + type: 'console.flag', + } as EncodedExtension, + ...PolicyExtensions, + ...StateExtensions, +]; diff --git a/src/utils/flags/consts.ts b/src/utils/flags/consts.ts new file mode 100644 index 00000000..0c817671 --- /dev/null +++ b/src/utils/flags/consts.ts @@ -0,0 +1 @@ +export const FLAG_NMSTATE_DYNAMIC = 'NMSTATE_DYNAMIC'; diff --git a/src/utils/flags/enableNMStateDynamicFlag.ts b/src/utils/flags/enableNMStateDynamicFlag.ts new file mode 100644 index 00000000..65a6399d --- /dev/null +++ b/src/utils/flags/enableNMStateDynamicFlag.ts @@ -0,0 +1,6 @@ +import { SetFeatureFlag } from '@openshift-console/dynamic-plugin-sdk'; + +import { FLAG_NMSTATE_DYNAMIC } from './consts'; + +export const enableNMStateDynamicFlag = (setFeatureFlag: SetFeatureFlag) => + setFeatureFlag(FLAG_NMSTATE_DYNAMIC, true); diff --git a/src/utils/flags/index.ts b/src/utils/flags/index.ts new file mode 100644 index 00000000..1740344b --- /dev/null +++ b/src/utils/flags/index.ts @@ -0,0 +1 @@ +export { enableNMStateDynamicFlag } from './enableNMStateDynamicFlag';