Skip to content

kdump: Port KdumpTestDialog to Dialogs API - #23421

Open
jelly wants to merge 1 commit into
cockpit-project:mainfrom
jelly:kdump-show-modal-dialog
Open

kdump: Port KdumpTestDialog to Dialogs API#23421
jelly wants to merge 1 commit into
cockpit-project:mainfrom
jelly:kdump-show-modal-dialog

Conversation

@jelly

@jelly jelly commented Jun 29, 2026

Copy link
Copy Markdown
Member

Move away from the show_modal_dialog to the new Dialog API.

Related: COCKPIT-1886

@jelly
jelly requested a review from mvollmer June 29, 2026 07:44
Comment thread pkg/kdump/kdump-view.jsx
const [task, setTask] = useState(null);

function crash() {
setTask(onCrashKernel()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't show any error in the dialog when onCrashKernel() throws an exception, right?

I think the old code didn't do that either, and would actually crash JavaScript in that case, because it doesn't provide a set_error function in the footer props. Hmm,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the old code didn't do that either, and would actually crash JavaScript in that case, because it doesn't provide a set_error function in the footer props. Hmm,

No, show_modal_dialog sets set_error by itself. So we are loosing error reporting here.

@mvollmer mvollmer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dialog needs to continue to show errors from running the crashkernel.sh script.

Move away from the `show_modal_dialog` to the new Dialog API.

Related: COCKPIT-1886
@jelly
jelly force-pushed the kdump-show-modal-dialog branch from 8a4ad32 to 855a949 Compare July 6, 2026 07:51
Comment thread pkg/kdump/kdump-view.jsx
Comment on lines +318 to +321
const KdumpTestDialog = ({ verifyMessage, onCrashKernel }) => {
const Dialogs = useDialogs();
const [task, setTask] = useState(null);
const [error, setError] = useState(null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 4 added lines are not executed by any test. Details

Comment thread pkg/kdump/kdump-view.jsx
Comment on lines +323 to +329
function crash() {
setError(null);
setTask(onCrashKernel()
.then(Dialogs.close)
.catch(error => {
setTask(null);
setError(error);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 7 added lines are not executed by any test. Details

Comment thread pkg/kdump/kdump-view.jsx
Comment on lines +333 to +361
return (
<Modal position="top" variant="small" id="kdump-test-dialog" isOpen
onClose={Dialogs.close}>
<ModalHeader title={_("Test kdump settings")} titleIconVariant="warning" />
<ModalBody>
{error && <ModalError dialogError={error.message || error} />}
<Content>
<Content component={ContentVariants.p}>
{_("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.")}
</Content>
{verifyMessage && <Content component={ContentVariants.p}>
{verifyMessage}
</Content>}
</Content>
</ModalBody>
<ModalFooter>
<Button variant="danger"
isLoading={!!task}
isDisabled={!!task}
onClick={crash}>
{_("Crash system")}
</Button>
<Button variant="link"
isDisabled={!!task}
onClick={Dialogs.close}>
{_("Cancel")}
</Button>
</ModalFooter>
</Modal>);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 29 added lines are not executed by any test. Details

Comment thread pkg/kdump/kdump-view.jsx
}

handleTestSettingsClick() {
const Dialogs = this.context;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test. Details

Comment thread pkg/kdump/kdump-view.jsx
Comment on lines +408 to +409
Dialogs.show(<KdumpTestDialog verifyMessage={verifyMessage}
onCrashKernel={this.props.onCrashKernel} />);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 2 added lines are not executed by any test. Details

@jelly jelly added needswork and removed needswork labels Jul 6, 2026
@jelly
jelly requested a review from tomasmatus July 7, 2026 11:04
@jelly

jelly commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

@tomasmatus maybe you can take over the review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants