From a62c5236b9b660803c98da943f2fdbca5faaf588 Mon Sep 17 00:00:00 2001 From: Eugene Zamriy Date: Tue, 21 Nov 2023 00:36:55 +0300 Subject: [PATCH 5/6] Show MSVSPHERE_PRETTY_NAME instead of PRETTY_NAME in overview --- pkg/systemd/overview.jsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/systemd/overview.jsx b/pkg/systemd/overview.jsx index e780a1c5d..3527b02b6 100644 --- a/pkg/systemd/overview.jsx +++ b/pkg/systemd/overview.jsx @@ -28,6 +28,7 @@ import { Page, PageSection, PageSectionVariants } from "@patternfly/react-core/d import { Gallery } from "@patternfly/react-core/dist/esm/layouts/Gallery/index.js"; import { Dropdown, DropdownItem, DropdownPosition, DropdownToggle, DropdownToggleAction } from '@patternfly/react-core/dist/esm/deprecated/components/Dropdown/index.js'; +import { read_os_release } from "os-release.js"; import { superuser } from "superuser"; import { SystemInformationCard } from './overview-cards/systemInformationCard.jsx'; @@ -53,11 +54,14 @@ class OverviewPage extends React.Component { this.state = { actionIsOpen: false, privileged: true, + osRelease: {}, }; this.hostnameMonitor = this.hostnameMonitor.bind(this); this.onPermissionChanged = this.onPermissionChanged.bind(this); this.superuser = cockpit.dbus(null, { bus: "internal" }).proxy("cockpit.Superuser", "/superuser"); + + read_os_release().then(os => this.setState({ osRelease: os || {} })); } componentDidMount() { @@ -154,9 +158,12 @@ class OverviewPage extends React.Component {

{this.hostname_text()}

- {this.state.hostnameData && - this.state.hostnameData.OperatingSystemPrettyName && -
{cockpit.format(_("running $0"), this.state.hostnameData.OperatingSystemPrettyName)}
} + {this.state.osRelease && this.state.osRelease.MSVSPHERE_PRETTY_NAME ? ( +
{cockpit.format(_("running $0"), this.state.osRelease.MSVSPHERE_PRETTY_NAME)}
+ ) : ( + this.state.hostnameData && this.state.hostnameData.OperatingSystemPrettyName && +
{cockpit.format(_("running $0"), this.state.hostnameData.OperatingSystemPrettyName)}
+ )}
{ show_superuser && } -- 2.43.0