diff --git a/bots/naughty/debian-stable/9641-xtermjs-dimensions-crash b/bots/naughty/debian-stable/9641-xtermjs-dimensions-crash deleted file mode 100644 index 5a2f524433b4..000000000000 --- a/bots/naughty/debian-stable/9641-xtermjs-dimensions-crash +++ /dev/null @@ -1,4 +0,0 @@ -Traceback (most recent call last): - File "test/verify/machineslib.py", line *, in testSerialConsole -* -RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/debian-testing/9641-xtermjs-dimensions-crash b/bots/naughty/debian-testing/9641-xtermjs-dimensions-crash deleted file mode 100644 index 5a2f524433b4..000000000000 --- a/bots/naughty/debian-testing/9641-xtermjs-dimensions-crash +++ /dev/null @@ -1,4 +0,0 @@ -Traceback (most recent call last): - File "test/verify/machineslib.py", line *, in testSerialConsole -* -RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/fedora-28/9641-xtermjs-dimensions-crash b/bots/naughty/fedora-28/9641-xtermjs-dimensions-crash deleted file mode 100644 index 5a2f524433b4..000000000000 --- a/bots/naughty/fedora-28/9641-xtermjs-dimensions-crash +++ /dev/null @@ -1,4 +0,0 @@ -Traceback (most recent call last): - File "test/verify/machineslib.py", line *, in testSerialConsole -* -RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/fedora-29/9641-xtermjs-dimensions-crash b/bots/naughty/fedora-29/9641-xtermjs-dimensions-crash deleted file mode 100644 index 5a2f524433b4..000000000000 --- a/bots/naughty/fedora-29/9641-xtermjs-dimensions-crash +++ /dev/null @@ -1,4 +0,0 @@ -Traceback (most recent call last): - File "test/verify/machineslib.py", line *, in testSerialConsole -* -RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/rhel-7/9641-xtermjs-dimensions-crash b/bots/naughty/rhel-7/9641-xtermjs-dimensions-crash deleted file mode 100644 index 5a2f524433b4..000000000000 --- a/bots/naughty/rhel-7/9641-xtermjs-dimensions-crash +++ /dev/null @@ -1,4 +0,0 @@ -Traceback (most recent call last): - File "test/verify/machineslib.py", line *, in testSerialConsole -* -RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/rhel-x/9641-xtermjs-dimensions-crash b/bots/naughty/rhel-x/9641-xtermjs-dimensions-crash deleted file mode 100644 index 5a2f524433b4..000000000000 --- a/bots/naughty/rhel-x/9641-xtermjs-dimensions-crash +++ /dev/null @@ -1,4 +0,0 @@ -Traceback (most recent call last): - File "test/verify/machineslib.py", line *, in testSerialConsole -* -RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/ubuntu-1604/9641-xtermjs-dimensions-crash b/bots/naughty/ubuntu-1604/9641-xtermjs-dimensions-crash deleted file mode 100644 index 5a2f524433b4..000000000000 --- a/bots/naughty/ubuntu-1604/9641-xtermjs-dimensions-crash +++ /dev/null @@ -1,4 +0,0 @@ -Traceback (most recent call last): - File "test/verify/machineslib.py", line *, in testSerialConsole -* -RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/naughty/ubuntu-stable/9641-xtermjs-dimensions-crash b/bots/naughty/ubuntu-stable/9641-xtermjs-dimensions-crash deleted file mode 100644 index 5a2f524433b4..000000000000 --- a/bots/naughty/ubuntu-stable/9641-xtermjs-dimensions-crash +++ /dev/null @@ -1,4 +0,0 @@ -Traceback (most recent call last): - File "test/verify/machineslib.py", line *, in testSerialConsole -* -RuntimeError: TypeError: Cannot read property 'dimensions' of undefined diff --git a/bots/npm-update b/bots/npm-update index bb13a632e025..c4eb14900b08 100755 --- a/bots/npm-update +++ b/bots/npm-update @@ -34,8 +34,6 @@ FRAGILE = [ "patternfly", "paternfly-bootstrap-combobox", "requirejs", - # 1.4.x needs the full React 16, does not work with our react-lite 15 - "@patternfly/react-console", # version 0.32.2 switches to babel 7, which causes build failures with our babel 6 build system "react-bootstrap", ] diff --git a/package.json b/package.json index 52afc03a495a..631d12e81a9c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "Cockpit isn't a Node package, these are devel time deps, not needed to build tarball either", "private": true, "dependencies": { - "@patternfly/react-console": "1.3.0", + "@patternfly/react-console": "1.4.2", "angular": "1.3.20", "angular-bootstrap-npm": "0.13.4", "angular-gettext": "2.3.11", @@ -11,6 +11,7 @@ "bootstrap": "3.3.7", "bootstrap-datepicker": "1.8.0", "c3": "0.4.23", + "create-react-class": "15.6.3", "d3": "3.5.17", "jquery": "3.3.1", "jquery-flot": "0.8.3", @@ -27,10 +28,12 @@ "patternfly-bootstrap-combobox": "1.1.7", "patternfly-react": "1.19.1", "promise": "8.0.2", + "prop-types": "15.6.1", "qunit-tap": "1.5.1", "qunitjs": "1.23.1", "react-bootstrap": "0.32.4", - "react-lite": "0.15.39", + "react": "16.4.0", + "react-dom": "16.4.0", "react-redux": "5.0.7", "react-remarkable": "1.1.3", "redux": "3.7.2", diff --git a/pkg/docker/containers-view.jsx b/pkg/docker/containers-view.jsx index fab2f75d1204..7b58ff83aa07 100644 --- a/pkg/docker/containers-view.jsx +++ b/pkg/docker/containers-view.jsx @@ -19,6 +19,9 @@ 'use strict'; +var React = require('react'); +var createReactClass = require('create-react-class'); + var cockpit = require('cockpit'); var _ = cockpit.gettext; @@ -27,14 +30,14 @@ var docker = require('./docker'); var atomic = require('./atomic'); var util = require('./util'); var searchImage = require("./search"); -var React = require('react'); + var Listing = require('cockpit-components-listing.jsx'); var Select = require('cockpit-components-select.jsx'); var moment = require('moment'); moment.locale(cockpit.language); -var Dropdown = React.createClass({ +var Dropdown = createReactClass({ getDefaultProps: function () { return { actions: [ { label: '' } ] @@ -75,7 +78,7 @@ var Dropdown = React.createClass({ } }); -var ContainerHeader = React.createClass({ +var ContainerHeader = createReactClass({ getInitialState: function () { return { filter: 'running', @@ -114,7 +117,7 @@ var ContainerHeader = React.createClass({ } }); -var ContainerDetails = React.createClass({ +var ContainerDetails = createReactClass({ render: function () { var container = this.props.container; return ( @@ -132,7 +135,7 @@ var ContainerDetails = React.createClass({ } }); -var ContainerProblems = React.createClass({ +var ContainerProblems = createReactClass({ onItemClick: function (event) { cockpit.jump(event.currentTarget.dataset.url, cockpit.transport.host); }, @@ -155,7 +158,7 @@ var ContainerProblems = React.createClass({ } }); -var ContainerList = React.createClass({ +var ContainerList = createReactClass({ getDefaultProps: function () { return { client: {}, @@ -371,7 +374,7 @@ var ContainerList = React.createClass({ } }); -var ImageDetails = React.createClass({ +var ImageDetails = createReactClass({ render: function () { var image = this.props.image; var created = moment.unix(image.Created); @@ -403,7 +406,7 @@ var ImageDetails = React.createClass({ } }); -var ImageSecurity = React.createClass({ +var ImageSecurity = createReactClass({ render: function () { var info = this.props.info; var text, rows; @@ -445,7 +448,7 @@ var ImageSecurity = React.createClass({ } }); -var ImageInline = React.createClass({ +var ImageInline = createReactClass({ getInitialState: function () { return { vulnerableInfos: {} @@ -500,7 +503,7 @@ var ImageInline = React.createClass({ } }); -var ImageList = React.createClass({ +var ImageList = createReactClass({ getDefaultProps: function () { return { client: {}, @@ -604,7 +607,7 @@ var ImageList = React.createClass({ element =
; } else { element = { action_buttons } @@ -246,14 +249,14 @@ var DialogFooter = React.createClass({ * - footer (react element, top element should be of class modal-footer) * - id optional, id that is assigned to the top level dialog node, but not the backdrop */ -var Dialog = React.createClass({ +var Dialog = createReactClass({ propTypes: { // TODO: fix following by refactoring the logic showing modal dialog (recently show_modal_dialog()) - title: React.PropTypes.string, // is effectively required, but show_modal_dialog() provides initially no props and resets them later. - no_backdrop: React.PropTypes.bool, - body: React.PropTypes.element, // is effectively required, see above - footer: React.PropTypes.element, // is effectively required, see above - id: React.PropTypes.string, + title: PropTypes.string, // is effectively required, but show_modal_dialog() provides initially no props and resets them later. + no_backdrop: PropTypes.bool, + body: PropTypes.element, // is effectively required, see above + footer: PropTypes.element, // is effectively required, see above + id: PropTypes.string }, componentDidMount: function() { // if we used a button to open this, make sure it's not focused anymore diff --git a/pkg/lib/cockpit-components-file-autocomplete.jsx b/pkg/lib/cockpit-components-file-autocomplete.jsx index acb73e115110..5db1c7ec9e3d 100644 --- a/pkg/lib/cockpit-components-file-autocomplete.jsx +++ b/pkg/lib/cockpit-components-file-autocomplete.jsx @@ -21,16 +21,19 @@ var cockpit = require("cockpit"); var React = require("react"); +var PropTypes = require("prop-types"); +var createReactClass = require('create-react-class'); + var _ = cockpit.gettext; require("./cockpit-components-file-autocomplete.css"); -var FileAutoComplete = React.createClass({ +var FileAutoComplete = createReactClass({ propTypes: { - id: React.PropTypes.string, - placeholder: React.PropTypes.string, - value: React.PropTypes.string, - superuser: React.PropTypes.string, - onChange: React.PropTypes.func, + id: PropTypes.string, + placeholder: PropTypes.string, + value: PropTypes.string, + superuser: PropTypes.string, + onChange: PropTypes.func, }, getInitialState () { var value = this.props.value || ""; diff --git a/pkg/lib/cockpit-components-onoff.jsx b/pkg/lib/cockpit-components-onoff.jsx index 4b2416072856..b823e058eb12 100644 --- a/pkg/lib/cockpit-components-onoff.jsx +++ b/pkg/lib/cockpit-components-onoff.jsx @@ -21,6 +21,8 @@ var cockpit = require("cockpit"); var React = require("react"); +var createReactClass = require('create-react-class'); + var _ = cockpit.gettext; require("./cockpit-components-onoff.css"); @@ -32,7 +34,7 @@ require("./cockpit-components-onoff.css"); * onChange triggered when the switch is flipped, parameter: new state * enabled whether the component is enabled or not, defaults to true */ -var OnOffSwitch = React.createClass({ +var OnOffSwitch = createReactClass({ getDefaultProps: function() { return { captionOff: _("Off"), diff --git a/pkg/lib/cockpit-components-terminal.jsx b/pkg/lib/cockpit-components-terminal.jsx index 6d50f8a843f9..d9af9d35674b 100644 --- a/pkg/lib/cockpit-components-terminal.jsx +++ b/pkg/lib/cockpit-components-terminal.jsx @@ -22,6 +22,9 @@ var React = require("react"); var ReactDOM = require("react-dom"); + var PropTypes = require("prop-types"); + var createReactClass = require('create-react-class'); + var Term = require("term"); require("console.css"); @@ -41,12 +44,12 @@ * * Call focus() to set the input focus on the terminal. */ - var Terminal = React.createClass({ + var Terminal = createReactClass({ propTypes: { - cols: React.PropTypes.number, - rows: React.PropTypes.number, - channel: React.PropTypes.object.isRequired, - onTitleChanged: React.PropTypes.func + cols: PropTypes.number, + rows: PropTypes.number, + channel: PropTypes.object.isRequired, + onTitleChanged: PropTypes.func }, componentWillMount: function () { diff --git a/pkg/lib/cockpit-components-tooltip.jsx b/pkg/lib/cockpit-components-tooltip.jsx index fac67095840b..0e6c5c57d058 100644 --- a/pkg/lib/cockpit-components-tooltip.jsx +++ b/pkg/lib/cockpit-components-tooltip.jsx @@ -20,6 +20,7 @@ "use strict"; var React = require('react'); +var createReactClass = require('create-react-class'); require('./tooltip.css'); @@ -38,7 +39,7 @@ require('./tooltip.css'); * outermost element of the tooltip. */ -var Tooltip = React.createClass({ +var Tooltip = createReactClass({ getInitialState: function () { return { open: false, pos: "top" }; }, diff --git a/pkg/machines/app.jsx b/pkg/machines/app.jsx index e7177fab8c89..da9d67b24597 100644 --- a/pkg/machines/app.jsx +++ b/pkg/machines/app.jsx @@ -16,7 +16,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ -import React from "react"; +import React from 'react'; +import PropTypes from 'prop-types'; + import HostVmsList from "./hostvmslist.jsx"; import LibvirtSlate from "./components/libvirtSlate.jsx"; import { createVmAction } from "./components/create-vm-dialog/createVmDialog.jsx"; @@ -38,7 +40,7 @@ const App = ({ store }) => { actions={createVmAction({ dispatch, systemInfo })} />); }; App.propTypes = { - store: React.PropTypes.object.isRequired, + store: PropTypes.object.isRequired, }; export default App; diff --git a/pkg/machines/components/consoles.jsx b/pkg/machines/components/consoles.jsx index 267be712b9b5..d10ddb2f58c1 100644 --- a/pkg/machines/components/consoles.jsx +++ b/pkg/machines/components/consoles.jsx @@ -16,7 +16,8 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ -import React, { PropTypes } from "react"; +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; import * as Select from "cockpit-components-select.jsx"; diff --git a/pkg/machines/components/create-vm-dialog/createVmDialog.jsx b/pkg/machines/components/create-vm-dialog/createVmDialog.jsx index ebcd65906f69..b1e416f9ee8f 100644 --- a/pkg/machines/components/create-vm-dialog/createVmDialog.jsx +++ b/pkg/machines/components/create-vm-dialog/createVmDialog.jsx @@ -17,8 +17,9 @@ * along with Cockpit; If not, see . */ +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; -import React, { PropTypes } from "react"; import DialogPattern from 'cockpit-components-dialog.jsx'; import * as Select from "cockpit-components-select.jsx"; import FileAutoComplete from "cockpit-components-file-autocomplete.jsx"; @@ -66,6 +67,7 @@ class CreateVM extends React.Component { storageSize: props.vmParams.storageSize, // tied to Unit storageSizeUnit: units.GiB.name, sourceType: props.vmParams.sourceType, + startVm: props.vmParams.startVm }; } @@ -135,6 +137,10 @@ class CreateVM extends React.Component { value = convertToUnit(this.state.storageSize, value, units.GiB); key = 'storageSize'; break; + case 'startVm': { + this.setState({ [key]: value }); + break; + } default: break; } @@ -287,7 +293,7 @@ class CreateVM extends React.Component { diff --git a/pkg/machines/components/deleteDialog.jsx b/pkg/machines/components/deleteDialog.jsx index 6ebd2fb0c08a..cd6ab98511f8 100644 --- a/pkg/machines/components/deleteDialog.jsx +++ b/pkg/machines/components/deleteDialog.jsx @@ -29,7 +29,7 @@ const _ = cockpit.gettext; const DeleteDialogBody = ({ values, onChange }) => { function disk_row(disk) { return ( - + { @@ -84,10 +84,15 @@ export function deleteDialog(vm, dispatch) { if (vm.state == 'running') values.destroy = true; + function body_props() { + return { + title: cockpit.format(_("Confirm deletion of $0"), vm.name), + body: dlg.setProps(body_props())} /> + }; + } + let dlg = show_modal_dialog( - { title: cockpit.format(_("Confirm deletion of $0"), vm.name), - body: dlg.render()} /> - }, + body_props(), { actions: [ { caption: _("Delete"), style: 'danger', diff --git a/pkg/machines/components/diskAdd.jsx b/pkg/machines/components/diskAdd.jsx index 64050c058b2a..b4bc7151342f 100644 --- a/pkg/machines/components/diskAdd.jsx +++ b/pkg/machines/components/diskAdd.jsx @@ -141,7 +141,7 @@ const VolumeName = ({ idPrefix, dialogValues, onValueChanged }) => { type="text" minLength={1} placeholder={_("New Volume Name")} - value={dialogValues.volumeName} + value={dialogValues.volumeName || ""} onChange={e => onValueChanged('volumeName', e.target.value)} />
@@ -347,7 +347,7 @@ class AddDisk extends React.Component { name="source" checked={this.state.mode === CREATE_NEW} onChange={e => this.onValueChanged('mode', CREATE_NEW)} - extraClass={this.state.mode === CREATE_NEW ? "active" : ''} /> + className={this.state.mode === CREATE_NEW ? "active" : ''} /> @@ -359,7 +359,7 @@ class AddDisk extends React.Component { name="source" checked={this.state.mode === USE_EXISTING} onChange={e => this.onValueChanged('mode', USE_EXISTING)} - extraClass={this.state.mode === USE_EXISTING ? "active" : ''} /> + className={this.state.mode === USE_EXISTING ? "active" : ''} /> diff --git a/pkg/machines/components/dropdownButtons.jsx b/pkg/machines/components/dropdownButtons.jsx index 3383000ac727..928b5eb48195 100644 --- a/pkg/machines/components/dropdownButtons.jsx +++ b/pkg/machines/components/dropdownButtons.jsx @@ -16,7 +16,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ -import React, { PropTypes } from "react"; +import React from 'react'; +import PropTypes from 'prop-types'; + import { mouseClick } from '../helpers.es6'; import './dropdownButtons.css'; diff --git a/pkg/machines/components/infoRecord.jsx b/pkg/machines/components/infoRecord.jsx index 51360ed482fb..9652c5a51c9a 100644 --- a/pkg/machines/components/infoRecord.jsx +++ b/pkg/machines/components/infoRecord.jsx @@ -17,7 +17,8 @@ * along with Cockpit; If not, see . */ -import React, { PropTypes } from "react"; +import React from "react"; +import PropTypes from "prop-types"; import { Tooltip } from "cockpit-components-tooltip.jsx"; const InfoRecord = ({id, descr, value, descrClass, valueClass, tooltip}) => { diff --git a/pkg/machines/components/libvirtSlate.jsx b/pkg/machines/components/libvirtSlate.jsx index d4a27efcf084..b2d7c2c45971 100644 --- a/pkg/machines/components/libvirtSlate.jsx +++ b/pkg/machines/components/libvirtSlate.jsx @@ -16,7 +16,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ -import React from "react"; +import React from 'react'; +import PropTypes from 'prop-types'; + import cockpit from 'cockpit'; import { mouseClick } from "../helpers.es6"; import { @@ -142,8 +144,8 @@ class LibvirtSlate extends React.Component { } LibvirtSlate.propTypes = { - dispatch: React.PropTypes.func.isRequired, - libvirtService: React.PropTypes.object.isRequired, + dispatch: PropTypes.func.isRequired, + libvirtService: PropTypes.object.isRequired, }; export default LibvirtSlate; diff --git a/pkg/machines/components/notification/inlineNotification.jsx b/pkg/machines/components/notification/inlineNotification.jsx index f5d3182059da..efa1fedf706f 100644 --- a/pkg/machines/components/notification/inlineNotification.jsx +++ b/pkg/machines/components/notification/inlineNotification.jsx @@ -16,8 +16,10 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; -import React, { PropTypes } from "react"; + import { mouseClick } from '../../helpers.es6'; import { Notification } from "./notification.jsx"; import './inlineNotification.css'; diff --git a/pkg/machines/components/notification/notification.jsx b/pkg/machines/components/notification/notification.jsx index 818d7343fcbb..2fef9ab66a82 100644 --- a/pkg/machines/components/notification/notification.jsx +++ b/pkg/machines/components/notification/notification.jsx @@ -17,7 +17,9 @@ * along with Cockpit; If not, see . */ -import React, { PropTypes } from "react"; +import React from 'react'; +import PropTypes from 'prop-types'; + import { mouseClick } from "../../helpers.es6"; import './notification.css'; diff --git a/pkg/machines/components/notification/notificationArea.jsx b/pkg/machines/components/notification/notificationArea.jsx index 3a9121ce7038..00194ddca74e 100644 --- a/pkg/machines/components/notification/notificationArea.jsx +++ b/pkg/machines/components/notification/notificationArea.jsx @@ -17,7 +17,8 @@ * along with Cockpit; If not, see . */ -import React, { PropTypes } from "react"; +import React from 'react'; +import PropTypes from 'prop-types'; import { Notification, NotificationMessage } from "./notification.jsx"; const NotificationArea = ({ notifications, onDismiss, id }) => { diff --git a/pkg/machines/components/serialConsole.jsx b/pkg/machines/components/serialConsole.jsx index a0a4f3ca9b42..2a49a5d667e5 100644 --- a/pkg/machines/components/serialConsole.jsx +++ b/pkg/machines/components/serialConsole.jsx @@ -16,7 +16,8 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ -import React, { PropTypes } from "react"; +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; import { SerialConsole } from '@patternfly/react-console'; diff --git a/pkg/machines/components/vcpuModal.jsx b/pkg/machines/components/vcpuModal.jsx index 84348c6a61c5..88cb68824ff4 100644 --- a/pkg/machines/components/vcpuModal.jsx +++ b/pkg/machines/components/vcpuModal.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; import { show_modal_dialog } from 'cockpit-components-dialog.jsx'; @@ -199,12 +200,12 @@ class VCPUModalBody extends React.Component { } VCPUModalBody.propTypes = { - vcpus: React.PropTypes.object, - cpu: React.PropTypes.shape({ - topology: React.PropTypes.object.isRequired + vcpus: PropTypes.object, + cpu: PropTypes.shape({ + topology: PropTypes.object.isRequired }).isRequired, - onChange: React.PropTypes.func.isRequired, - hypervisorMax: React.PropTypes.number + onChange: PropTypes.func.isRequired, + hypervisorMax: PropTypes.number }; export default function ({ vm, dispatch, config }) { diff --git a/pkg/machines/components/vm/dummyVm.jsx b/pkg/machines/components/vm/dummyVm.jsx index 5bf10cb768d1..6d29ec137a78 100644 --- a/pkg/machines/components/vm/dummyVm.jsx +++ b/pkg/machines/components/vm/dummyVm.jsx @@ -16,14 +16,17 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ -import React, { PropTypes } from "react"; +import React from 'react'; +import PropTypes from 'prop-types'; + +import { ListingRow } from "cockpit-components-listing.jsx"; + import { rephraseUI, vmId, } from "../../helpers.es6"; import StateIcon from './stateIcon.jsx'; -import { ListingRow } from "cockpit-components-listing.jsx"; /** One Ui Dummy VM in the list (a row) */ diff --git a/pkg/machines/components/vm/stateIcon.jsx b/pkg/machines/components/vm/stateIcon.jsx index 7cd6bd91f31b..048f46e913a6 100644 --- a/pkg/machines/components/vm/stateIcon.jsx +++ b/pkg/machines/components/vm/stateIcon.jsx @@ -16,8 +16,10 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; -import React, { PropTypes } from "react"; + import { rephraseUI, } from "../../helpers.es6"; diff --git a/pkg/machines/components/vm/vm.jsx b/pkg/machines/components/vm/vm.jsx index 5bbac9594127..06b970a69782 100644 --- a/pkg/machines/components/vm/vm.jsx +++ b/pkg/machines/components/vm/vm.jsx @@ -16,8 +16,12 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; -import React, { PropTypes } from "react"; + +import { ListingRow } from "cockpit-components-listing.jsx"; + import { rephraseUI, vmId, @@ -30,7 +34,6 @@ import VmOverviewTab from '../vmOverviewTabLibvirt.jsx'; import VmActions from './vmActions.jsx'; import StateIcon from './stateIcon.jsx'; import VmUsageTab from './vmUsageTab.jsx'; -import { ListingRow } from "cockpit-components-listing.jsx"; const _ = cockpit.gettext; diff --git a/pkg/machines/components/vm/vmActions.jsx b/pkg/machines/components/vm/vmActions.jsx index 7b63526f5695..26e7da69e918 100644 --- a/pkg/machines/components/vm/vmActions.jsx +++ b/pkg/machines/components/vm/vmActions.jsx @@ -17,7 +17,8 @@ * along with Cockpit; If not, see . */ import cockpit from 'cockpit'; -import React, { PropTypes } from "react"; +import React from 'react'; +import PropTypes from 'prop-types'; import { vmId, diff --git a/pkg/machines/components/vm/vmUsageTab.jsx b/pkg/machines/components/vm/vmUsageTab.jsx index c90cede5ccc0..26440216d650 100644 --- a/pkg/machines/components/vm/vmUsageTab.jsx +++ b/pkg/machines/components/vm/vmUsageTab.jsx @@ -16,8 +16,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; -import React, { PropTypes } from "react"; import { logDebug, @@ -108,7 +109,7 @@ class VmUsageTab extends React.Component { } VmUsageTab.propTypes = { - vm: React.PropTypes.object.isRequired, + vm: PropTypes.object.isRequired, onUsageStartPolling: PropTypes.func.isRequired, onUsageStopPolling: PropTypes.func.isRequired, }; diff --git a/pkg/machines/components/vmDiskSourceCell.jsx b/pkg/machines/components/vmDiskSourceCell.jsx index 367212839c48..4e119a1fdfeb 100644 --- a/pkg/machines/components/vmDiskSourceCell.jsx +++ b/pkg/machines/components/vmDiskSourceCell.jsx @@ -16,7 +16,8 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; import InfoRecord from './infoRecord.jsx'; diff --git a/pkg/machines/components/vmDisksTab.jsx b/pkg/machines/components/vmDisksTab.jsx index 1646a0fe0b05..84a7d6398fc3 100644 --- a/pkg/machines/components/vmDisksTab.jsx +++ b/pkg/machines/components/vmDisksTab.jsx @@ -16,8 +16,10 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; + import { Listing, ListingRow } from 'cockpit-components-listing.jsx'; import { Info } from './notification/inlineNotification.jsx'; import { convertToUnit, toReadableNumber, units } from "../helpers.es6"; @@ -113,7 +115,7 @@ const VmDisksTab = ({ idPrefix, disks, actions, renderCapacity, notificationText VmDisksTab.propTypes = { idPrefix: PropTypes.string.isRequired, - actions: PropTypes.arrayOf(React.PropTypes.node), + actions: PropTypes.arrayOf(PropTypes.node), disks: PropTypes.array.isRequired, renderCapacity: PropTypes.bool, notificationText: PropTypes.string, diff --git a/pkg/machines/components/vmDisksTabLibvirt.jsx b/pkg/machines/components/vmDisksTabLibvirt.jsx index 8245f53d9c98..07dfcd5806e6 100644 --- a/pkg/machines/components/vmDisksTabLibvirt.jsx +++ b/pkg/machines/components/vmDisksTabLibvirt.jsx @@ -16,7 +16,8 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; import { vmId } from '../helpers.es6'; diff --git a/pkg/machines/components/vmOverviewTab.jsx b/pkg/machines/components/vmOverviewTab.jsx index 651681f2b9f4..dbf9e429f9b4 100644 --- a/pkg/machines/components/vmOverviewTab.jsx +++ b/pkg/machines/components/vmOverviewTab.jsx @@ -16,8 +16,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; -import React, { PropTypes } from "react"; const _ = cockpit.gettext; diff --git a/pkg/machines/components/vmOverviewTabLibvirt.jsx b/pkg/machines/components/vmOverviewTabLibvirt.jsx index b658c5ef5a64..6286a9183776 100644 --- a/pkg/machines/components/vmOverviewTabLibvirt.jsx +++ b/pkg/machines/components/vmOverviewTabLibvirt.jsx @@ -16,8 +16,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; -import React, { PropTypes } from "react"; import VmOverviewTab, { commonTitles } from './vmOverviewTab.jsx'; import VmLastMessage from './vmLastMessage.jsx'; diff --git a/pkg/machines/components/vnc.jsx b/pkg/machines/components/vnc.jsx index 8f51fcdea569..b4fadf410d70 100644 --- a/pkg/machines/components/vnc.jsx +++ b/pkg/machines/components/vnc.jsx @@ -16,7 +16,8 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ -import React from "react"; +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; import { vmId, logDebug } from '../helpers.es6'; @@ -33,8 +34,8 @@ const Frame = ({ url, novncContainerId }) => { ); }; Frame.propTypes = { - url: React.PropTypes.string.isRequired, - novncContainerId: React.PropTypes.string.isRequired, + url: PropTypes.string.isRequired, + novncContainerId: PropTypes.string.isRequired, }; export const VncActions = ({ vm }) => { diff --git a/pkg/machines/hostvmslist.jsx b/pkg/machines/hostvmslist.jsx index 05aa72c93b2e..95013a13f44e 100644 --- a/pkg/machines/hostvmslist.jsx +++ b/pkg/machines/hostvmslist.jsx @@ -17,8 +17,10 @@ * You should have received a copy of the GNU Lesser General Public License * along with Cockpit; If not, see . */ +import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; -import React, { PropTypes } from "react"; + import { shutdownVm, forceVmOff, diff --git a/pkg/machines/vmnetworktab.jsx b/pkg/machines/vmnetworktab.jsx index 702b72f0a01b..04d399753360 100644 --- a/pkg/machines/vmnetworktab.jsx +++ b/pkg/machines/vmnetworktab.jsx @@ -17,10 +17,11 @@ * along with Cockpit; If not, see . */ import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; import { changeNetworkState } from "./actions/provider-actions.es6"; -import { rephraseUI, vmId } from "./helpers.es6"; import { Listing, ListingRow } from 'cockpit-components-listing.jsx'; +import { rephraseUI, vmId } from "./helpers.es6"; const _ = cockpit.gettext; @@ -156,7 +157,7 @@ const VmNetworkTab = function ({ vm, dispatch, hostDevices }) { }; VmNetworkTab.propTypes = { - vm: React.PropTypes.object.isRequired, + vm: PropTypes.object.isRequired, }; export default VmNetworkTab; diff --git a/pkg/networkmanager/firewall.jsx b/pkg/networkmanager/firewall.jsx index e3fda685c2d2..c3f0dd9fec44 100644 --- a/pkg/networkmanager/firewall.jsx +++ b/pkg/networkmanager/firewall.jsx @@ -99,11 +99,13 @@ class SearchInput extends React.Component { } onValueChanged(event) { + let value = event.target.value; + if (this.timer) window.clearTimeout(this.timer); this.timer = window.setTimeout(() => { - this.props.onChange(event.target.value); + this.props.onChange(value); this.timer = null; }, 300); } @@ -176,23 +178,25 @@ class AddServicesDialogBody extends React.Component { return (
- - - - + + + + + +
- - - -
+ + + +
    { services.map(s => ( -
  • +
@@ -198,7 +201,7 @@ const App = ({ store }) => { ); }; App.propTypes = { - store: React.PropTypes.object.isRequired + store: PropTypes.object.isRequired, }; export default App; diff --git a/pkg/ovirt/components/OVirtTab.jsx b/pkg/ovirt/components/OVirtTab.jsx index 06cad50b7e42..a9e05a1a387a 100644 --- a/pkg/ovirt/components/OVirtTab.jsx +++ b/pkg/ovirt/components/OVirtTab.jsx @@ -143,7 +143,7 @@ const OVirtTab = ({ vm, providerState, dispatch }) => { - + diff --git a/pkg/ovirt/components/vcpuModal.jsx b/pkg/ovirt/components/vcpuModal.jsx index 130a67a341e7..915c0b9504b7 100644 --- a/pkg/ovirt/components/vcpuModal.jsx +++ b/pkg/ovirt/components/vcpuModal.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import cockpit from 'cockpit'; import { show_modal_dialog } from 'cockpit-components-dialog.jsx'; @@ -74,10 +75,10 @@ class VCPUModalBody extends React.Component { } VCPUModalBody.propTypes = { - cpu: React.PropTypes.shape({ - topology: React.PropTypes.object.isRequired + cpu: PropTypes.shape({ + topology: PropTypes.object.isRequired }).isRequired, - onChange: React.PropTypes.func.isRequired, + onChange: PropTypes.func.isRequired, }; export default function ({ vm, dispatch }) { diff --git a/pkg/playground/react-demo-dialog.jsx b/pkg/playground/react-demo-dialog.jsx index 3b17070eedb6..3894d28c87f3 100644 --- a/pkg/playground/react-demo-dialog.jsx +++ b/pkg/playground/react-demo-dialog.jsx @@ -21,11 +21,13 @@ "use strict"; var React = require("react"); + var createReactClass = require('create-react-class'); + var Select = require("cockpit-components-select.jsx"); /* Sample dialog body */ - var PatternDialogBody = React.createClass({ + var PatternDialogBody = createReactClass({ selectChanged: function(value) { console.log("new value: " + value); }, diff --git a/pkg/playground/react-demo-listing.jsx b/pkg/playground/react-demo-listing.jsx index 2e43be91c52b..f7597334e95f 100644 --- a/pkg/playground/react-demo-listing.jsx +++ b/pkg/playground/react-demo-listing.jsx @@ -22,15 +22,17 @@ var React = require("react"); var ReactDOM = require("react-dom"); + var PropTypes = require("prop-types"); + var createReactClass = require('create-react-class'); var cockpitListing = require("cockpit-components-listing.jsx"); /* Sample tab renderer for listing pattern * Shows a caption and the time it was instantiated */ - var DemoListingTab = React.createClass({ + var DemoListingTab = createReactClass({ propTypes: { - description: React.PropTypes.string.isRequired, + description: PropTypes.string.isRequired, }, getInitialState: function() { return { diff --git a/pkg/playground/react-demo-onoff.jsx b/pkg/playground/react-demo-onoff.jsx index 086320dd18e5..ef9c04946bdc 100644 --- a/pkg/playground/react-demo-onoff.jsx +++ b/pkg/playground/react-demo-onoff.jsx @@ -19,10 +19,11 @@ var React = require("react"); var ReactDOM = require("react-dom"); +var createReactClass = require('create-react-class'); var OnOffSwitch = require("cockpit-components-onoff.jsx").OnOffSwitch; -var OnOffDemo = React.createClass({ +var OnOffDemo = createReactClass({ getInitialState: function() { return { onOffA: true, diff --git a/pkg/selinux/setroubleshoot-view.jsx b/pkg/selinux/setroubleshoot-view.jsx index e2f55e5f2b96..730b39ff3319 100644 --- a/pkg/selinux/setroubleshoot-view.jsx +++ b/pkg/selinux/setroubleshoot-view.jsx @@ -21,6 +21,7 @@ var cockpit = require("cockpit"); var _ = cockpit.gettext; var React = require("react"); +var createReactClass = require('create-react-class'); var cockpitListing = require("cockpit-components-listing.jsx"); var OnOffSwitch = require("cockpit-components-onoff.jsx").OnOffSwitch; @@ -28,7 +29,7 @@ var OnOffSwitch = require("cockpit-components-onoff.jsx").OnOffSwitch; /* Show details for an alert, including possible solutions * Props correspond to an item in the setroubleshoot dataStore */ -var SELinuxEventDetails = React.createClass({ +var SELinuxEventDetails = createReactClass({ getInitialState: function() { var expanded; // all details are collapsed by default @@ -154,7 +155,7 @@ var SELinuxEventDetails = React.createClass({ }); /* Show the audit log events for an alert */ -var SELinuxEventLog = React.createClass({ +var SELinuxEventLog = createReactClass({ render: function() { if (!this.props.details) { // details should be requested by default, so we just need to wait for them @@ -185,7 +186,7 @@ var SELinuxEventLog = React.createClass({ * - 'waiting' - display spinner * - 'error' - display error icon */ -var EmptyState = React.createClass({ +var EmptyState = createReactClass({ render: function() { var description = null; if (this.props.description) @@ -220,7 +221,7 @@ var EmptyState = React.createClass({ /* Component to show a dismissable error, message as child text * dismissError callback function triggered when the close button is pressed */ -var DismissableError = React.createClass({ +var DismissableError = createReactClass({ handleDismissError: function(e) { // only consider primary mouse button if (!e || e.button !== 0) @@ -248,7 +249,7 @@ var DismissableError = React.createClass({ * changeSelinuxMode function to use for changing the selinux enforcing mode * dismissError function to dismiss the error message */ -var SELinuxStatus = React.createClass({ +var SELinuxStatus = createReactClass({ render: function() { var errorMessage; if (this.props.selinuxStatusError) { @@ -311,7 +312,7 @@ var SELinuxStatus = React.createClass({ * changeSelinuxMode function to use for changing the selinux enforcing mode * dismissStatusError function that is triggered to dismiss the selinux status error */ -var SETroubleshootPage = React.createClass({ +var SETroubleshootPage = createReactClass({ handleDeleteAlert: function(alertId, e) { // only consider primary mouse button if (!e || e.button !== 0) diff --git a/pkg/shell/active-pages-dialog.jsx b/pkg/shell/active-pages-dialog.jsx index 35144f4fe731..f0286d73410d 100644 --- a/pkg/shell/active-pages-dialog.jsx +++ b/pkg/shell/active-pages-dialog.jsx @@ -18,6 +18,7 @@ */ var React = require("react"); +var createReactClass = require('create-react-class'); var cockpit = require("cockpit"); var _ = cockpit.gettext; @@ -31,7 +32,7 @@ var ListingRow = listingPattern.ListingRow; * - iframes iframe elements on page to list * - selectionChanged callback when the select state changed, parameters: frame object, new value */ -var ActivePagesDialogBody = React.createClass({ +var ActivePagesDialogBody = createReactClass({ render: function() { var self = this; var frames = self.props.iframes.map(function(frame) { diff --git a/pkg/storaged/content-views.jsx b/pkg/storaged/content-views.jsx index 390d6e9d878c..dcc195d70eed 100644 --- a/pkg/storaged/content-views.jsx +++ b/pkg/storaged/content-views.jsx @@ -25,6 +25,7 @@ import { import utils from "./utils.js"; import React from "react"; +import createReactClass from 'create-react-class'; import { Listing, ListingRow } from "cockpit-components-listing.jsx"; import { StorageButton, StorageLink } from "./storage-controls.jsx"; @@ -609,7 +610,7 @@ function vgroup_rows(client, vgroup) { return rows; } -var VGroup = React.createClass({ +var VGroup = createReactClass({ render: function () { var self = this; var vgroup = this.props.vgroup; diff --git a/pkg/storaged/crypto-tab.jsx b/pkg/storaged/crypto-tab.jsx index a8d764b92378..10ebfc7286c3 100644 --- a/pkg/storaged/crypto-tab.jsx +++ b/pkg/storaged/crypto-tab.jsx @@ -29,9 +29,11 @@ import { FormatButton, crypto_options_dialogx_fields, crypto_options_dialog_opti import { CryptoKeyslots } from "./crypto-keyslots.jsx"; +var createReactClass = require('create-react-class'); + var _ = cockpit.gettext; -var CryptoTab = React.createClass({ +var CryptoTab = createReactClass({ render: function () { var self = this; var client = self.props.client; diff --git a/pkg/storaged/dialogx.jsx b/pkg/storaged/dialogx.jsx index dd8751f973d9..5dd66c1213f2 100644 --- a/pkg/storaged/dialogx.jsx +++ b/pkg/storaged/dialogx.jsx @@ -427,7 +427,7 @@ export const SelectOne = (tag, title, options, choices) => { render: (val, change) => { return ( -
+
{ choices.map(c => {c.title}) } @@ -515,7 +515,7 @@ export const SelectSpaces = (tag, title, options, spaces) => { }; return ( -
  • +
  • +
  • - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
    - - - - { urlEntries['default'] } - { urlEntries['custom'] } - - {customURL} -
    - - - - {proxy} -
    - - - -
    - - - -
    - - - -
    - - - -
    + + + + { urlEntries['default'] } + { urlEntries['custom'] } + + {customURL} +
    + + + + {proxy} +
    + + + +
    + + + +
    + + + +
    + + + +
    ); diff --git a/pkg/subscriptions/subscriptions-view.jsx b/pkg/subscriptions/subscriptions-view.jsx index e3680f267f35..d8c23c147262 100644 --- a/pkg/subscriptions/subscriptions-view.jsx +++ b/pkg/subscriptions/subscriptions-view.jsx @@ -17,26 +17,29 @@ * along with Cockpit; If not, see . */ +var React = require("react"); +var createReactClass = require('create-react-class'); + var cockpit = require("cockpit"); var _ = cockpit.gettext; -var React = require("react"); - var cockpitListing = require("cockpit-components-listing.jsx"); // Show details for an installed product -var SubscriptionProductDetails = React.createClass({ +var SubscriptionProductDetails = createReactClass({ render: function() { return ( -
    - {_("Product name")}{this.props.productName} - {_("Product ID")}{this.props.productId} - {_("Version")}{this.props.version} - {_("Architecture")}{this.props.arch} - {_("Status")}{this.props.status} - {_("Starts")}{this.props.starts} - {_("Ends")}{this.props.ends} -
    + + + + + + + + + + +
    {_("Product name")}{this.props.productName}
    {_("Product ID")}{this.props.productId}
    {_("Version")}{this.props.version}
    {_("Architecture")}{this.props.arch}
    {_("Status")}{this.props.status}
    {_("Starts")}{this.props.starts}
    {_("Ends")}{this.props.ends}
    ); } }); @@ -47,7 +50,7 @@ var SubscriptionProductDetails = React.createClass({ * - 'waiting' - display spinner * - 'error' - display error icon */ -var Curtains = React.createClass({ +var Curtains = createReactClass({ render: function() { var description = null; if (this.props.description) @@ -80,7 +83,7 @@ var Curtains = React.createClass({ /* Component to show a dismissable error, message as child text * dismissError callback function triggered when the close button is pressed */ -var DismissableError = React.createClass({ +var DismissableError = createReactClass({ handleDismissError: function(e) { // only consider primary mouse button if (!e || e.button !== 0) @@ -110,7 +113,7 @@ var DismissableError = React.createClass({ * register callback, triggered when user clicks on register * unregister callback, triggered when user clicks on unregister */ -var SubscriptionStatus = React.createClass({ +var SubscriptionStatus = createReactClass({ handleRegisterSystem: function(e) { // only consider primary mouse button if (!e || e.button !== 0) @@ -177,7 +180,7 @@ var SubscriptionStatus = React.createClass({ * register callback, triggered when user clicks on register * unregister callback, triggered when user clicks on unregister */ -var SubscriptionsPage = React.createClass({ +var SubscriptionsPage = createReactClass({ renderCurtains: function() { var icon; var description; @@ -212,7 +215,7 @@ var SubscriptionsPage = React.createClass({ }, ]; var columns = [ { name: itm.productName, 'header': true } ]; - return ; + return ; }); return ( diff --git a/pkg/systemd/terminal.jsx b/pkg/systemd/terminal.jsx index 648d52fb9229..d9bfe15bf7cc 100644 --- a/pkg/systemd/terminal.jsx +++ b/pkg/systemd/terminal.jsx @@ -6,6 +6,8 @@ var React = require("react"); var ReactDOM = require("react-dom"); + var createReactClass = require('create-react-class'); + var componentsTerminal = require("cockpit-components-terminal.jsx"); cockpit.translate(); @@ -18,74 +20,74 @@ * * Spawns the user's shell in the user's home directory. */ - var UserTerminal = React.createClass({displayName: "UserTerminal", - createChannel: function (user) { - return cockpit.channel({ - "payload": "stream", - "spawn": [user.shell || "/bin/bash", "-i"], - "environ": [ - "TERM=xterm-256color", - "PATH=/sbin:/bin:/usr/sbin:/usr/bin" - ], - "directory": user.home || "/", - "pty": true - }); - }, - - getInitialState: function () { - return { - title: 'Terminal' - }; - }, - - componentWillMount: function () { - cockpit.user().done(function (user) { - this.setState({ user: user, channel: this.createChannel(user) }); - }.bind(this)); - }, - - onTitleChanged: function (title) { - this.setState({ title: title }); - }, - - onResetClick: function (event) { - if (event.button !== 0) - return; - - if (this.state.channel) - this.state.channel.close(); - - if (this.state.user) - this.setState({ channel: this.createChannel(this.state.user) }); - - // don't focus the button, but keep it on the terminal - this.refs.resetButton.blur(); - this.refs.terminal.focus(); - }, - - render: function () { - var terminal; - if (this.state.channel) - terminal = (); - else - terminal = Loading...; - - return ( -
    -
    - {this.state.title} - -
    -
    - {terminal} -
    -
    - ); - } + +
    + {terminal} +
    + + ); + } }); ReactDOM.render(, document.getElementById('terminal')); diff --git a/pkg/tuned/change-profile.jsx b/pkg/tuned/change-profile.jsx index 4887a06ea6a8..5ce217aab4ff 100644 --- a/pkg/tuned/change-profile.jsx +++ b/pkg/tuned/change-profile.jsx @@ -19,6 +19,8 @@ var cockpit = require("cockpit"); var React = require("react"); +var PropTypes = require("prop-types"); +var createReactClass = require('create-react-class'); var _ = cockpit.gettext; @@ -31,14 +33,14 @@ var _ = cockpit.gettext; * - description * - click (callback function) */ -var TunedDialogProfile = React.createClass({ +var TunedDialogProfile = createReactClass({ propTypes: { - name: React.PropTypes.string.isRequired, - recommended: React.PropTypes.bool.isRequired, - selected: React.PropTypes.bool.isRequired, - title: React.PropTypes.string.isRequired, - description: React.PropTypes.string.isRequired, - click: React.PropTypes.func.isRequired, + name: PropTypes.string.isRequired, + recommended: PropTypes.bool.isRequired, + selected: PropTypes.bool.isRequired, + title: PropTypes.string.isRequired, + description: PropTypes.string.isRequired, + click: PropTypes.func.isRequired, }, render: function() { var classes = "list-group-item"; @@ -68,11 +70,11 @@ var TunedDialogProfile = React.createClass({ * - title (string) * - description (string) */ -var TunedDialogBody = React.createClass({ +var TunedDialogBody = createReactClass({ propTypes: { - active_profile: React.PropTypes.string.isRequired, - change_selected: React.PropTypes.func.isRequired, - profiles: React.PropTypes.array.isRequired, + active_profile: PropTypes.string.isRequired, + change_selected: PropTypes.func.isRequired, + profiles: PropTypes.array.isRequired, }, getInitialState: function() { return { @@ -103,7 +105,7 @@ var TunedDialogBody = React.createClass({ } }); -var TunedLink = React.createClass({ +var TunedLink = createReactClass({ render: function() { var self = this; diff --git a/pkg/users/local.js b/pkg/users/local.js index 90c6d90d297b..40d2934697c7 100755 --- a/pkg/users/local.js +++ b/pkg/users/local.js @@ -22,6 +22,7 @@ var cockpit = require("cockpit"); var React = require("react"); var ReactDOM = require("react-dom"); +var createReactClass = require('create-react-class'); var Mustache = require("mustache"); var authorized_keys = require("./authorized-keys"); @@ -272,7 +273,7 @@ function is_user_in_group(user, group) { return false; } -var AccountItem = React.createClass({ +var AccountItem = createReactClass({ displayName: 'AccountItem', click: function(ev) { if (ev && ev.button === 0) @@ -287,7 +288,7 @@ var AccountItem = React.createClass({ } }); -var AccountList = React.createClass({ +var AccountList = createReactClass({ displayName: 'AccountList', render: function() { var i, items = []; diff --git a/test/verify/check-ovirt b/test/verify/check-ovirt index d7c120e59092..b62aca612c77 100755 --- a/test/verify/check-ovirt +++ b/test/verify/check-ovirt @@ -346,9 +346,9 @@ class TestOVirtMachines(MachineCase): b.is_present(".machines-vcpu-caution") # Set new socket value - b.set_val("#socketsInput", "2") - b.set_val("#coresInput", "1") - b.set_val("#threadsInput", "2") + b.set_input_text("#socketsInput", "2") + b.set_input_text("#coresInput", "1") + b.set_input_text("#threadsInput", "2") b.wait_val("#machines-vcpu-count-field", "4") diff --git a/test/verify/check-subscriptions b/test/verify/check-subscriptions index 32a9d54416b5..9f3d971b710b 100755 --- a/test/verify/check-subscriptions +++ b/test/verify/check-subscriptions @@ -142,9 +142,9 @@ class TestSubscriptions(MachineCase): # enter server and incorrect login data b.wait_present("#subscription-register-url-custom") b.wait_visible("#subscription-register-url-custom") - b.set_val("#subscription-register-url-custom", "10.111.113.5:8443/candlepin") - b.set_val("#subscription-register-username", "doc") - b.set_val("#subscription-register-password", "wrongpass") + b.set_input_text("#subscription-register-url-custom", "10.111.113.5:8443/candlepin") + b.set_input_text("#subscription-register-username", "doc") + b.set_input_text("#subscription-register-password", "wrongpass") # try to register dialog_register_button_sel = "div.modal-footer .btn-primary" @@ -154,7 +154,7 @@ class TestSubscriptions(MachineCase): b.wait_in_text("body", "Invalid credentials") # enter correct login data and try again, old error should disappear - b.set_val("#subscription-register-password", "password") + b.set_input_text("#subscription-register-password", "password") b.click(dialog_register_button_sel) b.wait_not_in_text("body", "Invalid credentials") @@ -163,17 +163,17 @@ class TestSubscriptions(MachineCase): b.wait_in_text("body", "'Organization' required to register.") # now specify the org - b.set_val("#subscription-register-org", "admin") + b.set_input_text("#subscription-register-org", "admin") # use an activation key activation_key_id = self.candlepin.execute(ACTIVATION_KEY_COMMAND).strip() pool_id = self.candlepin.execute(POOL_COMMAND).strip() key_url = "https://localhost:8443/candlepin/activation_keys/{key}/pools/{pool}".format(key=activation_key_id, pool=pool_id) self.candlepin.execute("curl -s --insecure --request POST --user admin:admin {url}".format(url=key_url)) - b.set_val("#subscription-register-username", "") - b.set_val("#subscription-register-password", "") - b.set_val("#subscription-register-password", "") - b.set_val("#subscription-register-key", "awesome_os_pool") + b.set_input_text("#subscription-register-username", "") + b.set_input_text("#subscription-register-password", "") + b.set_input_text("#subscription-register-password", "") + b.set_input_text("#subscription-register-key", "awesome_os_pool") # try to register again b.click(dialog_register_button_sel) @@ -233,14 +233,14 @@ class TestSubscriptions(MachineCase): # enter server data b.wait_present("#subscription-register-url-custom") b.wait_visible("#subscription-register-url-custom") - b.set_val("#subscription-register-url-custom", "10.111.113.5:8443/candlepin") + b.set_input_text("#subscription-register-url-custom", "10.111.113.5:8443/candlepin") # make sure we have an activation key on the target machine self.candlepin.execute("curl -s --insecure --request POST --user admin:admin {url}".format(url=key_url)) # enter key and org - b.set_val("#subscription-register-key", "awesome_os_pool") - b.set_val("#subscription-register-org", "admin") + b.set_input_text("#subscription-register-key", "awesome_os_pool") + b.set_input_text("#subscription-register-org", "admin") b.click(dialog_register_button_sel) # dialog should disappear diff --git a/test/verify/machineslib.py b/test/verify/machineslib.py index c36608cf96f9..7f58c16a4ec7 100755 --- a/test/verify/machineslib.py +++ b/test/verify/machineslib.py @@ -712,8 +712,8 @@ def testVCPU(self): b.wait_val("#machines-vcpu-max-field", "1") # Set new values - b.set_val("#machines-vcpu-max-field", "4") - b.set_val("#machines-vcpu-count-field", "3") + b.set_input_text("#machines-vcpu-max-field", "4") + b.set_input_text("#machines-vcpu-count-field", "3") # Set new socket value b.wait_present("#socketsSelect li[data-value=2] a") @@ -774,7 +774,7 @@ def testVCPU(self): b.wait_present(".vcpu-detail-modal-table") - b.set_val("#machines-vcpu-count-field", "2") + b.set_input_text("#machines-vcpu-count-field", "2") # Set new socket value b.wait_present("#coresSelect li[data-value=2] a") diff --git a/test/verify/storagelib.py b/test/verify/storagelib.py index 20021d312745..7193a81a088d 100644 --- a/test/verify/storagelib.py +++ b/test/verify/storagelib.py @@ -199,6 +199,8 @@ def dialog_val(self, field): return False else: return self.browser.val(sel + " input[type=text]") + elif ftype == "select": + return self.browser.attr(sel, "data-value") else: return self.browser.val(self.dialog_field(field)) @@ -272,15 +274,17 @@ def dialog_select(self, field, label, val): def dialog_wait_val(self, field, val): sel = self.dialog_field(field) + ftype = self.browser.attr(sel, "data-field-type") if isinstance(val, int): # size slider - ftype = self.browser.attr(sel, "data-field-type") if ftype == "size-slider": self.browser.wait_text(sel + " .size-unit button", "MiB") self.browser.wait_val(sel + " .size-text", str(val)) else: self.browser.wait_val(sel + " .size-unit", "1048576") self.browser.wait_val(sel + " .size-text", str(val)) + elif ftype == "select": + self.browser.wait_attr(sel, "data-value", val) else: self.browser.wait_val(sel, val) diff --git a/webpack.config.js b/webpack.config.js index c4964d74f424..64d535dbb035 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -397,8 +397,6 @@ var aliases = { "angular-route": "angular-route/angular-route.js", "d3": "d3/d3.js", "moment": "moment/moment.js", - "react": "react-lite/dist/react-lite.js", - "react-dom": "react-lite/dist/react-lite.js", "term": "term.js-cockpit/src/term.js" }; @@ -446,6 +444,11 @@ module.exports = { exclude: /\/node_modules\/.*\//, // exclude external dependencies loader: 'strict' // Adds "use strict" }, + /* these are called *.js, but are ES6 */ + { + test: /\/node_modules\/@novnc.*\.js$/, + loader: "babel-loader" + }, { test: /\.jsx$/, loader: "babel-loader"