Merge pull request #6597 from home-assistant/show-if-healthy

This commit is contained in:
Joakim Sørensen 2020-08-12 15:40:18 +02:00 committed by GitHub
commit 684f098450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 23 deletions

View File

@ -12,6 +12,7 @@ import {
import { fireEvent } from "../../../src/common/dom/fire_event"; import { fireEvent } from "../../../src/common/dom/fire_event";
import "../../../src/components/buttons/ha-call-api-button"; import "../../../src/components/buttons/ha-call-api-button";
import "../../../src/components/ha-card"; import "../../../src/components/ha-card";
import { HassioHostInfo as HassioHostInfoType } from "../../../src/data/hassio/host";
import { import {
HassioSupervisorInfo as HassioSupervisorInfoType, HassioSupervisorInfo as HassioSupervisorInfoType,
setSupervisorOption, setSupervisorOption,
@ -33,6 +34,8 @@ class HassioSupervisorInfo extends LitElement {
@property() public supervisorInfo!: HassioSupervisorInfoType; @property() public supervisorInfo!: HassioSupervisorInfoType;
@property() public hostInfo!: HassioHostInfoType;
@internalProperty() private _errors?: string; @internalProperty() private _errors?: string;
public render(): TemplateResult | void { public render(): TemplateResult | void {
@ -61,27 +64,41 @@ class HassioSupervisorInfo extends LitElement {
</tbody> </tbody>
</table> </table>
<div class="options"> <div class="options">
<ha-settings-row> ${this.supervisorInfo?.supported
<span slot="heading"> ? html` <ha-settings-row>
Share Diagnostics <span slot="heading">
</span> Share Diagnostics
<div slot="description" class="diagnostics-description"> </span>
Share crash reports and diagnostic information. <div slot="description" class="diagnostics-description">
<button Share crash reports and diagnostic information.
class="link" <button
@click=${this._diagnosticsInformationDialog} class="link"
> @click=${this._diagnosticsInformationDialog}
Learn more >
</button> Learn more
</div> </button>
<ha-switch </div>
.checked=${this.supervisorInfo.diagnostics} <ha-switch
@change=${this._toggleDiagnostics} .checked=${this.supervisorInfo.diagnostics}
></ha-switch> @change=${this._toggleDiagnostics}
</ha-settings-row> ></ha-switch>
</ha-settings-row>`
: html`<div class="error">
You are running an unsupported installation.
<a
href="https://github.com/home-assistant/architecture/blob/master/adr/${this.hostInfo.features.includes(
"hassos"
)
? "0015-home-assistant-os.md"
: "0014-home-assistant-supervised.md"}"
target="_blank"
rel="noreferrer"
>Learn More</a
>
</div>`}
</div> </div>
${this._errors ${this._errors
? html` <div class="errors">Error: ${this._errors}</div> ` ? html` <div class="error">Error: ${this._errors}</div> `
: ""} : ""}
</div> </div>
<div class="card-actions"> <div class="card-actions">
@ -143,10 +160,6 @@ class HassioSupervisorInfo extends LitElement {
.info td:nth-child(2) { .info td:nth-child(2) {
text-align: right; text-align: right;
} }
.errors {
color: var(--error-color);
margin-top: 16px;
}
ha-settings-row { ha-settings-row {
padding: 0; padding: 0;
} }

View File

@ -56,6 +56,7 @@ class HassioSystem extends LitElement {
<div class="card-group"> <div class="card-group">
<hassio-supervisor-info <hassio-supervisor-info
.hass=${this.hass} .hass=${this.hass}
.hostInfo=${this.hostInfo}
.supervisorInfo=${this.supervisorInfo} .supervisorInfo=${this.supervisorInfo}
></hassio-supervisor-info> ></hassio-supervisor-info>
<hassio-host-info <hassio-host-info