Replace add label by manage labels in filters (#20330)

This commit is contained in:
Paul Bottein 2024-04-02 19:05:01 +02:00 committed by GitHub
parent 56d328b4db
commit ed1a69071b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 10 deletions

View File

@ -1,19 +1,18 @@
import { SelectedDetail } from "@material/mwc-list"; import { SelectedDetail } from "@material/mwc-list";
import "@material/mwc-menu/mwc-menu-surface"; import "@material/mwc-menu/mwc-menu-surface";
import { mdiPlus } from "@mdi/js"; import { mdiCog } from "@mdi/js";
import { UnsubscribeFunc } from "home-assistant-js-websocket"; import { UnsubscribeFunc } from "home-assistant-js-websocket";
import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; import { CSSResultGroup, LitElement, css, html, nothing } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { repeat } from "lit/directives/repeat"; import { repeat } from "lit/directives/repeat";
import { computeCssColor } from "../common/color/compute-color"; import { computeCssColor } from "../common/color/compute-color";
import { fireEvent } from "../common/dom/fire_event"; import { fireEvent } from "../common/dom/fire_event";
import { navigate } from "../common/navigate";
import { import {
LabelRegistryEntry, LabelRegistryEntry,
createLabelRegistryEntry,
subscribeLabelRegistry, subscribeLabelRegistry,
} from "../data/label_registry"; } from "../data/label_registry";
import { SubscribeMixin } from "../mixins/subscribe-mixin"; import { SubscribeMixin } from "../mixins/subscribe-mixin";
import { showLabelDetailDialog } from "../panels/config/labels/show-dialog-label-detail";
import { haStyleScrollbar } from "../resources/styles"; import { haStyleScrollbar } from "../resources/styles";
import type { HomeAssistant } from "../types"; import type { HomeAssistant } from "../types";
import "./ha-check-list-item"; import "./ha-check-list-item";
@ -95,11 +94,11 @@ export class HaFilterLabels extends SubscribeMixin(LitElement) {
${this.expanded ${this.expanded
? html`<ha-list-item ? html`<ha-list-item
graphic="icon" graphic="icon"
@click=${this._addLabel} @click=${this._manageLabels}
class="add" class="add"
> >
<ha-svg-icon slot="graphic" .path=${mdiPlus}></ha-svg-icon> <ha-svg-icon slot="graphic" .path=${mdiCog}></ha-svg-icon>
${this.hass.localize("ui.panel.config.labels.add_label")} ${this.hass.localize("ui.panel.config.labels.manage_labels")}
</ha-list-item>` </ha-list-item>`
: nothing} : nothing}
`; `;
@ -115,10 +114,8 @@ export class HaFilterLabels extends SubscribeMixin(LitElement) {
} }
} }
private _addLabel() { private _manageLabels() {
showLabelDetailDialog(this, { navigate("/config/labels");
createEntry: (values) => createLabelRegistryEntry(this.hass, values),
});
} }
private _expandedWillChange(ev) { private _expandedWillChange(ev) {

View File

@ -1962,6 +1962,7 @@
"color": "Color" "color": "Color"
}, },
"add_label": "Add label", "add_label": "Add label",
"manage_labels": "Manage labels",
"no_labels": "You don't have any labels", "no_labels": "You don't have any labels",
"introduction": "Labels can help you organize your areas, devices and entities. They can be used to filter in the UI, or use them as a target in automations.", "introduction": "Labels can help you organize your areas, devices and entities. They can be used to filter in the UI, or use them as a target in automations.",
"introduction2": "Go to the area, device or entity you want to add a label to, and click on the edit button to assign labels to them.", "introduction2": "Go to the area, device or entity you want to add a label to, and click on the edit button to assign labels to them.",