);
}
});
@@ -260,7 +266,7 @@
* small: If true, a small version is rendered
* with a link to the setup page.
*/
- var OverviewBox = React.createClass({
+ var OverviewBox = createReactClass({
getInitialState: function () {
return { total: 0, used: 0 };
},
@@ -311,8 +317,10 @@
-
{_("Used")}
{used_fmt[0]} {used_fmt[1]}
-
{_("Total")}
{total_fmt[0]} {total_fmt[1]}
+
+
{_("Used")}
{used_fmt[0]} {used_fmt[1]}
+
{_("Total")}
{total_fmt[0]} {total_fmt[1]}
+
diff --git a/pkg/kdump/kdump-view.jsx b/pkg/kdump/kdump-view.jsx
index bacb280eaa7f..a5d14ec00a0c 100644
--- a/pkg/kdump/kdump-view.jsx
+++ b/pkg/kdump/kdump-view.jsx
@@ -21,6 +21,7 @@ var cockpit = require("cockpit");
var _ = cockpit.gettext;
var React = require("react");
+var createReactClass = require('create-react-class');
var OnOffSwitch = require("cockpit-components-onoff.jsx").OnOffSwitch;
var Select = require("cockpit-components-select.jsx");
@@ -43,7 +44,7 @@ var Tooltip = require("cockpit-components-tooltip.jsx").Tooltip;
* nfs and ssh are disabled for now
*/
-var KdumpTargetBody = React.createClass({
+var KdumpTargetBody = createReactClass({
getInitialState: function() {
return {
storeDest: this.props.initialTarget.target, // dialog mode, depends on location
@@ -218,7 +219,7 @@ var KdumpTargetBody = React.createClass({
* reservedMemory memory reserved at boot time for kdump use
* onCrashKernel callback to crash the kernel via kdumpClient, expects a promise
*/
-var KdumpPage = React.createClass({
+var KdumpPage = createReactClass({
getInitialState: function() {
return {
dialogSettings: undefined,
diff --git a/pkg/lib/cockpit-components-detail-page.jsx b/pkg/lib/cockpit-components-detail-page.jsx
index 7187462f4872..afc9af04c4af 100644
--- a/pkg/lib/cockpit-components-detail-page.jsx
+++ b/pkg/lib/cockpit-components-detail-page.jsx
@@ -20,6 +20,7 @@
'use strict';
const React = require('react');
+const PropTypes = require("prop-types");
require('./listing.less');
// TODO remove next line and detail-page.less file as well once React 16 is merged
@@ -48,8 +49,8 @@ const DetailPageRow = ({title, idPrefix, children}) => {
};
DetailPageRow.propTypes = {
- title: React.PropTypes.string,
- idPrefix: React.PropTypes.string, // row will have no elements with id if not specified
+ title: PropTypes.string,
+ idPrefix: PropTypes.string, // row will have no elements with id if not specified
};
const DetailPageHeader = ({title, iconClass, navigateUpTitle, onNavigateUp, actions, idPrefix}) => {
@@ -75,12 +76,12 @@ const DetailPageHeader = ({title, iconClass, navigateUpTitle, onNavigateUp, acti
};
DetailPageHeader.propTypes = {
- title: React.PropTypes.string,
- iconClass: React.PropTypes.string, // className used for an icon
- navigateUpTitle: React.PropTypes.string,
- onNavigateUp: React.PropTypes.func,
- actions: React.PropTypes.object,
- idPrefix: React.PropTypes.string, // header will have no elements with id if not specified
+ title: PropTypes.string,
+ iconClass: PropTypes.string, // className used for an icon
+ navigateUpTitle: PropTypes.string,
+ onNavigateUp: PropTypes.func,
+ actions: PropTypes.object,
+ idPrefix: PropTypes.string, // header will have no elements with id if not specified
};
module.exports = {
diff --git a/pkg/lib/cockpit-components-dialog.jsx b/pkg/lib/cockpit-components-dialog.jsx
index ecddabc93a60..2a9fc503d46a 100644
--- a/pkg/lib/cockpit-components-dialog.jsx
+++ b/pkg/lib/cockpit-components-dialog.jsx
@@ -20,6 +20,9 @@
var cockpit = require("cockpit");
var React = require("react");
var ReactDOM = require("react-dom");
+var PropTypes = require("prop-types");
+var createReactClass = require('create-react-class');
+
var _ = cockpit.gettext;
require("page.css");
@@ -46,13 +49,13 @@ require("cockpit-components-dialog.css");
* - idle_message optional, always show this message on the last row when idle
* - dialog_done optional, callback when dialog is finished (param true if success, false on cancel)
*/
-var DialogFooter = React.createClass({
+var DialogFooter = createReactClass({
propTypes: {
- cancel_clicked: React.PropTypes.func,
- cancel_caption: React.PropTypes.string,
- actions: React.PropTypes.array,
- static_error: React.PropTypes.string,
- dialog_done: React.PropTypes.func,
+ cancel_clicked: PropTypes.func,
+ cancel_caption: PropTypes.string,
+ actions: PropTypes.array,
+ static_error: PropTypes.string,
+ dialog_done: PropTypes.func,
},
getInitialState: function() {
return {
@@ -72,11 +75,11 @@ var DialogFooter = React.createClass({
},
componentDidMount: function() {
document.body.classList.add("modal-in");
- document.addEventListener('keyup', this.keyUpHandler.bind(this));
+ document.addEventListener('keyup', this.keyUpHandler);
},
componentWillUnmount: function() {
document.body.classList.remove("modal-in");
- document.removeEventListener('keyup', this.keyUpHandler.bind(this));
+ document.removeEventListener('keyup', this.keyUpHandler);
},
update_progress: function(msg, cancel) {
this.setState({ action_progress_message: msg, action_progress_cancel: cancel });
@@ -93,7 +96,7 @@ var DialogFooter = React.createClass({
action_canceled: false,
});
- var p = handler(this.update_progress.bind(this))
+ var p = handler(this.update_progress)
.then(function() {
self.setState({ action_in_progress: false, error_message: null });
if (self.props.dialog_done)
@@ -113,7 +116,7 @@ var DialogFooter = React.createClass({
});
if (p.progress)
- p.progress(this.update_progress.bind(this));
+ p.progress(this.update_progress);
this.setState({ action_in_progress_promise: p });
@@ -222,7 +225,7 @@ var DialogFooter = React.createClass({
{ wait_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 {
{
@@ -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 (