mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Add count of items (#20410)
* Add count of items * Adjust layout, correct filter count
This commit is contained in:
parent
72d1e37a23
commit
5c42c5130c
@ -496,8 +496,9 @@ export class HaTabsSubpageDataTable extends LitElement {
|
||||
${this.showFilters && !showPane
|
||||
? html`<ha-dialog
|
||||
open
|
||||
hideActions
|
||||
.heading=${localize("ui.components.subpage-data-table.filters")}
|
||||
.heading=${localize("ui.components.subpage-data-table.filters", {
|
||||
number: this.data.length,
|
||||
})}
|
||||
>
|
||||
<ha-dialog-header slot="heading">
|
||||
<ha-icon-button
|
||||
@ -509,7 +510,9 @@ export class HaTabsSubpageDataTable extends LitElement {
|
||||
)}
|
||||
></ha-icon-button>
|
||||
<span slot="title"
|
||||
>${localize("ui.components.subpage-data-table.filters")}</span
|
||||
>${localize("ui.components.subpage-data-table.filters", {
|
||||
number: this.data.length,
|
||||
})}</span
|
||||
>
|
||||
${this.filters
|
||||
? html`<ha-icon-button
|
||||
@ -523,8 +526,17 @@ export class HaTabsSubpageDataTable extends LitElement {
|
||||
: nothing}
|
||||
</ha-dialog-header>
|
||||
<div class="filter-dialog-content">
|
||||
<slot name="filter-pane"></slot></div
|
||||
></ha-dialog>`
|
||||
<slot name="filter-pane"></slot>
|
||||
</div>
|
||||
<div slot="primaryAction">
|
||||
<ha-button @click=${this._toggleFilters}>
|
||||
${this.hass.localize(
|
||||
"ui.components.subpage-data-table.show_results",
|
||||
{ number: this.data.length }
|
||||
)}
|
||||
</ha-button>
|
||||
</div>
|
||||
</ha-dialog>`
|
||||
: nothing}
|
||||
`;
|
||||
}
|
||||
@ -793,7 +805,7 @@ export class HaTabsSubpageDataTable extends LitElement {
|
||||
}
|
||||
|
||||
.filter-dialog-content {
|
||||
height: calc(100vh - 1px - var(--header-height));
|
||||
height: calc(100vh - 1px - 61px - var(--header-height));
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
@ -422,6 +422,14 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
|
||||
const labelsInOverflow =
|
||||
(this._sizeController.value && this._sizeController.value < 700) ||
|
||||
(!this._sizeController.value && this.hass.dockedSidebar === "docked");
|
||||
const automations = this._automations(
|
||||
this.automations,
|
||||
this._entityReg,
|
||||
this.hass.areas,
|
||||
this._categories,
|
||||
this._labels,
|
||||
this._filteredAutomations
|
||||
);
|
||||
return html`
|
||||
<hass-tabs-subpage-data-table
|
||||
.hass=${this.hass}
|
||||
@ -432,13 +440,23 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
|
||||
id="entity_id"
|
||||
.route=${this.route}
|
||||
.tabs=${configSections.automations}
|
||||
.searchLabel=${this.hass.localize(
|
||||
"ui.panel.config.automation.picker.search",
|
||||
{ number: automations.length }
|
||||
)}
|
||||
selectable
|
||||
.selected=${this._selected.length}
|
||||
@selection-changed=${this._handleSelectionChanged}
|
||||
hasFilters
|
||||
.filters=${
|
||||
Object.values(this._filters).filter((filter) => filter.value?.length)
|
||||
.length
|
||||
Object.values(this._filters).filter((filter) =>
|
||||
Array.isArray(filter.value)
|
||||
? filter.value.length
|
||||
: filter.value &&
|
||||
Object.values(filter.value).some((val) =>
|
||||
Array.isArray(val) ? val.length : val
|
||||
)
|
||||
).length
|
||||
}
|
||||
.columns=${this._columns(
|
||||
this.narrow,
|
||||
@ -446,14 +464,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
|
||||
this.hass.locale
|
||||
)}
|
||||
initialGroupColumn="category"
|
||||
.data=${this._automations(
|
||||
this.automations,
|
||||
this._entityReg,
|
||||
this.hass.areas,
|
||||
this._categories,
|
||||
this._labels,
|
||||
this._filteredAutomations
|
||||
)}
|
||||
.data=${automations}
|
||||
.empty=${!this.automations.length}
|
||||
@row-click=${this._handleRowClicked}
|
||||
.noDataText=${this.hass.localize(
|
||||
|
@ -591,7 +591,8 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
|
||||
.tabs=${configSections.devices}
|
||||
.route=${this.route}
|
||||
.searchLabel=${this.hass.localize(
|
||||
"ui.panel.config.devices.picker.search"
|
||||
"ui.panel.config.devices.picker.search",
|
||||
{ number: devicesOutput.length }
|
||||
)}
|
||||
.columns=${this._columns(this.hass.localize, this.narrow)}
|
||||
.data=${devicesOutput}
|
||||
@ -600,8 +601,13 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
|
||||
@selection-changed=${this._handleSelectionChanged}
|
||||
.filter=${this._filter}
|
||||
hasFilters
|
||||
.filters=${Object.values(this._filters).filter(
|
||||
(filter) => filter.value?.length
|
||||
.filters=${Object.values(this._filters).filter((filter) =>
|
||||
Array.isArray(filter.value)
|
||||
? filter.value.length
|
||||
: filter.value &&
|
||||
Object.values(filter.value).some((val) =>
|
||||
Array.isArray(val) ? val.length : val
|
||||
)
|
||||
).length}
|
||||
@clear-filter=${this._clearFilter}
|
||||
@search-changed=${this._handleSearchChange}
|
||||
|
@ -573,12 +573,19 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
|
||||
)}
|
||||
.data=${filteredEntities}
|
||||
.searchLabel=${this.hass.localize(
|
||||
"ui.panel.config.entities.picker.search"
|
||||
"ui.panel.config.entities.picker.search",
|
||||
{ number: filteredEntities.length }
|
||||
)}
|
||||
hasFilters
|
||||
.filters=${
|
||||
Object.values(this._filters).filter((filter) => filter.value?.length)
|
||||
.length
|
||||
Object.values(this._filters).filter((filter) =>
|
||||
Array.isArray(filter.value)
|
||||
? filter.value.length
|
||||
: filter.value &&
|
||||
Object.values(filter.value).some((val) =>
|
||||
Array.isArray(val) ? val.length : val
|
||||
)
|
||||
).length
|
||||
}
|
||||
.filter=${this._filter}
|
||||
selectable
|
||||
|
@ -486,6 +486,16 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
|
||||
const labelsInOverflow =
|
||||
(this._sizeController.value && this._sizeController.value < 700) ||
|
||||
(!this._sizeController.value && this.hass.dockedSidebar === "docked");
|
||||
const helpers = this._getItems(
|
||||
this.hass.localize,
|
||||
this._stateItems,
|
||||
this._entityEntries,
|
||||
this._configEntries,
|
||||
this._entityReg,
|
||||
this._categories,
|
||||
this._labels,
|
||||
this._filteredStateItems
|
||||
);
|
||||
return html`
|
||||
<hass-tabs-subpage-data-table
|
||||
.hass=${this.hass}
|
||||
@ -493,24 +503,24 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
|
||||
back-path="/config"
|
||||
.route=${this.route}
|
||||
.tabs=${configSections.devices}
|
||||
.searchLabel=${this.hass.localize(
|
||||
"ui.panel.config.helpers.picker.search",
|
||||
{ number: helpers.length }
|
||||
)}
|
||||
selectable
|
||||
.selected=${this._selected.length}
|
||||
@selection-changed=${this._handleSelectionChanged}
|
||||
hasFilters
|
||||
.filters=${Object.values(this._filters).filter(
|
||||
(filter) => filter.value?.length
|
||||
.filters=${Object.values(this._filters).filter((filter) =>
|
||||
Array.isArray(filter.value)
|
||||
? filter.value.length
|
||||
: filter.value &&
|
||||
Object.values(filter.value).some((val) =>
|
||||
Array.isArray(val) ? val.length : val
|
||||
)
|
||||
).length}
|
||||
.columns=${this._columns(this.narrow, this.hass.localize)}
|
||||
.data=${this._getItems(
|
||||
this.hass.localize,
|
||||
this._stateItems,
|
||||
this._entityEntries,
|
||||
this._configEntries,
|
||||
this._entityReg,
|
||||
this._categories,
|
||||
this._labels,
|
||||
this._filteredStateItems
|
||||
)}
|
||||
.data=${helpers}
|
||||
initialGroupColumn="category"
|
||||
.activeFilters=${this._activeFilters}
|
||||
@clear-filter=${this._clearFilter}
|
||||
|
@ -425,6 +425,14 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
|
||||
const labelsInOverflow =
|
||||
(this._sizeController.value && this._sizeController.value < 700) ||
|
||||
(!this._sizeController.value && this.hass.dockedSidebar === "docked");
|
||||
const scenes = this._scenes(
|
||||
this.scenes,
|
||||
this._entityReg,
|
||||
this.hass.areas,
|
||||
this._categories,
|
||||
this._labels,
|
||||
this._filteredScenes
|
||||
);
|
||||
return html`
|
||||
<hass-tabs-subpage-data-table
|
||||
.hass=${this.hass}
|
||||
@ -432,24 +440,26 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
|
||||
back-path="/config"
|
||||
.route=${this.route}
|
||||
.tabs=${configSections.automations}
|
||||
.searchLabel=${this.hass.localize(
|
||||
"ui.panel.config.scene.picker.search",
|
||||
{ number: scenes.length }
|
||||
)}
|
||||
selectable
|
||||
.selected=${this._selected.length}
|
||||
@selection-changed=${this._handleSelectionChanged}
|
||||
hasFilters
|
||||
.filters=${Object.values(this._filters).filter(
|
||||
(filter) => filter.value?.length
|
||||
.filters=${Object.values(this._filters).filter((filter) =>
|
||||
Array.isArray(filter.value)
|
||||
? filter.value.length
|
||||
: filter.value &&
|
||||
Object.values(filter.value).some((val) =>
|
||||
Array.isArray(val) ? val.length : val
|
||||
)
|
||||
).length}
|
||||
.columns=${this._columns(this.narrow, this.hass.localize)}
|
||||
id="entity_id"
|
||||
initialGroupColumn="category"
|
||||
.data=${this._scenes(
|
||||
this.scenes,
|
||||
this._entityReg,
|
||||
this.hass.areas,
|
||||
this._categories,
|
||||
this._labels,
|
||||
this._filteredScenes
|
||||
)}
|
||||
.data=${scenes}
|
||||
.empty=${!this.scenes.length}
|
||||
.activeFilters=${this._activeFilters}
|
||||
.noDataText=${this.hass.localize(
|
||||
|
@ -437,6 +437,14 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
|
||||
const labelsInOverflow =
|
||||
(this._sizeController.value && this._sizeController.value < 700) ||
|
||||
(!this._sizeController.value && this.hass.dockedSidebar === "docked");
|
||||
const scripts = this._scripts(
|
||||
this.scripts,
|
||||
this._entityReg,
|
||||
this.hass.areas,
|
||||
this._categories,
|
||||
this._labels,
|
||||
this._filteredScripts
|
||||
);
|
||||
return html`
|
||||
<hass-tabs-subpage-data-table
|
||||
.hass=${this.hass}
|
||||
@ -444,27 +452,29 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
|
||||
back-path="/config"
|
||||
.route=${this.route}
|
||||
.tabs=${configSections.automations}
|
||||
.searchLabel=${this.hass.localize(
|
||||
"ui.panel.config.script.picker.search",
|
||||
{ number: scripts.length }
|
||||
)}
|
||||
hasFilters
|
||||
initialGroupColumn="category"
|
||||
selectable
|
||||
.selected=${this._selected.length}
|
||||
@selection-changed=${this._handleSelectionChanged}
|
||||
.filters=${Object.values(this._filters).filter(
|
||||
(filter) => filter.value?.length
|
||||
.filters=${Object.values(this._filters).filter((filter) =>
|
||||
Array.isArray(filter.value)
|
||||
? filter.value.length
|
||||
: filter.value &&
|
||||
Object.values(filter.value).some((val) =>
|
||||
Array.isArray(val) ? val.length : val
|
||||
)
|
||||
).length}
|
||||
.columns=${this._columns(
|
||||
this.narrow,
|
||||
this.hass.localize,
|
||||
this.hass.locale
|
||||
)}
|
||||
.data=${this._scripts(
|
||||
this.scripts,
|
||||
this._entityReg,
|
||||
this.hass.areas,
|
||||
this._categories,
|
||||
this._labels,
|
||||
this._filteredScripts
|
||||
)}
|
||||
.data=${scripts}
|
||||
.empty=${!this.scripts.length}
|
||||
.activeFilters=${this._activeFilters}
|
||||
id="entity_id"
|
||||
|
@ -501,6 +501,7 @@
|
||||
},
|
||||
"subpage-data-table": {
|
||||
"filters": "Filters",
|
||||
"show_results": "show {number} results",
|
||||
"clear_filter": "Clear filter",
|
||||
"close_filter": "Close filters",
|
||||
"exit_selection_mode": "Exit selection mode",
|
||||
@ -2270,7 +2271,8 @@
|
||||
"category": "Category"
|
||||
},
|
||||
"create_helper": "Create helper",
|
||||
"no_helpers": "Looks like you don't have any helpers yet!"
|
||||
"no_helpers": "Looks like you don't have any helpers yet!",
|
||||
"search": "Search {number} helpers"
|
||||
},
|
||||
"dialog": {
|
||||
"create": "Create",
|
||||
@ -2684,6 +2686,7 @@
|
||||
"assign_category": "Assign category",
|
||||
"no_category_support": "You can't assign an category to this automation",
|
||||
"no_category_entity_reg": "To assign an category to an automation it needs to have a unique ID.",
|
||||
"search": "Search {number} automations",
|
||||
"headers": {
|
||||
"toggle": "Enable/disable",
|
||||
"name": "Name",
|
||||
@ -3577,7 +3580,8 @@
|
||||
"delete": "[%key:ui::common::delete%]",
|
||||
"duplicate": "[%key:ui::common::duplicate%]",
|
||||
"empty_header": "Create your first script",
|
||||
"empty_text": "A script is a sequence of actions that can be run from a dashboard, an automation, or be triggered by voice. For example, a ''Wake-up routine''' script that gradually turns on the light in the bedroom and opens the blinds after a delay."
|
||||
"empty_text": "A script is a sequence of actions that can be run from a dashboard, an automation, or be triggered by voice. For example, a ''Wake-up routine''' script that gradually turns on the light in the bedroom and opens the blinds after a delay.",
|
||||
"search": "Search {number} scripts"
|
||||
},
|
||||
"dialog_new": {
|
||||
"header": "Create script",
|
||||
@ -3685,7 +3689,8 @@
|
||||
"no_category_support": "You can't assign an category to this scene",
|
||||
"no_category_entity_reg": "To assign an category to an scene it needs to have a unique ID.",
|
||||
"empty_header": "Create your first scene",
|
||||
"empty_text": "Scenes capture entities' states, so you can re-experience the same scene later on. For example, a ''Watching TV'' scene that dims the living room lights, sets a warm white color and turns on the TV."
|
||||
"empty_text": "Scenes capture entities' states, so you can re-experience the same scene later on. For example, a ''Watching TV'' scene that dims the living room lights, sets a warm white color and turns on the TV.",
|
||||
"search": "Search {number} scenes"
|
||||
},
|
||||
"editor": {
|
||||
"default_name": "New scene",
|
||||
@ -4010,7 +4015,7 @@
|
||||
"confirm_delete": "Are you sure you want to delete this device?",
|
||||
"confirm_delete_integration": "Are you sure you want to remove this device from {integration}?",
|
||||
"picker": {
|
||||
"search": "Search devices",
|
||||
"search": "Search {number} devices",
|
||||
"state": "State"
|
||||
}
|
||||
},
|
||||
@ -4021,7 +4026,7 @@
|
||||
"header": "Entities",
|
||||
"introduction": "Home Assistant keeps a registry of every entity it has ever seen that can be uniquely identified. Each of these entities will have an entity ID assigned which will be reserved for just this entity.",
|
||||
"introduction2": "Use the entity registry to override the name, change the entity ID or remove the entry from Home Assistant.",
|
||||
"search": "Search entities",
|
||||
"search": "Search {number} entities",
|
||||
"unnamed_entity": "Unnamed entity",
|
||||
"status": {
|
||||
"restored": "Restored",
|
||||
|
Loading…
x
Reference in New Issue
Block a user