Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20200907.0 #6821

Merged
merged 23 commits into from
Sep 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d5794c3
[ci skip] Translation update
homeassistant Sep 5, 2020
879011c
Fix incorrect link to mode documentation in automation editor (#6793)
donkawechico Sep 5, 2020
8f8a2ce
Don't show source select dialog when media player Unavailable. (#6799)
pszafer Sep 5, 2020
3fd7899
Display services as services and not devices (#6798)
ludeeus Sep 6, 2020
d69333d
[ci skip] Translation update
homeassistant Sep 6, 2020
bd66bd6
Add color to hass-error-screen (#6803)
ludeeus Sep 6, 2020
76f59d9
Remove extra > from button (#6804)
ludeeus Sep 6, 2020
9aa8175
Update ha-logbook.ts
bramkragten Sep 6, 2020
509481e
Ignore more proxy disconnect codes (#6805)
ludeeus Sep 6, 2020
cfa0c45
Fix media browser panel title + selection header color (#6807)
spacegaier Sep 6, 2020
a37aad1
Minor typo fix (#6809)
SeanPM5 Sep 6, 2020
efe8eca
Media browser updates (#6801)
zsarnett Sep 6, 2020
c73330a
[ci skip] Translation update
homeassistant Sep 7, 2020
979b7ae
Add attention required for config flows in progress (#6808)
bramkragten Sep 7, 2020
d5bc498
Fix action handler bugs (#6811)
bramkragten Sep 7, 2020
bb24624
Use Sortable to move entities in entities editor (#6810)
zsarnett Sep 7, 2020
e5c386c
Fix white flash in dark mode (#6815)
bramkragten Sep 7, 2020
0c7c536
Fixes issues with channel toggle (#6812)
ludeeus Sep 7, 2020
80224e6
Fix onboarding styling (#6819)
bramkragten Sep 7, 2020
de7ffb1
Automation editor tweaks (#6713)
bramkragten Sep 7, 2020
5339fe6
Updates to correct zindexs on new dialogs (#6816)
zsarnett Sep 7, 2020
046f7b5
Handle media browser errors (#6813)
bramkragten Sep 7, 2020
f15fbe5
Bumped version to 20200907.0
bramkragten Sep 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hassio/src/addon-view/config/hassio-addon-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class HassioAddonNetwork extends LitElement {
</div>
<div class="card-actions">
<ha-progress-button class="warning" @click=${this._resetTapped}>
Reset to defaults </ha-progress-button
>>
Reset to defaults
</ha-progress-button>
<ha-progress-button @click=${this._saveTapped}>
Save
</ha-progress-button>
Expand Down
5 changes: 3 additions & 2 deletions hassio/src/dashboard/hassio-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ export class HassioUpdate extends LitElement {
try {
await this.hass.callApi<HassioResponse<void>>("POST", item.apiPath);
} catch (err) {
// Only show an error if the status code was not 504, or no status at all (connection terminated)
if (err.status_code && err.status_code !== 504) {
// Only show an error if the status code was not expected (user behind proxy)
// or no status at all(connection terminated)
if (err.status_code && ![502, 503, 504].includes(err.status_code)) {
showAlertDialog(this, {
title: "Update failed",
text: extractApiErrorMessage(err),
Expand Down
5 changes: 4 additions & 1 deletion hassio/src/system/hassio-supervisor-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
setSupervisorOption,
SupervisorOptions,
updateSupervisor,
fetchHassioSupervisorInfo,
} from "../../../src/data/hassio/supervisor";
import {
showAlertDialog,
Expand Down Expand Up @@ -176,10 +177,11 @@ class HassioSupervisorInfo extends LitElement {

try {
const data: Partial<SupervisorOptions> = {
channel: this.supervisorInfo.channel !== "stable" ? "beta" : "stable",
channel: this.supervisorInfo.channel === "stable" ? "beta" : "stable",
};
await setSupervisorOption(this.hass, data);
await reloadSupervisor(this.hass);
this.supervisorInfo = await fetchHassioSupervisorInfo(this.hass);
} catch (err) {
showAlertDialog(this, {
title: "Failed to set supervisor option",
Expand All @@ -195,6 +197,7 @@ class HassioSupervisorInfo extends LitElement {

try {
await reloadSupervisor(this.hass);
this.supervisorInfo = await fetchHassioSupervisorInfo(this.hass);
} catch (err) {
showAlertDialog(this, {
title: "Failed to reload the supervisor",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"@polymer/polymer": "3.1.0",
"@thomasloven/round-slider": "0.5.0",
"@types/chromecast-caf-sender": "^1.0.3",
"@types/sortablejs": "^1.10.6",
"@vaadin/vaadin-combo-box": "^5.0.10",
"@vaadin/vaadin-date-picker": "^4.0.7",
"@vue/web-component-wrapper": "^1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="home-assistant-frontend",
version="20200904.0",
version="20200907.0",
description="The Home Assistant frontend",
url="https://github.com/home-assistant/home-assistant-polymer",
author="The Home Assistant Authors",
Expand Down
178 changes: 178 additions & 0 deletions src/components/entity/ha-entity-attribute-picker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
import "@polymer/paper-input/paper-input";
import "@polymer/paper-item/paper-item";
import "@vaadin/vaadin-combo-box/theme/material/vaadin-combo-box-light";
import { HassEntity } from "home-assistant-js-websocket";
import {
css,
CSSResult,
customElement,
html,
LitElement,
property,
PropertyValues,
query,
TemplateResult,
} from "lit-element";
import { fireEvent } from "../../common/dom/fire_event";
import { PolymerChangedEvent } from "../../polymer-types";
import { HomeAssistant } from "../../types";
import "../ha-icon-button";
import "./state-badge";

export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;

const rowRenderer = (root: HTMLElement, _owner, model: { item: string }) => {
if (!root.firstElementChild) {
root.innerHTML = `
<style>
paper-item {
margin: -10px;
padding: 0;
}
</style>
<paper-item></paper-item>
`;
}
root.querySelector("paper-item")!.textContent = model.item;
};

@customElement("ha-entity-attribute-picker")
class HaEntityAttributePicker extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public entityId?: string;

@property({ type: Boolean }) public autofocus = false;

@property({ type: Boolean }) public disabled = false;

@property({ type: Boolean, attribute: "allow-custom-value" })
public allowCustomValue;

@property() public label?: string;

@property() public value?: string;

@property({ type: Boolean }) private _opened = false;

@query("vaadin-combo-box-light") private _comboBox!: HTMLElement;

protected shouldUpdate(changedProps: PropertyValues) {
return !(!changedProps.has("_opened") && this._opened);
}

protected updated(changedProps: PropertyValues) {
if (changedProps.has("_opened") && this._opened) {
const state = this.entityId ? this.hass.states[this.entityId] : undefined;
(this._comboBox as any).items = state
? Object.keys(state.attributes)
: [];
}
}

protected render(): TemplateResult {
if (!this.hass) {
return html``;
}

return html`
<vaadin-combo-box-light
.value=${this._value}
.allowCustomValue=${this.allowCustomValue}
.renderer=${rowRenderer}
@opened-changed=${this._openedChanged}
@value-changed=${this._valueChanged}
>
<paper-input
.autofocus=${this.autofocus}
.label=${this.label ??
this.hass.localize(
"ui.components.entity.entity-attribute-picker.attribute"
)}
.value=${this._value}
.disabled=${this.disabled || !this.entityId}
class="input"
autocapitalize="none"
autocomplete="off"
autocorrect="off"
spellcheck="false"
>
${this.value
? html`
<ha-icon-button
aria-label=${this.hass.localize(
"ui.components.entity.entity-picker.clear"
)}
slot="suffix"
class="clear-button"
icon="hass:close"
@click=${this._clearValue}
no-ripple
>
Clear
</ha-icon-button>
`
: ""}

<ha-icon-button
aria-label=${this.hass.localize(
"ui.components.entity.entity-attribute-picker.show_attributes"
)}
slot="suffix"
class="toggle-button"
.icon=${this._opened ? "hass:menu-up" : "hass:menu-down"}
>
Toggle
</ha-icon-button>
</paper-input>
</vaadin-combo-box-light>
`;
}

private _clearValue(ev: Event) {
ev.stopPropagation();
this._setValue("");
}

private get _value() {
return this.value || "";
}

private _openedChanged(ev: PolymerChangedEvent<boolean>) {
this._opened = ev.detail.value;
}

private _valueChanged(ev: PolymerChangedEvent<string>) {
const newValue = ev.detail.value;
if (newValue !== this._value) {
this._setValue(newValue);
}
}

private _setValue(value: string) {
this.value = value;
setTimeout(() => {
fireEvent(this, "value-changed", { value });
fireEvent(this, "change");
}, 0);
}

static get styles(): CSSResult {
return css`
paper-input > ha-icon-button {
--mdc-icon-button-size: 24px;
padding: 0px 2px;
color: var(--secondary-text-color);
}
[hidden] {
display: none;
}
`;
}
}

declare global {
interface HTMLElementTagNameMap {
"ha-entity-attribute-picker": HaEntityAttributePicker;
}
}
15 changes: 12 additions & 3 deletions src/components/entity/ha-entity-picker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "../ha-icon-button";
import "@polymer/paper-input/paper-input";
import "@polymer/paper-item/paper-icon-item";
import "@polymer/paper-item/paper-item-body";
Expand All @@ -20,6 +19,7 @@ import { computeDomain } from "../../common/entity/compute_domain";
import { computeStateName } from "../../common/entity/compute_state_name";
import { PolymerChangedEvent } from "../../polymer-types";
import { HomeAssistant } from "../../types";
import "../ha-icon-button";
import "./state-badge";

export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
Expand Down Expand Up @@ -95,6 +95,8 @@ class HaEntityPicker extends LitElement {

@query("vaadin-combo-box-light") private _comboBox!: HTMLElement;

private _initedStates = false;

private _getStates = memoizeOne(
(
_opened: boolean,
Expand Down Expand Up @@ -148,11 +150,18 @@ class HaEntityPicker extends LitElement {
);

protected shouldUpdate(changedProps: PropertyValues) {
if (
changedProps.has("value") ||
changedProps.has("label") ||
changedProps.has("disabled")
) {
return true;
}
return !(!changedProps.has("_opened") && this._opened);
}

protected updated(changedProps: PropertyValues) {
if (changedProps.has("_opened") && this._opened) {
if (!this._initedStates || (changedProps.has("_opened") && this._opened)) {
const states = this._getStates(
this._opened,
this.hass,
Expand All @@ -162,14 +171,14 @@ class HaEntityPicker extends LitElement {
this.includeDeviceClasses
);
(this._comboBox as any).items = states;
this._initedStates = true;
}
}

protected render(): TemplateResult {
if (!this.hass) {
return html``;
}

return html`
<vaadin-combo-box-light
item-value-path="entity_id"
Expand Down
1 change: 1 addition & 0 deletions src/components/ha-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class HaDialog extends MwcDialog {
}
.mdc-dialog .mdc-dialog__surface {
position: var(--dialog-surface-position, relative);
top: var(--dialog-surface-top);
min-height: var(--mdc-dialog-min-height, auto);
}
:host([flexContent]) .mdc-dialog .mdc-dialog__content {
Expand Down
77 changes: 0 additions & 77 deletions src/components/ha-sidebar-sort-styles.ts

This file was deleted.

Loading