diff --git a/frontend/packages/metal3-plugin/console-extensions.json b/frontend/packages/metal3-plugin/console-extensions.json index 19f94e632aa..c75fe51c314 100644 --- a/frontend/packages/metal3-plugin/console-extensions.json +++ b/frontend/packages/metal3-plugin/console-extensions.json @@ -1,10 +1,110 @@ [ + { + "type": "console.flag/model", + "properties": { + "model": { + "group": "metal3.io", + "version": "v1alpha1", + "kind": "BareMetalHost" + }, + "flag": "METAL3" + } + }, + { + "type": "console.flag/model", + "properties": { + "model": { + "group": "nodemaintenance.medik8s.io", + "version": "v1beta1", + "kind": "NodeMaintenance" + }, + "flag": "NODE_MAINTENANCE" + } + }, + { + "type": "console.flag/model", + "properties": { + "model": { + "group": "nodemaintenance.kubevirt.io", + "version": "v1beta1", + "kind": "NodeMaintenance" + }, + "flag": "NODE_MAINTENANCE_KV_BETA" + } + }, + { + "type": "console.flag/model", + "properties": { + "model": { + "group": "kubevirt.io", + "version": "v1alpha1", + "kind": "NodeMaintenance" + }, + "flag": "NODE_MAINTENANCE_KV_ALPHA" + } + }, { "type": "console.flag/hookProvider", "properties": { "handler": { "$codeRef": "features.useDetectNodeMaintenance" } } }, + { + "type": "console.model-metadata", + "properties": { + "model": { + "group": "metal3.io", + "version": "v1alpha1", + "kind": "BareMetalHost" + }, + "label": "%metal3-plugin~Bare Metal Host%", + "labelPlural": "%metal3-plugin~Bare Metal Hosts%", + "abbr": "BMH", + "color": "#2b9af3" + } + }, + { + "type": "console.model-metadata", + "properties": { + "model": { + "group": "nodemaintenance.medik8s.io", + "version": "v1beta1", + "kind": "NodeMaintenance" + }, + "label": "%metal3-plugin~Node Maintenance%", + "labelPlural": "%metal3-plugin~Node Maintenances%", + "abbr": "NM", + "color": "#2b9af3" + } + }, + { + "type": "console.model-metadata", + "properties": { + "model": { + "group": "kubevirt.io", + "version": "v1alpha1", + "kind": "NodeMaintenance" + }, + "label": "%metal3-plugin~Node Maintenance%", + "labelPlural": "%metal3-plugin~Node Maintenances%", + "abbr": "NM", + "color": "#2b9af3" + } + }, + { + "type": "console.model-metadata", + "properties": { + "model": { + "group": "nodemaintenance.kubevirt.io", + "version": "v1beta1", + "kind": "NodeMaintenance" + }, + "label": "%metal3-plugin~Node Maintenance%", + "labelPlural": "%metal3-plugin~Node Maintenances%", + "abbr": "NM", + "color": "#2b9af3" + } + }, { "type": "console.navigation/resource-ns", "properties": { @@ -36,5 +136,47 @@ "flags": { "required": ["NODE_MAINTENANCE_ENABLED"] } + }, + { + "type": "console.page/resource/list", + "properties": { + "model": { + "group": "metal3.io", + "version": "v1alpha1", + "kind": "BareMetalHost" + }, + "component": { "$codeRef": "baremetalHostsPage" } + }, + "flags": { + "required": ["BAREMETAL"] + } + }, + { + "type": "console.page/resource/details", + "properties": { + "model": { + "group": "metal3.io", + "version": "v1alpha1", + "kind": "BareMetalHost" + }, + "component": { "$codeRef": "baremetalHostsDetailsPage" } + }, + "flags": { + "required": ["BAREMETAL"] + } + }, + { + "type": "console.page/route", + "properties": { + "exact": true, + "path": [ + "/k8s/ns/:ns/metal3.io~v1alpha1~BareMetalHost/~new/form", + "/k8s/ns/:ns/metal3.io~v1alpha1~BareMetalHost/:name/edit" + ], + "component": { "$codeRef": "addBareMetalHostPage" } + }, + "flags": { + "required": ["BAREMETAL", "METAL3"] + } } ] diff --git a/frontend/packages/metal3-plugin/locales/en/metal3-plugin.json b/frontend/packages/metal3-plugin/locales/en/metal3-plugin.json index f21017770a2..97b73170646 100644 --- a/frontend/packages/metal3-plugin/locales/en/metal3-plugin.json +++ b/frontend/packages/metal3-plugin/locales/en/metal3-plugin.json @@ -1,5 +1,8 @@ { + "Bare Metal Host": "Bare Metal Host", "Bare Metal Hosts": "Bare Metal Hosts", + "Node Maintenance": "Node Maintenance", + "Node Maintenances": "Node Maintenances", "resources": "resources", "Name \"${value}\" is already taken.": "Name \"${value}\" is already taken.", "Value provided is not a valid BMC address": "Value provided is not a valid BMC address", diff --git a/frontend/packages/metal3-plugin/package.json b/frontend/packages/metal3-plugin/package.json index 6c6dfcaa624..915d7980b07 100644 --- a/frontend/packages/metal3-plugin/package.json +++ b/frontend/packages/metal3-plugin/package.json @@ -13,7 +13,10 @@ "entry": "src/plugin.tsx", "exposedModules": { "nodeActions": "src/components/maintenance/actions.tsx", - "features": "src/features.ts" + "features": "src/features.ts", + "baremetalHostsDetailsPage": "src/components/baremetal-hosts/BareMetalHostDetailsPage.tsx", + "baremetalHostsPage": "src/components/baremetal-hosts/BareMetalHostsPage.tsx", + "addBareMetalHostPage": "src/components/baremetal-hosts/add-baremetal-host/AddBareMetalHostPage.tsx" } } } diff --git a/frontend/packages/metal3-plugin/src/components/baremetal-hosts/add-baremetal-host/AddBareMetalHostPage.tsx b/frontend/packages/metal3-plugin/src/components/baremetal-hosts/add-baremetal-host/AddBareMetalHostPage.tsx index d1b0c2da414..34be618d928 100644 --- a/frontend/packages/metal3-plugin/src/components/baremetal-hosts/add-baremetal-host/AddBareMetalHostPage.tsx +++ b/frontend/packages/metal3-plugin/src/components/baremetal-hosts/add-baremetal-host/AddBareMetalHostPage.tsx @@ -6,7 +6,7 @@ import { PageHeading } from '@console/shared/src/components/heading/PageHeading' import PaneBody from '@console/shared/src/components/layout/PaneBody'; import AddBareMetalHost from './AddBareMetalHost'; -const AddBareMetalHostPage: React.FunctionComponent = () => { +const AddBareMetalHostPage: React.FC = () => { const { t } = useTranslation(); const location = useLocation(); const { name, ns: namespace } = useParams(); diff --git a/frontend/packages/metal3-plugin/src/plugin.tsx b/frontend/packages/metal3-plugin/src/plugin.tsx index 8885365e49d..851885eef94 100644 --- a/frontend/packages/metal3-plugin/src/plugin.tsx +++ b/frontend/packages/metal3-plugin/src/plugin.tsx @@ -51,45 +51,6 @@ type ConsumedExtensions = const METAL3_FLAG = 'METAL3'; const plugin: Plugin = [ - { - type: 'ModelDefinition', - properties: { - models: [ - BareMetalHostModel, - NodeMaintenanceModel, - NodeMaintenanceKubevirtAlphaModel, - NodeMaintenanceKubevirtBetaModel, - ], - }, - }, - { - type: 'FeatureFlag/Model', - properties: { - model: BareMetalHostModel, - flag: METAL3_FLAG, - }, - }, - { - type: 'FeatureFlag/Model', - properties: { - model: NodeMaintenanceModel, - flag: NODE_MAINTENANCE_FLAG, - }, - }, - { - type: 'FeatureFlag/Model', - properties: { - model: NodeMaintenanceKubevirtBetaModel, - flag: NODE_MAINTENANCE_KV_BETA_FLAG, - }, - }, - { - type: 'FeatureFlag/Model', - properties: { - model: NodeMaintenanceKubevirtAlphaModel, - flag: NODE_MAINTENANCE_KV_ALPHA_FLAG, - }, - }, { type: 'FeatureFlag/Custom', properties: { @@ -102,54 +63,6 @@ const plugin: Plugin = [ detect: detectBMOEnabled, }, }, - { - type: 'Page/Resource/List', - properties: { - model: BareMetalHostModel, - loader: () => - import( - './components/baremetal-hosts/BareMetalHostsPage' /* webpackChunkName: "metal3-baremetalhost" */ - ).then((m) => m.default), - }, - }, - { - type: 'Page/Resource/Details', - properties: { - model: BareMetalHostModel, - loader: () => - import( - './components/baremetal-hosts/BareMetalHostDetailsPage' /* webpackChunkName: "metal3-baremetalhost" */ - ).then((m) => m.default), - }, - }, - { - type: 'Page/Route', - properties: { - exact: true, - path: `/k8s/ns/:ns/${referenceForModel(BareMetalHostModel)}/~new/form`, - loader: () => - import( - './components/baremetal-hosts/add-baremetal-host/AddBareMetalHostPage' /* webpackChunkName: "metal3-baremetalhost" */ - ).then((m) => m.default), - }, - flags: { - required: [BAREMETAL_FLAG, METAL3_FLAG], - }, - }, - { - type: 'Page/Route', - properties: { - exact: true, - path: `/k8s/ns/:ns/${referenceForModel(BareMetalHostModel)}/:name/edit`, - loader: () => - import( - './components/baremetal-hosts/add-baremetal-host/AddBareMetalHostPage' /* webpackChunkName: "metal3-baremetalhost" */ - ).then((m) => m.default), - }, - flags: { - required: [BAREMETAL_FLAG, METAL3_FLAG], - }, - }, { type: 'Dashboards/Overview/Inventory/Item/Replacement', properties: {