mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
Don't show back button when no history (#8822)
* Don't show back button when no history * Update src/translations/en.json Co-authored-by: Philip Allgaier <mail@spacegaier.de> Co-authored-by: Philip Allgaier <mail@spacegaier.de>
This commit is contained in:
parent
4cf1e52ac0
commit
4511c8f30c
@ -28,7 +28,7 @@ class HassErrorScreen extends LitElement {
|
|||||||
return html`
|
return html`
|
||||||
${this.toolbar
|
${this.toolbar
|
||||||
? html`<div class="toolbar">
|
? html`<div class="toolbar">
|
||||||
${this.rootnav
|
${this.rootnav || history.state?.root
|
||||||
? html`
|
? html`
|
||||||
<ha-menu-button
|
<ha-menu-button
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
@ -30,7 +30,7 @@ class HassLoadingScreen extends LitElement {
|
|||||||
${this.noToolbar
|
${this.noToolbar
|
||||||
? ""
|
? ""
|
||||||
: html`<div class="toolbar">
|
: html`<div class="toolbar">
|
||||||
${this.rootnav
|
${this.rootnav || history.state?.root
|
||||||
? html`
|
? html`
|
||||||
<ha-menu-button
|
<ha-menu-button
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
@ -8,7 +8,6 @@ import {
|
|||||||
property,
|
property,
|
||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { classMap } from "lit-html/directives/class-map";
|
|
||||||
import { restoreScroll } from "../common/decorators/restore-scroll";
|
import { restoreScroll } from "../common/decorators/restore-scroll";
|
||||||
import "../components/ha-icon-button-arrow-prev";
|
import "../components/ha-icon-button-arrow-prev";
|
||||||
import "../components/ha-menu-button";
|
import "../components/ha-menu-button";
|
||||||
@ -20,9 +19,11 @@ class HassSubpage extends LitElement {
|
|||||||
|
|
||||||
@property() public header?: string;
|
@property() public header?: string;
|
||||||
|
|
||||||
@property({ type: Boolean }) public showBackButton = true;
|
@property({ type: Boolean, attribute: "main-page" }) public mainPage = false;
|
||||||
|
|
||||||
@property({ type: Boolean }) public hassio = false;
|
@property({ type: Boolean, reflect: true }) public narrow = false;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public supervisor = false;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@restoreScroll(".content") private _savedScrollPos?: number;
|
@restoreScroll(".content") private _savedScrollPos?: number;
|
||||||
@ -30,11 +31,20 @@ class HassSubpage extends LitElement {
|
|||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
|
${this.mainPage || history.state?.root
|
||||||
|
? html`
|
||||||
|
<ha-menu-button
|
||||||
|
.hassio=${this.supervisor}
|
||||||
|
.hass=${this.hass}
|
||||||
|
.narrow=${this.narrow}
|
||||||
|
></ha-menu-button>
|
||||||
|
`
|
||||||
|
: html`
|
||||||
<ha-icon-button-arrow-prev
|
<ha-icon-button-arrow-prev
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@click=${this._backTapped}
|
@click=${this._backTapped}
|
||||||
class=${classMap({ hidden: !this.showBackButton })}
|
|
||||||
></ha-icon-button-arrow-prev>
|
></ha-icon-button-arrow-prev>
|
||||||
|
`}
|
||||||
|
|
||||||
<div class="main-title">${this.header}</div>
|
<div class="main-title">${this.header}</div>
|
||||||
<slot name="toolbar-icon"></slot>
|
<slot name="toolbar-icon"></slot>
|
||||||
|
@ -140,7 +140,7 @@ class HassTabsSubpage extends LitElement {
|
|||||||
const showTabs = tabs.length > 1 || !this.narrow;
|
const showTabs = tabs.length > 1 || !this.narrow;
|
||||||
return html`
|
return html`
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
${this.mainPage
|
${this.mainPage || history.state?.root
|
||||||
? html`
|
? html`
|
||||||
<ha-menu-button
|
<ha-menu-button
|
||||||
.hassio=${this.supervisor}
|
.hassio=${this.supervisor}
|
||||||
|
@ -11,12 +11,11 @@ import {
|
|||||||
TemplateResult,
|
TemplateResult,
|
||||||
} from "lit-element";
|
} from "lit-element";
|
||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
import "./hass-subpage";
|
|
||||||
import "../resources/ha-style";
|
import "../resources/ha-style";
|
||||||
import "../resources/roboto";
|
|
||||||
import { haStyle } from "../resources/styles";
|
import { haStyle } from "../resources/styles";
|
||||||
import { applyThemesOnElement } from "../common/dom/apply_themes_on_element";
|
import { applyThemesOnElement } from "../common/dom/apply_themes_on_element";
|
||||||
import { atLeastVersion } from "../common/config/version";
|
import { atLeastVersion } from "../common/config/version";
|
||||||
|
import "./hass-subpage";
|
||||||
|
|
||||||
@customElement("supervisor-error-screen")
|
@customElement("supervisor-error-screen")
|
||||||
class SupervisorErrorScreen extends LitElement {
|
class SupervisorErrorScreen extends LitElement {
|
||||||
@ -41,21 +40,15 @@ class SupervisorErrorScreen extends LitElement {
|
|||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<div class="toolbar">
|
<hass-subpage
|
||||||
<ha-icon-button-arrow-prev
|
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@click=${this._handleBack}
|
.header=${this.hass.localize("ui.errors.supervisor.title")}
|
||||||
></ha-icon-button-arrow-prev>
|
>
|
||||||
</div>
|
|
||||||
<div class="content">
|
|
||||||
<div class="title">
|
|
||||||
${this.hass.localize("ui.panel.error.supervisor.title")}
|
|
||||||
</div>
|
|
||||||
<ha-card header="Troubleshooting">
|
<ha-card header="Troubleshooting">
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
${this.hass.localize("ui.panel.error.supervisor.wait")}
|
${this.hass.localize("ui.errors.supervisor.wait")}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
@ -64,17 +57,15 @@ class SupervisorErrorScreen extends LitElement {
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
${this.hass.localize("ui.panel.error.supervisor.observer")}
|
${this.hass.localize("ui.errors.supervisor.observer")}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
${this.hass.localize("ui.panel.error.supervisor.reboot")}
|
${this.hass.localize("ui.errors.supervisor.reboot")}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/config/info" target="_parent">
|
<a href="/config/info" target="_parent">
|
||||||
${this.hass.localize(
|
${this.hass.localize("ui.errors.supervisor.system_health")}
|
||||||
"ui.panel.error.supervisor.system_health"
|
|
||||||
)}
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -83,13 +74,13 @@ class SupervisorErrorScreen extends LitElement {
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
>
|
>
|
||||||
${this.hass.localize("ui.panel.error.supervisor.ask")}
|
${this.hass.localize("ui.errors.supervisor.ask")}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</ha-card>
|
</ha-card>
|
||||||
</div>
|
</hass-subpage>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,50 +116,17 @@ class SupervisorErrorScreen extends LitElement {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleBack(): void {
|
|
||||||
history.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
static get styles(): CSSResultArray {
|
static get styles(): CSSResultArray {
|
||||||
return [
|
return [
|
||||||
haStyle,
|
haStyle,
|
||||||
css`
|
css`
|
||||||
.toolbar {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 20px;
|
|
||||||
height: var(--header-height);
|
|
||||||
padding: 0 16px;
|
|
||||||
pointer-events: none;
|
|
||||||
background-color: var(--app-header-background-color);
|
|
||||||
font-weight: 400;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
ha-icon-button-arrow-prev {
|
|
||||||
pointer-events: auto;
|
|
||||||
}
|
|
||||||
.content {
|
|
||||||
color: var(--primary-text-color);
|
|
||||||
display: flex;
|
|
||||||
padding: 16px;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
.title {
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: 400;
|
|
||||||
line-height: 32px;
|
|
||||||
padding-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: var(--mdc-theme-primary);
|
color: var(--mdc-theme-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
ha-card {
|
ha-card {
|
||||||
width: 600px;
|
width: 600px;
|
||||||
margin: 16px;
|
margin: auto;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
@media all and (max-width: 500px) {
|
@media all and (max-width: 500px) {
|
||||||
|
@ -103,7 +103,6 @@ export class HaAutomationTrace extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.narrow=${this.narrow}
|
.narrow=${this.narrow}
|
||||||
.route=${this.route}
|
.route=${this.route}
|
||||||
.backCallback=${() => this._backTapped()}
|
|
||||||
.tabs=${configSections.automation}
|
.tabs=${configSections.automation}
|
||||||
>
|
>
|
||||||
${this.narrow
|
${this.narrow
|
||||||
@ -388,10 +387,6 @@ export class HaAutomationTrace extends LitElement {
|
|||||||
this._trace = trace;
|
this._trace = trace;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _backTapped(): void {
|
|
||||||
history.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
private _downloadTrace() {
|
private _downloadTrace() {
|
||||||
const aEl = document.createElement("a");
|
const aEl = document.createElement("a");
|
||||||
aEl.download = `trace ${this._entityId} ${
|
aEl.download = `trace ${this._entityId} ${
|
||||||
|
@ -214,9 +214,9 @@ class CloudAlexa extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<hass-subpage .hass=${this.hass} header="${this.hass!.localize(
|
<hass-subpage .hass=${this.hass} .narrow=${
|
||||||
"ui.panel.config.cloud.alexa.title"
|
this.narrow
|
||||||
)}">
|
} .header=${this.hass!.localize("ui.panel.config.cloud.alexa.title")}>
|
||||||
${
|
${
|
||||||
emptyFilter
|
emptyFilter
|
||||||
? html`
|
? html`
|
||||||
|
@ -239,7 +239,8 @@ class CloudGoogleAssistant extends LitElement {
|
|||||||
return html`
|
return html`
|
||||||
<hass-subpage
|
<hass-subpage
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.header=${this.hass!.localize("ui.panel.config.cloud.google.title")}>
|
.header=${this.hass!.localize("ui.panel.config.cloud.google.title")}
|
||||||
|
.narrow=${this.narrow}>
|
||||||
${
|
${
|
||||||
emptyFilter
|
emptyFilter
|
||||||
? html`
|
? html`
|
||||||
|
@ -23,6 +23,8 @@ import "./mqtt-subscribe-card";
|
|||||||
class HaPanelDevMqtt extends LitElement {
|
class HaPanelDevMqtt extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property({ type: Boolean }) public narrow!: boolean;
|
||||||
|
|
||||||
@internalProperty() private topic = "";
|
@internalProperty() private topic = "";
|
||||||
|
|
||||||
@internalProperty() private payload = "";
|
@internalProperty() private payload = "";
|
||||||
@ -41,7 +43,7 @@ class HaPanelDevMqtt extends LitElement {
|
|||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
<hass-subpage .hass=${this.hass}>
|
<hass-subpage .narrow=${this.narrow} .hass=${this.hass}>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<ha-card header="MQTT settings">
|
<ha-card header="MQTT settings">
|
||||||
<div class="card-actions">
|
<div class="card-actions">
|
||||||
|
@ -25,6 +25,9 @@ export const urlSyncMixin = <
|
|||||||
|
|
||||||
public connectedCallback(): void {
|
public connectedCallback(): void {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
|
if (history.length === 1) {
|
||||||
|
history.replaceState({ ...history.state, root: true }, "");
|
||||||
|
}
|
||||||
window.addEventListener("popstate", this._popstateChangeListener);
|
window.addEventListener("popstate", this._popstateChangeListener);
|
||||||
this.addEventListener("dialog-closed", this._dialogClosedListener);
|
this.addEventListener("dialog-closed", this._dialogClosedListener);
|
||||||
}
|
}
|
||||||
|
@ -823,6 +823,14 @@
|
|||||||
"key_not_expected": "Key \"{key}\" is not expected or not supported by the visual editor.",
|
"key_not_expected": "Key \"{key}\" is not expected or not supported by the visual editor.",
|
||||||
"key_wrong_type": "The provided value for \"{key}\" is not supported by the visual editor. We support ({type_correct}) but received ({type_wrong}).",
|
"key_wrong_type": "The provided value for \"{key}\" is not supported by the visual editor. We support ({type_correct}) but received ({type_wrong}).",
|
||||||
"no_template_editor_support": "Templates not supported in visual editor"
|
"no_template_editor_support": "Templates not supported in visual editor"
|
||||||
|
},
|
||||||
|
"supervisor": {
|
||||||
|
"title": "Could not load the Supervisor panel!",
|
||||||
|
"wait": "If you just started, make sure you have given the Supervisor enough time to start.",
|
||||||
|
"ask": "Ask for help",
|
||||||
|
"reboot": "Try a reboot of the host",
|
||||||
|
"observer": "Check the Observer",
|
||||||
|
"system_health": "Check System Health"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"login-form": {
|
"login-form": {
|
||||||
@ -3521,17 +3529,6 @@
|
|||||||
"complete_access": "It will have access to all data in Home Assistant.",
|
"complete_access": "It will have access to all data in Home Assistant.",
|
||||||
"hide_message": "Check docs for the panel_custom component to hide this message"
|
"hide_message": "Check docs for the panel_custom component to hide this message"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"error": {
|
|
||||||
"go_back": "Go back",
|
|
||||||
"supervisor": {
|
|
||||||
"title": "Could not load the Supervisor panel!",
|
|
||||||
"wait": "If you just started, make sure you have given the supervisor enough time to start.",
|
|
||||||
"ask": "Ask for help",
|
|
||||||
"reboot": "Try a reboot of the host",
|
|
||||||
"observer": "Check the Observer",
|
|
||||||
"system_health": "Check System Health"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user