mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-01 13:37:47 +00:00
Add supervisor-connectivity
This commit is contained in:
parent
845411b48c
commit
bc14d6dfcb
@ -1,3 +1,4 @@
|
|||||||
|
import "../components/supervisor-connectivity";
|
||||||
import "@material/mwc-icon-button/mwc-icon-button";
|
import "@material/mwc-icon-button/mwc-icon-button";
|
||||||
import { ActionDetail } from "@material/mwc-list/mwc-list-foundation";
|
import { ActionDetail } from "@material/mwc-list/mwc-list-foundation";
|
||||||
import "@material/mwc-list/mwc-list-item";
|
import "@material/mwc-list/mwc-list-item";
|
||||||
@ -133,6 +134,8 @@ class HassioAddonStore extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
|
<supervisor-connectivity .supervisor=${this.supervisor}>
|
||||||
|
</supervisor-connectivity>
|
||||||
</hass-tabs-subpage>
|
</hass-tabs-subpage>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import "../components/supervisor-connectivity";
|
||||||
import {
|
import {
|
||||||
mdiCogs,
|
mdiCogs,
|
||||||
mdiFileDocument,
|
mdiFileDocument,
|
||||||
@ -129,6 +130,8 @@ class HassioAddonDashboard extends LitElement {
|
|||||||
.supervisor=${this.supervisor}
|
.supervisor=${this.supervisor}
|
||||||
.addon=${this.addon}
|
.addon=${this.addon}
|
||||||
></hassio-addon-router>
|
></hassio-addon-router>
|
||||||
|
<supervisor-connectivity .supervisor=${this.supervisor}>
|
||||||
|
</supervisor-connectivity>
|
||||||
</hass-tabs-subpage>
|
</hass-tabs-subpage>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -177,8 +180,9 @@ class HassioAddonDashboard extends LitElement {
|
|||||||
const requestedAddon = extractSearchParam("addon");
|
const requestedAddon = extractSearchParam("addon");
|
||||||
if (requestedAddon) {
|
if (requestedAddon) {
|
||||||
const addonsInfo = await fetchHassioAddonsInfo(this.hass);
|
const addonsInfo = await fetchHassioAddonsInfo(this.hass);
|
||||||
const validAddon = addonsInfo.addons
|
const validAddon = addonsInfo.addons.some(
|
||||||
.some((addon) => addon.slug === requestedAddon);
|
(addon) => addon.slug === requestedAddon
|
||||||
|
);
|
||||||
if (!validAddon) {
|
if (!validAddon) {
|
||||||
this._error = this.supervisor.localize("my.error_addon_not_found");
|
this._error = this.supervisor.localize("my.error_addon_not_found");
|
||||||
} else {
|
} else {
|
||||||
|
57
hassio/src/components/supervisor-connectivity.ts
Normal file
57
hassio/src/components/supervisor-connectivity.ts
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import {
|
||||||
|
css,
|
||||||
|
CSSResult,
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
LitElement,
|
||||||
|
property,
|
||||||
|
TemplateResult,
|
||||||
|
} from "lit-element";
|
||||||
|
import { Supervisor } from "../../../src/data/supervisor/supervisor";
|
||||||
|
import { haStyle } from "../../../src/resources/styles";
|
||||||
|
|
||||||
|
@customElement("supervisor-connectivity")
|
||||||
|
class SupervisorConnectivity extends LitElement {
|
||||||
|
@property({ attribute: false }) public supervisor!: Supervisor;
|
||||||
|
|
||||||
|
protected render(): TemplateResult {
|
||||||
|
if (
|
||||||
|
!this.supervisor.network.host_internet &&
|
||||||
|
this.supervisor.network.supervisor_internet
|
||||||
|
) {
|
||||||
|
return html``;
|
||||||
|
}
|
||||||
|
|
||||||
|
return html`<div class="connectivity">
|
||||||
|
<span>The supervisor has lost connectivity.</span>
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get styles(): CSSResult[] {
|
||||||
|
return [
|
||||||
|
haStyle,
|
||||||
|
css`
|
||||||
|
.connectivity {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
height: 32px;
|
||||||
|
width: 100vw;
|
||||||
|
background-color: var(--error-color);
|
||||||
|
color: var(--primary-text-color);
|
||||||
|
font-weight: 500;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
span {
|
||||||
|
padding-left: 16px;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"supervisor-connectivity": SupervisorConnectivity;
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
import "../components/supervisor-connectivity";
|
||||||
import {
|
import {
|
||||||
css,
|
css,
|
||||||
CSSResult,
|
CSSResult,
|
||||||
@ -49,6 +50,8 @@ class HassioDashboard extends LitElement {
|
|||||||
.supervisor=${this.supervisor}
|
.supervisor=${this.supervisor}
|
||||||
></hassio-addons>
|
></hassio-addons>
|
||||||
</div>
|
</div>
|
||||||
|
<supervisor-connectivity .supervisor=${this.supervisor}>
|
||||||
|
</supervisor-connectivity>
|
||||||
</hass-tabs-subpage>
|
</hass-tabs-subpage>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import "../components/supervisor-connectivity";
|
||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import "@material/mwc-icon-button";
|
import "@material/mwc-icon-button";
|
||||||
import { ActionDetail } from "@material/mwc-list/mwc-list-foundation";
|
import { ActionDetail } from "@material/mwc-list/mwc-list-foundation";
|
||||||
@ -269,6 +270,8 @@ class HassioSnapshots extends LitElement {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<supervisor-connectivity .supervisor=${this.supervisor}>
|
||||||
|
</supervisor-connectivity>
|
||||||
</hass-tabs-subpage>
|
</hass-tabs-subpage>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import "../components/supervisor-connectivity";
|
||||||
import {
|
import {
|
||||||
css,
|
css,
|
||||||
CSSResult,
|
CSSResult,
|
||||||
@ -62,6 +63,8 @@ class HassioSystem extends LitElement {
|
|||||||
.supervisor=${this.supervisor}
|
.supervisor=${this.supervisor}
|
||||||
></hassio-supervisor-log>
|
></hassio-supervisor-log>
|
||||||
</div>
|
</div>
|
||||||
|
<supervisor-connectivity .supervisor=${this.supervisor}>
|
||||||
|
</supervisor-connectivity>
|
||||||
</hass-tabs-subpage>
|
</hass-tabs-subpage>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,8 @@ export interface WifiConfiguration {
|
|||||||
export interface NetworkInfo {
|
export interface NetworkInfo {
|
||||||
interfaces: NetworkInterface[];
|
interfaces: NetworkInterface[];
|
||||||
docker: DockerNetwork;
|
docker: DockerNetwork;
|
||||||
|
supervisor_internet: boolean;
|
||||||
|
host_internet: boolean | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fetchNetworkInfo = async (
|
export const fetchNetworkInfo = async (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user