* Sort areas alphabetically in device card

* Fix background color of registry editors when using themes

* Fix area/entity reg dialog being disabled after deletion

* Better fix card background

* Warn user when system health component not loaded
This commit is contained in:
Paulus Schoutsen 2019-02-01 09:40:57 -08:00 committed by GitHub
parent ecd33fd93c
commit 25a579f7ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 23 deletions

View File

@ -1,17 +1,18 @@
import { HomeAssistant } from "../types"; import { HomeAssistant } from "../types";
export interface HomeAssistantSystemHealthInfo {
version: string;
dev: boolean;
hassio: boolean;
virtualenv: string;
python_version: string;
docker: boolean;
arch: string;
timezone: string;
os_name: string;
}
export interface SystemHealthInfo { export interface SystemHealthInfo {
homeassistant: {
version: string;
dev: boolean;
hassio: boolean;
virtualenv: string;
python_version: string;
docker: boolean;
arch: string;
timezone: string;
os_name: string;
};
[domain: string]: { [key: string]: string | number | boolean }; [domain: string]: { [key: string]: string | number | boolean };
} }

View File

@ -97,6 +97,7 @@ class DialogAreaDetail extends LitElement {
} }
private async _updateEntry() { private async _updateEntry() {
this._submitting = true;
try { try {
const values: AreaRegistryEntryMutableParams = { const values: AreaRegistryEntryMutableParams = {
name: this._name.trim(), name: this._name.trim(),
@ -109,12 +110,19 @@ class DialogAreaDetail extends LitElement {
this._params = undefined; this._params = undefined;
} catch (err) { } catch (err) {
this._error = err; this._error = err;
} finally {
this._submitting = false;
} }
} }
private async _deleteEntry() { private async _deleteEntry() {
if (await this._params!.removeEntry()) { this._submitting = true;
this._params = undefined; try {
if (await this._params!.removeEntry()) {
this._params = undefined;
}
} finally {
this._submitting = false;
} }
} }

View File

@ -162,7 +162,6 @@ All devices in this area will become unassigned.`)
display: block; display: block;
max-width: 600px; max-width: 600px;
margin: 16px auto; margin: 16px auto;
background-color: white;
} }
.empty { .empty {
text-align: center; text-align: center;

View File

@ -145,7 +145,7 @@ class HaConfigEntries extends NavigateMixin(PolymerElement) {
}); });
fetchAreaRegistry(this.hass).then((areas) => { fetchAreaRegistry(this.hass).then((areas) => {
this._areas = areas; this._areas = areas.sort((a, b) => compare(a.name, b.name));
}); });
} }

View File

@ -123,25 +123,27 @@ class DialogEntityRegistryDetail extends LitElement {
} }
private async _updateEntry(): Promise<void> { private async _updateEntry(): Promise<void> {
this._submitting = true;
try { try {
this._submitting = true;
await this._params!.updateEntry({ await this._params!.updateEntry({
name: this._name.trim() || null, name: this._name.trim() || null,
new_entity_id: this._entityId.trim(), new_entity_id: this._entityId.trim(),
}); });
this._params = undefined; this._params = undefined;
} catch (err) { } catch (err) {
this._submitting = false;
this._error = err; this._error = err;
} finally {
this._submitting = false;
} }
} }
private async _deleteEntry(): Promise<void> { private async _deleteEntry(): Promise<void> {
this._submitting = true; this._submitting = true;
try {
if (await this._params!.removeEntry()) { if (await this._params!.removeEntry()) {
this._params = undefined; this._params = undefined;
} else { }
} finally {
this._submitting = false; this._submitting = false;
} }
} }

View File

@ -150,7 +150,6 @@ Deleting an entry will not remove the entity from Home Assistant. To do this, yo
} }
paper-card { paper-card {
display: block; display: block;
background-color: white;
} }
paper-icon-item { paper-icon-item {
cursor: pointer; cursor: pointer;

View File

@ -95,7 +95,16 @@ class SystemHealthCard extends LitElement {
} }
private async _fetchInfo() { private async _fetchInfo() {
this._info = await fetchSystemHealthInfo(this.hass!); try {
this._info = await fetchSystemHealthInfo(this.hass!);
} catch (err) {
this._info = {
system_health: {
error:
"System Health component is not loaded. Add 'system_health:' to configuration.yaml",
},
};
}
} }
static get styles(): CSSResult { static get styles(): CSSResult {

View File

@ -35,6 +35,7 @@
"sensor": "Sensor", "sensor": "Sensor",
"sun": "Sun", "sun": "Sun",
"switch": "Switch", "switch": "Switch",
"system_health": "System Health",
"updater": "Updater", "updater": "Updater",
"vacuum": "Vacuum", "vacuum": "Vacuum",
"weblink": "Weblink", "weblink": "Weblink",