-
Notifications
You must be signed in to change notification settings - Fork 668
CONSOLE-4778: Bump i18next and react-i18next to the reasonably recent version #15875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,9 @@ | |
| "name": "@console/dynamic-demo-plugin", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "resolutions": { | ||
| "@types/react": "17.0.39" | ||
| }, | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "scripts": { | ||
| "clean": "rm -rf dist", | ||
| "build": "yarn clean && NODE_ENV=production yarn ts-node node_modules/.bin/webpack", | ||
|
|
@@ -20,7 +23,7 @@ | |
| "@patternfly/react-core": "^6.2.2", | ||
| "@patternfly/react-icons": "^6.2.2", | ||
| "@patternfly/react-table": "^6.2.2", | ||
| "@types/react": "16.8.13", | ||
| "@types/react": "17.0.39", | ||
| "@types/react-router": "^5.1.20", | ||
| "@types/react-router-dom": "5.3.x", | ||
| "copy-webpack-plugin": "^6.4.1", | ||
|
|
@@ -29,9 +32,9 @@ | |
| "http-server": "0.12.x", | ||
| "i18next-parser": "^3.3.0", | ||
| "js-yaml": "^4.1.0", | ||
| "react": "17.0.1", | ||
| "react-dom": "17.0.1", | ||
| "react-i18next": "^11.7.3", | ||
| "react": "^17.0.1", | ||
| "react-dom": "^17.0.1", | ||
|
Comment on lines
+35
to
+36
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this change in semver range necessary? I mean I will be updating this in #14869 anyway so it's okay
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this was done to keep React deps in sync with Console frontend For both Console frontend and dynamic demo plugin, I'd prefer that we use a specific React version instead of version range. So let's revisit this once we bump React to 18 in Console frontend. |
||
| "react-i18next": "^15.1.4", | ||
| "react-router": "5.3.x", | ||
| "react-router-dom": "5.3.x", | ||
| "react-router-dom-v5-compat": "^6.11.2", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| import * as React from 'react'; | ||
| import { | ||
| K8sResourceCommon, | ||
| useK8sWatchResource, | ||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,10 @@ export const translateExtensionDeep = <E extends Extension>( | |
| * Recursively updates the extension's properties, replacing all translatable string values | ||
| * via the provided `t` function. | ||
| */ | ||
| export const translateExtension = <E extends Extension>(extension: E, t: TFunction): E => { | ||
| export const translateExtension = <E extends Extension>( | ||
| extension: E, | ||
| t: TFunction | ((key: string) => string), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems there are lots of places that work with The Maybe we can add e.g. export type ConsoleTFunction = TFunction | ((key: string) => string); |
||
| ): E => { | ||
| translateExtensionDeep(extension, isTranslatableString, (value, key, obj) => { | ||
| obj[key] = t(value); | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { TFunction } from 'react-i18next'; | ||
| import { TFunction } from 'i18next'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 where possible,
|
||
| import * as yup from 'yup'; | ||
| import { RESOURCE_NAME_REGEX } from './regex'; | ||
|
|
||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't this remove the i18n for these strings?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| import { TFunction } from 'i18next'; | ||
| import { toInteger } from 'lodash'; | ||
| import { | ||
| HealthState, | ||
|
|
@@ -9,13 +8,15 @@ import { | |
| } from '@console/dynamic-plugin-sdk'; | ||
| import { ConfigMap } from '../resources'; | ||
|
|
||
| export type TranslationFunction = (key: string, options?: Record<string, unknown>) => string; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be aligned with proposed Also not sure we need the |
||
|
|
||
|
Comment on lines
+11
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n frontend/packages/vsphere-plugin/src/components/getVSphereHealth.tsRepository: openshift/console Length of output: 3712 🏁 Script executed: rg -nP --type=ts --type=tsx -C3 'getVSphereHealth\s*\(' -g '!*.spec.ts' -g '!*.test.ts'Repository: openshift/console Length of output: 88 🏁 Script executed: rg -nP --type=ts -C3 'getVSphereHealth\s*\(' -g '!*.spec.ts' -g '!*.test.ts'Repository: openshift/console Length of output: 1848 🏁 Script executed: cat -n frontend/packages/vsphere-plugin/src/components/ClusterOverview/VSphereStatus.tsxRepository: openshift/console Length of output: 2823 Type abstraction is well-designed and consumers are compatible. The However, fix missing translation wrapper at line 76: the message 🤖 Prompt for AI Agents |
||
| const getPrometheusMetricValue = ( | ||
| prometheusResult: PrometheusResult[], | ||
| reason: string, | ||
| ): PrometheusValue | undefined => prometheusResult.find((r) => r.metric.reason === reason)?.value; | ||
|
|
||
| export const getVSphereHealth = ( | ||
| t: TFunction, | ||
| t: TranslationFunction, | ||
| responses: PrometheusHealthPopupProps['responses'], | ||
| configMapResult: PrometheusHealthPopupProps['k8sResult'], | ||
| ): SubsystemHealth => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| import { safeLoad, dump } from 'js-yaml'; | ||
| import { TFunction } from 'react-i18next'; | ||
| import { | ||
| k8sCreate, | ||
| k8sGet, | ||
|
|
@@ -15,6 +14,7 @@ import { | |
| VSPHERE_CREDS_SECRET_NAMESPACE, | ||
| } from '../constants'; | ||
| import { ConfigMap, Infrastructure, KubeControllerManager, Secret } from '../resources'; | ||
| import { TranslationFunction } from './getVSphereHealth'; | ||
| import { ConnectionFormFormikValues, PersistOp, ProviderCM } from './types'; | ||
| import { encodeBase64, getErrorMessage } from './utils'; | ||
|
|
||
|
|
@@ -92,7 +92,7 @@ const getPersistSecretOp = async ( | |
| }; | ||
|
|
||
| const getPatchKubeControllerManagerOp = async ( | ||
| t: TFunction<'vsphere-plugin'>, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that we can utilize the export type ConsoleTFunction<Ns extends Namespace = DefaultNamespace> = TFunction<Ns> | ((key: string) => string); |
||
| t: TranslationFunction, | ||
| kubeControllerManagerModel: K8sModel, | ||
| ): Promise<PersistOp> => { | ||
| let cm: KubeControllerManager; | ||
|
|
@@ -129,7 +129,7 @@ const getPatchKubeControllerManagerOp = async ( | |
| }; | ||
|
|
||
| const updateYamlFormat = ( | ||
| t: TFunction<'vsphere-plugin'>, | ||
| t: TranslationFunction, | ||
| values: ConnectionFormFormikValues, | ||
| initValues: ConnectionFormFormikValues, | ||
| cloudProviderConfig: ConfigMap, | ||
|
|
@@ -249,7 +249,7 @@ const getUpdatedConfigMapResourcePool = ( | |
| }; | ||
|
|
||
| const updateIniFormat = ( | ||
| t: TFunction<'vsphere-plugin'>, | ||
| t: TranslationFunction, | ||
| values: ConnectionFormFormikValues, | ||
| initValues: ConnectionFormFormikValues, | ||
| cloudProviderConfig: ConfigMap, | ||
|
|
@@ -360,7 +360,7 @@ const fixConfigMap = (values: ConnectionFormFormikValues) => { | |
| }; | ||
|
|
||
| const getPersistProviderConfigMapOp = async ( | ||
| t: TFunction<'vsphere-plugin'>, | ||
| t: TranslationFunction, | ||
| configMapModel: K8sModel, | ||
| values: ConnectionFormFormikValues, | ||
| initValues: ConnectionFormFormikValues, | ||
|
|
@@ -551,7 +551,7 @@ const runPatches = async ({ | |
| addTaints, | ||
| queryParams, | ||
| }: { | ||
| t: TFunction<'vsphere-plugin'>; | ||
| t: TranslationFunction; | ||
| persistSecret: PersistOp; | ||
| persistKubeControllerManager: PersistOp; | ||
| persistProviderCM: PersistOp; | ||
|
|
@@ -599,7 +599,7 @@ const runPatches = async ({ | |
| }; | ||
|
|
||
| export const persist = async ( | ||
| t: TFunction<'vsphere-plugin'>, | ||
| t: TranslationFunction, | ||
| { | ||
| secretModel, | ||
| configMapModel, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, we should align all React related version resolutions with Console frontend.
Once we bump React to 18 along with any React related dependencies, we should try to eliminate this resolution override.