Merge pull request #13329 from home-assistant/dev

This commit is contained in:
Zack Barett 2022-08-02 10:20:21 -05:00 committed by GitHub
commit df4b83349e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 59 additions and 30 deletions

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 90 days stale policy - name: 90 days stale policy
uses: actions/stale@v5.1.0 uses: actions/stale@v5.1.1
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 90 days-before-stale: 90

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "home-assistant-frontend" name = "home-assistant-frontend"
version = "20220728.0" version = "20220802.0"
license = {text = "Apache-2.0"} license = {text = "Apache-2.0"}
description = "The Home Assistant frontend" description = "The Home Assistant frontend"
readme = "README.md" readme = "README.md"

View File

@ -1,5 +1,4 @@
import "@material/mwc-list/mwc-list-item"; import "@material/mwc-list/mwc-list-item";
import "./ha-select";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
@ -8,6 +7,7 @@ import { stopPropagation } from "../common/dom/stop_propagation";
import { stringCompare } from "../common/string/compare"; import { stringCompare } from "../common/string/compare";
import { Blueprint, Blueprints, fetchBlueprints } from "../data/blueprint"; import { Blueprint, Blueprints, fetchBlueprints } from "../data/blueprint";
import { HomeAssistant } from "../types"; import { HomeAssistant } from "../types";
import "./ha-select";
@customElement("ha-blueprint-picker") @customElement("ha-blueprint-picker")
class HaBluePrintPicker extends LitElement { class HaBluePrintPicker extends LitElement {
@ -59,11 +59,6 @@ class HaBluePrintPicker extends LitElement {
@selected=${this._blueprintChanged} @selected=${this._blueprintChanged}
@closed=${stopPropagation} @closed=${stopPropagation}
> >
<mwc-list-item value="">
${this.hass.localize(
"ui.components.blueprint-picker.select_blueprint"
)}
</mwc-list-item>
${this._processedBlueprints(this.blueprints).map( ${this._processedBlueprints(this.blueprints).map(
(blueprint) => html` (blueprint) => html`
<mwc-list-item .value=${blueprint.path}> <mwc-list-item .value=${blueprint.path}>

View File

@ -6,7 +6,10 @@ export const computeInitialHaFormData = (
): Record<string, any> => { ): Record<string, any> => {
const data = {}; const data = {};
schema.forEach((field) => { schema.forEach((field) => {
if (field.description?.suggested_value !== undefined) { if (
field.description?.suggested_value !== undefined &&
field.description?.suggested_value !== null
) {
data[field.name] = field.description.suggested_value; data[field.name] = field.description.suggested_value;
} else if ("default" in field) { } else if ("default" in field) {
data[field.name] = field.default; data[field.name] = field.default;

View File

@ -105,7 +105,8 @@ export class HaFormInteger extends LitElement implements HaFormElement {
} }
return ( return (
this.schema.description?.suggested_value !== undefined || (this.schema.description?.suggested_value !== undefined &&
this.schema.description?.suggested_value !== null) ||
this.schema.default || this.schema.default ||
this.schema.valueMin || this.schema.valueMin ||
0 0

View File

@ -11,24 +11,24 @@ import {
} from "lit"; } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { computeDomain } from "../../../../common/entity/compute_domain"; import { computeDomain } from "../../../../common/entity/compute_domain";
import { computeStateName } from "../../../../common/entity/compute_state_name";
import { domainIcon } from "../../../../common/entity/domain_icon"; import { domainIcon } from "../../../../common/entity/domain_icon";
import { stripPrefixFromEntityName } from "../../../../common/entity/strip_prefix_from_entity_name";
import "../../../../components/entity/state-badge"; import "../../../../components/entity/state-badge";
import "../../../../components/ha-card"; import "../../../../components/ha-card";
import "../../../../components/ha-icon"; import "../../../../components/ha-icon";
import type { LovelaceRowConfig } from "../../../lovelace/entity-rows/types";
import type { HomeAssistant } from "../../../../types";
import type { HuiErrorCard } from "../../../lovelace/cards/hui-error-card";
import { createRowElement } from "../../../lovelace/create-element/create-row-element";
import { addEntitiesToLovelaceView } from "../../../lovelace/editor/add-entities-to-view";
import { LovelaceRow } from "../../../lovelace/entity-rows/types";
import { showEntityEditorDialog } from "../../entities/show-dialog-entity-editor";
import { EntityRegistryStateEntry } from "../ha-config-device-page";
import { computeStateName } from "../../../../common/entity/compute_state_name";
import { stripPrefixFromEntityName } from "../../../../common/entity/strip_prefix_from_entity_name";
import { import {
ExtEntityRegistryEntry, ExtEntityRegistryEntry,
getExtendedEntityRegistryEntry, getExtendedEntityRegistryEntry,
} from "../../../../data/entity_registry"; } from "../../../../data/entity_registry";
import type { HomeAssistant } from "../../../../types";
import type { HuiErrorCard } from "../../../lovelace/cards/hui-error-card";
import { createRowElement } from "../../../lovelace/create-element/create-row-element";
import { addEntitiesToLovelaceView } from "../../../lovelace/editor/add-entities-to-view";
import type { LovelaceRowConfig } from "../../../lovelace/entity-rows/types";
import { LovelaceRow } from "../../../lovelace/entity-rows/types";
import { showEntityEditorDialog } from "../../entities/show-dialog-entity-editor";
import { EntityRegistryStateEntry } from "../ha-config-device-page";
@customElement("ha-device-entities-card") @customElement("ha-device-entities-card")
export class HaDeviceEntitiesCard extends LitElement { export class HaDeviceEntitiesCard extends LitElement {
@ -165,7 +165,7 @@ export class HaDeviceEntitiesCard extends LitElement {
const stateObj = this.hass.states[entry.entity_id]; const stateObj = this.hass.states[entry.entity_id];
let name = entry.name let name = entry.name
? entry.name ? stripPrefixFromEntityName(entry.name, this.deviceName.toLowerCase())
: entry.has_entity_name : entry.has_entity_name
? entry.original_name || this.deviceName ? entry.original_name || this.deviceName
: stripPrefixFromEntityName( : stripPrefixFromEntityName(

View File

@ -8,7 +8,6 @@ import {
mdiDevices, mdiDevices,
mdiInformation, mdiInformation,
mdiInformationOutline, mdiInformationOutline,
mdiLifebuoy,
mdiLightningBolt, mdiLightningBolt,
mdiMapMarkerRadius, mdiMapMarkerRadius,
mdiMathLog, mdiMathLog,
@ -19,6 +18,7 @@ import {
mdiPaletteSwatch, mdiPaletteSwatch,
mdiPuzzle, mdiPuzzle,
mdiRobot, mdiRobot,
mdiScrewdriver,
mdiScriptText, mdiScriptText,
mdiShape, mdiShape,
mdiSofa, mdiSofa,
@ -270,7 +270,7 @@ export const configSections: { [name: string]: PageNavigation[] } = {
{ {
path: "/config/repairs", path: "/config/repairs",
translationKey: "repairs", translationKey: "repairs",
iconPath: mdiLifebuoy, iconPath: mdiScrewdriver,
iconColor: "#5c995c", iconColor: "#5c995c",
}, },
{ {

View File

@ -1,4 +1,5 @@
import "@material/mwc-button/mwc-button"; import "@material/mwc-button/mwc-button";
import { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item-base";
import "@polymer/paper-item/paper-icon-item"; import "@polymer/paper-item/paper-icon-item";
import "@polymer/paper-tooltip/paper-tooltip"; import "@polymer/paper-tooltip/paper-tooltip";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
@ -6,6 +7,7 @@ import { customElement, property, query, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map"; import { classMap } from "lit/directives/class-map";
import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { isComponentLoaded } from "../../../common/config/is_component_loaded";
import { dynamicElement } from "../../../common/dom/dynamic-element-directive"; import { dynamicElement } from "../../../common/dom/dynamic-element-directive";
import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event";
import "../../../components/ha-circular-progress"; import "../../../components/ha-circular-progress";
import "../../../components/ha-dialog"; import "../../../components/ha-dialog";
import { getConfigFlowHandlers } from "../../../data/config_flow"; import { getConfigFlowHandlers } from "../../../data/config_flow";
@ -81,11 +83,15 @@ export class DialogHelperDetail extends LitElement {
public closeDialog(): void { public closeDialog(): void {
this._opened = false; this._opened = false;
this._error = ""; this._error = undefined;
this._domain = undefined;
this._params = undefined; this._params = undefined;
} }
protected render(): TemplateResult { protected render(): TemplateResult {
if (!this._opened) {
return html``;
}
let content: TemplateResult; let content: TemplateResult;
if (this._domain) { if (this._domain) {
@ -189,7 +195,7 @@ export class DialogHelperDetail extends LitElement {
return html` return html`
<ha-dialog <ha-dialog
.open=${this._opened} open
@closed=${this.closeDialog} @closed=${this.closeDialog}
class=${classMap({ "button-left": !this._domain })} class=${classMap({ "button-left": !this._domain })}
scrimClickAction scrimClickAction
@ -229,7 +235,10 @@ export class DialogHelperDetail extends LitElement {
} }
} }
private _domainPicked(ev: Event): void { private _domainPicked(ev: CustomEvent<RequestSelectedDetail>): void {
if (!shouldHandleRequestSelectedEvent(ev)) {
return;
}
const domain = (ev.currentTarget! as any).domain; const domain = (ev.currentTarget! as any).domain;
if (domain in HELPERS) { if (domain in HELPERS) {

View File

@ -6,6 +6,8 @@ import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { isComponentLoaded } from "../../../common/config/is_component_loaded";
import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event"; import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event";
import { navigate } from "../../../common/navigate";
import { extractSearchParam } from "../../../common/url/search-params";
import "../../../components/ha-card"; import "../../../components/ha-card";
import "../../../components/ha-check-list-item"; import "../../../components/ha-check-list-item";
import { import {
@ -37,6 +39,17 @@ class HaConfigRepairsDashboard extends SubscribeMixin(LitElement) {
: repairsIssues.filter((issue) => !issue.ignored) : repairsIssues.filter((issue) => !issue.ignored)
); );
public connectedCallback(): void {
super.connectedCallback();
const searchParam = extractSearchParam("dialog");
if (searchParam === "system-health") {
navigate("/config/repairs", { replace: true });
showSystemInformationDialog(this);
}
}
public hassSubscribe(): UnsubscribeFunc[] { public hassSubscribe(): UnsubscribeFunc[] {
return [ return [
subscribeRepairsIssueRegistry(this.hass.connection!, (repairs) => { subscribeRepairsIssueRegistry(this.hass.connection!, (repairs) => {

View File

@ -281,7 +281,7 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) {
}); });
break; break;
case "unsupported_state_class": case "unsupported_state_class":
showAlertDialog(this, { showConfirmationDialog(this, {
title: "Unsupported state class", title: "Unsupported state class",
text: html`The state class of this entity, ${issue.data.state_class} text: html`The state class of this entity, ${issue.data.state_class}
is not supported. <br />Statistics can not be generated until this is not supported. <br />Statistics can not be generated until this
@ -296,7 +296,15 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) {
rel="noreferrer noopener" rel="noreferrer noopener"
> >
developer documentation</a developer documentation</a
>.`, >. If the state class has permanently changed, you may want to
remove the long term statistics of it from your database.<br /><br />Do
you want to permanently remove the long term statistics of
${issue.data.statistic_id} from your database?`,
confirmText: this.hass.localize("ui.common.remove"),
confirm: async () => {
await clearStatistics(this.hass, [issue.data.statistic_id]);
this._validateStatistics();
},
}); });
break; break;
case "unsupported_unit_metadata": case "unsupported_unit_metadata":

View File

@ -157,7 +157,7 @@ export const getMyRedirects = (hasSupervisor: boolean): Redirects => ({
redirect: "/config/info", redirect: "/config/info",
}, },
system_health: { system_health: {
redirect: "/config/system_health", redirect: "/config/repairs?dialog=system-health",
}, },
hardware: { hardware: {
redirect: "/config/hardware", redirect: "/config/hardware",

View File

@ -30,7 +30,7 @@ class StateCardNumber extends mixinBehaviors(
.sliderstate { .sliderstate {
min-width: 45px; min-width: 45px;
} }
ha-slider[hidden] { [hidden] {
display: none !important; display: none !important;
} }
ha-textfield { ha-textfield {