Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions apps/ocp-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,30 @@
"webpack-dev-server": "^6.0.0"
},
"dependencies": {
"@openshift-console/dynamic-plugin-sdk": "4.19.1",
"@openshift-console/dynamic-plugin-sdk-webpack": "4.19.0",
"@openshift-console/dynamic-plugin-sdk": "4.23.0",
"@openshift-console/dynamic-plugin-sdk-webpack": "4.23.0",
"@patternfly/patternfly": "^6.4.0",
"@patternfly/react-charts": "^8.4.0",
"@patternfly/react-code-editor": "^6.4.0",
"@patternfly/react-core": "^6.4.0",
"@patternfly/react-icons": "^6.4.0",
"@patternfly/react-styles": "^6.4.0",
"@patternfly/react-table": "^6.4.0",
"@patternfly/react-topology": "6.6.0",
"@patternfly/react-log-viewer": "^6.3.0",
"@types/react-redux": "^7.1.33",
"formik": "^2.4.9",
"i18next": "^21.8.14",
"i18next": "25.6.2",
"js-yaml": "^4.3.0",
"monaco-editor": "^0.51.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-i18next": "^11.7.3",
"react-redux": "7.2.2",
"react-router-dom": "^5.3.x",
"react-router-dom-v5-compat": "^6.30.6",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-i18next": "16.5.8",
"react-redux": "9.2.0",
"react-router": "7.18.5",
"react-router-dom": "^7.18.5",
"redux": "5.0.1",
"redux-thunk": "3.1.0",
"yup": "^1.3.3"
}
}
4 changes: 2 additions & 2 deletions apps/ocp-plugin/src/components/AppContext/AppContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {
useNavigate,
useParams,
useSearchParams,
} from 'react-router-dom-v5-compat';
import { getUser } from '@openshift-console/dynamic-plugin-sdk/lib/app/core/reducers';
} from 'react-router-dom';
import { getUser } from '@openshift-console/dynamic-plugin-sdk/lib/app/core/reducers/coreSelectors';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: same, we must ensure user information functionality remains the same.

import { useSelector } from 'react-redux';
import { useFetch } from '../../hooks/useFetch';
import { apiProxy } from '../../utils/apiCalls';
Expand Down
13 changes: 12 additions & 1 deletion apps/ocp-plugin/src/utils/apiCalls.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable no-console */

import { type PatchRequest } from '@flightctl/types';
import { getCSRFToken } from '@openshift-console/dynamic-plugin-sdk/lib/utils/fetch/console-fetch-utils';
import {
getErrorMsgFromAlertsApiResponse,
getErrorMsgFromApiResponse,
Expand All @@ -18,6 +17,18 @@ declare global {

type Api = 'flightctl' | 'imagebuilder' | 'alerts' | 'catalog' | 'vulnerability';

const getCSRFToken = (): string => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: This change would need to be well tested in the OCP console.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs testing, but the equivalent should be ts import { getCSRFToken } from '@openshift-console/dynamic-plugin-sdk-internal';

const cookiePrefix = 'csrf-token=';
return (
document.cookie
.split(';')
.map((cookie) => cookie.trim())
.filter((cookie) => cookie.startsWith(cookiePrefix))
.map((cookie) => cookie.slice(cookiePrefix.length))
.pop() ?? ''
);
};

const addRequiredHeaders = (options: RequestInit, api?: Api): RequestInit => {
const token = getCSRFToken();
const orgId = localStorage.getItem(ORGANIZATION_STORAGE_KEY);
Expand Down
6 changes: 3 additions & 3 deletions apps/standalone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
"i18next-http-backend": "^4.0.4",
"js-yaml": "^4.3.0",
"monaco-editor": "^0.51.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-i18next": "^11.7.3",
"react-router-dom": "^6.30.6",
"react-router-dom": "^7.18.5",
"yup": "^1.3.3"
}
}
6 changes: 4 additions & 2 deletions apps/standalone/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import ReactDOM, { render } from 'react-dom';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import { Bullseye, Spinner } from '@patternfly/react-core';
import App from './app/index';
import { UserPreferencesProvider } from '@flightctl/ui-components/src/components/Masthead/UserPreferencesProvider';
Expand Down Expand Up @@ -28,6 +29,7 @@ if (window.API_PORT) {
}

