diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index 709c1001c..9cedd2223 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -27,6 +27,13 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: + # Install clipboard utility required by `clipboardy >=4.0.0` package + # - name: Install clipboard utility + # if: (success() || failure()) && runner.os == 'Linux' + # run: | + # sudo apt-get update + # sudo apt-get install -y xclip + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v4 diff --git a/package-lock.json b/package-lock.json index 3ffbc77cf..7c2ba3b89 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,7 +58,7 @@ "@vscode/test-electron": "^2.5.2", "chai": "^5.2.0", "chokidar": "^4.0.3", - "clipboardy": "^2.3.0", + "clipboardy": "^4.0.0", "clsx": "^2.1.1", "codemirror": "^6.0.1", "dockerode": "^4.0.6", @@ -93,7 +93,7 @@ "npm-run-all": "^4.1.5", "portfinder": "^1.0.37", "prettier": "^3.5.3", - "pretty-bytes": "^6.1.1", + "pretty-bytes": "^7.0.0", "proxyquire": "^2.1.3", "react": "^18.3.1", "react-copy-to-clipboard": "^5.1.0", @@ -2946,163 +2946,6 @@ "typescript": ">=4.6.2" } }, - "node_modules/@redhat-developer/page-objects/node_modules/clipboardy": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-4.0.0.tgz", - "integrity": "sha512-5mOlNS0mhX0707P2I0aZ2V/cmHUEO/fL7VFLqszkhUsxt7RwnmrInf/eEQKlf5GzvYeHIjT+Ov1HRfNmymlG0w==", - "dev": true, - "dependencies": { - "execa": "^8.0.1", - "is-wsl": "^3.1.0", - "is64bit": "^2.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@redhat-developer/page-objects/node_modules/execa": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", - "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^8.0.1", - "human-signals": "^5.0.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^4.1.0", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": ">=16.17" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/@redhat-developer/page-objects/node_modules/get-stream": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", - "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", - "dev": true, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@redhat-developer/page-objects/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@redhat-developer/page-objects/node_modules/is-wsl": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", - "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", - "dev": true, - "dependencies": { - "is-inside-container": "^1.0.0" - }, - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@redhat-developer/page-objects/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@redhat-developer/page-objects/node_modules/npm-run-path": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", - "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", - "dev": true, - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@redhat-developer/page-objects/node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@redhat-developer/page-objects/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@redhat-developer/page-objects/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@redhat-developer/page-objects/node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@redhat-developer/page-objects/node_modules/type-fest": { "version": "4.31.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.31.0.tgz", @@ -5632,26 +5475,6 @@ "node": ">=0.10.0" } }, - "node_modules/arch": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", - "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/are-docs-informative": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.0.2.tgz", @@ -6555,17 +6378,171 @@ } }, "node_modules/clipboardy": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-2.3.0.tgz", - "integrity": "sha512-mKhiIL2DrQIsuXMgBgnfEHOZOryC7kY7YO//TN6c63wlEm3NG5tz+YgY5rVi29KCmq/QQjKYvM7a19+MDOTHOQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-4.0.0.tgz", + "integrity": "sha512-5mOlNS0mhX0707P2I0aZ2V/cmHUEO/fL7VFLqszkhUsxt7RwnmrInf/eEQKlf5GzvYeHIjT+Ov1HRfNmymlG0w==", "dev": true, + "license": "MIT", "dependencies": { - "arch": "^2.1.1", - "execa": "^1.0.0", - "is-wsl": "^2.1.1" + "execa": "^8.0.1", + "is-wsl": "^3.1.0", + "is64bit": "^2.0.0" }, "engines": { - "node": ">=8" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/clipboardy/node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/clipboardy/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/cliui": { @@ -9876,6 +9853,7 @@ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=16.17.0" } @@ -10237,6 +10215,7 @@ "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", "dev": true, + "license": "MIT", "dependencies": { "is-docker": "^3.0.0" }, @@ -10255,6 +10234,7 @@ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", "dev": true, + "license": "MIT", "bin": { "is-docker": "cli.js" }, @@ -13294,12 +13274,13 @@ } }, "node_modules/pretty-bytes": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-6.1.1.tgz", - "integrity": "sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-7.0.0.tgz", + "integrity": "sha512-U5otLYPR3L0SVjHGrkEUx5mf7MxV2ceXeE7VwWPk+hyzC5drNohsOGNPDZqxCqyX1lkbEN4kl1LiI8QFd7r0ZA==", "dev": true, + "license": "MIT", "engines": { - "node": "^14.13.1 || >=16.0.0" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" diff --git a/package.json b/package.json index 9e6300037..741500dce 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ "@vscode/test-electron": "^2.5.2", "chai": "^5.2.0", "chokidar": "^4.0.3", - "clipboardy": "^2.3.0", + "clipboardy": "^4.0.0", "clsx": "^2.1.1", "codemirror": "^6.0.1", "dockerode": "^4.0.6", @@ -158,7 +158,7 @@ "npm-run-all": "^4.1.5", "portfinder": "^1.0.37", "prettier": "^3.5.3", - "pretty-bytes": "^6.1.1", + "pretty-bytes": "^7.0.0", "proxyquire": "^2.1.3", "react": "^18.3.1", "react-copy-to-clipboard": "^5.1.0", diff --git a/src/util/esmBridge.ts b/src/util/esmBridge.ts new file mode 100644 index 000000000..d51bff114 --- /dev/null +++ b/src/util/esmBridge.ts @@ -0,0 +1,37 @@ +/*----------------------------------------------------------------------------------------------- + * Copyright (c) Red Hat, Inc. All rights reserved. + * Licensed under the MIT License. See LICENSE file in the project root for license information. + *-----------------------------------------------------------------------------------------------*/ + +// This is just an experiment of using an ESM module from CommonJS +export class EsmBridge { + private static INSTANCE = new EsmBridge(); + private _prettyBytes; + private _clipboardyApi; + + private constructor() { + } + + static get Instance() { + return EsmBridge.INSTANCE; + } + + public async prettyBytesApi(): Promise { + if (!this._prettyBytes) { + this._prettyBytes = (await (async () => await import('pretty-bytes'))()).default; + } + return this._prettyBytes + } + + public async clibboardyApi(): Promise { + if (!this._clipboardyApi) { + this._clipboardyApi = (await (async () => await import('clipboardy'))()).default; + } + return this._clipboardyApi; + } +} + +// (async () => { +// const esmModule = await import('pretty-bytes'); +// esmModule.default(); // or esmModule.someExportedFunction() +// })(); \ No newline at end of file diff --git a/src/webview/cluster/app/clusterView.tsx b/src/webview/cluster/app/clusterView.tsx index 21523a0b5..6e7d7fe4f 100644 --- a/src/webview/cluster/app/clusterView.tsx +++ b/src/webview/cluster/app/clusterView.tsx @@ -11,25 +11,25 @@ import RefreshIcon from '@mui/icons-material/Refresh'; import StopIcon from '@mui/icons-material/Stop'; import { Alert } from '@mui/lab'; import { - Accordion, AccordionActions, AccordionDetails, AccordionSummary, Avatar, - Button, - Chip, - Divider, - LinearProgress, - List, - ListItem, - ListItemAvatar, - ListItemText, - Paper, Step, StepContent, StepLabel, Stepper, TextField, - ThemeProvider, - Tooltip, - Typography + Accordion, AccordionActions, AccordionDetails, AccordionSummary, Avatar, + Button, + Chip, + Divider, + LinearProgress, + List, + ListItem, + ListItemAvatar, + ListItemText, + Paper, Step, StepContent, StepLabel, Stepper, TextField, + ThemeProvider, + Tooltip, + Typography } from '@mui/material'; import { makeStyles } from '@mui/styles'; import * as React from 'react'; -import * as ClusterViewStyles from './clusterView.style'; +import { EsmBridge } from '../../../../src/util/esmBridge'; import { ClusterViewProps } from '../../common/propertyTypes'; -import prettyBytes from 'pretty-bytes'; +import * as ClusterViewStyles from './clusterView.style'; const useStyles = makeStyles(ClusterViewStyles.useStyles); @@ -74,7 +74,7 @@ export default function addClusterView(props: ClusterViewProps) { const steps = getSteps(); - const setCrcStatus = (message) => { + const setCrcStatus = async (message) => { if (!message.status.success) { setStatus( { @@ -86,8 +86,8 @@ export default function addClusterView(props: ClusterViewProps) { setStatus({ crcStatus: message.status.crcStatus, openshiftStatus: message.status.openshiftStatus, - diskUsage: message.status.diskUsage ? prettyBytes(message.status.diskUsage) : 'N/A', - cacheUsage: message.status.cacheUsage ? prettyBytes(message.status.cacheUsage) : 'N/A', + diskUsage: message.status.diskUsage ? (await EsmBridge.Instance.prettyBytesApi()).prettyBytes(message.status.diskUsage) : 'N/A', + cacheUsage: message.status.cacheUsage ? (await EsmBridge.Instance.prettyBytesApi()).prettyBytes(message.status.cacheUsage) : 'N/A', cacheDir: message.status.cacheDir, crcVer: message.versionInfo.version, openshiftVer: message.versionInfo.openshiftVersion, @@ -96,7 +96,7 @@ export default function addClusterView(props: ClusterViewProps) { } } - const messageListener = (event) => { + const messageListener = async (event) => { if (event?.data?.action){ const message = event.data; switch (message.action) { @@ -107,7 +107,7 @@ export default function addClusterView(props: ClusterViewProps) { case 'crcstartstatus' : setProgress(false); setStatusSkeleton(false); - setCrcStatus(message); + await setCrcStatus(message); setSettingPresent(true); break; case 'sendcrcstoperror' : @@ -122,7 +122,7 @@ export default function addClusterView(props: ClusterViewProps) { } setStopProgress(false); setStatusSkeleton(false); - setCrcStatus(message); + await setCrcStatus(message); break; case 'crcsetting' : setSettingPresent(true); @@ -132,7 +132,7 @@ export default function addClusterView(props: ClusterViewProps) { if (message.errorStatus) { setStatusError(true); } else { - setCrcStatus(message); + await setCrcStatus(message); } break; default: diff --git a/test/ui/common/ui/webviewView/openshiftTerminalWebviewView.ts b/test/ui/common/ui/webviewView/openshiftTerminalWebviewView.ts index 39544821b..35539d7d5 100644 --- a/test/ui/common/ui/webviewView/openshiftTerminalWebviewView.ts +++ b/test/ui/common/ui/webviewView/openshiftTerminalWebviewView.ts @@ -3,6 +3,7 @@ * Licensed under the MIT License. See LICENSE file in the project root for license information. *-----------------------------------------------------------------------------------------------*/ import { By, Key, VSBrowser, WebElement, WebviewView } from 'vscode-extension-tester'; +import { EsmBridge } from '../../../../../src/util/esmBridge'; import { WebviewViewForm } from './webviewViewForm'; export class OpenshiftTerminalWebviewView extends WebviewViewForm { @@ -16,9 +17,21 @@ export class OpenshiftTerminalWebviewView extends WebviewViewForm { async () => { try { await this.sendKeysToTerminal(copyKeys); - const cb = await import('clipboardy'); + const cb = await EsmBridge.Instance.clibboardyApi(); + /* eslint-disable no-console */ + + console.error(`clibboardyApi: ${cb}`); + console.error(`clibboardyApi.read: ${cb?.read}`); + + /* eslint-disable no-console */ + return await cb.read(); - } catch { + } catch(__err) { + /* eslint-disable no-console */ + + console.error(`clibboardyApi call error: ${__err}`); + + /* eslint-disable no-console */ return null; } },