mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Merge pull request #11033 from home-assistant/dev
This commit is contained in:
commit
9b0b2c5b71
@ -102,7 +102,7 @@
|
|||||||
"fuse.js": "^6.0.0",
|
"fuse.js": "^6.0.0",
|
||||||
"google-timezones-json": "^1.0.2",
|
"google-timezones-json": "^1.0.2",
|
||||||
"hls.js": "^1.0.11",
|
"hls.js": "^1.0.11",
|
||||||
"home-assistant-js-websocket": "^5.12.0",
|
"home-assistant-js-websocket": "^6.0.0",
|
||||||
"idb-keyval": "^5.1.3",
|
"idb-keyval": "^5.1.3",
|
||||||
"intl-messageformat": "^9.9.1",
|
"intl-messageformat": "^9.9.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
|
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="home-assistant-frontend",
|
name="home-assistant-frontend",
|
||||||
version="20211220.0",
|
version="20211227.0",
|
||||||
description="The Home Assistant frontend",
|
description="The Home Assistant frontend",
|
||||||
url="https://github.com/home-assistant/frontend",
|
url="https://github.com/home-assistant/frontend",
|
||||||
author="The Home Assistant Authors",
|
author="The Home Assistant Authors",
|
||||||
|
@ -8,6 +8,10 @@ import { FrontendLocaleData } from "../data/translation";
|
|||||||
import { getValueInPercentage, normalize } from "../util/calculate";
|
import { getValueInPercentage, normalize } from "../util/calculate";
|
||||||
import { isSafari } from "../util/is_safari";
|
import { isSafari } from "../util/is_safari";
|
||||||
|
|
||||||
|
// Safari version 15.2 and up behaves differently than other Safari versions.
|
||||||
|
// https://github.com/home-assistant/frontend/issues/10766
|
||||||
|
const isSafari152 = isSafari && /Version\/15\.[^0-1]/.test(navigator.userAgent);
|
||||||
|
|
||||||
const getAngle = (value: number, min: number, max: number) => {
|
const getAngle = (value: number, min: number, max: number) => {
|
||||||
const percentage = getValueInPercentage(normalize(value, min, max), min, max);
|
const percentage = getValueInPercentage(normalize(value, min, max), min, max);
|
||||||
return (percentage * 180) / 100;
|
return (percentage * 180) / 100;
|
||||||
@ -113,7 +117,9 @@ export class Gauge extends LitElement {
|
|||||||
: undefined
|
: undefined
|
||||||
)}
|
)}
|
||||||
transform=${ifDefined(
|
transform=${ifDefined(
|
||||||
isSafari ? `rotate(${this._angle} 50 50)` : undefined
|
isSafari
|
||||||
|
? `rotate(${this._angle}${isSafari152 ? "" : " 50 50"})`
|
||||||
|
: undefined
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
`
|
`
|
||||||
@ -126,7 +132,9 @@ export class Gauge extends LitElement {
|
|||||||
: undefined
|
: undefined
|
||||||
)}
|
)}
|
||||||
transform=${ifDefined(
|
transform=${ifDefined(
|
||||||
isSafari ? `rotate(${this._angle} 50 50)` : undefined
|
isSafari
|
||||||
|
? `rotate(${this._angle}${isSafari152 ? "" : " 50 50"})`
|
||||||
|
: undefined
|
||||||
)}
|
)}
|
||||||
>`
|
>`
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,6 @@ const panelUrl = (path: string) => {
|
|||||||
export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
||||||
@state() private _route: Route;
|
@state() private _route: Route;
|
||||||
|
|
||||||
@state() private _error = false;
|
|
||||||
|
|
||||||
private _panelUrl: string;
|
private _panelUrl: string;
|
||||||
|
|
||||||
private _haVersion?: string;
|
private _haVersion?: string;
|
||||||
@ -44,8 +42,6 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
|||||||
|
|
||||||
private _visiblePromiseResolve?: () => void;
|
private _visiblePromiseResolve?: () => void;
|
||||||
|
|
||||||
private _visibleLaunchScreen = true;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
const path = curPath();
|
const path = curPath();
|
||||||
@ -62,27 +58,22 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
|||||||
this._panelUrl = panelUrl(path);
|
this._panelUrl = panelUrl(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected render() {
|
protected renderHass() {
|
||||||
if (this._isHassComplete() && this.hass) {
|
return html`
|
||||||
return html`
|
<home-assistant-main
|
||||||
<home-assistant-main
|
.hass=${this.hass}
|
||||||
.hass=${this.hass}
|
.route=${this._route}
|
||||||
.route=${this._route}
|
></home-assistant-main>
|
||||||
></home-assistant-main>
|
`;
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update(changedProps) {
|
update(changedProps) {
|
||||||
super.update(changedProps);
|
if (this.hass?.states && this.hass.config && this.hass.services) {
|
||||||
|
this.render = this.renderHass;
|
||||||
// Remove launch screen if main gui is loaded
|
this.update = super.update;
|
||||||
if (this._isHassComplete() && this._visibleLaunchScreen) {
|
|
||||||
this._visibleLaunchScreen = false;
|
|
||||||
removeLaunchScreen();
|
removeLaunchScreen();
|
||||||
}
|
}
|
||||||
|
super.update(changedProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected firstUpdated(changedProps) {
|
protected firstUpdated(changedProps) {
|
||||||
@ -129,10 +120,9 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Render launch screen info box (loading data / error message)
|
// Render launch screen info box (loading data / error message)
|
||||||
if (!this._isHassComplete() && this._visibleLaunchScreen) {
|
// if Home Assistant is not loaded yet.
|
||||||
renderLaunchScreenInfoBox(
|
if (this.render !== this.renderHass) {
|
||||||
html`<ha-init-page .error=${this._error}></ha-init-page>`
|
this._renderInitInfo(false);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +178,7 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
|||||||
if (window.hassConnection) {
|
if (window.hassConnection) {
|
||||||
result = await window.hassConnection;
|
result = await window.hassConnection;
|
||||||
} else {
|
} else {
|
||||||
// In the edge case that
|
// In the edge case that core.ts loads before app.ts
|
||||||
result = await new Promise((resolve) => {
|
result = await new Promise((resolve) => {
|
||||||
window.hassConnectionReady = resolve;
|
window.hassConnectionReady = resolve;
|
||||||
});
|
});
|
||||||
@ -198,7 +188,7 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
|||||||
this._haVersion = conn.haVersion;
|
this._haVersion = conn.haVersion;
|
||||||
this.initializeHass(auth, conn);
|
this.initializeHass(auth, conn);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this._error = true;
|
this._renderInitInfo(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,12 +245,10 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _isHassComplete(): boolean {
|
private _renderInitInfo(error: boolean) {
|
||||||
if (this.hass?.states && this.hass.config && this.hass.services) {
|
renderLaunchScreenInfoBox(
|
||||||
return true;
|
html`<ha-init-page .error=${error}></ha-init-page>`
|
||||||
}
|
);
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import "@polymer/paper-input/paper-input";
|
|||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { componentsWithService } from "../../../common/config/components_with_service";
|
import { componentsWithService } from "../../../common/config/components_with_service";
|
||||||
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
|
|
||||||
import "../../../components/buttons/ha-call-service-button";
|
import "../../../components/buttons/ha-call-service-button";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import { checkCoreConfig } from "../../../data/core";
|
import { checkCoreConfig } from "../../../data/core";
|
||||||
@ -158,20 +157,6 @@ export class HaConfigServerControl extends LitElement {
|
|||||||
"ui.panel.config.server_control.section.server_management.restart"
|
"ui.panel.config.server_control.section.server_management.restart"
|
||||||
)}
|
)}
|
||||||
</ha-call-service-button>
|
</ha-call-service-button>
|
||||||
${!isComponentLoaded(this.hass, "hassio")
|
|
||||||
? html`<ha-call-service-button
|
|
||||||
class="warning"
|
|
||||||
.hass=${this.hass}
|
|
||||||
domain="homeassistant"
|
|
||||||
service="stop"
|
|
||||||
confirmation=${this.hass.localize(
|
|
||||||
"ui.panel.config.server_control.section.server_management.confirm_stop"
|
|
||||||
)}
|
|
||||||
>${this.hass.localize(
|
|
||||||
"ui.panel.config.server_control.section.server_management.stop"
|
|
||||||
)}
|
|
||||||
</ha-call-service-button>`
|
|
||||||
: ""}
|
|
||||||
</div>
|
</div>
|
||||||
</ha-card>
|
</ha-card>
|
||||||
|
|
||||||
|
@ -1419,7 +1419,7 @@
|
|||||||
},
|
},
|
||||||
"server_control": {
|
"server_control": {
|
||||||
"caption": "Server Controls",
|
"caption": "Server Controls",
|
||||||
"description": "Restart and stop the Home Assistant server",
|
"description": "Validate and restart the Home Assistant server",
|
||||||
"section": {
|
"section": {
|
||||||
"validation": {
|
"validation": {
|
||||||
"heading": "Configuration validation",
|
"heading": "Configuration validation",
|
||||||
|
@ -7,9 +7,9 @@ export const removeLaunchScreen = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const renderLaunchScreenInfoBox = (element: TemplateResult) => {
|
export const renderLaunchScreenInfoBox = (content: TemplateResult) => {
|
||||||
const infoBoxElement = document.getElementById("ha-launch-screen-info-box");
|
const infoBoxElement = document.getElementById("ha-launch-screen-info-box");
|
||||||
if (infoBoxElement) {
|
if (infoBoxElement) {
|
||||||
render(element, infoBoxElement);
|
render(content, infoBoxElement);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
10
yarn.lock
10
yarn.lock
@ -9113,7 +9113,7 @@ fsevents@^1.2.7:
|
|||||||
gulp-rename: ^2.0.0
|
gulp-rename: ^2.0.0
|
||||||
gulp-zopfli-green: ^3.0.1
|
gulp-zopfli-green: ^3.0.1
|
||||||
hls.js: ^1.0.11
|
hls.js: ^1.0.11
|
||||||
home-assistant-js-websocket: ^5.12.0
|
home-assistant-js-websocket: ^6.0.0
|
||||||
html-minifier: ^4.0.0
|
html-minifier: ^4.0.0
|
||||||
husky: ^1.3.1
|
husky: ^1.3.1
|
||||||
idb-keyval: ^5.1.3
|
idb-keyval: ^5.1.3
|
||||||
@ -9184,10 +9184,10 @@ fsevents@^1.2.7:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
"home-assistant-js-websocket@npm:^5.12.0":
|
"home-assistant-js-websocket@npm:^6.0.0":
|
||||||
version: 5.12.0
|
version: 6.0.0
|
||||||
resolution: "home-assistant-js-websocket@npm:5.12.0"
|
resolution: "home-assistant-js-websocket@npm:6.0.0"
|
||||||
checksum: 62171c10e55e3245c9a4fc77dbd2641f234a66b4e3d0adaf8c4364c567473555dbf34f3d737bf3f31e92f2a198051b57f2782fd71f8406784693e64496809501
|
checksum: fef904210f66e180457ac2ae003fd29a0613179d3f8e5bb3f37aaaf0d5708a86ed071feb0d3bbf7268fdf454acec49539c8e9c0100ef159a711fcc98fd78cb14
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user