const root = document.getElementById('root') as Element;
const rootContainer = createRoot(root);

const rootApp = (
<React.StrictMode>
Expand All @@ -45,4 +47,4 @@ const rootApp = (
</React.StrictMode>
);

render(rootApp, root);
rootContainer.render(rootApp);
14 changes: 9 additions & 5 deletions libs/ui-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
"@types/file-saver": "^2.0.5",
"@types/react-dom": "^18.2.17",
"@types/semver": "^7.5.2",
"react-router": "^6.30.6",
"react-router-dom": "^6.30.6"
"i18next": "21.10.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-i18next": "11.18.6",
"react-router": "^7.18.5",
"react-router-dom": "^7.18.5"
},
"dependencies": {
"@rjsf/core": "5.24.13",
Expand All @@ -56,12 +60,12 @@
"@patternfly/react-styles": "^6.4.0",
"@patternfly/react-table": "^6.4.0",
"@patternfly/react-log-viewer": "^6.3.0",
"i18next": "21.8.14 - 23.x",
"i18next": "21.8.14 - 25.x",
"monaco-editor": "^0.51.0",
"react": "17.0.1 - 18.x",
"react-dom": "17.0.1 - 18.x",
"react-i18next": "11.7.3 - 15.x",
"react-router-dom": "^5.3 || ^6.30.6",
"react-i18next": "11.7.3 - 16.x",
"react-router-dom": "^5.3 || ^6.30.6 || ^7.18.5",
"victory": "^37.3.6"
}
}
2 changes: 1 addition & 1 deletion libs/ui-components/src/components/ImagePromotion/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type TFunction } from 'react-i18next';
import { type TFunction } from 'i18next';
import * as Yup from 'yup';
import semver from 'semver';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { describe, expect, it } from 'vitest';
import { type TFunction } from 'i18next';

import { ApiVersion, OciRepoSpec, RepoSpecType, type Repository } from '@flightctl/types';

Expand All @@ -14,7 +15,7 @@ import { OciPlacementMode, type RepositoryFormValues } from './types';

type DefinedOciConfig = NonNullable<RepositoryFormValues['ociConfig']>;

const t = (key: string) => key;
const t = ((key: string) => key) as unknown as TFunction;

const testRegistry = 'my-registry.com';
const testRepo = 'my-org/diffs';
Expand Down
2 changes: 1 addition & 1 deletion libs/ui-components/src/utils/imageBuilds.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type TFunction } from 'react-i18next';
import { type TFunction } from 'i18next';
import {
ExportFormatType,
type ImageBuild,
Expand Down
6 changes: 4 additions & 2 deletions libs/ui-components/src/utils/status/devices.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type TFunction } from 'react-i18next';
import { type TFunction } from 'i18next';
import { PowerOffIcon } from '@patternfly/react-icons/dist/js/icons/power-off-icon';
import { PauseCircleIcon } from '@patternfly/react-icons/dist/js/icons/pause-circle-icon';
import { BanIcon } from '@patternfly/react-icons/dist/js/icons/ban-icon';
Expand Down Expand Up @@ -372,4 +372,6 @@ export const getDeviceLifecycleStatusItems = (t: TFunction): StatusItem<DeviceLi
},
];

export const deviceStatusOrder = getDeviceStatusItems((s: string) => s).map((item) => item.id);
export const deviceStatusOrder = getDeviceStatusItems(((s: string) => s) as unknown as TFunction).map(
(item) => item.id,
);
Loading
Loading