From 8bcbeb299b43b1402a6ff6fac94ede9899cb643a Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 23 Aug 2022 21:37:37 +0200 Subject: [PATCH] Add icons to integration action overflow menu (#13457) --- .../integrations/ha-config-flow-card.ts | 34 +++-- .../integrations/ha-integration-card.ts | 129 ++++++++++++------ 2 files changed, 114 insertions(+), 49 deletions(-) diff --git a/src/panels/config/integrations/ha-config-flow-card.ts b/src/panels/config/integrations/ha-config-flow-card.ts index e3d9fb0265..fdd7c37d88 100644 --- a/src/panels/config/integrations/ha-config-flow-card.ts +++ b/src/panels/config/integrations/ha-config-flow-card.ts @@ -1,7 +1,13 @@ import { css, html, LitElement, TemplateResult } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; -import { mdiDotsVertical, mdiOpenInNew } from "@mdi/js"; +import { + mdiBookshelf, + mdiCog, + mdiDotsVertical, + mdiEyeOff, + mdiOpenInNew, +} from "@mdi/js"; import { fireEvent } from "../../../common/dom/fire_event"; import { ATTENTION_SOURCES, @@ -71,13 +77,12 @@ export class HaConfigFlowCard extends LitElement { ? "_self" : "_blank"} > - + ${this.hass.localize( "ui.panel.config.integrations.config_entry.open_configuration_url" - )} + )} + + ` : ""} @@ -92,23 +97,26 @@ export class HaConfigFlowCard extends LitElement { rel="noreferrer" target="_blank" > - + ${this.hass.localize( "ui.panel.config.integrations.config_entry.documentation" - )} + ` : ""} ${DISCOVERY_SOURCES.includes(this.flow.context.source) && this.flow.context.unique_id ? html` - + ${this.hass.localize( "ui.panel.config.integrations.ignore.ignore" )} + ` : ""} @@ -170,6 +178,10 @@ export class HaConfigFlowCard extends LitElement { text-decoration: none; color: var(--primary-color); } + ha-svg-icon[slot="meta"] { + width: 18px; + height: 18px; + } `; } diff --git a/src/panels/config/integrations/ha-integration-card.ts b/src/panels/config/integrations/ha-integration-card.ts index 348cdc3e6f..7da9ce51d7 100644 --- a/src/panels/config/integrations/ha-integration-card.ts +++ b/src/panels/config/integrations/ha-integration-card.ts @@ -3,9 +3,18 @@ import "@material/mwc-list/mwc-list-item"; import type { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item"; import { mdiAlertCircle, + mdiBookshelf, + mdiBug, mdiChevronLeft, + mdiCog, + mdiDelete, mdiDotsVertical, + mdiDownload, mdiOpenInNew, + mdiReload, + mdiRenameBox, + mdiToggleSwitch, + mdiToggleSwitchOff, } from "@mdi/js"; import "@polymer/paper-item/paper-item"; import "@polymer/paper-listbox"; @@ -320,16 +329,47 @@ export class HaIntegrationCard extends LitElement { .label=${this.hass.localize("ui.common.menu")} .path=${mdiDotsVertical} > - + ${!item.disabled_by && + RECOVERABLE_STATES.includes(item.state) && + item.supports_unload && + item.source !== "system" + ? html` + ${this.hass.localize( + "ui.panel.config.integrations.config_entry.reload" + )} + + ` + : ""} + + ${this.hass.localize( "ui.panel.config.integrations.config_entry.rename" )} + - - ${this.hass.localize( - "ui.panel.config.integrations.config_entry.system_options" - )} - + ${this.supportsDiagnostics && item.state === "loaded" + ? html` + + ${this.hass.localize( + "ui.panel.config.integrations.config_entry.download_diagnostics" + )} + + + ` + : ""} + +
  • + ${this.manifest ? html` - + ${this.hass.localize( "ui.panel.config.integrations.config_entry.documentation" - )} + ` : ""} @@ -358,59 +400,66 @@ export class HaIntegrationCard extends LitElement { rel="noreferrer" target="_blank" > - + ${this.hass.localize( "ui.panel.config.integrations.config_entry.known_issues" - )} - - ` - : ""} - ${!item.disabled_by && - RECOVERABLE_STATES.includes(item.state) && - item.supports_unload && - item.source !== "system" - ? html` - ${this.hass.localize( - "ui.panel.config.integrations.config_entry.reload" - )} - ` - : ""} - ${this.supportsDiagnostics && item.state === "loaded" - ? html` - - ${this.hass.localize( - "ui.panel.config.integrations.config_entry.download_diagnostics" )} + + ` : ""} + +
  • + + + ${this.hass.localize( + "ui.panel.config.integrations.config_entry.system_options" + )} + + ${item.disabled_by === "user" - ? html` + ? html` ${this.hass.localize("ui.common.enable")} + ` : item.source !== "system" ? html` ${this.hass.localize("ui.common.disable")} + ` : ""} ${item.source !== "system" ? html` ${this.hass.localize( "ui.panel.config.integrations.config_entry.delete" )} + ` : ""} @@ -807,6 +856,10 @@ export class HaIntegrationCard extends LitElement { mwc-list-item ha-svg-icon { color: var(--secondary-text-color); } + ha-svg-icon[slot="meta"] { + width: 18px; + height: 18px; + } `, ]; }