From e1308a463063368a234e18a275ca3635f5abef6a Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Fri, 31 Jul 2026 17:00:20 +0200 Subject: [PATCH 1/3] selinux: Drop commented out code --- pkg/selinux/setroubleshoot-view.jsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/selinux/setroubleshoot-view.jsx b/pkg/selinux/setroubleshoot-view.jsx index 49497aad212e..28b3fc1870df 100644 --- a/pkg/selinux/setroubleshoot-view.jsx +++ b/pkg/selinux/setroubleshoot-view.jsx @@ -249,8 +249,6 @@ class SELinuxStatus extends React.Component { else if (!configUnknown && this.props.selinuxStatus.enforcing !== this.props.selinuxStatus.configEnforcing) note = _("Setting deviates from the configured state and will revert on the next boot."); - // note = _("Setting deviates from the configured state and will revert on the next boot."); - return ( From 20524c5d9a7ba0862ff54fe6d536d3e9932acfa9 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Fri, 31 Jul 2026 17:06:46 +0200 Subject: [PATCH 2/3] selinux: Convert SELinuxStatus to a functional component The component is trivial enough to be ported to a functional component. --- pkg/selinux/setroubleshoot-view.jsx | 90 ++++++++++++++--------------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/pkg/selinux/setroubleshoot-view.jsx b/pkg/selinux/setroubleshoot-view.jsx index 28b3fc1870df..fa65183b381b 100644 --- a/pkg/selinux/setroubleshoot-view.jsx +++ b/pkg/selinux/setroubleshoot-view.jsx @@ -219,58 +219,54 @@ class DismissableError extends React.Component { * changeSelinuxMode function to use for changing the selinux enforcing mode * dismissError function to dismiss the error message */ -class SELinuxStatus extends React.Component { - render() { - const errorMessage = this.props.selinuxStatusError - ? {this.props.selinuxStatusError} - : null; - - if (this.props.selinuxStatus.enabled === undefined) { - // we don't know the current state - return ( -
- {errorMessage} -

{_("SELinux system status is unknown.")}

-
- ); - } else if (!this.props.selinuxStatus.enabled) { - // selinux is disabled on the system, not much we can do - return ( -
- {errorMessage} -

{_("SELinux is disabled on the system.")}

-
- ); - } - const configUnknown = (this.props.selinuxStatus.configEnforcing === undefined); - let note = null; - if (configUnknown) - note = _("The configured state is unknown, it might change on the next boot."); - else if (!configUnknown && this.props.selinuxStatus.enforcing !== this.props.selinuxStatus.configEnforcing) - note = _("Setting deviates from the configured state and will revert on the next boot."); +const SELinuxStatus = ({ selinuxStatus, selinuxStatusError, changeSelinuxMode, dismissError }) => { + const errorMessage = selinuxStatusError + ? {selinuxStatusError} + : null; + if (selinuxStatus.enabled === undefined) { return ( - - - - {_("SELinux policy")} - - - - { note !== null && - - - { "\n" } - { note } - - } +
{errorMessage} - +

{_("SELinux system status is unknown.")}

+
+ ); + } else if (!selinuxStatus.enabled) { + return ( +
+ {errorMessage} +

{_("SELinux is disabled on the system.")}

+
); } -} + const configUnknown = (selinuxStatus.configEnforcing === undefined); + let note = null; + if (configUnknown) + note = _("The configured state is unknown, it might change on the next boot."); + else if (!configUnknown && selinuxStatus.enforcing !== selinuxStatus.configEnforcing) + note = _("Setting deviates from the configured state and will revert on the next boot."); + + return ( + + + + {_("SELinux policy")} + + + + { note !== null && + + + { "\n" } + { note } + + } + {errorMessage} + + ); +}; /* The listing only shows if we have a connection to the dbus API * Otherwise we have blank slate: trying to connect, error From 923588d9ee4e53e1c8f79f2c4facc489ae4dbaaa Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Fri, 31 Jul 2026 17:16:20 +0200 Subject: [PATCH 3/3] storaged: Convert StorageLogsPanel to a functional component This has no state so can be trivially converted. --- pkg/storaged/logs-panel.jsx | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/pkg/storaged/logs-panel.jsx b/pkg/storaged/logs-panel.jsx index 5bf47648f439..18fe196a177d 100644 --- a/pkg/storaged/logs-panel.jsx +++ b/pkg/storaged/logs-panel.jsx @@ -10,18 +10,16 @@ import { LogsPanel } from "cockpit-components-logs-panel.jsx"; const _ = cockpit.gettext; -export class StorageLogsPanel extends React.Component { - render() { - const match = [ - "_SYSTEMD_UNIT=storaged.service", "+", - "_SYSTEMD_UNIT=udisks2.service", "+", - "_SYSTEMD_UNIT=dm-event.service", "+", - "_SYSTEMD_UNIT=smartd.service", "+", - "_SYSTEMD_UNIT=multipathd.service" - ]; +export function StorageLogsPanel() { + const match = [ + "_SYSTEMD_UNIT=storaged.service", "+", + "_SYSTEMD_UNIT=udisks2.service", "+", + "_SYSTEMD_UNIT=dm-event.service", "+", + "_SYSTEMD_UNIT=smartd.service", "+", + "_SYSTEMD_UNIT=multipathd.service" + ]; + const search_options = { prio: "debug", _SYSTEMD_UNIT: "storaged.service,udisks2.service,dm-event.service,smartd.service,multipathd.service" }; + const url = "/system/logs/#/?prio=debug&_SYSTEMD_UNIT=storaged.service,udisks2.service,dm-event.service,smartd.service,multipathd.service"; - const search_options = { prio: "debug", _SYSTEMD_UNIT: "storaged.service,udisks2.service,dm-event.service,smartd.service,multipathd.service" }; - const url = "/system/logs/#/?prio=debug&_SYSTEMD_UNIT=storaged.service,udisks2.service,dm-event.service,smartd.service,multipathd.service"; - return ; - } + return ; }