Skip to content

Commit e72e011

Browse files
jhadvigclaude
andcommitted
Upgrade Console SDK to 4.22 and fix review issues from PR #8
- SDK 4.22: React 17→18, react-router v5→v7, react-i18next v11→v16, PatternFly 6.2→6.4, i18next 23→25 - Fix useHistory→useNavigate (runtime crash on OCP 5.0) - Fix react-router-dom→react-router imports - Fix getRiskColor case-insensitive matching (CRD serves capitalized) - Remove exact from console-extensions.json (react-router v7 default) - Add trailing newline to locale JSON - Update consolePlugin dependency to >=4.22.0-0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a1223ca commit e72e011

7 files changed

Lines changed: 335 additions & 1310 deletions

File tree

console-extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{
33
"type": "console.page/route",
44
"properties": {
5-
"exact": true,
65
"path": "/administration/cluster-update",
76
"component": { "$codeRef": "ClusterUpdatePage" }
87
}

locales/en/plugin__cluster-update-console-plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@
7070
"View pod logs": "View pod logs",
7171
"Yes": "Yes",
7272
"z-stream": "z-stream"
73-
}
73+
}

package.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@
2828
"@babel/core": "^7.29.0",
2929
"@babel/preset-env": "^7.29.0",
3030
"@cypress/webpack-preprocessor": "^7.0.2",
31-
"@openshift-console/dynamic-plugin-sdk": "4.21-latest",
32-
"@openshift-console/dynamic-plugin-sdk-webpack": "4.21-latest",
33-
"@patternfly/react-core": "^6.2.2",
34-
"@patternfly/react-icons": "^6.2.2",
35-
"@patternfly/react-table": "^6.2.2",
31+
"@openshift-console/dynamic-plugin-sdk": "4.22-latest",
32+
"@openshift-console/dynamic-plugin-sdk-webpack": "4.22-latest",
33+
"@patternfly/react-core": "^6.4.3",
34+
"@patternfly/react-icons": "^6.4.0",
35+
"@patternfly/react-table": "^6.4.3",
3636
"@types/jest": "^30.0.0",
3737
"@types/node": "^22.0.0",
38-
"@types/react": "^17.0.37",
39-
"@types/react-router-dom": "^5.3.3",
38+
"@types/react": "^18.3.28",
4039
"babel-loader": "^10.1.0",
4140
"copy-webpack-plugin": "^14.0.0",
4241
"css-loader": "^7.1.4",
@@ -49,7 +48,7 @@
4948
"eslint-plugin-react": "^7.37.5",
5049
"eslint-plugin-react-hooks": "^7.0.1",
5150
"globals": "^17.4.0",
52-
"i18next": "^23.11.5",
51+
"i18next": "^25.8.18",
5352
"i18next-parser": "^9.4.0",
5453
"jest": "^30.3.0",
5554
"mocha": "^11.7.5",
@@ -59,12 +58,10 @@
5958
"pluralize": "^8.0.0",
6059
"prettier": "^3.8.1",
6160
"prettier-stylelint": "^0.4.2",
62-
"react": "^17.0.1",
63-
"react-dom": "^17.0.1",
64-
"react-i18next": "^11.7.3",
65-
"react-router": "5.3.x",
66-
"react-router-dom": "5.3.x",
67-
"react-router-dom-v5-compat": "^6.11.2",
61+
"react": "^18.3.1",
62+
"react-dom": "^18.3.1",
63+
"react-i18next": "~16.5.8",
64+
"react-router": "~7.13.1",
6865
"style-loader": "^4.0.0",
6966
"stylelint": "^17.4.0",
7067
"stylelint-config-standard": "^40.0.0",
@@ -91,7 +88,7 @@
9188
"ClusterUpdatePage": "./components/ClusterUpdatePage"
9289
},
9390
"dependencies": {
94-
"@console/pluginAPI": "^4.21.0"
91+
"@console/pluginAPI": ">=4.22.0-0"
9592
}
9693
},
9794
"packageManager": "yarn@4.14.1"

src/components/active-plans/ActivePlansTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { useTranslation } from 'react-i18next';
3-
import { Link } from 'react-router-dom';
3+
import { Link } from 'react-router';
44
import { Timestamp } from '@openshift-console/dynamic-plugin-sdk';
55
import { EmptyState, EmptyStateBody } from '@patternfly/react-core';
66
import { SearchIcon } from '@patternfly/react-icons';

src/components/update-plan/DecisionActions.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { useTranslation } from 'react-i18next';
3-
import { useHistory } from 'react-router-dom';
3+
import { useNavigate } from 'react-router';
44
import { k8sPatch } from '@openshift-console/dynamic-plugin-sdk';
55
import {
66
Alert,
@@ -30,7 +30,7 @@ const CONFIRM_TIMEOUT_MS = 5000;
3030

3131
const DecisionActions: React.FC<DecisionActionsProps> = ({ proposal, clusterVersion }) => {
3232
const { t } = useTranslation(I18N_NAMESPACE);
33-
const history = useHistory();
33+
const navigate = useNavigate();
3434

3535
// Find the ProposalApproval matching this proposal (same name/namespace)
3636
const [approvals] = useProposalApprovals();
@@ -97,7 +97,7 @@ const DecisionActions: React.FC<DecisionActionsProps> = ({ proposal, clusterVers
9797
model: ClusterVersionModel,
9898
resource: clusterVersion,
9999
});
100-
history.push('/settings/cluster');
100+
navigate('/settings/cluster');
101101
} catch (err) {
102102
setUpgradeError(getErrorMessage(err));
103103
}
@@ -109,7 +109,7 @@ const DecisionActions: React.FC<DecisionActionsProps> = ({ proposal, clusterVers
109109
setConfirmingApprove(false);
110110
}, CONFIRM_TIMEOUT_MS);
111111
}
112-
}, [confirmingApprove, approveStage, proposal, clusterVersion, history, t]);
112+
}, [confirmingApprove, approveStage, proposal, clusterVersion, navigate, t]);
113113

114114
const handleDenyClick = React.useCallback(async () => {
115115
if (confirmingDeny) {

src/models/proposal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export const getPhaseDisplay = (phase?: ProposalPhase | string): PhaseDisplay =>
183183
};
184184

185185
export const getRiskColor = (risk?: string): 'green' | 'orange' | 'red' | 'grey' => {
186-
switch (risk) {
186+
switch (risk?.toLowerCase()) {
187187
case 'low':
188188
return 'green';
189189
case 'medium':

0 commit comments

Comments
 (0)