From cfa4c14108cef75d064e432142ac814d95e3363f Mon Sep 17 00:00:00 2001 From: Yosi Levy Date: Sun, 19 Jul 2020 05:56:39 +0300 Subject: [PATCH 1/5] Added search label support to ha-data-table --- src/components/data-table/ha-data-table.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts index 05283fb7db..912d0b02c4 100644 --- a/src/components/data-table/ha-data-table.ts +++ b/src/components/data-table/ha-data-table.ts @@ -98,6 +98,8 @@ export class HaDataTable extends LitElement { @property({ type: String }) public noDataText?: string; + @property({ type: String }) public searchLabel = ""; + @property({ type: String }) public filter = ""; @internalProperty() private _filterable = false; @@ -202,6 +204,7 @@ export class HaDataTable extends LitElement {
` From 3e14d27a1ef83f47634bfddbc8477d6d4c272f72 Mon Sep 17 00:00:00 2001 From: Yosi Levy Date: Sun, 19 Jul 2020 05:58:01 +0300 Subject: [PATCH 2/5] Usage of search label --- .../integration-panels/zha/zha-clusters-data-table.ts | 1 + .../integration-panels/zha/zha-device-endpoint-data-table.ts | 1 + .../lovelace/editor/unused-entities/hui-unused-entities.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts b/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts index 3354b0f80f..45625b6ad6 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts @@ -93,6 +93,7 @@ export class ZHAClustersDataTable extends LitElement { selectable auto-height .dir=${computeRTLDirection(this.hass)} + .searchLabel=${this.hass.localize("ui.components.data-table.search")} > `; } diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts index b316805b31..8c07e59107 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts @@ -149,6 +149,7 @@ export class ZHADeviceEndpointDataTable extends LitElement { .selectable=${this.selectable} auto-height .dir=${computeRTLDirection(this.hass)} + .searchLabel=${this.hass.localize("ui.components.data-table.search")} > `; } diff --git a/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts b/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts index 28f114ae97..76269a2090 100644 --- a/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts +++ b/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts @@ -176,6 +176,7 @@ export class HuiUnusedEntities extends LitElement { selectable @selection-changed=${this._handleSelectionChanged} .dir=${computeRTLDirection(this.hass)} + .searchLabel=${this.hass.localize("ui.components.data-table.search")} > ${this._selectedEntities.length From 3f920767f173c78e16682319fcb6ce36408184ed Mon Sep 17 00:00:00 2001 From: Yosi Levy Date: Sun, 19 Jul 2020 06:04:42 +0300 Subject: [PATCH 3/5] Added noDataText --- src/components/data-table/ha-data-table.ts | 2 +- .../integration-panels/zha/zha-clusters-data-table.ts | 1 + .../integration-panels/zha/zha-device-endpoint-data-table.ts | 1 + .../lovelace/editor/unused-entities/hui-unused-entities.ts | 1 + src/translations/en.json | 3 ++- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts index 912d0b02c4..3bd894e288 100644 --- a/src/components/data-table/ha-data-table.ts +++ b/src/components/data-table/ha-data-table.ts @@ -98,7 +98,7 @@ export class HaDataTable extends LitElement { @property({ type: String }) public noDataText?: string; - @property({ type: String }) public searchLabel = ""; + @property({ type: String }) public searchLabel?: string; @property({ type: String }) public filter = ""; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts b/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts index 45625b6ad6..96fd1e679a 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts @@ -94,6 +94,7 @@ export class ZHAClustersDataTable extends LitElement { auto-height .dir=${computeRTLDirection(this.hass)} .searchLabel=${this.hass.localize("ui.components.data-table.search")} + .noDataText=${this.hass.localize("ui.components.data-table.no-data")} > `; } diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts index 8c07e59107..0a12acabe6 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts @@ -150,6 +150,7 @@ export class ZHADeviceEndpointDataTable extends LitElement { auto-height .dir=${computeRTLDirection(this.hass)} .searchLabel=${this.hass.localize("ui.components.data-table.search")} + .noDataText=${this.hass.localize("ui.components.data-table.no-data")} > `; } diff --git a/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts b/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts index 76269a2090..ef6a2aec42 100644 --- a/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts +++ b/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts @@ -177,6 +177,7 @@ export class HuiUnusedEntities extends LitElement { @selection-changed=${this._handleSelectionChanged} .dir=${computeRTLDirection(this.hass)} .searchLabel=${this.hass.localize("ui.components.data-table.search")} + .noDataText=${this.hass.localize("ui.components.data-table.no-data")} > ${this._selectedEntities.length diff --git a/src/translations/en.json b/src/translations/en.json index 9dcdeb92e0..4ba4a13fce 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -335,7 +335,8 @@ "automation": "Part of the following automations" }, "data-table": { - "search": "Search" + "search": "Search", + "no-data": "No data" } }, "dialogs": { From 7638020bfc3a31c3264a4d8154002fcf730f420b Mon Sep 17 00:00:00 2001 From: Yosi Levy Date: Mon, 20 Jul 2020 13:37:18 +0300 Subject: [PATCH 4/5] Changed default wording --- .../editor/unused-entities/hui-unused-entities.ts | 8 ++++++-- src/translations/en.json | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts b/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts index ef6a2aec42..00b6e82f7d 100644 --- a/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts +++ b/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts @@ -176,8 +176,12 @@ export class HuiUnusedEntities extends LitElement { selectable @selection-changed=${this._handleSelectionChanged} .dir=${computeRTLDirection(this.hass)} - .searchLabel=${this.hass.localize("ui.components.data-table.search")} - .noDataText=${this.hass.localize("ui.components.data-table.no-data")} + .searchLabel=${this.hass.localize( + "ui.panel.lovelace.unused_entities.search" + )} + .noDataText=${this.hass.localize( + "ui.panel.lovelace.unused_entities.no-data" + )} > ${this._selectedEntities.length diff --git a/src/translations/en.json b/src/translations/en.json index 4ba4a13fce..33d10e8648 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1830,7 +1830,9 @@ "entity": "Entity", "entity_id": "Entity ID", "domain": "Domain", - "last_changed": "Last Changed" + "last_changed": "Last Changed", + "search": "Search entities", + "no_data": "No unused entities found" }, "add_entities": { "yaml_unsupported": "You cannot use this function when using Lovelace UI in YAML mode.", From a6e948c808bb8dcdd33cdcf13ccc4082907db453 Mon Sep 17 00:00:00 2001 From: Yosi Levy Date: Mon, 20 Jul 2020 13:41:20 +0300 Subject: [PATCH 5/5] Typeo --- .../lovelace/editor/unused-entities/hui-unused-entities.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts b/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts index 00b6e82f7d..27dc450346 100644 --- a/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts +++ b/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts @@ -180,7 +180,7 @@ export class HuiUnusedEntities extends LitElement { "ui.panel.lovelace.unused_entities.search" )} .noDataText=${this.hass.localize( - "ui.panel.lovelace.unused_entities.no-data" + "ui.panel.lovelace.unused_entities.no_data" )} >