diff --git a/src/ContainerCheckpointModal.jsx b/src/ContainerCheckpointModal.jsx
index 6711edda5..8dadad08c 100644
--- a/src/ContainerCheckpointModal.jsx
+++ b/src/ContainerCheckpointModal.jsx
@@ -13,7 +13,6 @@ const ContainerCheckpointModal = ({ containerWillCheckpoint, onAddNotification }
const [keep, setKeep] = useState(false);
const [leaveRunning, setLeaveRunning] = useState(false);
const [tcpEstablished, setTcpEstablished] = useState(false);
- const [ignoreRootFS, setIgnoreRootFS] = useState(false);
const handleCheckpointContainer = () => {
setProgress(true);
@@ -21,7 +20,6 @@ const ContainerCheckpointModal = ({ containerWillCheckpoint, onAddNotification }
keep,
leaveRunning,
tcpEstablished,
- ignoreRootFS,
})
.catch(ex => {
const error = cockpit.format(_("Failed to checkpoint container $0"), containerWillCheckpoint.Names);
@@ -59,9 +57,6 @@ const ContainerCheckpointModal = ({ containerWillCheckpoint, onAddNotification }
-
);
diff --git a/src/ContainerRestoreModal.jsx b/src/ContainerRestoreModal.jsx
index d16ea2f66..4f852367d 100644
--- a/src/ContainerRestoreModal.jsx
+++ b/src/ContainerRestoreModal.jsx
@@ -1,90 +1,71 @@
-import React from 'react';
+import React, { useState } from 'react';
import { Button, Checkbox, Form, Modal } from '@patternfly/react-core';
-import { DialogsContext } from "dialogs.jsx";
+import { useDialogs } from "dialogs.jsx";
import cockpit from 'cockpit';
import * as client from './client.js';
const _ = cockpit.gettext;
-class ContainerRestoreModal extends React.Component {
- static contextType = DialogsContext;
+const ContainerRestoreModal = ({ containerWillRestore, onAddNotification }) => {
+ const Dialogs = useDialogs();
- constructor(props) {
- super(props);
- this.state = {
- inProgress: false,
- keep: false,
- tcpEstablished: false,
- ignoreRootFS: false,
- ignoreStaticIP: false,
- ignoreStaticMAC: false
- };
- this.handleChange = this.handleChange.bind(this);
- }
+ const [inProgress, setInProgress] = useState(false);
+ const [keep, setKeep] = useState(false);
+ const [tcpEstablished, setTcpEstablished] = useState(false);
+ const [ignoreStaticIP, setIgnoreStaticIP] = useState(false);
+ const [ignoreStaticMAC, setIgnoreStaticMAC] = useState(false);
- handleChange(checked, event) {
- if (event.target.type === "checkbox")
- this.setState({ [event.target.name]: event.target.checked });
- }
-
- handleRestoreContainer(args) {
- const Dialogs = this.context;
- const container = this.props.containerWillRestore;
- this.setState({ inProgress: true });
- client.postContainer(container.isSystem, "restore", container.Id, args)
+ const handleRestoreContainer = () => {
+ setInProgress(true);
+ client.postContainer(containerWillRestore.isSystem, "restore", containerWillRestore.Id, {
+ keep,
+ tcpEstablished,
+ ignoreStaticIP,
+ ignoreStaticMAC,
+ })
.catch(ex => {
- const error = cockpit.format(_("Failed to restore container $0"), container.Names);
- this.props.onAddNotification({ type: 'danger', error, errorDetail: ex.message });
- this.setState({ inProgress: false });
+ const error = cockpit.format(_("Failed to restore container $0"), containerWillRestore.Names);
+ onAddNotification({ type: 'danger', error, errorDetail: ex.message });
+ setInProgress(false);
})
.finally(() => {
Dialogs.close();
});
- }
+ };
- render() {
- const Dialogs = this.context;
- return (
-
-
-
- >}
- >
-
-
- );
- }
-}
+ return (
+
+
+
+ >}
+ >
+
+
+ );
+};
export default ContainerRestoreModal;
diff --git a/test/check-application b/test/check-application
index 153f7edb5..a1d555f4f 100755
--- a/test/check-application
+++ b/test/check-application
@@ -1132,7 +1132,6 @@ class TestApplication(testlib.MachineCase):
self.performContainerAction("busybox:latest", "Checkpoint")
b.set_checked('.pf-c-modal-box input#checkpoint-dialog-keep', True)
b.set_checked('.pf-c-modal-box input#checkpoint-dialog-tcpEstablished', True)
- b.set_checked('.pf-c-modal-box input#checkpoint-dialog-ignoreRootFS', True)
b.click('.pf-c-modal-box button:contains(Checkpoint)')
b.wait_not_present('.modal_dialog')
@@ -1175,7 +1174,6 @@ class TestApplication(testlib.MachineCase):
self.performContainerAction("swamped-crate", "Checkpoint")
b.set_checked('.pf-c-modal-box input#checkpoint-dialog-keep', True)
b.set_checked('.pf-c-modal-box input#checkpoint-dialog-tcpEstablished', True)
- b.set_checked('.pf-c-modal-box input#checkpoint-dialog-ignoreRootFS', True)
b.click('.pf-c-modal-box button:contains(Checkpoint)')
with b.wait_timeout(300):