mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Add installation method to the about page (#25378)
Co-authored-by: Bram Kragten <mail@bramkragten.nl> Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
0742aed8e7
commit
7c879cc291
@ -26,13 +26,29 @@ export type SystemCheckValue =
|
|||||||
| boolean
|
| boolean
|
||||||
| SystemCheckValueObject;
|
| SystemCheckValueObject;
|
||||||
|
|
||||||
export type SystemHealthInfo = Record<
|
export type SystemHealthInfo = Partial<{
|
||||||
string,
|
homeassistant: {
|
||||||
{
|
info: {
|
||||||
|
version: string;
|
||||||
|
installation_type: string;
|
||||||
|
dev: boolean;
|
||||||
|
hassio: boolean;
|
||||||
|
docker: boolean;
|
||||||
|
user: string;
|
||||||
|
virtualenv: boolean;
|
||||||
|
python_version: string;
|
||||||
|
os_name: string;
|
||||||
|
os_version: string;
|
||||||
|
arch: string;
|
||||||
|
timezone: string;
|
||||||
|
config_dir: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
[domain: string]: {
|
||||||
manage_url?: string;
|
manage_url?: string;
|
||||||
info: Record<string, SystemCheckValue>;
|
info: Record<string, SystemCheckValue>;
|
||||||
}
|
};
|
||||||
>;
|
}>;
|
||||||
|
|
||||||
interface SystemHealthEventInitial {
|
interface SystemHealthEventInitial {
|
||||||
type: "initial";
|
type: "initial";
|
||||||
|
@ -29,6 +29,7 @@ import { mdiHomeAssistant } from "../../../resources/home-assistant-logo-svg";
|
|||||||
import { haStyle } from "../../../resources/styles";
|
import { haStyle } from "../../../resources/styles";
|
||||||
import type { HomeAssistant, Route } from "../../../types";
|
import type { HomeAssistant, Route } from "../../../types";
|
||||||
import { documentationUrl } from "../../../util/documentation-url";
|
import { documentationUrl } from "../../../util/documentation-url";
|
||||||
|
import { subscribeSystemHealthInfo } from "../../../data/system_health";
|
||||||
|
|
||||||
const JS_TYPE = __BUILD__;
|
const JS_TYPE = __BUILD__;
|
||||||
const JS_VERSION = __VERSION__;
|
const JS_VERSION = __VERSION__;
|
||||||
@ -99,6 +100,8 @@ class HaConfigInfo extends LitElement {
|
|||||||
|
|
||||||
@state() private _hassioInfo?: HassioInfo;
|
@state() private _hassioInfo?: HassioInfo;
|
||||||
|
|
||||||
|
@state() private _installationMethod?: string;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
const hass = this.hass;
|
const hass = this.hass;
|
||||||
const customUiList: { name: string; url: string; version: string }[] =
|
const customUiList: { name: string; url: string; version: string }[] =
|
||||||
@ -127,6 +130,14 @@ class HaConfigInfo extends LitElement {
|
|||||||
</a>
|
</a>
|
||||||
<p>Home Assistant</p>
|
<p>Home Assistant</p>
|
||||||
<ul class="versions">
|
<ul class="versions">
|
||||||
|
<li>
|
||||||
|
<span class="version-label"
|
||||||
|
>${this.hass.localize(
|
||||||
|
`ui.panel.config.info.installation_method`
|
||||||
|
)}</span
|
||||||
|
>
|
||||||
|
<span class="version">${this._installationMethod || "…"}</span>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span class="version-label">Core</span>
|
<span class="version-label">Core</span>
|
||||||
<span class="version">${hass.connection.haVersion}</span>
|
<span class="version">${hass.connection.haVersion}</span>
|
||||||
@ -249,6 +260,13 @@ class HaConfigInfo extends LitElement {
|
|||||||
if (isComponentLoaded(this.hass, "hassio")) {
|
if (isComponentLoaded(this.hass, "hassio")) {
|
||||||
this._loadSupervisorInfo();
|
this._loadSupervisorInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const unsubSystemHealth = subscribeSystemHealthInfo(this.hass, (info) => {
|
||||||
|
if (info?.homeassistant) {
|
||||||
|
this._installationMethod = info.homeassistant.info.installation_type;
|
||||||
|
unsubSystemHealth.then((unsub) => unsub());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _loadSupervisorInfo(): Promise<void> {
|
private async _loadSupervisorInfo(): Promise<void> {
|
||||||
|
@ -301,7 +301,7 @@ class DialogSystemInformation extends LitElement {
|
|||||||
} else {
|
} else {
|
||||||
const domains = Object.keys(this._systemInfo).sort(sortKeys);
|
const domains = Object.keys(this._systemInfo).sort(sortKeys);
|
||||||
for (const domain of domains) {
|
for (const domain of domains) {
|
||||||
const domainInfo = this._systemInfo[domain];
|
const domainInfo = this._systemInfo[domain]!;
|
||||||
const keys: TemplateResult[] = [];
|
const keys: TemplateResult[] = [];
|
||||||
|
|
||||||
for (const key of Object.keys(domainInfo.info)) {
|
for (const key of Object.keys(domainInfo.info)) {
|
||||||
@ -387,7 +387,7 @@ class DialogSystemInformation extends LitElement {
|
|||||||
const domainParts: string[] = [];
|
const domainParts: string[] = [];
|
||||||
|
|
||||||
for (const domain of Object.keys(this._systemInfo!).sort(sortKeys)) {
|
for (const domain of Object.keys(this._systemInfo!).sort(sortKeys)) {
|
||||||
const domainInfo = this._systemInfo![domain];
|
const domainInfo = this._systemInfo![domain]!;
|
||||||
let first = true;
|
let first = true;
|
||||||
const parts = [
|
const parts = [
|
||||||
`${
|
`${
|
||||||
|
@ -3110,6 +3110,7 @@
|
|||||||
},
|
},
|
||||||
"info": {
|
"info": {
|
||||||
"caption": "About",
|
"caption": "About",
|
||||||
|
"installation_method": "Installation method",
|
||||||
"copy_menu": "Copy menu",
|
"copy_menu": "Copy menu",
|
||||||
"copy_raw": "Raw text",
|
"copy_raw": "Raw text",
|
||||||
"copy_github": "For GitHub",
|
"copy_github": "For GitHub",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user