diff --git a/src/panels/config/integrations/ha-config-integration-page.ts b/src/panels/config/integrations/ha-config-integration-page.ts index 2afb107fd9fe..8ef1ddebb953 100644 --- a/src/panels/config/integrations/ha-config-integration-page.ts +++ b/src/panels/config/integrations/ha-config-integration-page.ts @@ -1,6 +1,6 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import "@material/mwc-list/mwc-list"; -import { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item-base"; +import "@material/web/divider/divider"; import { mdiAlertCircle, mdiBookshelf, @@ -27,13 +27,13 @@ import { } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; import { - css, CSSResultGroup, - html, LitElement, - nothing, PropertyValues, TemplateResult, + css, + html, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -41,15 +41,15 @@ import { until } from "lit/directives/until"; import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { isDevVersion } from "../../../common/config/version"; -import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event"; import { caseInsensitiveStringCompare } from "../../../common/string/compare"; import { nextRender } from "../../../common/util/render-status"; import "../../../components/ha-button"; +import "../../../components/ha-button-menu-new"; import "../../../components/ha-card"; import "../../../components/ha-list-item"; -import "../../../components/ha-list-new"; import "../../../components/ha-list-item-new"; -import "../../../components/ha-button-menu-new"; +import "../../../components/ha-list-new"; +import "../../../components/ha-menu-item"; import { deleteApplicationCredential, fetchApplicationCredentialsConfigEntry, @@ -57,13 +57,13 @@ import { import { getSignedPath } from "../../../data/auth"; import { ConfigEntry, + DisableConfigEntryResult, + ERROR_STATES, + RECOVERABLE_STATES, deleteConfigEntry, disableConfigEntry, - DisableConfigEntryResult, enableConfigEntry, - ERROR_STATES, getConfigEntries, - RECOVERABLE_STATES, reloadConfigEntry, updateConfigEntry, } from "../../../data/config_entries"; @@ -80,13 +80,13 @@ import { } from "../../../data/entity_registry"; import { getErrorLogDownloadUrl } from "../../../data/error_log"; import { + IntegrationLogInfo, + IntegrationManifest, + LogSeverity, domainToName, fetchIntegrationManifest, integrationIssuesUrl, - IntegrationLogInfo, - IntegrationManifest, integrationsWithPanel, - LogSeverity, setIntegrationLogLevel, subscribeLogInfo, } from "../../../data/integration"; @@ -792,104 +792,98 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { RECOVERABLE_STATES.includes(item.state) && item.supports_unload && item.source !== "system" - ? html` - ${this.hass.localize( - "ui.panel.config.integrations.config_entry.reload" - )} - - ` - : ""} + ? html` + + + ${this.hass.localize( + "ui.panel.config.integrations.config_entry.reload" + )} + + ` + : nothing} - + + ${this.hass.localize( "ui.panel.config.integrations.config_entry.rename" )} - - + -
  • + ${this._diagnosticHandler && item.state === "loaded" - ? html` - + ? html` + + ${this.hass.localize( "ui.panel.config.integrations.config_entry.download_diagnostics" )} - - - ` + + ` : ""} ${!item.disabled_by && item.supports_reconfigure && item.source !== "system" - ? html` - ${this.hass.localize( - "ui.panel.config.integrations.config_entry.reconfigure" - )} - - ` - : ""} + ? html` + + + ${this.hass.localize( + "ui.panel.config.integrations.config_entry.reconfigure" + )} + + ` + : nothing} - + + ${this.hass.localize( "ui.panel.config.integrations.config_entry.system_options" )} - - + ${item.disabled_by === "user" - ? html` - ${this.hass.localize("ui.common.enable")} - - ` + ? html` + + + ${this.hass.localize("ui.common.enable")} + + ` : item.source !== "system" - ? html` - ${this.hass.localize("ui.common.disable")} + ? html` + + + ${this.hass.localize("ui.common.disable")} + + ` + : nothing} + ${item.source !== "system" + ? html` + - ` - : ""} - ${item.source !== "system" - ? html` - ${this.hass.localize( - "ui.panel.config.integrations.config_entry.delete" - )} - - ` - : ""} + ${this.hass.localize( + "ui.panel.config.integrations.config_entry.delete" + )} + + ` + : nothing} `; } @@ -1055,64 +1049,43 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { ); } - private _handleRename(ev: CustomEvent): void { - if (!shouldHandleRequestSelectedEvent(ev)) { - return; - } + private _handleRename(ev: Event): void { this._editEntryName( ((ev.target as HTMLElement).closest(".config_entry") as any).configEntry ); } - private _handleReload(ev: CustomEvent): void { - if (!shouldHandleRequestSelectedEvent(ev)) { - return; - } + private _handleReload(ev: Event): void { this._reloadIntegration( ((ev.target as HTMLElement).closest(".config_entry") as any).configEntry ); } - private _handleReconfigure(ev: CustomEvent): void { - if (!shouldHandleRequestSelectedEvent(ev)) { - return; - } + private _handleReconfigure(ev: Event): void { this._reconfigureIntegration( ((ev.target as HTMLElement).closest(".config_entry") as any).configEntry ); } - private _handleDelete(ev: CustomEvent): void { - if (!shouldHandleRequestSelectedEvent(ev)) { - return; - } + private _handleDelete(ev: Event): void { this._removeIntegration( ((ev.target as HTMLElement).closest(".config_entry") as any).configEntry ); } - private _handleDisable(ev: CustomEvent): void { - if (!shouldHandleRequestSelectedEvent(ev)) { - return; - } + private _handleDisable(ev: Event): void { this._disableIntegration( ((ev.target as HTMLElement).closest(".config_entry") as any).configEntry ); } - private _handleEnable(ev: CustomEvent): void { - if (ev.detail.source && !shouldHandleRequestSelectedEvent(ev)) { - return; - } + private _handleEnable(ev: Event): void { this._enableIntegration( ((ev.target as HTMLElement).closest(".config_entry") as any).configEntry ); } - private _handleSystemOptions(ev: CustomEvent): void { - if (!shouldHandleRequestSelectedEvent(ev)) { - return; - } + private _handleSystemOptions(ev: Event): void { this._showSystemOptions( ((ev.target as HTMLElement).closest(".config_entry") as any).configEntry ); @@ -1327,7 +1300,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { } private async _signUrl(ev) { - const anchor = ev.target.closest("a"); + const anchor = ev.currentTarget; ev.preventDefault(); const signedUrl = await getSignedPath( this.hass, @@ -1438,8 +1411,8 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { --mdc-list-item-meta-size: auto; --mdc-list-item-meta-display: flex; } - ha-button-menu-new ha-list-item { - --mdc-list-item-meta-size: 24px; + ha-button-menu-new ha-menu-item { + --mdc-icon-size: 24px; } ha-list-item-new.config_entry::after { position: absolute;