You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cockpit/SOURCES/0005-Show-MSVSPHERE_PRETTY_...

50 lines
2.6 KiB

From 142ff58b85f5267c55e7ae5d77793ad1a412585d Mon Sep 17 00:00:00 2001
From: tigro <tigro@msvsphere-os.ru>
Date: Thu, 17 Oct 2024 13:11:41 +0300
Subject: [PATCH] Show MSVSPHERE_PRETTY_NAME instead of PRETTY_NAME in overview
---
pkg/systemd/overview.jsx | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/pkg/systemd/overview.jsx b/pkg/systemd/overview.jsx
index 7ade0dc27..7ac476b94 100644
--- a/pkg/systemd/overview.jsx
+++ b/pkg/systemd/overview.jsx
@@ -29,6 +29,7 @@ import { Gallery } from "@patternfly/react-core/dist/esm/layouts/Gallery/index.j
import { Dropdown, DropdownItem, DropdownList } from '@patternfly/react-core/dist/esm/components/Dropdown/index.js';
import { MenuToggle, MenuToggleAction } from "@patternfly/react-core/dist/esm/components/MenuToggle";
+import { read_os_release } from "os-release.js";
import { superuser } from "superuser";
import { SystemInformationCard } from './overview-cards/systemInformationCard.jsx';
@@ -59,6 +60,8 @@ class OverviewPage extends React.Component {
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() {
@@ -164,9 +167,12 @@ class OverviewPage extends React.Component {
<h1>
{this.hostname_text()}
</h1>
- {this.state.hostnameData &&
- this.state.hostnameData.OperatingSystemPrettyName &&
- <div className="ct-overview-header-subheading" id="system_information_os_text">{cockpit.format(_("running $0"), this.state.hostnameData.OperatingSystemPrettyName)}</div>}
+ {this.state.osRelease && this.state.osRelease.MSVSPHERE_PRETTY_NAME ? (
+ <div className="ct-overview-header-subheading" id="system_information_os_text">{cockpit.format(_("running $0"), this.state.osRelease.MSVSPHERE_PRETTY_NAME)}</div>
+ ) : (
+ this.state.hostnameData && this.state.hostnameData.OperatingSystemPrettyName &&
+ <div className="ct-overview-header-subheading" id="system_information_os_text">{cockpit.format(_("running $0"), this.state.hostnameData.OperatingSystemPrettyName)}</div>
+ )}
</div>
<div className='ct-overview-header-actions'>
{ show_superuser && <SuperuserIndicator proxy={this.superuser} /> }
--
2.47.0