Skip to content

Commit

Permalink
Improve refresh token dialogs (#20917)
Browse files Browse the repository at this point in the history
* Improve refresh token dialogs

* Remove this
  • Loading branch information
silamon authored May 30, 2024
1 parent c5ae9e8 commit f97971f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/panels/profile/ha-long-lived-access-tokens-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/panels/profile/ha-refresh-tokens-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,13 @@ class HaRefreshTokens extends LitElement {
private async _deleteAllTokens(): Promise<void> {
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,
}))
) {
Expand Down
8 changes: 6 additions & 2 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
Expand All @@ -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.",
Expand Down

0 comments on commit f97971f

Please sign in to comment.