Skip to content

Commit

Permalink
Replace add label by manage labels in filters (#20330)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Apr 2, 2024
1 parent 56d328b commit ed1a690
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/components/ha-filter-labels.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { SelectedDetail } from "@material/mwc-list";
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 { CSSResultGroup, LitElement, css, html, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { repeat } from "lit/directives/repeat";
import { computeCssColor } from "../common/color/compute-color";
import { fireEvent } from "../common/dom/fire_event";
import { navigate } from "../common/navigate";
import {
LabelRegistryEntry,
createLabelRegistryEntry,
subscribeLabelRegistry,
} from "../data/label_registry";
import { SubscribeMixin } from "../mixins/subscribe-mixin";
import { showLabelDetailDialog } from "../panels/config/labels/show-dialog-label-detail";
import { haStyleScrollbar } from "../resources/styles";
import type { HomeAssistant } from "../types";
import "./ha-check-list-item";
Expand Down Expand Up @@ -95,11 +94,11 @@ export class HaFilterLabels extends SubscribeMixin(LitElement) {
${this.expanded
? html`<ha-list-item
graphic="icon"
@click=${this._addLabel}
@click=${this._manageLabels}
class="add"
>
<ha-svg-icon slot="graphic" .path=${mdiPlus}></ha-svg-icon>
${this.hass.localize("ui.panel.config.labels.add_label")}
<ha-svg-icon slot="graphic" .path=${mdiCog}></ha-svg-icon>
${this.hass.localize("ui.panel.config.labels.manage_labels")}
</ha-list-item>`
: nothing}
`;
Expand All @@ -115,10 +114,8 @@ export class HaFilterLabels extends SubscribeMixin(LitElement) {
}
}

private _addLabel() {
showLabelDetailDialog(this, {
createEntry: (values) => createLabelRegistryEntry(this.hass, values),
});
private _manageLabels() {
navigate("/config/labels");
}

private _expandedWillChange(ev) {
Expand Down
1 change: 1 addition & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1962,6 +1962,7 @@
"color": "Color"
},
"add_label": "Add label",
"manage_labels": "Manage 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.",
"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.",
Expand Down

0 comments on commit ed1a690

Please sign in to comment.