Add supervisor, OS version info to about page (#12421)

* Add supervisor, OS version info to about page

* description

* description
This commit is contained in:
Bram Kragten 2022-04-25 22:14:32 +02:00 committed by GitHub
parent 1faf60444d
commit 86f39d1d43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 63 additions and 23 deletions

View File

@ -1,6 +1,14 @@
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { property } from "lit/decorators"; import { property, state } from "lit/decorators";
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
import "../../../components/ha-logo-svg"; import "../../../components/ha-logo-svg";
import {
fetchHassioHostInfo,
fetchHassioHassOsInfo,
HassioHassOSInfo,
HassioHostInfo,
} from "../../../data/hassio/host";
import { HassioInfo, fetchHassioInfo } from "../../../data/hassio/supervisor";
import "../../../layouts/hass-subpage"; import "../../../layouts/hass-subpage";
import { haStyle } from "../../../resources/styles"; import { haStyle } from "../../../resources/styles";
import { HomeAssistant, Route } from "../../../types"; import { HomeAssistant, Route } from "../../../types";
@ -21,6 +29,12 @@ class HaConfigInfo extends LitElement {
@property() public route!: Route; @property() public route!: Route;
@state() private _hostInfo?: HassioHostInfo;
@state() private _osInfo?: HassioHassOSInfo;
@state() private _hassioInfo?: HassioInfo;
protected render(): TemplateResult { protected render(): TemplateResult {
const hass = this.hass; const hass = this.hass;
const customUiList: Array<{ name: string; url: string; version: string }> = const customUiList: Array<{ name: string; url: string; version: string }> =
@ -47,7 +61,19 @@ class HaConfigInfo extends LitElement {
</ha-logo-svg> </ha-logo-svg>
</a> </a>
<br /> <br />
<h2>Home Assistant ${hass.connection.haVersion}</h2> <h2>Home Assistant Core ${hass.connection.haVersion}</h2>
${this._hassioInfo
? html`<h2>
Home Assistant Supervisor ${this._hassioInfo.supervisor}
</h2>`
: ""}
${this._osInfo
? html`<h2>Home Assistant OS ${this._osInfo.version}</h2>`
: ""}
${this._hostInfo
? html`<h4>Kernel version ${this._hostInfo.kernel}</h4>
<h4>Agent version ${this._hostInfo.agent_version}</h4>`
: ""}
<p> <p>
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.info.path_configuration", "ui.panel.config.info.path_configuration",
@ -110,23 +136,21 @@ class HaConfigInfo extends LitElement {
"type", "type",
JS_TYPE JS_TYPE
)} )}
${ ${customUiList.length > 0
customUiList.length > 0
? html` ? html`
<div> <div>
${this.hass.localize("ui.panel.config.info.custom_uis")} ${this.hass.localize("ui.panel.config.info.custom_uis")}
${customUiList.map( ${customUiList.map(
(item) => html` (item) => html`
<div> <div>
<a href=${item.url} target="_blank"> ${item.name}</a <a href=${item.url} target="_blank"> ${item.name}</a>:
>: ${item.version} ${item.version}
</div> </div>
` `
)} )}
</div> </div>
` `
: "" : ""}
}
</p> </p>
</div> </div>
<div> <div>
@ -135,7 +159,7 @@ class HaConfigInfo extends LitElement {
.narrow=${this.narrow} .narrow=${this.narrow}
></integrations-card> ></integrations-card>
</div> </div>
</hass-tabs-subpage> </hass-subpage>
`; `;
} }
@ -149,6 +173,22 @@ class HaConfigInfo extends LitElement {
this.requestUpdate(); this.requestUpdate();
} }
}, 1000); }, 1000);
if (isComponentLoaded(this.hass, "hassio")) {
this._loadSupervisorInfo();
}
}
private async _loadSupervisorInfo(): Promise<void> {
const [hostInfo, osInfo, hassioInfo] = await Promise.all([
fetchHassioHostInfo(this.hass),
fetchHassioHassOsInfo(this.hass),
fetchHassioInfo(this.hass),
]);
this._hassioInfo = hassioInfo;
this._osInfo = osInfo;
this._hostInfo = hostInfo;
} }
static get styles(): CSSResultGroup { static get styles(): CSSResultGroup {

View File

@ -1111,7 +1111,7 @@
}, },
"about": { "about": {
"main": "About", "main": "About",
"secondary": "Version, system health and links to documentation" "secondary": "Version, loaded integrations and links to documentation"
} }
}, },
"common": { "common": {
@ -1486,11 +1486,11 @@
"board": "Board" "board": "Board"
}, },
"info": { "info": {
"caption": "Info", "caption": "About",
"copy_menu": "Copy menu", "copy_menu": "Copy menu",
"copy_raw": "Raw Text", "copy_raw": "Raw Text",
"copy_github": "For GitHub", "copy_github": "For GitHub",
"description": "Version, system health and links to documentation", "description": "Version, loaded integration and links to documentation",
"home_assistant_logo": "Home Assistant logo", "home_assistant_logo": "Home Assistant logo",
"path_configuration": "Path to configuration.yaml: {path}", "path_configuration": "Path to configuration.yaml: {path}",
"developed_by": "Developed by a bunch of awesome people.", "developed_by": "Developed by a bunch of awesome people.",