From c00287c401a81a4d2e0efc0c792c2372d6734ffa Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 29 May 2024 23:49:20 +0200 Subject: [PATCH 1/5] Fix config entry menu (#20908) --- .../ha-config-integration-page.ts | 211 ++++++++---------- 1 file changed, 92 insertions(+), 119 deletions(-) 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; From c5ae9e8497e4ae5b4bf4fbf899b8210248432bc4 Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Thu, 30 May 2024 03:49:40 -0400 Subject: [PATCH 2/5] Remove eslint-plugin-disable (#20902) --- .eslintrc.json | 3 +-- package.json | 1 - yarn.lock | 16 ++-------------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 266ef17ca845..92943aa598ed 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -126,6 +126,5 @@ "lit-a11y/anchor-is-valid": "warn", "lit-a11y/role-has-required-aria-attrs": "warn" }, - "plugins": ["disable", "unused-imports"], - "processor": "disable/disable" + "plugins": ["unused-imports"] } diff --git a/package.json b/package.json index c6b40a8decd0..f85a53aaaf4c 100644 --- a/package.json +++ b/package.json @@ -198,7 +198,6 @@ "eslint-config-airbnb-typescript": "18.0.0", "eslint-config-prettier": "9.1.0", "eslint-import-resolver-webpack": "0.13.8", - "eslint-plugin-disable": "2.0.3", "eslint-plugin-import": "2.29.1", "eslint-plugin-lit": "1.13.0", "eslint-plugin-lit-a11y": "4.1.2", diff --git a/yarn.lock b/yarn.lock index 010ae66b36e0..d04f5745ccba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7583,17 +7583,6 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-disable@npm:2.0.3": - version: 2.0.3 - resolution: "eslint-plugin-disable@npm:2.0.3" - dependencies: - resolve: "npm:^1.1.6" - peerDependencies: - eslint: ">=0.16.0" - checksum: 10/2d68c0e5750325fb42c5cdc4300751753a10530df8e4a0656f102bcd1eb44cca01dfdf563b3f0a33c10c8ffdb7d92b8bb38b4c73717e04a967500af649512128 - languageName: node - linkType: hard - "eslint-plugin-import@npm:2.29.1": version: 2.29.1 resolution: "eslint-plugin-import@npm:2.29.1" @@ -9057,7 +9046,6 @@ __metadata: eslint-config-airbnb-typescript: "npm:18.0.0" eslint-config-prettier: "npm:9.1.0" eslint-import-resolver-webpack: "npm:0.13.8" - eslint-plugin-disable: "npm:2.0.3" eslint-plugin-import: "npm:2.29.1" eslint-plugin-lit: "npm:1.13.0" eslint-plugin-lit-a11y: "npm:4.1.2" @@ -12571,7 +12559,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.1.6, resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.22.1, resolve@npm:^1.22.4": +"resolve@npm:^1.14.2, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.22.1, resolve@npm:^1.22.4": version: 1.22.8 resolution: "resolve@npm:1.22.8" dependencies: @@ -12597,7 +12585,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@npm%3A^1.1.6#optional!builtin, resolve@patch:resolve@npm%3A^1.14.2#optional!builtin, resolve@patch:resolve@npm%3A^1.19.0#optional!builtin, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.1#optional!builtin, resolve@patch:resolve@npm%3A^1.22.4#optional!builtin": +"resolve@patch:resolve@npm%3A^1.14.2#optional!builtin, resolve@patch:resolve@npm%3A^1.19.0#optional!builtin, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.1#optional!builtin, resolve@patch:resolve@npm%3A^1.22.4#optional!builtin": version: 1.22.8 resolution: "resolve@patch:resolve@npm%3A1.22.8#optional!builtin::version=1.22.8&hash=c3c19d" dependencies: From f97971faf65ded2165c187ca57dc9deeb665d946 Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Thu, 30 May 2024 10:39:15 +0200 Subject: [PATCH 3/5] Improve refresh token dialogs (#20917) * Improve refresh token dialogs * Remove this --- src/panels/profile/ha-long-lived-access-tokens-card.ts | 7 ++++++- src/panels/profile/ha-refresh-tokens-card.ts | 4 ++++ src/translations/en.json | 8 ++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/panels/profile/ha-long-lived-access-tokens-card.ts b/src/panels/profile/ha-long-lived-access-tokens-card.ts index a835f9898695..25c7fd44c16a 100644 --- a/src/panels/profile/ha-long-lived-access-tokens-card.ts +++ b/src/panels/profile/ha-long-lived-access-tokens-card.ts @@ -135,10 +135,15 @@ class HaLongLivedTokens extends LitElement { const token = (ev.currentTarget as any).token; if ( !(await showConfirmationDialog(this, { + title: this.hass.localize( + "ui.panel.profile.long_lived_access_tokens.confirm_delete_title" + ), text: this.hass.localize( - "ui.panel.profile.long_lived_access_tokens.confirm_delete", + "ui.panel.profile.long_lived_access_tokens.confirm_delete_text", { name: token.client_name } ), + confirmText: this.hass.localize("ui.common.delete"), + destructive: true, })) ) { return; diff --git a/src/panels/profile/ha-refresh-tokens-card.ts b/src/panels/profile/ha-refresh-tokens-card.ts index 4a0bf2c77c13..2309045e7f0e 100644 --- a/src/panels/profile/ha-refresh-tokens-card.ts +++ b/src/panels/profile/ha-refresh-tokens-card.ts @@ -295,9 +295,13 @@ class HaRefreshTokens extends LitElement { private async _deleteAllTokens(): Promise { if ( !(await showConfirmationDialog(this, { + title: this.hass.localize( + "ui.panel.profile.refresh_tokens.confirm_delete_all_title" + ), text: this.hass.localize( "ui.panel.profile.refresh_tokens.confirm_delete_all" ), + confirmText: this.hass.localize("ui.common.delete"), destructive: true, })) ) { diff --git a/src/translations/en.json b/src/translations/en.json index 83e115d2ee23..ec84ebd489e4 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1888,7 +1888,9 @@ "editor": { "confirm_unsaved": "You have unsaved changes. Are you sure you want to leave?" }, - "multiselect": { "failed": "Failed to update {number} items." }, + "multiselect": { + "failed": "Failed to update {number} items." + }, "learn_more": "Learn more" }, "updates": { @@ -6405,6 +6407,7 @@ "confirm_delete_title": "Delete refresh token?", "confirm_delete_text": "The refresh token for ''{name}'' will be permanently deleted. This will end the login session on the associated device.", "delete_all_tokens": "Delete all tokens", + "confirm_delete_all_title": "Delete all refresh tokens?", "confirm_delete_all": "Are you sure you want to delete all refresh tokens? Your current session token will not be removed. Your long-lived access tokens will not be removed.", "delete_failed": "Failed to delete the refresh token.", "current_token_tooltip": "Unable to delete current refresh token" @@ -6414,7 +6417,8 @@ "description": "Create long-lived access tokens to allow your scripts to interact with your Home Assistant instance. Each token will be valid for 10 years from creation. The following long-lived access tokens are currently active.", "learn_auth_requests": "Learn how to make authenticated requests.", "created": "Created {date}", - "confirm_delete": "Are you sure you want to delete the access token for {name}?", + "confirm_delete_title": "Delete long-lived access token?", + "confirm_delete_text": "Are you sure you want to delete the long-lived access token for {name}?", "delete_failed": "Failed to delete the access token.", "create": "Create Token", "create_failed": "Failed to create the access token.", From b38a348957bd23c38a119abdaca32ce4952de4eb Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 30 May 2024 09:29:28 -0400 Subject: [PATCH 4/5] Disable beta menu instead of hiding (#20906) --- src/panels/config/core/ha-config-section-updates.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/panels/config/core/ha-config-section-updates.ts b/src/panels/config/core/ha-config-section-updates.ts index 9f3191b7be48..15a437b742f3 100644 --- a/src/panels/config/core/ha-config-section-updates.ts +++ b/src/panels/config/core/ha-config-section-updates.ts @@ -82,10 +82,13 @@ class HaConfigSectionUpdates extends LitElement { > ${this.hass.localize("ui.panel.config.updates.show_skipped")} - ${this._supervisorInfo && this._supervisorInfo.channel !== "dev" + ${this._supervisorInfo ? html`
  • - + ${this._supervisorInfo.channel === "stable" ? this.hass.localize("ui.panel.config.updates.join_beta") : this.hass.localize( From 6f1fa139e75dd63b9361c3267dfc8b0d3e44d536 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 30 May 2024 16:08:31 +0200 Subject: [PATCH 5/5] Bumped version to 20240530.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 65d925019d34..32bf3ddd7cf6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240529.0" +version = "20240530.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md"