mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Add reload buttons to store and snapshot (#5714)
This commit is contained in:
parent
f16a674a39
commit
79d1a2f458
@ -13,11 +13,14 @@ import {
|
|||||||
reloadHassioAddons,
|
reloadHassioAddons,
|
||||||
} from "../../../src/data/hassio/addon";
|
} from "../../../src/data/hassio/addon";
|
||||||
import "../../../src/layouts/loading-screen";
|
import "../../../src/layouts/loading-screen";
|
||||||
import { HomeAssistant } from "../../../src/types";
|
import "../../../src/layouts/hass-tabs-subpage";
|
||||||
|
import { HomeAssistant, Route } from "../../../src/types";
|
||||||
import "../components/hassio-search-input";
|
import "../components/hassio-search-input";
|
||||||
import "./hassio-addon-repository";
|
import "./hassio-addon-repository";
|
||||||
import "./hassio-repositories-editor";
|
import "./hassio-repositories-editor";
|
||||||
|
|
||||||
|
import { supervisorTabs } from "../hassio-panel";
|
||||||
|
|
||||||
const sortRepos = (a: HassioAddonRepository, b: HassioAddonRepository) => {
|
const sortRepos = (a: HassioAddonRepository, b: HassioAddonRepository) => {
|
||||||
if (a.slug === "local") {
|
if (a.slug === "local") {
|
||||||
return -1;
|
return -1;
|
||||||
@ -35,11 +38,15 @@ const sortRepos = (a: HassioAddonRepository, b: HassioAddonRepository) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class HassioAddonStore extends LitElement {
|
class HassioAddonStore extends LitElement {
|
||||||
@property() public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property() private _addons?: HassioAddonInfo[];
|
@property({ type: Boolean }) public narrow!: boolean;
|
||||||
|
|
||||||
@property() private _repos?: HassioAddonRepository[];
|
@property({ attribute: false }) public route!: Route;
|
||||||
|
|
||||||
|
@property({ attribute: false }) private _addons?: HassioAddonInfo[];
|
||||||
|
|
||||||
|
@property({ attribute: false }) private _repos?: HassioAddonRepository[];
|
||||||
|
|
||||||
@property() private _filter?: string;
|
@property() private _filter?: string;
|
||||||
|
|
||||||
@ -52,42 +59,61 @@ class HassioAddonStore extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
if (!this._addons || !this._repos) {
|
|
||||||
return html` <loading-screen></loading-screen> `;
|
|
||||||
}
|
|
||||||
const repos: TemplateResult[] = [];
|
const repos: TemplateResult[] = [];
|
||||||
|
|
||||||
for (const repo of this._repos) {
|
if (this._repos) {
|
||||||
const addons = this._addons!.filter(
|
for (const repo of this._repos) {
|
||||||
(addon) => addon.repository === repo.slug
|
const addons = this._addons!.filter(
|
||||||
);
|
(addon) => addon.repository === repo.slug
|
||||||
|
);
|
||||||
|
|
||||||
if (addons.length === 0) {
|
if (addons.length === 0) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
repos.push(html`
|
||||||
|
<hassio-addon-repository
|
||||||
|
.hass=${this.hass}
|
||||||
|
.repo=${repo}
|
||||||
|
.addons=${addons}
|
||||||
|
.filter=${this._filter}
|
||||||
|
></hassio-addon-repository>
|
||||||
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
repos.push(html`
|
|
||||||
<hassio-addon-repository
|
|
||||||
.hass=${this.hass}
|
|
||||||
.repo=${repo}
|
|
||||||
.addons=${addons}
|
|
||||||
.filter=${this._filter}
|
|
||||||
></hassio-addon-repository>
|
|
||||||
`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<hassio-repositories-editor
|
<hass-tabs-subpage
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.repos=${this._repos}
|
.narrow=${this.narrow}
|
||||||
></hassio-repositories-editor>
|
.route=${this.route}
|
||||||
|
hassio
|
||||||
|
.tabs=${supervisorTabs}
|
||||||
|
>
|
||||||
|
<span slot="header">Add-on store</span>
|
||||||
|
<paper-icon-button
|
||||||
|
icon="hassio:reload"
|
||||||
|
slot="toolbar-icon"
|
||||||
|
aria-label="Reload add-ons"
|
||||||
|
@click=${this.refreshData}
|
||||||
|
></paper-icon-button>
|
||||||
|
|
||||||
<hassio-search-input
|
${repos.length === 0
|
||||||
.filter=${this._filter}
|
? html`<loading-screen></loading-screen>`
|
||||||
@value-changed=${this._filterChanged}
|
: html`
|
||||||
></hassio-search-input>
|
<hassio-repositories-editor
|
||||||
|
.hass=${this.hass}
|
||||||
|
.repos=${this._repos!}
|
||||||
|
></hassio-repositories-editor>
|
||||||
|
|
||||||
${repos}
|
<hassio-search-input
|
||||||
|
.filter=${this._filter}
|
||||||
|
@value-changed=${this._filterChanged}
|
||||||
|
></hassio-search-input>
|
||||||
|
|
||||||
|
${repos}
|
||||||
|
`}
|
||||||
|
</hass-tabs-subpage>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class HassioAddonDashboard extends LitElement {
|
|||||||
{
|
{
|
||||||
name: "Info",
|
name: "Info",
|
||||||
path: `/hassio/addon/${this.addon.slug}/info`,
|
path: `/hassio/addon/${this.addon.slug}/info`,
|
||||||
icon: "mdi:information-variant",
|
icon: "hassio:information-variant",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ class HassioAddonDashboard extends LitElement {
|
|||||||
addonTabs.push({
|
addonTabs.push({
|
||||||
name: "Documentation",
|
name: "Documentation",
|
||||||
path: `/hassio/addon/${this.addon.slug}/documentation`,
|
path: `/hassio/addon/${this.addon.slug}/documentation`,
|
||||||
icon: "mdi:file-document",
|
icon: "hassio:file-document",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,12 +76,12 @@ class HassioAddonDashboard extends LitElement {
|
|||||||
{
|
{
|
||||||
name: "Configuration",
|
name: "Configuration",
|
||||||
path: `/hassio/addon/${this.addon.slug}/config`,
|
path: `/hassio/addon/${this.addon.slug}/config`,
|
||||||
icon: "mdi:cogs",
|
icon: "hassio:cogs",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Log",
|
name: "Log",
|
||||||
path: `/hassio/addon/${this.addon.slug}/logs`,
|
path: `/hassio/addon/${this.addon.slug}/logs`,
|
||||||
icon: "mdi:math-log",
|
icon: "hassio:math-log",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ class HassioAddonDashboard extends LitElement {
|
|||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
.backPath=${this.addon.version ? "/hassio/dashboard" : "/hassio/store"}
|
.backPath=${this.addon.version ? "/hassio/dashboard" : "/hassio/store"}
|
||||||
.route=${route}
|
.route=${route}
|
||||||
.hassio=${true}
|
hassio
|
||||||
.tabs=${addonTabs}
|
.tabs=${addonTabs}
|
||||||
>
|
>
|
||||||
<span slot="header">${this.addon.name}</span>
|
<span slot="header">${this.addon.name}</span>
|
||||||
|
@ -13,34 +13,50 @@ import {
|
|||||||
HassioSupervisorInfo,
|
HassioSupervisorInfo,
|
||||||
} from "../../../src/data/hassio/supervisor";
|
} from "../../../src/data/hassio/supervisor";
|
||||||
import { haStyle } from "../../../src/resources/styles";
|
import { haStyle } from "../../../src/resources/styles";
|
||||||
import { HomeAssistant } from "../../../src/types";
|
import { HomeAssistant, Route } from "../../../src/types";
|
||||||
|
import "../../../src/layouts/hass-tabs-subpage";
|
||||||
import "./hassio-addons";
|
import "./hassio-addons";
|
||||||
import "./hassio-update";
|
import "./hassio-update";
|
||||||
|
|
||||||
|
import { supervisorTabs } from "../hassio-panel";
|
||||||
|
|
||||||
@customElement("hassio-dashboard")
|
@customElement("hassio-dashboard")
|
||||||
class HassioDashboard extends LitElement {
|
class HassioDashboard extends LitElement {
|
||||||
@property() public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property() public supervisorInfo!: HassioSupervisorInfo;
|
@property({ type: Boolean }) public narrow!: boolean;
|
||||||
|
|
||||||
@property() public hassInfo!: HassioHomeAssistantInfo;
|
@property({ attribute: false }) public route!: Route;
|
||||||
|
|
||||||
@property() public hassOsInfo!: HassioHassOSInfo;
|
@property({ attribute: false }) public supervisorInfo!: HassioSupervisorInfo;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public hassInfo!: HassioHomeAssistantInfo;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public hassOsInfo!: HassioHassOSInfo;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<div class="content">
|
<hass-tabs-subpage
|
||||||
<hassio-update
|
.hass=${this.hass}
|
||||||
.hass=${this.hass}
|
.narrow=${this.narrow}
|
||||||
.hassInfo=${this.hassInfo}
|
hassio
|
||||||
.supervisorInfo=${this.supervisorInfo}
|
.route=${this.route}
|
||||||
.hassOsInfo=${this.hassOsInfo}
|
.tabs=${supervisorTabs}
|
||||||
></hassio-update>
|
>
|
||||||
<hassio-addons
|
<span slot="header">Dashboard</span>
|
||||||
.hass=${this.hass}
|
<div class="content">
|
||||||
.addons=${this.supervisorInfo.addons}
|
<hassio-update
|
||||||
></hassio-addons>
|
.hass=${this.hass}
|
||||||
</div>
|
.hassInfo=${this.hassInfo}
|
||||||
|
.supervisorInfo=${this.supervisorInfo}
|
||||||
|
.hassOsInfo=${this.hassOsInfo}
|
||||||
|
></hassio-update>
|
||||||
|
<hassio-addons
|
||||||
|
.hass=${this.hass}
|
||||||
|
.addons=${this.supervisorInfo.addons}
|
||||||
|
></hassio-addons>
|
||||||
|
</div>
|
||||||
|
</hass-tabs-subpage>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
HassRouterPage,
|
HassRouterPage,
|
||||||
RouterOptions,
|
RouterOptions,
|
||||||
} from "../../src/layouts/hass-router-page";
|
} from "../../src/layouts/hass-router-page";
|
||||||
import { HomeAssistant } from "../../src/types";
|
import { HomeAssistant, Route } from "../../src/types";
|
||||||
import "./addon-store/hassio-addon-store";
|
import "./addon-store/hassio-addon-store";
|
||||||
// Don't codesplit it, that way the dashboard always loads fast.
|
// Don't codesplit it, that way the dashboard always loads fast.
|
||||||
import "./dashboard/hassio-dashboard";
|
import "./dashboard/hassio-dashboard";
|
||||||
@ -20,6 +20,10 @@ import "./system/hassio-system";
|
|||||||
class HassioPanelRouter extends HassRouterPage {
|
class HassioPanelRouter extends HassRouterPage {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public route!: Route;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public narrow!: boolean;
|
||||||
|
|
||||||
@property({ attribute: false }) public supervisorInfo: HassioSupervisorInfo;
|
@property({ attribute: false }) public supervisorInfo: HassioSupervisorInfo;
|
||||||
|
|
||||||
@property({ attribute: false }) public hostInfo: HassioHostInfo;
|
@property({ attribute: false }) public hostInfo: HassioHostInfo;
|
||||||
@ -47,6 +51,8 @@ class HassioPanelRouter extends HassRouterPage {
|
|||||||
|
|
||||||
protected updatePageEl(el) {
|
protected updatePageEl(el) {
|
||||||
el.hass = this.hass;
|
el.hass = this.hass;
|
||||||
|
el.route = this.route;
|
||||||
|
el.narrow = this.narrow;
|
||||||
el.supervisorInfo = this.supervisorInfo;
|
el.supervisorInfo = this.supervisorInfo;
|
||||||
el.hostInfo = this.hostInfo;
|
el.hostInfo = this.hostInfo;
|
||||||
el.hassInfo = this.hassInfo;
|
el.hassInfo = this.hassInfo;
|
||||||
|
@ -15,7 +15,29 @@ import "../../src/resources/ha-style";
|
|||||||
import { HomeAssistant, Route } from "../../src/types";
|
import { HomeAssistant, Route } from "../../src/types";
|
||||||
import "./hassio-panel-router";
|
import "./hassio-panel-router";
|
||||||
import type { PageNavigation } from "../../src/layouts/hass-tabs-subpage";
|
import type { PageNavigation } from "../../src/layouts/hass-tabs-subpage";
|
||||||
import "../../src/layouts/hass-tabs-subpage";
|
|
||||||
|
export const supervisorTabs: PageNavigation[] = [
|
||||||
|
{
|
||||||
|
name: "Dashboard",
|
||||||
|
path: `/hassio/dashboard`,
|
||||||
|
icon: "hassio:view-dashboard",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Add-on store",
|
||||||
|
path: `/hassio/store`,
|
||||||
|
icon: "hassio:store",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Snapshots",
|
||||||
|
path: `/hassio/snapshots`,
|
||||||
|
icon: "hassio:backup-restore",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "System",
|
||||||
|
path: `/hassio/system`,
|
||||||
|
icon: "hassio:cogs",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
@customElement("hassio-panel")
|
@customElement("hassio-panel")
|
||||||
class HassioPanel extends LitElement {
|
class HassioPanel extends LitElement {
|
||||||
@ -34,46 +56,16 @@ class HassioPanel extends LitElement {
|
|||||||
@property({ attribute: false }) public hassOsInfo!: HassioHassOSInfo;
|
@property({ attribute: false }) public hassOsInfo!: HassioHassOSInfo;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
const supervisorTabs: PageNavigation[] = [
|
|
||||||
{
|
|
||||||
name: "Dashboard",
|
|
||||||
path: `/hassio/dashboard`,
|
|
||||||
icon: "mdi:view-dashboard",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Add-on store",
|
|
||||||
path: `/hassio/store`,
|
|
||||||
icon: "mdi:store",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Snapshots",
|
|
||||||
path: `/hassio/snapshots`,
|
|
||||||
icon: "mdi:backup-restore",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "System",
|
|
||||||
path: `/hassio/system`,
|
|
||||||
icon: "mdi:cogs",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<hass-tabs-subpage
|
<hassio-panel-router
|
||||||
|
.route=${this.route}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
.route=${this.route}
|
.supervisorInfo=${this.supervisorInfo}
|
||||||
.tabs=${supervisorTabs}
|
.hostInfo=${this.hostInfo}
|
||||||
>
|
.hassInfo=${this.hassInfo}
|
||||||
<span slot="header">Supervisor</span>
|
.hassOsInfo=${this.hassOsInfo}
|
||||||
<hassio-panel-router
|
></hassio-panel-router>
|
||||||
.route=${this.route}
|
|
||||||
.hass=${this.hass}
|
|
||||||
.supervisorInfo=${this.supervisorInfo}
|
|
||||||
.hostInfo=${this.hostInfo}
|
|
||||||
.hassInfo=${this.hassInfo}
|
|
||||||
.hassOsInfo=${this.hassOsInfo}
|
|
||||||
></hassio-panel-router>
|
|
||||||
</hass-tabs-subpage>
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,14 @@ import {
|
|||||||
import { HassioSupervisorInfo } from "../../../src/data/hassio/supervisor";
|
import { HassioSupervisorInfo } from "../../../src/data/hassio/supervisor";
|
||||||
import { PolymerChangedEvent } from "../../../src/polymer-types";
|
import { PolymerChangedEvent } from "../../../src/polymer-types";
|
||||||
import { haStyle } from "../../../src/resources/styles";
|
import { haStyle } from "../../../src/resources/styles";
|
||||||
import { HomeAssistant } from "../../../src/types";
|
import { HomeAssistant, Route } from "../../../src/types";
|
||||||
|
import "../../../src/layouts/hass-tabs-subpage";
|
||||||
import "../components/hassio-card-content";
|
import "../components/hassio-card-content";
|
||||||
import { showHassioSnapshotDialog } from "../dialogs/snapshot/show-dialog-hassio-snapshot";
|
import { showHassioSnapshotDialog } from "../dialogs/snapshot/show-dialog-hassio-snapshot";
|
||||||
import { hassioStyle } from "../resources/hassio-style";
|
import { hassioStyle } from "../resources/hassio-style";
|
||||||
|
|
||||||
|
import { supervisorTabs } from "../hassio-panel";
|
||||||
|
|
||||||
interface CheckboxItem {
|
interface CheckboxItem {
|
||||||
slug: string;
|
slug: string;
|
||||||
name: string;
|
name: string;
|
||||||
@ -43,9 +46,13 @@ interface CheckboxItem {
|
|||||||
|
|
||||||
@customElement("hassio-snapshots")
|
@customElement("hassio-snapshots")
|
||||||
class HassioSnapshots extends LitElement {
|
class HassioSnapshots extends LitElement {
|
||||||
@property() public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
@property() public supervisorInfo!: HassioSupervisorInfo;
|
@property({ type: Boolean }) public narrow!: boolean;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public route!: Route;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public supervisorInfo!: HassioSupervisorInfo;
|
||||||
|
|
||||||
@property() private _snapshotName = "";
|
@property() private _snapshotName = "";
|
||||||
|
|
||||||
@ -81,135 +88,152 @@ class HassioSnapshots extends LitElement {
|
|||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<div class="content">
|
<hass-tabs-subpage
|
||||||
<h1>
|
.hass=${this.hass}
|
||||||
Create snapshot
|
.narrow=${this.narrow}
|
||||||
</h1>
|
hassio
|
||||||
<p class="description">
|
.route=${this.route}
|
||||||
Snapshots allow you to easily backup and restore all data of your Home
|
.tabs=${supervisorTabs}
|
||||||
Assistant instance.
|
>
|
||||||
</p>
|
<span slot="header">Snapshots</span>
|
||||||
<div class="card-group">
|
|
||||||
<paper-card>
|
|
||||||
<div class="card-content">
|
|
||||||
<paper-input
|
|
||||||
autofocus
|
|
||||||
label="Name"
|
|
||||||
name="snapshotName"
|
|
||||||
.value=${this._snapshotName}
|
|
||||||
@value-changed=${this._handleTextValueChanged}
|
|
||||||
></paper-input>
|
|
||||||
Type:
|
|
||||||
<paper-radio-group
|
|
||||||
name="snapshotType"
|
|
||||||
.selected=${this._snapshotType}
|
|
||||||
@selected-changed=${this._handleRadioValueChanged}
|
|
||||||
>
|
|
||||||
<paper-radio-button name="full">
|
|
||||||
Full snapshot
|
|
||||||
</paper-radio-button>
|
|
||||||
<paper-radio-button name="partial">
|
|
||||||
Partial snapshot
|
|
||||||
</paper-radio-button>
|
|
||||||
</paper-radio-group>
|
|
||||||
${this._snapshotType === "full"
|
|
||||||
? undefined
|
|
||||||
: html`
|
|
||||||
Folders:
|
|
||||||
${this._folderList.map(
|
|
||||||
(folder, idx) => html`
|
|
||||||
<paper-checkbox
|
|
||||||
.idx=${idx}
|
|
||||||
.checked=${folder.checked}
|
|
||||||
@checked-changed=${this._folderChecked}
|
|
||||||
>
|
|
||||||
${folder.name}
|
|
||||||
</paper-checkbox>
|
|
||||||
`
|
|
||||||
)}
|
|
||||||
Add-ons:
|
|
||||||
${this._addonList.map(
|
|
||||||
(addon, idx) => html`
|
|
||||||
<paper-checkbox
|
|
||||||
.idx=${idx}
|
|
||||||
.checked=${addon.checked}
|
|
||||||
@checked-changed=${this._addonChecked}
|
|
||||||
>
|
|
||||||
${addon.name}
|
|
||||||
</paper-checkbox>
|
|
||||||
`
|
|
||||||
)}
|
|
||||||
`}
|
|
||||||
Security:
|
|
||||||
<paper-checkbox
|
|
||||||
name="snapshotHasPassword"
|
|
||||||
.checked=${this._snapshotHasPassword}
|
|
||||||
@checked-changed=${this._handleCheckboxValueChanged}
|
|
||||||
>
|
|
||||||
Password protection
|
|
||||||
</paper-checkbox>
|
|
||||||
${this._snapshotHasPassword
|
|
||||||
? html`
|
|
||||||
<paper-input
|
|
||||||
label="Password"
|
|
||||||
type="password"
|
|
||||||
name="snapshotPassword"
|
|
||||||
.value=${this._snapshotPassword}
|
|
||||||
@value-changed=${this._handleTextValueChanged}
|
|
||||||
></paper-input>
|
|
||||||
`
|
|
||||||
: undefined}
|
|
||||||
${this._error !== ""
|
|
||||||
? html` <p class="error">${this._error}</p> `
|
|
||||||
: undefined}
|
|
||||||
</div>
|
|
||||||
<div class="card-actions">
|
|
||||||
<mwc-button
|
|
||||||
.disabled=${this._creatingSnapshot}
|
|
||||||
@click=${this._createSnapshot}
|
|
||||||
>
|
|
||||||
Create
|
|
||||||
</mwc-button>
|
|
||||||
</div>
|
|
||||||
</paper-card>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h1>Available snapshots</h1>
|
<paper-icon-button
|
||||||
<div class="card-group">
|
icon="hassio:reload"
|
||||||
${this._snapshots === undefined
|
slot="toolbar-icon"
|
||||||
? undefined
|
aria-label="Reload snapshots"
|
||||||
: this._snapshots.length === 0
|
@click=${this.refreshData}
|
||||||
? html`
|
></paper-icon-button>
|
||||||
<paper-card>
|
|
||||||
<div class="card-content">
|
<div class="content">
|
||||||
You don't have any snapshots yet.
|
<h1>
|
||||||
</div>
|
Create snapshot
|
||||||
</paper-card>
|
</h1>
|
||||||
`
|
<p class="description">
|
||||||
: this._snapshots.map(
|
Snapshots allow you to easily backup and restore all data of your
|
||||||
(snapshot) => html`
|
Home Assistant instance.
|
||||||
<paper-card
|
</p>
|
||||||
class="pointer"
|
<div class="card-group">
|
||||||
.snapshot=${snapshot}
|
<paper-card>
|
||||||
@click=${this._snapshotClicked}
|
<div class="card-content">
|
||||||
>
|
<paper-input
|
||||||
|
autofocus
|
||||||
|
label="Name"
|
||||||
|
name="snapshotName"
|
||||||
|
.value=${this._snapshotName}
|
||||||
|
@value-changed=${this._handleTextValueChanged}
|
||||||
|
></paper-input>
|
||||||
|
Type:
|
||||||
|
<paper-radio-group
|
||||||
|
name="snapshotType"
|
||||||
|
.selected=${this._snapshotType}
|
||||||
|
@selected-changed=${this._handleRadioValueChanged}
|
||||||
|
>
|
||||||
|
<paper-radio-button name="full">
|
||||||
|
Full snapshot
|
||||||
|
</paper-radio-button>
|
||||||
|
<paper-radio-button name="partial">
|
||||||
|
Partial snapshot
|
||||||
|
</paper-radio-button>
|
||||||
|
</paper-radio-group>
|
||||||
|
${this._snapshotType === "full"
|
||||||
|
? undefined
|
||||||
|
: html`
|
||||||
|
Folders:
|
||||||
|
${this._folderList.map(
|
||||||
|
(folder, idx) => html`
|
||||||
|
<paper-checkbox
|
||||||
|
.idx=${idx}
|
||||||
|
.checked=${folder.checked}
|
||||||
|
@checked-changed=${this._folderChecked}
|
||||||
|
>
|
||||||
|
${folder.name}
|
||||||
|
</paper-checkbox>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
Add-ons:
|
||||||
|
${this._addonList.map(
|
||||||
|
(addon, idx) => html`
|
||||||
|
<paper-checkbox
|
||||||
|
.idx=${idx}
|
||||||
|
.checked=${addon.checked}
|
||||||
|
@checked-changed=${this._addonChecked}
|
||||||
|
>
|
||||||
|
${addon.name}
|
||||||
|
</paper-checkbox>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
`}
|
||||||
|
Security:
|
||||||
|
<paper-checkbox
|
||||||
|
name="snapshotHasPassword"
|
||||||
|
.checked=${this._snapshotHasPassword}
|
||||||
|
@checked-changed=${this._handleCheckboxValueChanged}
|
||||||
|
>
|
||||||
|
Password protection
|
||||||
|
</paper-checkbox>
|
||||||
|
${this._snapshotHasPassword
|
||||||
|
? html`
|
||||||
|
<paper-input
|
||||||
|
label="Password"
|
||||||
|
type="password"
|
||||||
|
name="snapshotPassword"
|
||||||
|
.value=${this._snapshotPassword}
|
||||||
|
@value-changed=${this._handleTextValueChanged}
|
||||||
|
></paper-input>
|
||||||
|
`
|
||||||
|
: undefined}
|
||||||
|
${this._error !== ""
|
||||||
|
? html` <p class="error">${this._error}</p> `
|
||||||
|
: undefined}
|
||||||
|
</div>
|
||||||
|
<div class="card-actions">
|
||||||
|
<mwc-button
|
||||||
|
.disabled=${this._creatingSnapshot}
|
||||||
|
@click=${this._createSnapshot}
|
||||||
|
>
|
||||||
|
Create
|
||||||
|
</mwc-button>
|
||||||
|
</div>
|
||||||
|
</paper-card>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h1>Available snapshots</h1>
|
||||||
|
<div class="card-group">
|
||||||
|
${this._snapshots === undefined
|
||||||
|
? undefined
|
||||||
|
: this._snapshots.length === 0
|
||||||
|
? html`
|
||||||
|
<paper-card>
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<hassio-card-content
|
You don't have any snapshots yet.
|
||||||
.hass=${this.hass}
|
|
||||||
.title=${snapshot.name || snapshot.slug}
|
|
||||||
.description=${this._computeDetails(snapshot)}
|
|
||||||
.datetime=${snapshot.date}
|
|
||||||
.icon=${snapshot.type === "full"
|
|
||||||
? "hassio:package-variant-closed"
|
|
||||||
: "hassio:package-variant"}
|
|
||||||
.icon-class="snapshot"
|
|
||||||
></hassio-card-content>
|
|
||||||
</div>
|
</div>
|
||||||
</paper-card>
|
</paper-card>
|
||||||
`
|
`
|
||||||
)}
|
: this._snapshots.map(
|
||||||
|
(snapshot) => html`
|
||||||
|
<paper-card
|
||||||
|
class="pointer"
|
||||||
|
.snapshot=${snapshot}
|
||||||
|
@click=${this._snapshotClicked}
|
||||||
|
>
|
||||||
|
<div class="card-content">
|
||||||
|
<hassio-card-content
|
||||||
|
.hass=${this.hass}
|
||||||
|
.title=${snapshot.name || snapshot.slug}
|
||||||
|
.description=${this._computeDetails(snapshot)}
|
||||||
|
.datetime=${snapshot.date}
|
||||||
|
.icon=${snapshot.type === "full"
|
||||||
|
? "hassio:package-variant-closed"
|
||||||
|
: "hassio:package-variant"}
|
||||||
|
.icon-class="snapshot"
|
||||||
|
></hassio-card-content>
|
||||||
|
</div>
|
||||||
|
</paper-card>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</hass-tabs-subpage>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,15 +14,22 @@ import {
|
|||||||
} from "../../../src/data/hassio/host";
|
} from "../../../src/data/hassio/host";
|
||||||
import { HassioSupervisorInfo } from "../../../src/data/hassio/supervisor";
|
import { HassioSupervisorInfo } from "../../../src/data/hassio/supervisor";
|
||||||
import { haStyle } from "../../../src/resources/styles";
|
import { haStyle } from "../../../src/resources/styles";
|
||||||
import { HomeAssistant } from "../../../src/types";
|
import "../../../src/layouts/hass-tabs-subpage";
|
||||||
|
import { HomeAssistant, Route } from "../../../src/types";
|
||||||
import { hassioStyle } from "../resources/hassio-style";
|
import { hassioStyle } from "../resources/hassio-style";
|
||||||
import "./hassio-host-info";
|
import "./hassio-host-info";
|
||||||
import "./hassio-supervisor-info";
|
import "./hassio-supervisor-info";
|
||||||
import "./hassio-supervisor-log";
|
import "./hassio-supervisor-log";
|
||||||
|
|
||||||
|
import { supervisorTabs } from "../hassio-panel";
|
||||||
|
|
||||||
@customElement("hassio-system")
|
@customElement("hassio-system")
|
||||||
class HassioSystem extends LitElement {
|
class HassioSystem extends LitElement {
|
||||||
@property() public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public narrow!: boolean;
|
||||||
|
|
||||||
|
@property({ attribute: false }) public route!: Route;
|
||||||
|
|
||||||
@property() public supervisorInfo!: HassioSupervisorInfo;
|
@property() public supervisorInfo!: HassioSupervisorInfo;
|
||||||
|
|
||||||
@ -32,22 +39,31 @@ class HassioSystem extends LitElement {
|
|||||||
|
|
||||||
public render(): TemplateResult | void {
|
public render(): TemplateResult | void {
|
||||||
return html`
|
return html`
|
||||||
<div class="content">
|
<hass-tabs-subpage
|
||||||
<h1>Information</h1>
|
.hass=${this.hass}
|
||||||
<div class="card-group">
|
.narrow=${this.narrow}
|
||||||
<hassio-supervisor-info
|
hassio
|
||||||
.hass=${this.hass}
|
.route=${this.route}
|
||||||
.supervisorInfo=${this.supervisorInfo}
|
.tabs=${supervisorTabs}
|
||||||
></hassio-supervisor-info>
|
>
|
||||||
<hassio-host-info
|
<span slot="header">System</span>
|
||||||
.hass=${this.hass}
|
<div class="content">
|
||||||
.hostInfo=${this.hostInfo}
|
<h1>Information</h1>
|
||||||
.hassOsInfo=${this.hassOsInfo}
|
<div class="card-group">
|
||||||
></hassio-host-info>
|
<hassio-supervisor-info
|
||||||
|
.hass=${this.hass}
|
||||||
|
.supervisorInfo=${this.supervisorInfo}
|
||||||
|
></hassio-supervisor-info>
|
||||||
|
<hassio-host-info
|
||||||
|
.hass=${this.hass}
|
||||||
|
.hostInfo=${this.hostInfo}
|
||||||
|
.hassOsInfo=${this.hassOsInfo}
|
||||||
|
></hassio-host-info>
|
||||||
|
</div>
|
||||||
|
<h1>System log</h1>
|
||||||
|
<hassio-supervisor-log .hass=${this.hass}></hassio-supervisor-log>
|
||||||
</div>
|
</div>
|
||||||
<h1>System log</h1>
|
</hass-tabs-subpage>
|
||||||
<hassio-supervisor-log .hass=${this.hass}></hassio-supervisor-log>
|
|
||||||
</div>
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user