From 88f74e1c8fdde92d1a789766a595c85ed2451402 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Date: Tue, 21 Jul 2026 17:35:46 -0400 Subject: [PATCH] CONSOLE-5400: Make Node management enhancements flagged by OpenShift 5 --- .../console/nodes/node-groups-filter.spec.ts | 8 ++-- .../console-app/console-extensions.json | 39 ------------------- .../console-app/locales/en/console-app.json | 3 -- .../console-app/locales/es/console-app.json | 3 -- .../console-app/locales/fr/console-app.json | 3 -- .../console-app/locales/ja/console-app.json | 3 -- .../console-app/locales/ko/console-app.json | 3 -- .../console-app/locales/zh/console-app.json | 3 -- frontend/packages/console-app/package.json | 1 - .../src/components/nodes/NodeDetailsPage.tsx | 8 ++-- .../components/nodes/NodeGroupEditButton.tsx | 6 +-- .../src/components/nodes/NodeLogs.tsx | 6 +-- .../src/components/nodes/NodesPage.tsx | 22 +++++------ .../nodes/__tests__/NodeDetailsPage.spec.tsx | 8 ++-- .../nodes/__tests__/NodeLogs.spec.tsx | 4 +- .../nodes/node-dashboard/DetailsCard.tsx | 6 +-- .../nodes/node-dashboard/InventoryCard.tsx | 6 +-- .../nodes/node-dashboard/NodeDashboard.tsx | 6 +-- .../__tests__/InventoryCard.spec.tsx | 4 +- .../__tests__/NodeDashboard.spec.tsx | 4 +- frontend/packages/console-app/src/consts.ts | 5 --- .../src/hooks/useNodeMgmtV1FlagProvider.ts | 27 ------------- 22 files changed, 44 insertions(+), 134 deletions(-) delete mode 100644 frontend/packages/console-app/src/hooks/useNodeMgmtV1FlagProvider.ts diff --git a/frontend/e2e/tests/console/nodes/node-groups-filter.spec.ts b/frontend/e2e/tests/console/nodes/node-groups-filter.spec.ts index 4029f30fdaf..a4ea5a84407 100644 --- a/frontend/e2e/tests/console/nodes/node-groups-filter.spec.ts +++ b/frontend/e2e/tests/console/nodes/node-groups-filter.spec.ts @@ -32,14 +32,14 @@ function filterChips(page: Page) { async function skipIfGroupsFilterDisabled(page: Page): Promise { if (!(await groupsFilter(page).isVisible().catch(() => false))) { - test.skip(true, 'FLAG_NODE_MGMT_V1 is not enabled'); + test.skip(true, 'FLAG_OPENSHIFT_5 is not enabled'); } } async function skipIfEditGroupsButtonHidden(page: Page): Promise { const editButton = page.getByRole('button', { name: /edit groups/i }); if (!(await editButton.isVisible().catch(() => false))) { - test.skip(true, 'FLAG_NODE_MGMT_V1 is not enabled'); + test.skip(true, 'FLAG_OPENSHIFT_5 is not enabled'); } } @@ -48,7 +48,7 @@ test.describe('Node Groups Filter', () => { await gotoNodesPage(page); }); - test('should display the Groups filter when FLAG_NODE_MGMT_V1 is enabled', async ({ page }) => { + test('should display the Groups filter when FLAG_OPENSHIFT_5 is enabled', async ({ page }) => { await skipIfGroupsFilterDisabled(page); const groupsFilterButton = groupsFilter(page); @@ -225,7 +225,7 @@ test.describe('Edit Groups Button', () => { await gotoNodesPage(page); }); - test('should display Edit groups button in page header when FLAG_NODE_MGMT_V1 is enabled', async ({ page }) => { + test('should display Edit groups button in page header when FLAG_OPENSHIFT_5 is enabled', async ({ page }) => { await skipIfEditGroupsButtonHidden(page); const editButton = page.getByRole('button', { name: /edit groups/i }); diff --git a/frontend/packages/console-app/console-extensions.json b/frontend/packages/console-app/console-extensions.json index c5e7e329639..d12d7b94292 100644 --- a/frontend/packages/console-app/console-extensions.json +++ b/frontend/packages/console-app/console-extensions.json @@ -696,15 +696,6 @@ "handler": { "$codeRef": "usePerspectivesAvailable.usePerspectivesAvailable" } } }, - { - "type": "console.flag/hookProvider", - "properties": { - "handler": { "$codeRef": "useNodeMgmtV1FlagProvider" } - }, - "flags": { - "required": ["TECH_PREVIEW"] - } - }, { "type": "console.user-preference/group", "properties": { @@ -733,36 +724,6 @@ "label": "%console-app~Applications%" } }, - { - "type": "console.user-preference/group", - "properties": { - "id": "node-mgmt-v1", - "label": "%console-app~Node management%" - }, - "flags": { - "required": ["TECH_PREVIEW"] - } - }, - { - "type": "console.user-preference/item", - "properties": { - "id": "console.nodeMgmtV1.enabled", - "label": "%console-app~Node management%", - "groupId": "node-mgmt-v1", - "description": "%console-app~Enable node management enhancements. This is a technology preview feature.%", - "field": { - "type": "checkbox", - "userSettingsKey": "console.nodeMgmtV1.enabled", - "label": "%console-app~Enable node management enhancements%", - "trueValue": true, - "falseValue": false, - "defaultValue": true - } - }, - "flags": { - "required": ["TECH_PREVIEW"] - } - }, { "type": "console.user-preference/item", "properties": { diff --git a/frontend/packages/console-app/locales/en/console-app.json b/frontend/packages/console-app/locales/en/console-app.json index 0a5e5e20094..dffe3b3527c 100644 --- a/frontend/packages/console-app/locales/en/console-app.json +++ b/frontend/packages/console-app/locales/en/console-app.json @@ -247,8 +247,6 @@ "Edit YAML": "Edit YAML", "Enable exact string match": "Enable exact string match", "Enable exact string match filtering on resources.": "Enable exact string match filtering on resources.", - "Enable node management enhancements": "Enable node management enhancements", - "Enable node management enhancements. This is a technology preview feature.": "Enable node management enhancements. This is a technology preview feature.", "Enabled": "Enabled", "Encrypted": "Encrypted", "Enhances contrast between interface elements for readability.": "Enhances contrast between interface elements for readability.", @@ -490,7 +488,6 @@ "Node addresses": "Node addresses", "Node conditions": "Node conditions", "Node details": "Node details", - "Node management": "Node management", "Node name": "Node name", "Node remediation agents": "Node remediation agents", "Node role {{role}}": "Node role {{role}}", diff --git a/frontend/packages/console-app/locales/es/console-app.json b/frontend/packages/console-app/locales/es/console-app.json index 016c3eba94b..fd6d1c06d13 100644 --- a/frontend/packages/console-app/locales/es/console-app.json +++ b/frontend/packages/console-app/locales/es/console-app.json @@ -14,9 +14,6 @@ "Language": "Idioma", "Notifications": "Notificaciones", "Applications": "Aplicaciones", - "Node management": "Gestión de nodos", - "Enable node management enhancements. This is a technology preview feature.": "Habilitar mejoras en la administración de nodos. Esta es una función en fase de vista previa tecnológica.", - "Enable node management enhancements": "Habilitar mejoras en la gestión de nodos", "Theme": "Tema", "Console will appear as per the selected theme.": "La consola aparecerá según el tema seleccionado.", "System default": "Sistema por defecto", diff --git a/frontend/packages/console-app/locales/fr/console-app.json b/frontend/packages/console-app/locales/fr/console-app.json index 3cdd7b55133..bc941ba087d 100644 --- a/frontend/packages/console-app/locales/fr/console-app.json +++ b/frontend/packages/console-app/locales/fr/console-app.json @@ -14,9 +14,6 @@ "Language": "Langue", "Notifications": "Notifications", "Applications": "Applications", - "Node management": "Gestion des nœuds", - "Enable node management enhancements. This is a technology preview feature.": "Activer les améliorations de la gestion des nœuds. Il s'agit d'une fonctionnalité en avant-première.", - "Enable node management enhancements": "Activer les améliorations de la gestion des nœuds", "Theme": "Thème", "Console will appear as per the selected theme.": "L’apparence de la console dépendra du thème sélectionné.", "System default": "Valeur par défaut du système", diff --git a/frontend/packages/console-app/locales/ja/console-app.json b/frontend/packages/console-app/locales/ja/console-app.json index 156150b0f0a..fa3f052ee9a 100644 --- a/frontend/packages/console-app/locales/ja/console-app.json +++ b/frontend/packages/console-app/locales/ja/console-app.json @@ -14,9 +14,6 @@ "Language": "言語", "Notifications": "通知", "Applications": "アプリケーション", - "Node management": "ノード管理", - "Enable node management enhancements. This is a technology preview feature.": "ノード管理の機能拡張を有効にします。これはテクノロジープレビュー機能です。", - "Enable node management enhancements": "ノード管理の機能拡張を有効にする", "Theme": "テーマ", "Console will appear as per the selected theme.": "選択したテーマに従ってコンソールが表示されます。", "System default": "システムのデフォルト", diff --git a/frontend/packages/console-app/locales/ko/console-app.json b/frontend/packages/console-app/locales/ko/console-app.json index 448ba637420..8632e95cfd2 100644 --- a/frontend/packages/console-app/locales/ko/console-app.json +++ b/frontend/packages/console-app/locales/ko/console-app.json @@ -14,9 +14,6 @@ "Language": "언어", "Notifications": "알림", "Applications": "애플리케이션", - "Node management": "노드 관리", - "Enable node management enhancements. This is a technology preview feature.": "노드 관리 기능을 활성화합니다. 이 기능은 기술 프리뷰 기능입니다.", - "Enable node management enhancements": "노드 관리 개선 사항 활성화", "Theme": "테마", "Console will appear as per the selected theme.": "선택한 테마에 따라 콘솔이 나타납니다.", "System default": "시스템 기본값", diff --git a/frontend/packages/console-app/locales/zh/console-app.json b/frontend/packages/console-app/locales/zh/console-app.json index 6d3bea95f3e..3778df387c5 100644 --- a/frontend/packages/console-app/locales/zh/console-app.json +++ b/frontend/packages/console-app/locales/zh/console-app.json @@ -14,9 +14,6 @@ "Language": "语言", "Notifications": "通知", "Applications": "应用程序", - "Node management": "节点管理", - "Enable node management enhancements. This is a technology preview feature.": "启用节点管理增强功能。这是一个技术预览功能。", - "Enable node management enhancements": "启用节点管理增强", "Theme": "主题", "Console will appear as per the selected theme.": "控制台将根据所选主题显示。", "System default": "系统默认", diff --git a/frontend/packages/console-app/package.json b/frontend/packages/console-app/package.json index b94057e1b9c..a3ccf5445ab 100644 --- a/frontend/packages/console-app/package.json +++ b/frontend/packages/console-app/package.json @@ -80,7 +80,6 @@ "getConsoleOperatorConfigFlag": "src/hooks/useCanGetConsoleOperatorConfig.ts", "techPreviewFlag": "src/features/tech-preview.ts", "usePerspectivesAvailable": "src/components/user-preferences/perspective/usePerspectivesAvailable.ts", - "useNodeMgmtV1FlagProvider": "src/hooks/useNodeMgmtV1FlagProvider.ts", "defaultProvider": "src/actions/providers/default-provider.ts", "OperatorStatus": "src/components/dashboards-page/OperatorStatus.tsx", "dashboardsActivity": "src/components/dashboards-page/activity.ts", diff --git a/frontend/packages/console-app/src/components/nodes/NodeDetailsPage.tsx b/frontend/packages/console-app/src/components/nodes/NodeDetailsPage.tsx index 88070ec7ca7..62d450f96de 100644 --- a/frontend/packages/console-app/src/components/nodes/NodeDetailsPage.tsx +++ b/frontend/packages/console-app/src/components/nodes/NodeDetailsPage.tsx @@ -1,6 +1,6 @@ import type { FC, ComponentProps } from 'react'; import { useCallback } from 'react'; -import { FLAG_NODE_MGMT_V1 } from '@console/app/src/consts'; +import { FLAG_OPENSHIFT_5 } from '@console/app/src/consts'; import { ResourceEventStream } from '@console/internal/components/events'; import { DetailsPage } from '@console/internal/components/factory'; import { PodsPage } from '@console/internal/components/pod-list'; @@ -72,11 +72,11 @@ const eventsTab = navFactory.events(ResourceEventStream); const terminalTab = navFactory.terminal(NodeTerminal); export const NodeDetailsPage: FC> = (props) => { - const nodeMgmtV1Enabled = useFlag(FLAG_NODE_MGMT_V1); + const isOpenShift5 = useFlag(FLAG_OPENSHIFT_5); const pagesFor = useCallback( (node: NodeKind) => { - const tabs = nodeMgmtV1Enabled + const tabs = isOpenShift5 ? [overviewTab, detailsTab, configurationTab, healthTab, workloadTab, yamlTab] : [overviewTab, detailsTab, yamlTab, podsTab, logsTab, eventsTab]; if (!isWindowsNode(node)) { @@ -84,7 +84,7 @@ export const NodeDetailsPage: FC> = (props) = } return tabs; }, - [nodeMgmtV1Enabled], + [isOpenShift5], ); const customActionMenu = (kindObj: K8sModel, obj: NodeKind) => { diff --git a/frontend/packages/console-app/src/components/nodes/NodeGroupEditButton.tsx b/frontend/packages/console-app/src/components/nodes/NodeGroupEditButton.tsx index 3d7a983de2d..361d5bf8561 100644 --- a/frontend/packages/console-app/src/components/nodes/NodeGroupEditButton.tsx +++ b/frontend/packages/console-app/src/components/nodes/NodeGroupEditButton.tsx @@ -3,7 +3,7 @@ import { Button, ButtonVariant, Tooltip } from '@patternfly/react-core'; import { useTranslation } from 'react-i18next'; import GroupsEditorModal from '@console/app/src/components/nodes/modals/GroupsEditorModal'; import NodeGroupsEditorModal from '@console/app/src/components/nodes/modals/NodeGroupsEditorModal'; -import { FLAG_NODE_MGMT_V1 } from '@console/app/src/consts'; +import { FLAG_OPENSHIFT_5 } from '@console/app/src/consts'; import { useAccessReview } from '@console/dynamic-plugin-sdk/src'; import { useOverlay } from '@console/dynamic-plugin-sdk/src/app/modal-support/useOverlay'; import { useFlag } from '@console/dynamic-plugin-sdk/src/utils/flags'; @@ -17,7 +17,7 @@ type NodeGroupEditButtonProps = { const NodeGroupEditButton: FC = ({ node }) => { const { t } = useTranslation('console-app'); const launchOverlay = useOverlay(); - const nodeMgmtV1Enabled = useFlag(FLAG_NODE_MGMT_V1); + const isOpenShift5 = useFlag(FLAG_OPENSHIFT_5); const [canEdit, isEditLoading] = useAccessReview({ group: NodeModel.apiGroup || '', @@ -25,7 +25,7 @@ const NodeGroupEditButton: FC = ({ node }) => { verb: 'patch', }); - if (!nodeMgmtV1Enabled) { + if (!isOpenShift5) { return null; } diff --git a/frontend/packages/console-app/src/components/nodes/NodeLogs.tsx b/frontend/packages/console-app/src/components/nodes/NodeLogs.tsx index 94ff31bfe06..27202ef7a68 100644 --- a/frontend/packages/console-app/src/components/nodes/NodeLogs.tsx +++ b/frontend/packages/console-app/src/components/nodes/NodeLogs.tsx @@ -19,7 +19,7 @@ import { import { LogViewer, LogViewerSearch } from '@patternfly/react-log-viewer'; import { css } from '@patternfly/react-styles'; import { Trans, useTranslation } from 'react-i18next'; -import { FLAG_NODE_MGMT_V1 } from '@console/app/src/consts'; +import { FLAG_OPENSHIFT_5 } from '@console/app/src/consts'; import { useFlag } from '@console/dynamic-plugin-sdk/src/utils/flags'; import { useTheme } from '@console/internal/components/ThemeProvider'; import { SectionHeading } from '@console/internal/components/utils'; @@ -179,7 +179,7 @@ const HeaderBanner: FC<{ lineCount: number }> = ({ lineCount }) => { const NodeLogs: FC = ({ obj: node }) => { const { getQueryArgument, setQueryArgument, removeQueryArgument } = useQueryParamsMutator(); - const nodeMgmtV1Enabled = useFlag(FLAG_NODE_MGMT_V1); + const isOpenShift5 = useFlag(FLAG_OPENSHIFT_5); const { kind, @@ -373,7 +373,7 @@ const NodeLogs: FC = ({ obj: node }) => { return ( - {nodeMgmtV1Enabled ? : null} + {isOpenShift5 ? : null}
{(isLoadingLog || errorExists) && logControls} {(lineCount >= MAX_LINE_COUNT || trimmedContent?.length > 0) && !isLoadingLog && ( diff --git a/frontend/packages/console-app/src/components/nodes/NodesPage.tsx b/frontend/packages/console-app/src/components/nodes/NodesPage.tsx index ed5d9003ed5..08705b8f959 100644 --- a/frontend/packages/console-app/src/components/nodes/NodesPage.tsx +++ b/frontend/packages/console-app/src/components/nodes/NodesPage.tsx @@ -23,7 +23,7 @@ import type { } from '@console/app/src/components/data-view/types'; import { useDataViewSelection } from '@console/app/src/components/data-view/useDataViewSelection'; import { useColumnWidthSettings } from '@console/app/src/components/data-view/useResizableColumnProps'; -import { FLAG_NODE_MGMT_V1 } from '@console/app/src/consts'; +import { FLAG_OPENSHIFT_5 } from '@console/app/src/consts'; import type { K8sModel } from '@console/dynamic-plugin-sdk/src/api/core-api'; import { getGroupVersionKindForResource, @@ -176,7 +176,7 @@ const kind = 'Node'; const useNodesColumns = ( vmsEnabled: boolean, - nodeMgmtV1Enabled: boolean, + isOpenShift5: boolean, ): { columns: TableColumn[]; resetAllColumnWidths: () => void } => { const { t } = useTranslation('console-app'); const { getResizableProps, getWidth, resetAllColumnWidths } = useColumnWidthSettings(NodeModel); @@ -204,7 +204,7 @@ const useNodesColumns = ( modifier: 'nowrap', }, }, - ...(nodeMgmtV1Enabled + ...(isOpenShift5 ? [ { title: t('Groups'), @@ -385,7 +385,7 @@ const useNodesColumns = ( }, }, ]; - }, [t, getResizableProps, nodeMgmtV1Enabled, vmsEnabled, isAdmin, getWidth]); + }, [t, getResizableProps, isOpenShift5, vmsEnabled, isAdmin, getWidth]); return { columns, resetAllColumnWidths }; }; @@ -679,7 +679,7 @@ type NodeListProps = { hideLabelFilter?: boolean; hideColumnManagement?: boolean; selectedColumns?: TableColumnsType; - nodeMgmtV1Enabled?: boolean; + isOpenShift5?: boolean; }; const NodeList: FC = ({ @@ -694,10 +694,10 @@ const NodeList: FC = ({ hideLabelFilter, hideColumnManagement, selectedColumns, - nodeMgmtV1Enabled = false, + isOpenShift5 = false, }) => { const { t } = useTranslation('console-app'); - const { columns, resetAllColumnWidths } = useNodesColumns(vmsEnabled, nodeMgmtV1Enabled); + const { columns, resetAllColumnWidths } = useNodesColumns(vmsEnabled, isOpenShift5); const nodeMetrics = useConsoleSelector(({ UI }) => UI.getIn(['metrics', 'node'])); const columnManagementID = referenceForModel(NodeModel); const statusExtensions = useNodeStatusExtensions(); @@ -864,7 +864,7 @@ const NodeList: FC = ({ placeholder={t('Filter by roles')} options={nodeRoleFilterOptions} />, - ...(nodeMgmtV1Enabled + ...(isOpenShift5 ? [ = ({ nodeArchitectureFilterOptions, machineSetFilterOptions, machineConfigPoolFilterOptions, - nodeMgmtV1Enabled, + isOpenShift5, ], ); @@ -1042,7 +1042,7 @@ const useWatchResourcesIfAllowed = ( export const NodesPage: FC = ({ selector }) => { const dispatch = useConsoleDispatch(); const { t } = useTranslation('console-app'); - const nodeMgmtV1Enabled = useFlag(FLAG_NODE_MGMT_V1); + const isOpenShift5 = useFlag(FLAG_OPENSHIFT_5); const [selectedColumns, , columnPreferenceLoaded] = useUserPreference( COLUMN_MANAGEMENT_USER_PREFERENCE_KEY, @@ -1185,7 +1185,7 @@ export const NodesPage: FC = ({ selector }) => { machineConfigPools={machineConfigPools} vmsEnabled={isKubevirtPluginActive} selectedColumns={selectedColumns} - nodeMgmtV1Enabled={nodeMgmtV1Enabled} + isOpenShift5={isOpenShift5} /> diff --git a/frontend/packages/console-app/src/components/nodes/__tests__/NodeDetailsPage.spec.tsx b/frontend/packages/console-app/src/components/nodes/__tests__/NodeDetailsPage.spec.tsx index 8a56b379d3c..f844a758eba 100644 --- a/frontend/packages/console-app/src/components/nodes/__tests__/NodeDetailsPage.spec.tsx +++ b/frontend/packages/console-app/src/components/nodes/__tests__/NodeDetailsPage.spec.tsx @@ -94,7 +94,7 @@ describe('NodeDetailsPage', () => { jest.clearAllMocks(); }); - it('should include health tab when FLAG_NODE_MGMT_V1 is enabled', () => { + it('should include health tab when FLAG_OPENSHIFT_5 is enabled', () => { useFlag.mockReturnValue(true); isWindowsNode.mockReturnValue(false); @@ -108,7 +108,7 @@ describe('NodeDetailsPage', () => { expect(healthTab.nameKey).toBe('console-app~Health'); }); - it('should not include health tab when FLAG_NODE_MGMT_V1 is disabled', () => { + it('should not include health tab when FLAG_OPENSHIFT_5 is disabled', () => { useFlag.mockReturnValue(false); isWindowsNode.mockReturnValue(false); @@ -147,7 +147,7 @@ describe('NodeDetailsPage', () => { expect(terminalTab).toBeUndefined(); }); - it('should include configuration and workload tabs when FLAG_NODE_MGMT_V1 enabled', () => { + it('should include configuration and workload tabs when FLAG_OPENSHIFT_5 enabled', () => { useFlag.mockReturnValue(true); isWindowsNode.mockReturnValue(false); @@ -168,7 +168,7 @@ describe('NodeDetailsPage', () => { expect(logsTab).toBeUndefined(); }); - it('should include events and logs tabs when FLAG_NODE_MGMT_V1 disabled', () => { + it('should include events and logs tabs when FLAG_OPENSHIFT_5 disabled', () => { useFlag.mockReturnValue(false); isWindowsNode.mockReturnValue(false); diff --git a/frontend/packages/console-app/src/components/nodes/__tests__/NodeLogs.spec.tsx b/frontend/packages/console-app/src/components/nodes/__tests__/NodeLogs.spec.tsx index a2faa902a7f..b22e3649d2b 100644 --- a/frontend/packages/console-app/src/components/nodes/__tests__/NodeLogs.spec.tsx +++ b/frontend/packages/console-app/src/components/nodes/__tests__/NodeLogs.spec.tsx @@ -81,7 +81,7 @@ describe('NodeLogs', () => { jest.clearAllMocks(); }); - it('should render SectionHeading when FLAG_NODE_MGMT_V1 is enabled', async () => { + it('should render SectionHeading when FLAG_OPENSHIFT_5 is enabled', async () => { useFlag.mockReturnValue(true); render(); @@ -94,7 +94,7 @@ describe('NodeLogs', () => { expect(heading).toHaveTextContent('Logs'); }); - it('should not render SectionHeading when FLAG_NODE_MGMT_V1 is disabled', async () => { + it('should not render SectionHeading when FLAG_OPENSHIFT_5 is disabled', async () => { useFlag.mockReturnValue(false); render(); diff --git a/frontend/packages/console-app/src/components/nodes/node-dashboard/DetailsCard.tsx b/frontend/packages/console-app/src/components/nodes/node-dashboard/DetailsCard.tsx index dd3b54379d3..b94f4a214d6 100644 --- a/frontend/packages/console-app/src/components/nodes/node-dashboard/DetailsCard.tsx +++ b/frontend/packages/console-app/src/components/nodes/node-dashboard/DetailsCard.tsx @@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next'; import { Link } from 'react-router'; import NodeGroupEditButton from '@console/app/src/components/nodes/NodeGroupEditButton'; import { getNodeGroups } from '@console/app/src/components/nodes/utils/NodeGroupUtils'; -import { FLAG_NODE_MGMT_V1 } from '@console/app/src/consts'; +import { FLAG_OPENSHIFT_5 } from '@console/app/src/consts'; import { OverviewDetailItem } from '@console/internal/components/overview/OverviewDetailItem'; import { resourcePathFromModel } from '@console/internal/components/utils/resource-link'; import { NodeModel } from '@console/internal/models'; @@ -33,7 +33,7 @@ const DetailsCard: FC = () => { const instanceType = obj.metadata.labels?.['beta.kubernetes.io/instance-type']; const zone = obj.metadata.labels?.['topology.kubernetes.io/zone']; const { t } = useTranslation('console-app'); - const nodeMgmtV1Enabled = useFlag(FLAG_NODE_MGMT_V1); + const isOpenShift5 = useFlag(FLAG_OPENSHIFT_5); const nodeGroups = useMemo(() => getNodeGroups(obj).sort().join(', ') || DASH, [obj]); @@ -80,7 +80,7 @@ const DetailsCard: FC = () => { - {nodeMgmtV1Enabled ? ( + {isOpenShift5 ? ( <> diff --git a/frontend/packages/console-app/src/components/nodes/node-dashboard/InventoryCard.tsx b/frontend/packages/console-app/src/components/nodes/node-dashboard/InventoryCard.tsx index e8370fd4e85..3f485b5359e 100644 --- a/frontend/packages/console-app/src/components/nodes/node-dashboard/InventoryCard.tsx +++ b/frontend/packages/console-app/src/components/nodes/node-dashboard/InventoryCard.tsx @@ -3,7 +3,7 @@ import { useMemo, useContext } from 'react'; import { useResolvedExtensions } from '@openshift/dynamic-plugin-sdk'; import { Card, CardBody, CardHeader, CardTitle, Stack, StackItem } from '@patternfly/react-core'; import { useTranslation } from 'react-i18next'; -import { FLAG_NODE_MGMT_V1 } from '@console/app/src/consts'; +import { FLAG_OPENSHIFT_5 } from '@console/app/src/consts'; import type { NodeInventoryExtensionItem } from '@console/dynamic-plugin-sdk/src/extensions/node'; import { isNodeInventoryItem } from '@console/dynamic-plugin-sdk/src/extensions/node'; import { useFlag } from '@console/dynamic-plugin-sdk/src/utils/flags'; @@ -22,7 +22,7 @@ import { NodeDashboardContext } from './NodeDashboardContext'; const NodePodInventoryItem: ComponentType<{ obj: NodeKind }> = ({ obj }) => { const nodeName = getName(obj); - const nodeMgmtV1Enabled = useFlag(FLAG_NODE_MGMT_V1); + const isOpenShift5 = useFlag(FLAG_OPENSHIFT_5); const podResource = useMemo( () => @@ -42,7 +42,7 @@ const NodePodInventoryItem: ComponentType<{ obj: NodeKind }> = ({ obj }) => { return ; } - const basePath = nodeMgmtV1Enabled + const basePath = isOpenShift5 ? `${resourcePathFromModel(NodeModel, nodeName)}/${WORKLOAD_PAGE_ID}/pods` : `${resourcePathFromModel(NodeModel, nodeName)}/pods`; diff --git a/frontend/packages/console-app/src/components/nodes/node-dashboard/NodeDashboard.tsx b/frontend/packages/console-app/src/components/nodes/node-dashboard/NodeDashboard.tsx index 309a396ef91..0012e6c20ef 100644 --- a/frontend/packages/console-app/src/components/nodes/node-dashboard/NodeDashboard.tsx +++ b/frontend/packages/console-app/src/components/nodes/node-dashboard/NodeDashboard.tsx @@ -1,7 +1,7 @@ import type { FC } from 'react'; import { useMemo, useReducer, useCallback, useEffect } from 'react'; import * as _ from 'lodash'; -import { FLAG_NODE_MGMT_V1 } from '@console/app/src/consts'; +import { FLAG_OPENSHIFT_5 } from '@console/app/src/consts'; import { useFlag } from '@console/dynamic-plugin-sdk/src/utils/flags'; import type { NodeKind } from '@console/internal/module/k8s'; import Dashboard from '@console/shared/src/components/dashboard/Dashboard'; @@ -77,7 +77,7 @@ const reducer = (state: NodeDashboardState, action: NodeDashboardAction) => { }; const NodeDashboard: FC = ({ obj }) => { - const nodeMgmtV1Enabled = useFlag(FLAG_NODE_MGMT_V1); + const isOpenShift5 = useFlag(FLAG_OPENSHIFT_5); const [state, dispatch] = useReducer(reducer, initialState(obj)); useEffect(() => { @@ -124,7 +124,7 @@ const NodeDashboard: FC = ({ obj }) => { diff --git a/frontend/packages/console-app/src/components/nodes/node-dashboard/__tests__/InventoryCard.spec.tsx b/frontend/packages/console-app/src/components/nodes/node-dashboard/__tests__/InventoryCard.spec.tsx index fe378d0a7fc..b2faaf59e6a 100644 --- a/frontend/packages/console-app/src/components/nodes/node-dashboard/__tests__/InventoryCard.spec.tsx +++ b/frontend/packages/console-app/src/components/nodes/node-dashboard/__tests__/InventoryCard.spec.tsx @@ -138,7 +138,7 @@ describe('InventoryCard', () => { expect(screen.getByText('Extension Inventory Item')).toBeVisible(); }); - it('should use legacy pods path when FLAG_NODE_MGMT_V1 is disabled', () => { + it('should use legacy pods path when FLAG_OPENSHIFT_5 is disabled', () => { useFlagMock.mockReturnValue(false); renderWithContext(); @@ -150,7 +150,7 @@ describe('InventoryCard', () => { ); }); - it('should use workload pods path when FLAG_NODE_MGMT_V1 is enabled', () => { + it('should use workload pods path when FLAG_OPENSHIFT_5 is enabled', () => { useFlagMock.mockReturnValue(true); renderWithContext(); diff --git a/frontend/packages/console-app/src/components/nodes/node-dashboard/__tests__/NodeDashboard.spec.tsx b/frontend/packages/console-app/src/components/nodes/node-dashboard/__tests__/NodeDashboard.spec.tsx index 1f8445cd716..1c813c9e23e 100644 --- a/frontend/packages/console-app/src/components/nodes/node-dashboard/__tests__/NodeDashboard.spec.tsx +++ b/frontend/packages/console-app/src/components/nodes/node-dashboard/__tests__/NodeDashboard.spec.tsx @@ -69,7 +69,7 @@ describe('NodeDashboard', () => { }); }); - describe('when NODE_MGMT_V1 flag is disabled', () => { + describe('when FLAG_OPENSHIFT_5 flag is disabled', () => { it('should pass rightCards, mainCards, and leftCards to DashboardGrid', () => { jest.spyOn(flagsModule, 'useFlag').mockReturnValue(false); @@ -90,7 +90,7 @@ describe('NodeDashboard', () => { }); }); - describe('when NODE_MGMT_V1 flag is enabled', () => { + describe('when FLAG_OPENSHIFT_5 flag is enabled', () => { it('should not pass rightCards to DashboardGrid', () => { jest.spyOn(flagsModule, 'useFlag').mockReturnValue(true); diff --git a/frontend/packages/console-app/src/consts.ts b/frontend/packages/console-app/src/consts.ts index e1e61abe895..26e01cd07d5 100644 --- a/frontend/packages/console-app/src/consts.ts +++ b/frontend/packages/console-app/src/consts.ts @@ -9,8 +9,3 @@ export const FLAG_TECH_PREVIEW = 'TECH_PREVIEW'; export const FLAG_OPENSHIFT_5 = 'FLAG_OPENSHIFT_5'; export const ACM_PERSPECTIVE_ID = 'acm'; -/** User settings key for the node management v1 (node groups) toggle */ -export const NODE_MGMT_V1_ENABLED_USER_SETTING_KEY = 'console.nodeMgmtV1.enabled'; - -/** Feature flag for node groups management UI (Nodes list + node details), gated by tech preview + user preference */ -export const FLAG_NODE_MGMT_V1 = 'NODE_MGMT_V1'; diff --git a/frontend/packages/console-app/src/hooks/useNodeMgmtV1FlagProvider.ts b/frontend/packages/console-app/src/hooks/useNodeMgmtV1FlagProvider.ts deleted file mode 100644 index 7e6a7b60692..00000000000 --- a/frontend/packages/console-app/src/hooks/useNodeMgmtV1FlagProvider.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { useEffect } from 'react'; -import type { SetFeatureFlag } from '@console/dynamic-plugin-sdk/src/extensions/feature-flags'; -import { useFlag } from '@console/shared/src/hooks/useFlag'; -import { useUserPreference } from '@console/shared/src/hooks/useUserPreference'; -import { - FLAG_NODE_MGMT_V1, - FLAG_TECH_PREVIEW, - NODE_MGMT_V1_ENABLED_USER_SETTING_KEY, -} from '../consts'; - -/** - * Sets the NODE_MGMT_V1 feature flag from user preferences (mirrors the Node groups management toggle). - * Requires technology preview - */ -const useNodeMgmtV1FlagProvider = (setFeatureFlag: SetFeatureFlag): void => { - const techPreviewEnabled = useFlag(FLAG_TECH_PREVIEW); - const [nodeMgmtV1Enabled] = useUserPreference( - NODE_MGMT_V1_ENABLED_USER_SETTING_KEY, - techPreviewEnabled ?? false, - true, - ); - useEffect(() => { - setFeatureFlag(FLAG_NODE_MGMT_V1, techPreviewEnabled && nodeMgmtV1Enabled); - }, [nodeMgmtV1Enabled, setFeatureFlag, techPreviewEnabled]); -}; - -export default useNodeMgmtV1FlagProvider;