diff --git a/package.json b/package.json index 58ae0365b6d..1cad2a51143 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,7 @@ "lerna-semantic-release": "^9.1.0", "lint-staged": "^7.0.4", "lodash": "^4.17.0", + "mutation-observer": "^1.0.3", "node-sass": "^4.8.3", "npmlog": "^4.1.2", "prettier": "^1.11.1", @@ -162,7 +163,7 @@ "\\.(css)$": "/packages/react-styles/jest-transform.js" }, "transformIgnorePatterns": [ - "node_modules/(?!@patternfly)" + "node_modules/(?!@patternfly|@novnc)" ], "roots": [ "/packages", diff --git a/packages/react-console/less/console.less b/packages/react-console/less/console.less index d64bf1d8d8c..2bf416d3b0e 100644 --- a/packages/react-console/less/console.less +++ b/packages/react-console/less/console.less @@ -3,13 +3,3 @@ */ @import 'serial-console'; @import 'vnc-console'; - -.console-actions-pf { - float: right; - position: relative; - top: -2em; -} - -.console-actions-buttons-pf { - margin-left: 5px; -} diff --git a/packages/react-console/less/serial-console.less b/packages/react-console/less/serial-console.less index a3bf307194e..b18af475c72 100644 --- a/packages/react-console/less/serial-console.less +++ b/packages/react-console/less/serial-console.less @@ -52,3 +52,13 @@ padding-right: 0px; padding-left: 0px; } + +.console-actions-pf { + float: right; + position: relative; + top: -2em; +} + +.console-actions-buttons-pf { + margin-left: 5px; +} diff --git a/packages/react-console/less/vnc-console.less b/packages/react-console/less/vnc-console.less index d93bc16ec11..3b4ab7b7fdd 100644 --- a/packages/react-console/less/vnc-console.less +++ b/packages/react-console/less/vnc-console.less @@ -1,8 +1,20 @@ .vnc-console { + padding-right: 0px; + padding-left: 0px; + .vnc-console-connecting { background-color: @color-pf-green; } .vnc-console-disconnected { background-color: @color-pf-red; } + .toolbar-pf { + border-bottom: none; + } + .toolbar-pf-results { + padding-top: 10px; + } + .toolbar-pf-action-right .dropdown-menu { + min-width: 102px; /* avoid overflow if DropdownButton is used under Toolbar.RightContent */ + } } diff --git a/packages/react-console/package.json b/packages/react-console/package.json index 319018a8f69..856fd528cbc 100644 --- a/packages/react-console/package.json +++ b/packages/react-console/package.json @@ -37,7 +37,7 @@ "@novnc/novnc": "^1.0.0", "classnames": "^2.2.5", "patternfly": "^3.51.0", - "patternfly-react": "^2.3.4", + "patternfly-react": "^2.10.0", "xterm": "^3.3.0" }, "peerDependencies": { diff --git a/packages/react-console/sass/_serial-console.scss b/packages/react-console/sass/_serial-console.scss index 10e5d0b75da..b8332209863 100644 --- a/packages/react-console/sass/_serial-console.scss +++ b/packages/react-console/sass/_serial-console.scss @@ -52,3 +52,13 @@ padding-right: 0; padding-left: 0; } + +.console-actions-pf { + float: right; + position: relative; + top: -2em; +} + +.console-actions-buttons-pf { + margin-left: 5px; +} diff --git a/packages/react-console/sass/_vnc-console.scss b/packages/react-console/sass/_vnc-console.scss index 7648f93a2e2..04e3bc2b304 100644 --- a/packages/react-console/sass/_vnc-console.scss +++ b/packages/react-console/sass/_vnc-console.scss @@ -6,4 +6,8 @@ .vnc-console-disconnected { background-color: $color-pf-red; } + + .toolbar-pf-action-right .dropdown-menu { + min-width: 102px; + } } diff --git a/packages/react-console/sass/console.scss b/packages/react-console/sass/console.scss index 0b048076da0..1c0c73039bb 100644 --- a/packages/react-console/sass/console.scss +++ b/packages/react-console/sass/console.scss @@ -17,12 +17,3 @@ /** Styling shared by both VncConsole and SerialConsole. */ -.console-actions-pf { - float: right; - position: relative; - top: -2em; -} - -.console-actions-buttons-pf { - margin-left: 5px; -} diff --git a/packages/react-console/src/VncConsole/VncActions.js b/packages/react-console/src/VncConsole/VncActions.js new file mode 100644 index 00000000000..9e6d2367277 --- /dev/null +++ b/packages/react-console/src/VncConsole/VncActions.js @@ -0,0 +1,32 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { DropdownButton, MenuItem, noop } from 'patternfly-react'; + +const VncActions = ({ textSendShortcut, textCtrlAltDel, onCtrlAltDel }) => ( + + + {textCtrlAltDel} + + +); + +VncActions.propTypes = { + onCtrlAltDel: PropTypes.func, + + textCtrlAltDel: PropTypes.string, + textSendShortcut: PropTypes.string +}; + +VncActions.defaultProps = { + onCtrlAltDel: noop, + + textCtrlAltDel: 'Ctrl+Alt+Del', + textSendShortcut: 'Send Key' +}; + +export default VncActions; diff --git a/packages/react-console/src/VncConsole/VncActions.test.js b/packages/react-console/src/VncConsole/VncActions.test.js new file mode 100644 index 00000000000..008fe7b1712 --- /dev/null +++ b/packages/react-console/src/VncConsole/VncActions.test.js @@ -0,0 +1,48 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import React from 'react'; +import { shallow, mount } from 'enzyme'; +import VncActions from './VncActions'; + +test('placeholder render test', () => { + const view = shallow(); + expect(view).toMatchSnapshot(); +}); + +test('VncActions renders correctly component hierarchy', () => { + const view = shallow( + + ); + expect(view).toMatchSnapshot(); +}); + +test('VncActions renders correctly html', () => { + const view = shallow( + + ); + expect(view.html()).toMatchSnapshot(); +}); + +test('VncActions calls ctrl+alt+del action', () => { + const onCtrlAltDel = jest.fn(); + + const wrapper = mount( + + ); + + const button = wrapper.find('a[role="menuitem"]'); + expect(button).toHaveLength(1); + button.simulate('click'); + expect(onCtrlAltDel).toHaveBeenCalledTimes(1); +}); diff --git a/packages/react-console/src/VncConsole/VncConsole.js b/packages/react-console/src/VncConsole/VncConsole.js index 171a9a21af1..99c5ed55d9f 100644 --- a/packages/react-console/src/VncConsole/VncConsole.js +++ b/packages/react-console/src/VncConsole/VncConsole.js @@ -1,11 +1,196 @@ import React from 'react'; +import PropTypes from 'prop-types'; -const propTypes = {}; -const defaultProps = {}; +import * as NovncLog from '@novnc/novnc/core/util/logging'; +import RFB from '@novnc/novnc/core/rfb'; -const VncConsole = () =>
VncConsole
; +import classNames from 'classnames'; +import { Toolbar, noop } from 'patternfly-react'; -VncConsole.propTypes = propTypes; -VncConsole.defaultProps = defaultProps; +import VncActions from './VncActions'; + +const CONNECTING = 'connecting'; +const CONNECTED = 'connected'; +const DISCONNECTED = 'disconnected'; + +/* eslint no-console: ["warn", { allow: ["error"] }] */ + +class VncConsole extends React.Component { + state = { status: CONNECTING }; + + componentDidMount() { + const { + host, + port, + path, + encrypt, + resizeSession, + viewOnly, + shared, + credentials, + repeaterID, + vncLogging, + onInitFailed + } = this.props; + + NovncLog.init_logging(vncLogging); + try { + const protocol = encrypt ? 'wss' : 'ws'; + const url = `${protocol}://${host}:${port}/${path}`; + + const options = { + repeaterID, + shared, + credentials + }; + + this.rfb = new RFB(this.novncElem, url, options); + this.rfb.addEventListener('connect', this.onConnected); + this.rfb.addEventListener('disconnect', this.onDisconnected); + this.rfb.addEventListener('securityfailure', this.onSecurityFailure); + this.rfb.viewOnly = viewOnly; + this.rfb.scaleViewport = false; // if the remote session is smaller than HTML container, the view will be centered + this.rfb.resizeSession = resizeSession; + } catch (e) { + onInitFailed && onInitFailed(e); + this.rfb = undefined; + } + } + + onConnected = () => { + this.setState({ status: CONNECTED }); + }; + + onCtrlAltDel = e => { + if (this.rfb) { + this.rfb.sendCtrlAltDel(); + this.focusVnc(e); + } + }; + + onDisconnected = e => { + this.setState({ status: DISCONNECTED }); + this.props.onDisconnected(e); + }; + + onSecurityFailure = e => { + this.setState({ status: DISCONNECTED }); + this.props.onSecurityFailure(e); + }; + + setNovncElem = e => { + this.novncElem = e; + }; + + focusVnc = e => { + if (e && e.target && e.target.blur) { + e.target.blur(); + } + this.novncElem && this.novncElem.focus(); + }; + + render() { + const { + textDisconnected, + textConnecting, + textSendShortcut, + textCtrlAltDel + } = this.props; + + let status = null; + let rightContent = null; + switch (this.state.status) { + case CONNECTED: + rightContent = ( + + + + ); + break; + case DISCONNECTED: + status = ( +
{textDisconnected}
+ ); + break; + case CONNECTING: + default: + status =
{textConnecting}
; + } + + if (!this.novncStaticComponent) { + // create just once + this.novncStaticComponent =
; + } + + return ( + + {this.props.children} + {rightContent} + + {status} + {this.novncStaticComponent} + + + ); + } +} + +VncConsole.propTypes = { + children: PropTypes.node /** Children nodes */, + + host: PropTypes.string.isRequired /** FQDN or IP to connect to */, + port: PropTypes.string /** TCP Port */, + path: PropTypes.string /** host:port/path */, + encrypt: + PropTypes.bool /** For all following, see: https://github.com/novnc/noVNC/blob/master/docs/API.md */, + resizeSession: + PropTypes.bool /** Change remote session size according to local HTML container */, + viewOnly: PropTypes.bool, + shared: PropTypes.bool, + credentials: + PropTypes.object /** { username: '', password: '', target: ''} */, + repeaterID: PropTypes.string, + vncLogging: PropTypes.string /** log-level for noVNC */, + + topClassName: PropTypes.string /** Enable customization */, + + onDisconnected: PropTypes.func /** Callback. VNC server disconnected. */, + onInitFailed: PropTypes.func /** Initialization of RFB failed */, + onSecurityFailure: PropTypes.func /** Handshake failed */, + + textConnecting: PropTypes.string /** For localization */, + textDisconnected: PropTypes.string, + textSendShortcut: PropTypes.string, + textCtrlAltDel: PropTypes.string +}; + +VncConsole.defaultProps = { + children: null, + + port: '80', + path: '', + encrypt: false, + resizeSession: true, + viewOnly: false, + shared: false, + credentials: undefined, + repeaterID: '', + vncLogging: 'warn', + + topClassName: '', + + onDisconnected: noop, + onInitFailed: noop, + onSecurityFailure: noop, + + textConnecting: 'Connecting', + textDisconnected: 'Disconnected', + textSendShortcut: undefined /** Default value defined in VncActions */, + textCtrlAltDel: undefined /** Default value defined in VncActions */ +}; export default VncConsole; diff --git a/packages/react-console/src/VncConsole/VncConsole.stories.js b/packages/react-console/src/VncConsole/VncConsole.stories.js index cb89a28d7e4..0bfe161a80f 100644 --- a/packages/react-console/src/VncConsole/VncConsole.stories.js +++ b/packages/react-console/src/VncConsole/VncConsole.stories.js @@ -6,14 +6,21 @@ import { inlineTemplate } from 'storybook/decorators/storyTemplates'; import { name } from '../../package.json'; import { storybookPackageName } from 'storybook/constants/siteConstants'; -import VncConsole from './VncConsole'; +// import VncConsole from './VncConsole'; const stories = storiesOf(`${storybookPackageName(name)}/Vnc Console`, module); +const VncConsoleConnector = () => ( +
+ There is recently no mock VNC backend implemented, so preview of the{' '} + VncConsole component is not available. +
+); + stories.add( 'VncConsole', withInfo()(() => { - const story = ; + const story = ; return inlineTemplate({ story, title: 'VncConsole' diff --git a/packages/react-console/src/VncConsole/VncConsole.test.js b/packages/react-console/src/VncConsole/VncConsole.test.js index 76dbd2874bc..327df491db5 100644 --- a/packages/react-console/src/VncConsole/VncConsole.test.js +++ b/packages/react-console/src/VncConsole/VncConsole.test.js @@ -1,9 +1,9 @@ /* eslint-disable import/no-extraneous-dependencies */ import React from 'react'; import { shallow } from 'enzyme'; -import VncConsole from './VncConsole'; +import { VncConsole } from './index'; test('placeholder render test', () => { - const view = shallow(); + const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/react-console/src/VncConsole/__snapshots__/VncActions.test.js.snap b/packages/react-console/src/VncConsole/__snapshots__/VncActions.test.js.snap new file mode 100644 index 00000000000..d81d4711dba --- /dev/null +++ b/packages/react-console/src/VncConsole/__snapshots__/VncActions.test.js.snap @@ -0,0 +1,43 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`VncActions renders correctly component hierarchy 1`] = ` + + + foobar + + +`; + +exports[`VncActions renders correctly html 1`] = `"
"`; + +exports[`placeholder render test 1`] = ` + + + Ctrl+Alt+Del + + +`; diff --git a/packages/react-console/src/VncConsole/__snapshots__/VncConsole.test.js.snap b/packages/react-console/src/VncConsole/__snapshots__/VncConsole.test.js.snap index c2bf632dc27..66927870d89 100644 --- a/packages/react-console/src/VncConsole/__snapshots__/VncConsole.test.js.snap +++ b/packages/react-console/src/VncConsole/__snapshots__/VncConsole.test.js.snap @@ -1,7 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`placeholder render test 1`] = ` -
- VncConsole -
+ + +
+ Connecting +
+
+ + `; diff --git a/packages/react-console/yarn.lock b/packages/react-console/yarn.lock deleted file mode 100644 index 5b9597a40dd..00000000000 --- a/packages/react-console/yarn.lock +++ /dev/null @@ -1,452 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@novnc/novnc@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@novnc/novnc/-/novnc-1.0.0.tgz#76b0e89e6f8738ca8154195baf5b8e6a80bc9105" - -asap@~2.0.3: - version "2.0.6" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" - -babel-runtime@^6.11.6: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.11.0" - -bootstrap-datepicker@^1.7.1: - version "1.8.0" - resolved "https://registry.yarnpkg.com/bootstrap-datepicker/-/bootstrap-datepicker-1.8.0.tgz#c63513931e6f09f16ae9f11b62f32d950df3958e" - dependencies: - jquery ">=1.7.1 <4.0.0" - -bootstrap-sass@^3.3.7: - version "3.3.7" - resolved "https://registry.yarnpkg.com/bootstrap-sass/-/bootstrap-sass-3.3.7.tgz#6596c7ab40f6637393323ab0bc80d064fc630498" - -bootstrap-select@^1.12.2: - version "1.12.4" - resolved "https://registry.yarnpkg.com/bootstrap-select/-/bootstrap-select-1.12.4.tgz#7f15d3c0ce978868d9c09c70f96624f55fa02ee1" - dependencies: - jquery ">=1.8" - -bootstrap-slider-without-jquery@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/bootstrap-slider-without-jquery/-/bootstrap-slider-without-jquery-10.0.0.tgz#5c304461b3b915037c7c118806c8ca08102f5de3" - -bootstrap-slider@^9.9.0: - version "9.10.0" - resolved "https://registry.yarnpkg.com/bootstrap-slider/-/bootstrap-slider-9.10.0.tgz#1103d6bc00cfbfa8cfc9a2599ab518c55643da3f" - -bootstrap-switch@~3.3.4: - version "3.3.4" - resolved "https://registry.yarnpkg.com/bootstrap-switch/-/bootstrap-switch-3.3.4.tgz#70e0aeb2a877c0dc766991de108e2170fc29a2ff" - -bootstrap-touchspin@~3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/bootstrap-touchspin/-/bootstrap-touchspin-3.1.1.tgz#9779deac72aaf577e5e762b8512c747c871d9597" - -bootstrap@3.3.x, bootstrap@^3.3, bootstrap@~3.3.7: - version "3.3.7" - resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-3.3.7.tgz#5a389394549f23330875a3b150656574f8a9eb71" - -breakjs@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/breakjs/-/breakjs-1.0.0.tgz#ec8353a06862eb43962deae09072ee66a4cd8459" - -c3@^0.4.11, c3@~0.4.11: - version "0.4.22" - resolved "https://registry.yarnpkg.com/c3/-/c3-0.4.22.tgz#88b895f06fb6b44314e94b2d7331c3dc98b64d2d" - dependencies: - d3 "~3.5.0" - -change-emitter@^0.1.2: - version "0.1.6" - resolved "https://registry.yarnpkg.com/change-emitter/-/change-emitter-0.1.6.tgz#e8b2fe3d7f1ab7d69a32199aff91ea6931409515" - -classnames@^2.2.5: - version "2.2.5" - resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.5.tgz#fb3801d453467649ef3603c7d61a02bd129bde6d" - -core-js@^1.0.0: - version "1.2.7" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" - -core-js@^2.4.0: - version "2.5.5" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.5.tgz#b14dde936c640c0579a6b50cabcc132dd6127e3b" - -css-element-queries@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/css-element-queries/-/css-element-queries-1.0.2.tgz#a32edfee4a5023688ef4d45f402077306d51d44c" - -d3@~3.5.0, d3@~3.5.17: - version "3.5.17" - resolved "https://registry.yarnpkg.com/d3/-/d3-3.5.17.tgz#bc46748004378b21a360c9fc7cf5231790762fb8" - -datatables.net-bs@>=1.10.9: - version "1.10.16" - resolved "https://registry.yarnpkg.com/datatables.net-bs/-/datatables.net-bs-1.10.16.tgz#b0854f5b374f713ae3db4156c7cea8a760c3de76" - dependencies: - datatables.net "1.10.16" - jquery ">=1.7" - -datatables.net-colreorder-bs@~1.3.2: - version "1.3.3" - resolved "https://registry.yarnpkg.com/datatables.net-colreorder-bs/-/datatables.net-colreorder-bs-1.3.3.tgz#3a9dcb08deebeb5d854079591e06e493ad793a53" - dependencies: - datatables.net-bs ">=1.10.9" - datatables.net-colreorder ">=1.2.0" - jquery ">=1.7" - -datatables.net-colreorder@>=1.2.0, datatables.net-colreorder@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/datatables.net-colreorder/-/datatables.net-colreorder-1.4.1.tgz#389e4b1a274e203979a3718d86c5884d0a0166b6" - dependencies: - datatables.net "^1.10.15" - jquery ">=1.7" - -datatables.net-select@~1.2.0: - version "1.2.5" - resolved "https://registry.yarnpkg.com/datatables.net-select/-/datatables.net-select-1.2.5.tgz#4f764669b464d5576a59c576c1250a5d069aa2e9" - dependencies: - datatables.net "^1.10.15" - jquery ">=1.7" - -datatables.net@1.10.16, datatables.net@^1.10.15: - version "1.10.16" - resolved "https://registry.yarnpkg.com/datatables.net/-/datatables.net-1.10.16.tgz#4b052d1082824261b68eed9d22741b711d3d2469" - dependencies: - jquery ">=1.7" - -dom-helpers@^3.2.0, dom-helpers@^3.2.1, dom-helpers@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.3.1.tgz#fc1a4e15ffdf60ddde03a480a9c0fece821dd4a6" - -drmonty-datatables-colvis@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/drmonty-datatables-colvis/-/drmonty-datatables-colvis-1.1.2.tgz#96ab9edfb48643cc2edda3f87b88933cdee8127c" - dependencies: - jquery ">=1.7.0" - -encoding@^0.1.11: - version "0.1.12" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" - dependencies: - iconv-lite "~0.4.13" - -eonasdan-bootstrap-datetimepicker@^4.17.47: - version "4.17.47" - resolved "https://registry.yarnpkg.com/eonasdan-bootstrap-datetimepicker/-/eonasdan-bootstrap-datetimepicker-4.17.47.tgz#7a49970044065276e7965efd16f822735219e735" - dependencies: - bootstrap "^3.3" - jquery "^1.8.3 || ^2.0 || ^3.0" - moment "^2.10" - moment-timezone "^0.4.0" - -fbjs@^0.8.1, fbjs@^0.8.16: - version "0.8.16" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.16.tgz#5e67432f550dc41b572bf55847b8aca64e5337db" - dependencies: - core-js "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.9" - -font-awesome-sass@^4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/font-awesome-sass/-/font-awesome-sass-4.7.0.tgz#4eda693e915009ce00b228e0964dc5eca9bc34e1" - -font-awesome@^4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/font-awesome/-/font-awesome-4.7.0.tgz#8fa8cf0411a1a31afd07b06d2902bb9fc815a133" - -google-code-prettify@~1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/google-code-prettify/-/google-code-prettify-1.0.5.tgz#9f477f224dbfa62372e5ef803a7e157410400084" - -hoist-non-react-statics@^2.3.1: - version "2.5.0" - resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.0.tgz#d2ca2dfc19c5a91c5a6615ce8e564ef0347e2a40" - -iconv-lite@~0.4.13: - version "0.4.21" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.21.tgz#c47f8733d02171189ebc4a400f3218d348094798" - dependencies: - safer-buffer "^2.1.0" - -invariant@^2.1.0, invariant@^2.2.1: - version "2.2.4" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" - dependencies: - loose-envify "^1.0.0" - -is-stream@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - -isomorphic-fetch@^2.1.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" - dependencies: - node-fetch "^1.0.1" - whatwg-fetch ">=0.10.0" - -jquery-match-height@^0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/jquery-match-height/-/jquery-match-height-0.7.2.tgz#f8d9f3ba5314daab109cf07408674be204be5f0e" - -"jquery@>= 2.1.x", jquery@>=1.7, jquery@>=1.7.0, "jquery@>=1.7.1 <4.0.0", jquery@>=1.8, "jquery@^1.8.3 || ^2.0 || ^3.0": - version "3.3.1" - resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca" - -jquery@~3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787" - -js-tokens@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - -keycode@^2.1.2: - version "2.2.0" - resolved "https://registry.yarnpkg.com/keycode/-/keycode-2.2.0.tgz#3d0af56dc7b8b8e5cba8d0a97f107204eec22b04" - -lodash.orderby@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.orderby/-/lodash.orderby-4.6.0.tgz#e697f04ce5d78522f54d9338b32b81a3393e4eb3" - -loose-envify@^1.0.0, loose-envify@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" - dependencies: - js-tokens "^3.0.0" - -moment-timezone@^0.4.0, moment-timezone@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.4.1.tgz#81f598c3ad5e22cdad796b67ecd8d88d0f5baa06" - dependencies: - moment ">= 2.6.0" - -"moment@>= 2.6.0", moment@^2.10, moment@^2.19.1: - version "2.22.1" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.1.tgz#529a2e9bf973f259c9643d237fda84de3a26e8ad" - -node-fetch@^1.0.1: - version "1.7.3" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - -object-assign@^4.1.0, object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -patternfly-bootstrap-combobox@~1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/patternfly-bootstrap-combobox/-/patternfly-bootstrap-combobox-1.1.7.tgz#6a5e3ccd1170c21b3c4b4aa168a7413e1ddbb6e1" - -patternfly-bootstrap-treeview@~2.1.0: - version "2.1.5" - resolved "https://registry.yarnpkg.com/patternfly-bootstrap-treeview/-/patternfly-bootstrap-treeview-2.1.5.tgz#4c29f2582fb8a2f28f0a928f2f0d324d21d6990d" - dependencies: - bootstrap "3.3.x" - jquery ">= 2.1.x" - -patternfly-react@^1.19.1: - version "1.19.1" - resolved "https://registry.yarnpkg.com/patternfly-react/-/patternfly-react-1.19.1.tgz#915db19b45370a03b2669acd4797a7dafa0a4c08" - dependencies: - bootstrap-slider-without-jquery "^10.0.0" - breakjs "^1.0.0" - classnames "^2.2.5" - css-element-queries "^1.0.1" - patternfly "^3.42.0" - react-bootstrap "^0.32.1" - react-bootstrap-switch "^15.5.3" - react-c3js "^0.1.20" - react-fontawesome "^1.6.1" - reactabular-table "^8.12.1" - recompose "^0.26.0" - optionalDependencies: - lodash.orderby "^4.6.0" - sortabular "^1.5.1" - table-resolver "^3.2.0" - -patternfly@^3.42.0, patternfly@^3.45.0: - version "3.45.0" - resolved "https://registry.yarnpkg.com/patternfly/-/patternfly-3.45.0.tgz#5b27bde3e3ef68a1542906b96016654aa089a7f3" - dependencies: - bootstrap "~3.3.7" - font-awesome "^4.7.0" - jquery "~3.2.1" - optionalDependencies: - bootstrap-datepicker "^1.7.1" - bootstrap-sass "^3.3.7" - bootstrap-select "^1.12.2" - bootstrap-slider "^9.9.0" - bootstrap-switch "~3.3.4" - bootstrap-touchspin "~3.1.1" - c3 "~0.4.11" - d3 "~3.5.17" - datatables.net "^1.10.15" - datatables.net-colreorder "^1.4.1" - datatables.net-colreorder-bs "~1.3.2" - datatables.net-select "~1.2.0" - drmonty-datatables-colvis "~1.1.2" - eonasdan-bootstrap-datetimepicker "^4.17.47" - font-awesome-sass "^4.7.0" - google-code-prettify "~1.0.5" - jquery-match-height "^0.7.2" - moment "^2.19.1" - moment-timezone "^0.4.1" - patternfly-bootstrap-combobox "~1.1.7" - patternfly-bootstrap-treeview "~2.1.0" - -promise@^7.1.1: - version "7.3.1" - resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" - dependencies: - asap "~2.0.3" - -prop-types-extra@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/prop-types-extra/-/prop-types-extra-1.0.1.tgz#a57bd4810e82d27a3ff4317ecc1b4ad005f79a82" - dependencies: - warning "^3.0.0" - -prop-types@^15.5.10, prop-types@^15.5.6, prop-types@^15.6.1: - version "15.6.1" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.1.tgz#36644453564255ddda391191fb3a125cbdf654ca" - dependencies: - fbjs "^0.8.16" - loose-envify "^1.3.1" - object-assign "^4.1.1" - -react-bootstrap-switch@^15.5.3: - version "15.5.3" - resolved "https://registry.yarnpkg.com/react-bootstrap-switch/-/react-bootstrap-switch-15.5.3.tgz#97287791d4ec0d1892d142542e7e5248002b1251" - -react-bootstrap@^0.32.1: - version "0.32.1" - resolved "https://registry.yarnpkg.com/react-bootstrap/-/react-bootstrap-0.32.1.tgz#60624c1b48a39d773ef6cce6421a4f33ecc166bb" - dependencies: - babel-runtime "^6.11.6" - classnames "^2.2.5" - dom-helpers "^3.2.0" - invariant "^2.2.1" - keycode "^2.1.2" - prop-types "^15.5.10" - prop-types-extra "^1.0.1" - react-overlays "^0.8.0" - react-prop-types "^0.4.0" - react-transition-group "^2.0.0" - uncontrollable "^4.1.0" - warning "^3.0.0" - -react-c3js@^0.1.20: - version "0.1.20" - resolved "https://registry.yarnpkg.com/react-c3js/-/react-c3js-0.1.20.tgz#561bb211bd691be42af39726d11bab42d09f3e7b" - dependencies: - c3 "^0.4.11" - -react-fontawesome@^1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/react-fontawesome/-/react-fontawesome-1.6.1.tgz#eddce17e7dc731aa09fd4a186688a61793a16c5c" - dependencies: - prop-types "^15.5.6" - -react-overlays@^0.8.0: - version "0.8.3" - resolved "https://registry.yarnpkg.com/react-overlays/-/react-overlays-0.8.3.tgz#fad65eea5b24301cca192a169f5dddb0b20d3ac5" - dependencies: - classnames "^2.2.5" - dom-helpers "^3.2.1" - prop-types "^15.5.10" - prop-types-extra "^1.0.1" - react-transition-group "^2.2.0" - warning "^3.0.0" - -react-prop-types@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/react-prop-types/-/react-prop-types-0.4.0.tgz#f99b0bfb4006929c9af2051e7c1414a5c75b93d0" - dependencies: - warning "^3.0.0" - -react-transition-group@^2.0.0, react-transition-group@^2.2.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.3.1.tgz#31d611b33e143a5e0f2d94c348e026a0f3b474b6" - dependencies: - dom-helpers "^3.3.1" - loose-envify "^1.3.1" - prop-types "^15.6.1" - -reactabular-table@^8.12.1: - version "8.12.1" - resolved "https://registry.yarnpkg.com/reactabular-table/-/reactabular-table-8.12.1.tgz#7155a725da95fe0a11dd00e53123fd77cdeb5b40" - dependencies: - classnames "^2.2.5" - -recompose@^0.26.0: - version "0.26.0" - resolved "https://registry.yarnpkg.com/recompose/-/recompose-0.26.0.tgz#9babff039cb72ba5bd17366d55d7232fbdfb2d30" - dependencies: - change-emitter "^0.1.2" - fbjs "^0.8.1" - hoist-non-react-statics "^2.3.1" - symbol-observable "^1.0.4" - -regenerator-runtime@^0.11.0: - version "0.11.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" - -safer-buffer@^2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - -setimmediate@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" - -sortabular@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/sortabular/-/sortabular-1.5.1.tgz#56316ee5755435d3d357bb81f5e2caa4a5ab95b0" - -symbol-observable@^1.0.4: - version "1.2.0" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" - -table-resolver@^3.2.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/table-resolver/-/table-resolver-3.3.0.tgz#22e575d3c6aed15404ab71a0f2046c4ff55e556e" - -ua-parser-js@^0.7.9: - version "0.7.17" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.17.tgz#e9ec5f9498b9ec910e7ae3ac626a805c4d09ecac" - -uncontrollable@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/uncontrollable/-/uncontrollable-4.1.0.tgz#e0358291252e1865222d90939b19f2f49f81c1a9" - dependencies: - invariant "^2.1.0" - -warning@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/warning/-/warning-3.0.0.tgz#32e5377cb572de4ab04753bdf8821c01ed605b7c" - dependencies: - loose-envify "^1.0.0" - -whatwg-fetch@>=0.10.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" - -xterm@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.3.0.tgz#b09a19fc2cd5decd21112e5c9dab0b61991f6cf3" diff --git a/test.env.js b/test.env.js index 674e151833e..7c29225040f 100644 --- a/test.env.js +++ b/test.env.js @@ -4,4 +4,10 @@ import Adapter from 'enzyme-adapter-react-16'; import { preventInjection } from './packages/react-styles'; preventInjection(); + +const MutationObserverPolyfill = require('mutation-observer'); +// referenced from '@novnc/nvnc/core/util/events.js' +// The MutationObserver is available in supported browsers, this is workaround for "jest" +global.MutationObserver = global.MutationObserver || MutationObserverPolyfill; + configure({ adapter: new Adapter() }); diff --git a/yarn.lock b/yarn.lock index ee293ccc40b..eec48156250 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9772,6 +9772,10 @@ ms@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" +mutation-observer@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/mutation-observer/-/mutation-observer-1.0.3.tgz#42e9222b101bca82e5ba9d5a7acf4a14c0f263d0" + mute-stream@0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.6.tgz#48962b19e169fd1dfc240b3f1e7317627bbc47db"