diff --git a/pkg/kdump/kdump-view.jsx b/pkg/kdump/kdump-view.jsx index 0910bc45a391..82f3e91ae8bb 100644 --- a/pkg/kdump/kdump-view.jsx +++ b/pkg/kdump/kdump-view.jsx @@ -31,7 +31,6 @@ import { Tooltip } from "@patternfly/react-core/dist/esm/components/Tooltip/inde import { useDialogs, DialogsContext } from "dialogs.jsx"; import { read_os_release } from "os-release.js"; import { fmt_to_fragments } from 'utils.jsx'; -import { show_modal_dialog } from "cockpit-components-dialog.jsx"; import { FormHelper } from "cockpit-components-form-helper"; import { ModalError } from 'cockpit-components-inline-notification.jsx'; import { PrivilegedButton } from "cockpit-components-privileged"; @@ -316,6 +315,52 @@ const KdumpSettingsModal = ({ settings, initialTarget, handleSave }) => { ); }; +const KdumpTestDialog = ({ verifyMessage, onCrashKernel }) => { + const Dialogs = useDialogs(); + const [task, setTask] = useState(null); + const [error, setError] = useState(null); + + function crash() { + setError(null); + setTask(onCrashKernel() + .then(Dialogs.close) + .catch(error => { + setTask(null); + setError(error); + })); + } + + return ( + + + + {error && } + + + {_("Test kdump settings by crashing the kernel. This may take a while and the system might not automatically reboot. Do not purposefully crash the system while any important task is running.")} + + {verifyMessage && + {verifyMessage} + } + + + + + + + ); +}; + /* Show kdump status of the system and offer options to change or test the state * Expected properties: * kdumpActive kdump service status @@ -340,6 +385,7 @@ export class KdumpPage extends React.Component { } handleTestSettingsClick() { + const Dialogs = this.context; // if we have multiple targets defined, the config is invalid const target = this.props.kdumpStatus.target; let verifyMessage; @@ -359,30 +405,8 @@ export class KdumpPage extends React.Component { } } - // open a dialog to confirm crashing the kernel to test the settings - then do it - const dialogProps = { - title: _("Test kdump settings"), - body: ( - - {_("Test kdump settings by crashing the kernel. This may take a while and the system might not automatically reboot. Do not purposefully crash the system while any important task is running.")} - - {verifyMessage && - {verifyMessage} - } - ), - titleIconVariant: "warning", - }; - // also test modifying properties in subsequent render calls - const footerProps = { - actions: [ - { - clicked: this.props.onCrashKernel.bind(this), - caption: _("Crash system"), - style: 'danger', - } - ], - }; - show_modal_dialog(dialogProps, footerProps); + Dialogs.show(); } handleServiceDetailsClick() { diff --git a/test/verify/check-kdump b/test/verify/check-kdump index b150520a7c50..c79f648abfa0 100755 --- a/test/verify/check-kdump +++ b/test/verify/check-kdump @@ -46,7 +46,7 @@ class KdumpHelpers(testlib.MachineCase): # we should get a warning dialog, confirm browser.click(f".pf-v6-c-modal-box button{self.danger_btn_class}") # wait until we've actually triggered a crash - browser.wait_visible(".apply.pf-m-in-progress") + browser.wait_visible("button.pf-m-in-progress") # wait for disconnect and then try connecting again browser.switch_to_top()