diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index a628326..0000000 --- a/.eslintignore +++ /dev/null @@ -1,35 +0,0 @@ -# Javascript builds -node_modules -dist -tsc_out -.out -.changelog -.DS_Store -coverage -.cache -.tmp -.eslintcache -generated - -# package managers -yarn-error.log -lerna-debug.log - -# IDEs and editors -.idea -.project -.classpath -.c9 -*.launch -.settings -*.sublime-workspace -.history -.vscode -.yo-rc.json - -# IDE - VSCode -.vscode -# For vim -*.swp - -public \ No newline at end of file diff --git a/.eslintrc-md.json b/.eslintrc-md.json deleted file mode 100644 index 1945c90..0000000 --- a/.eslintrc-md.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "plugins": [ - "markdown", - "react" - ], - "parserOptions": { - "ecmaVersion": 9, - "sourceType": "module", - "ecmaFeatures": { - "jsx": true - } - }, - "settings": { - "react": { - "version": "16.4.0" - } - }, - "rules": { - "eol-last": 2, - "spaced-comment": 2, - "no-unused-vars": 0, - "no-this-before-super": 2, - "react/jsx-uses-react": "error", - "react/jsx-uses-vars": "error", - "react/no-unknown-property": 2, - "react/jsx-no-undef": 2 - } -} \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 550c1e3..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "es6": true - }, - "extends": [ - "eslint:recommended", - "plugin:react/recommended", - "plugin:react-hooks/recommended", - "plugin:@typescript-eslint/recommended", - "plugin:react/jsx-runtime", - "prettier" - ], - "overrides": [ - { - "files": ["**/patternfly-docs/pages/*"], - "rules": { - "arrow-body-style": "off" - } - } - ], - "parserOptions": { - "ecmaVersion": "latest", - "sourceType": "module", - "ecmaFeatures": { - "jsx": true - } - }, - "settings": { - "react": { - "version": "detect" - } - }, - "plugins": ["react", "react-hooks", "@typescript-eslint"], - "rules": { - "@typescript-eslint/adjacent-overload-signatures": "error", - "@typescript-eslint/array-type": "error", - "@typescript-eslint/consistent-type-assertions": "error", - "@typescript-eslint/consistent-type-definitions": "error", - "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-namespace": "error", - "@typescript-eslint/no-unused-vars": [ - "error", - { - "argsIgnorePattern": "^_" - } - ], - "@typescript-eslint/prefer-for-of": "error", - "@typescript-eslint/prefer-function-type": "error", - "@typescript-eslint/prefer-namespace-keyword": "error", - "@typescript-eslint/unified-signatures": "error", - "@typescript-eslint/no-var-requires": "off", - "@typescript-eslint/no-explicit-any": "off", - "arrow-body-style": "error", - "camelcase": [ - "error", - { - "ignoreDestructuring": true - } - ], - "constructor-super": "error", - "curly": "error", - "dot-notation": "error", - "eqeqeq": ["error", "smart"], - "guard-for-in": "error", - "max-classes-per-file": ["error", 1], - "no-nested-ternary": "error", - "no-bitwise": "error", - "no-caller": "error", - "no-cond-assign": "error", - "no-console": "error", - "no-debugger": "error", - "no-empty": "error", - "no-eval": "error", - "no-new-wrappers": "error", - "no-undef-init": "error", - "no-unsafe-finally": "error", - "no-unused-expressions": [ - "error", - { - "allowTernary": true, - "allowShortCircuit": true - } - ], - "no-unused-labels": "error", - "no-var": "error", - "object-shorthand": "error", - "one-var": ["error", "never"], - "prefer-const": "error", - "radix": ["error", "as-needed"], - "react/prop-types": 0, - "react/display-name": 0, - "react-hooks/exhaustive-deps": "warn", - "react/no-unescaped-entities": ["error", { "forbid": [">", "}"] }], - "spaced-comment": "error", - "use-isnan": "error" - } -} diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index 6582be1..499b39e 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -7,25 +7,26 @@ jobs: env: GH_PR_NUM: ${{ github.event.number }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: | if [[ ! -z "${GH_PR_NUM}" ]]; then echo "Checking out PR" git fetch origin pull/$GH_PR_NUM/head:tmp git checkout tmp fi - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '22' + - run: corepack enable - uses: actions/cache@v4 id: yarn-cache - name: Cache npm deps + name: Cache yarn deps with: path: | node_modules **/node_modules key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} - - run: yarn install --frozen-lockfile + - run: yarn install --immutable if: steps.yarn-cache.outputs.cache-hit != 'true' - uses: actions/cache@v4 id: dist @@ -43,25 +44,26 @@ jobs: GH_PR_NUM: ${{ github.event.number }} needs: build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: | if [[ ! -z "${GH_PR_NUM}" ]]; then echo "Checking out PR" git fetch origin pull/$GH_PR_NUM/head:tmp git checkout tmp fi - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '22' + - run: corepack enable - uses: actions/cache@v4 id: yarn-cache - name: Cache npm deps + name: Cache yarn deps with: path: | node_modules **/node_modules key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} - - run: yarn install --frozen-lockfile + - run: yarn install --immutable if: steps.yarn-cache.outputs.cache-hit != 'true' - uses: actions/cache@v4 id: lint-cache @@ -79,7 +81,7 @@ jobs: GH_PR_NUM: ${{ github.event.number }} needs: build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 # Yes, we really want to checkout the PR - run: | if [[ ! -z "${GH_PR_NUM}" ]]; then @@ -87,19 +89,20 @@ jobs: git fetch origin pull/$GH_PR_NUM/head:tmp git checkout tmp fi - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '22' + - run: corepack enable - uses: actions/cache@v4 id: yarn-cache - name: Cache npm deps + name: Cache yarn deps with: path: | node_modules **/node_modules ~/.cache/Cypress key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} - - run: yarn install --frozen-lockfile + - run: yarn install --immutable if: steps.yarn-cache.outputs.cache-hit != 'true' - uses: actions/cache@v4 id: dist @@ -120,7 +123,7 @@ jobs: GH_PR_NUM: ${{ github.event.number }} needs: build steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 # Yes, we really want to checkout the PR - run: | if [[ ! -z "${GH_PR_NUM}" ]]; then @@ -128,19 +131,20 @@ jobs: git fetch origin pull/$GH_PR_NUM/head:tmp git checkout tmp fi - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '22' + - run: corepack enable - uses: actions/cache@v4 id: yarn-cache - name: Cache npm deps + name: Cache yarn deps with: path: | node_modules **/node_modules ~/.cache/Cypress key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} - - run: yarn install --frozen-lockfile + - run: yarn install --immutable if: steps.yarn-cache.outputs.cache-hit != 'true' - uses: actions/cache@v4 id: dist diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 210ee0e..b1d21ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ jobs: env: GH_PR_NUM: ${{ github.event.number }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: | if [[ ! -z "${GH_PR_NUM}" ]]; then echo "Checking out PR" @@ -30,18 +30,19 @@ jobs: run: ./devSetup.sh shell: bash if: steps.setup-cache.outputs.cache-hit != 'true' - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '22' + - run: corepack enable - uses: actions/cache@v4 id: yarn-cache - name: Cache npm deps + name: Cache yarn deps with: path: | node_modules **/node_modules key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} - - run: yarn install --frozen-lockfile + - run: yarn install --immutable if: steps.yarn-cache.outputs.cache-hit != 'true' - uses: actions/cache@v4 id: dist diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index 6301bd1..0ecba1c 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -2,7 +2,7 @@ name: promote on: push: # Sequence of patterns matched against refs/tags - tags: + tags: - v6.* jobs: build-and-promote: @@ -12,13 +12,14 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} steps: - - uses: actions/checkout@v2 - - name: Build for promotion - run: yarn install --frozen-lockfile && yarn build - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: '16.x' + node-version: '22' registry-url: 'https://registry.npmjs.org' + - run: corepack enable + - name: Build for promotion + run: yarn install --immutable && yarn build - name: GitHub Tag Name example run: | echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f6e9abc..514a30a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,20 +14,21 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '22' + - run: corepack enable - uses: actions/cache@v4 id: yarn-cache - name: Cache npm deps + name: Cache yarn deps with: path: | node_modules **/node_modules ~/.cache/Cypress key: ${{ runner.os }}-yarn-14-${{ secrets.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }} - - run: yarn install --frozen-lockfile + - run: yarn install --immutable if: steps.yarn-cache.outputs.cache-hit != 'true' - uses: actions/cache@v4 id: dist diff --git a/.gitignore b/.gitignore index ff76253..8f32a45 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,12 @@ coverage # package managers yarn-error.log lerna-debug.log +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +.pnp.* # IDEs and editors .idea diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000..3186f3f --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/eslint-md.config.mjs b/eslint-md.config.mjs new file mode 100644 index 0000000..e4cb208 --- /dev/null +++ b/eslint-md.config.mjs @@ -0,0 +1,57 @@ +import markdown from '@eslint/markdown'; +import react from 'eslint-plugin-react'; + +export default [ + { + ignores: [ + '**/dist/**', + '**/public/**', + '**/.cache/**', + '**/node_modules/**', + '**/generated/**', + '**/CHANGELOG.md' + ] + }, + { + files: ['packages/**/*.md'], + plugins: { + markdown + }, + language: 'markdown/gfm', + rules: { + 'markdown/no-multiple-h1': 'off', + 'markdown/heading-increment': 'off', + 'markdown/no-missing-label-refs': 'off' + } + }, + { + files: ['packages/**/*.md/*.js', 'packages/**/*.md/*.jsx'], + plugins: { + react + }, + languageOptions: { + ecmaVersion: 2020, + sourceType: 'module', + parserOptions: { + ecmaFeatures: { + jsx: true + } + } + }, + settings: { + react: { + version: '18' + } + }, + rules: { + 'eol-last': 'error', + 'spaced-comment': 'error', + 'no-unused-vars': 'off', + 'no-this-before-super': 'error', + 'react/jsx-uses-react': 'error', + 'react/jsx-uses-vars': 'error', + 'react/no-unknown-property': 'error', + 'react/jsx-no-undef': 'error' + } + } +]; diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..89f2dbd --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,127 @@ +import js from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import react from 'eslint-plugin-react'; +import reactHooks from 'eslint-plugin-react-hooks'; +import prettier from 'eslint-config-prettier'; +import globals from 'globals'; + +export default [ + { + ignores: [ + '**/dist/**', + '**/public/**', + '**/.cache/**', + '**/node_modules/**', + '**/*.md', + '**/tsc_out/**', + '**/.out/**', + '**/.changelog/**', + '**/coverage/**', + '**/.tmp/**', + '**/generated/**', + '**/.eslintcache' + ] + }, + js.configs.recommended, + ...tseslint.configs.recommended, + prettier, + { + files: ['packages/**/*.{js,jsx,ts,tsx}'], + plugins: { + react, + 'react-hooks': reactHooks + }, + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + globals: { + ...globals.browser, + ...globals.node + }, + parserOptions: { + ecmaFeatures: { + jsx: true + } + } + }, + settings: { + react: { + version: 'detect' + } + }, + rules: { + ...react.configs.recommended.rules, + ...react.configs['jsx-runtime'].rules, + ...reactHooks.configs.recommended.rules, + + '@typescript-eslint/adjacent-overload-signatures': 'error', + '@typescript-eslint/array-type': 'error', + '@typescript-eslint/consistent-type-assertions': 'error', + '@typescript-eslint/consistent-type-definitions': 'error', + '@typescript-eslint/no-misused-new': 'error', + '@typescript-eslint/no-namespace': 'error', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_' + } + ], + '@typescript-eslint/prefer-for-of': 'error', + '@typescript-eslint/prefer-function-type': 'error', + '@typescript-eslint/prefer-namespace-keyword': 'error', + '@typescript-eslint/unified-signatures': 'error', + '@typescript-eslint/no-require-imports': 'off', + '@typescript-eslint/no-explicit-any': 'off', + 'arrow-body-style': 'error', + camelcase: [ + 'error', + { + ignoreDestructuring: true + } + ], + 'constructor-super': 'error', + curly: 'error', + 'dot-notation': 'error', + eqeqeq: ['error', 'smart'], + 'guard-for-in': 'error', + 'max-classes-per-file': ['error', 1], + 'no-nested-ternary': 'error', + 'no-bitwise': 'error', + 'no-caller': 'error', + 'no-cond-assign': 'error', + 'no-console': 'error', + 'no-debugger': 'error', + 'no-empty': 'error', + 'no-eval': 'error', + 'no-new-wrappers': 'error', + 'no-undef-init': 'error', + 'no-unsafe-finally': 'error', + 'no-unused-expressions': 'off', + '@typescript-eslint/no-unused-expressions': [ + 'error', + { + allowTernary: true, + allowShortCircuit: true + } + ], + 'no-unused-labels': 'error', + 'no-var': 'error', + 'object-shorthand': 'error', + 'one-var': ['error', 'never'], + 'prefer-const': 'error', + radix: ['error', 'as-needed'], + 'react/prop-types': 0, + 'react/display-name': 0, + 'react-hooks/exhaustive-deps': 'warn', + 'react/no-unescaped-entities': ['error', { forbid: ['>', '}'] }], + 'spaced-comment': 'error', + 'use-isnan': 'error' + } + }, + { + files: ['**/patternfly-docs/pages/*'], + rules: { + 'arrow-body-style': 'off' + } + } +]; diff --git a/package.json b/package.json index 29b70db..25fb1c4 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,9 @@ "workspaces": [ "packages/*" ], + "engines": { + "node": ">=22" + }, "scripts": { "build": "yarn workspace @patternfly/react-console build", "build:watch": "npm run build:watch -w @patternfly/react-console", @@ -14,8 +17,8 @@ "start": "concurrently --kill-others \"npm run build:watch\" \"npm run docs:develop -w @patternfly/react-console\"", "serve:docs": "yarn workspace @patternfly/react-console docs:serve", "clean": "yarn workspace @patternfly/react-console clean", - "lint:js": "node --max-old-space-size=4096 node_modules/.bin/eslint packages --ext js,jsx,ts,tsx --cache", - "lint:md": "yarn eslint packages --ext md --no-eslintrc --config .eslintrc-md.json --cache", + "lint:js": "node --max-old-space-size=4096 node_modules/.bin/eslint packages --cache", + "lint:md": "yarn eslint \"packages/**/*.md\" --config eslint-md.config.mjs --cache", "lint": "yarn lint:js && yarn lint:md", "test": "TZ=EST jest packages", "test:a11y": "yarn workspace @patternfly/react-console test:a11y", @@ -23,40 +26,36 @@ "screenshots": "yarn workspace @patternfly/react-console docs:screenshots" }, "devDependencies": { - "@babel/core": "^7.24.7", - "@babel/preset-env": "^7.24.7", - "@babel/preset-flow": "^7.24.7", - "@babel/preset-react": "^7.24.7", - "@babel/preset-typescript": "^7.24.7", + "@babel/core": "^7.29.0", + "@babel/preset-env": "^7.29.0", + "@babel/preset-flow": "^7.27.1", + "@babel/preset-react": "^7.28.5", + "@babel/preset-typescript": "^7.28.5", + "@eslint/js": "^9.27.0", + "@eslint/markdown": "^7.0.3", "@testing-library/dom": "9.0.0", - "@testing-library/jest-dom": "5.16.2", + "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^13.4.0", - "@testing-library/user-event": "14.5.2", + "@testing-library/user-event": "14.6.1", "@types/file-saver": "^2.0.7", "@types/react": "^18", "@types/react-dom": "^18", - "@typescript-eslint/eslint-plugin": "^5.42.0", - "@typescript-eslint/parser": "^5.42.0", - "babel-jest": "^29.7.0", - "concurrently": "^5.3.0", - "eslint": "^8.0.1", - "eslint-config-prettier": "8.5.0", - "eslint-config-standard-with-typescript": "^23.0.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-markdown": "^1.0.2", - "eslint-plugin-n": "^15.0.0", - "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-promise": "^6.4.0", - "eslint-plugin-react": "^7.34.3", - "eslint-plugin-react-hooks": "^4.6.2", - "jest": "^29.7.0", + "babel-jest": "^30.3.0", + "concurrently": "^9.2.1", + "eslint": "^9.27.0", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^5.2.0", + "globals": "^16.2.0", + "jest": "^30.3.0", "jest-canvas-mock": "^2.5.2", - "jest-environment-jsdom": "^29.7.0", - "prettier": "2.7.1", + "jest-environment-jsdom": "^30.3.0", + "prettier": "3.8.1", "react": "^18", "react-dom": "^18", - "tslib": "^2.6.3", - "typescript": "^4.7.4" + "tslib": "^2.8.1", + "typescript": "^5.9.3", + "typescript-eslint": "^8.57.0" }, - "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" + "packageManager": "yarn@4.10.3" } diff --git a/packages/module/package.json b/packages/module/package.json index 379eb6e..907fbc4 100644 --- a/packages/module/package.json +++ b/packages/module/package.json @@ -35,13 +35,12 @@ "tag": "prerelease" }, "dependencies": { - "@novnc/novnc": "^1.5.0", + "@novnc/novnc": "1.5.0", "@patternfly/react-core": "^6.0.0", "@patternfly/react-styles": "^6.0.0", "@spice-project/spice-html5": "^0.2.1", - "file-saver": "^1.3.8", - "react-jss": "^10.10.0", - "xterm": "^5.1.0", + "file-saver": "^2.0.5", + "xterm": "^5.3.0", "xterm-addon-fit": "^0.8.0" }, "peerDependencies": { @@ -54,8 +53,8 @@ "@patternfly/patternfly-a11y": "^4.3.1", "@patternfly/react-code-editor": "^6.0.0", "@patternfly/react-table": "^6.0.0", - "monaco-editor": "^0.34.1", - "rimraf": "^2.6.2", - "serve": "^14.2.3" + "monaco-editor": "^0.55.1", + "rimraf": "^6.1.3", + "serve": "^14.2.6" } } diff --git a/packages/module/patternfly-docs/content/extensions/react-console/examples/SerialConsoleCustom.jsx b/packages/module/patternfly-docs/content/extensions/react-console/examples/SerialConsoleCustom.jsx index 56f4dde..6d4a712 100644 --- a/packages/module/patternfly-docs/content/extensions/react-console/examples/SerialConsoleCustom.jsx +++ b/packages/module/patternfly-docs/content/extensions/react-console/examples/SerialConsoleCustom.jsx @@ -1,4 +1,4 @@ -import { useState, useRef, createRef } from 'react'; +import React, { useState, useRef, createRef, useCallback } from 'react'; import { debounce } from '@patternfly/react-core'; import { SerialConsole } from '@patternfly/react-console'; @@ -7,16 +7,24 @@ export const SerialConsoleCustom = () => { const setConnected = useRef(debounce(() => setStatus('connected'), 3000)).current; const ref2 = createRef(); + const onConnect = useCallback(() => { + setStatus('loading'); + setConnected(); + }, [setConnected]); + + const onDisconnect = useCallback(() => { + setStatus('disconnected'); + }, []); + + const onData = useCallback((data) => { + ref2.current?.onDataReceived?.(data); + }, []); + return ( { - setStatus('loading'); - setConnected(); - }} - onDisconnect={() => setStatus('disconnected')} - onData={data => { - ref2.current.onDataReceived(data); - }} + onConnect={onConnect} + onDisconnect={onDisconnect} + onData={onData} status={status} ref={ref2} /> diff --git a/packages/module/patternfly-docs/pages/index.js b/packages/module/patternfly-docs/pages/index.js index 2af4d81..a3b8bde 100644 --- a/packages/module/patternfly-docs/pages/index.js +++ b/packages/module/patternfly-docs/pages/index.js @@ -1,4 +1,3 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars import React from 'react'; import { Title, PageSection } from '@patternfly/react-core'; diff --git a/packages/module/src/components/AccessConsoles/AccessConsoles.tsx b/packages/module/src/components/AccessConsoles/AccessConsoles.tsx index fbc3674..134fc06 100644 --- a/packages/module/src/components/AccessConsoles/AccessConsoles.tsx +++ b/packages/module/src/components/AccessConsoles/AccessConsoles.tsx @@ -8,25 +8,9 @@ import { } from '@patternfly/react-core'; import { constants } from '../common/constants'; -import { createUseStyles } from 'react-jss'; const { NONE_TYPE, SERIAL_CONSOLE_TYPE, VNC_CONSOLE_TYPE, DESKTOP_VIEWER_CONSOLE_TYPE } = constants; -const useStyles = createUseStyles({ - console: { - display: 'grid', - gridTemplateAreas: '\'actions-main actions-extra\'\n \'main main\'', - rowGap: 'var(--pf-t--global--spacer--md)' - }, - consoleActions: { - gridArea: 'actions-main', - display: 'flex', - '> div': { - marginRight: 'var(--pf-t--global--spacer--sm)' - } - } -}); - const getChildTypeName = (child: any) => child && child.props && child.props.type ? child.props.type : (child && child.type && child.type.displayName) || null; @@ -66,7 +50,6 @@ export const AccessConsoles: React.FunctionComponent = ({ textDesktopViewerConsole = 'Desktop viewer', preselectedType = null }) => { - const styles = useStyles(); const typeMap = { [SERIAL_CONSOLE_TYPE]: textSerialConsole, [VNC_CONSOLE_TYPE]: textVncConsole, @@ -154,9 +137,19 @@ export const AccessConsoles: React.FunctionComponent = ({ } }); return ( -
+
{Children.toArray(children).length > 1 && ( -
+