-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve refresh token dialogs #20917
Conversation
WalkthroughWalkthroughThe changes enhance the user experience for deleting tokens in the profile panel by adding confirmation dialogs with localized titles, confirmation texts, and a more descriptive destructive action indication. This ensures consistency across different dialogs for deleting refresh tokens and long-lived access tokens. Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant ProfilePanel
participant ConfirmationDialog
participant Localization
User ->> ProfilePanel: Request to delete a token
ProfilePanel ->> Localization: Fetch localized title and confirm text
Localization -->> ProfilePanel: Return localized strings
ProfilePanel ->> ConfirmationDialog: Open with localized title and confirm text
ConfirmationDialog -->> User: Display confirmation dialog
User ->> ConfirmationDialog: Confirms deletion
ConfirmationDialog ->> ProfilePanel: Confirm deletion action
ProfilePanel ->> User: Token deleted
Assessment against linked issues
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (3)
Additional context usedBiome
Additional comments not posted (5)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range comments (3)
src/panels/profile/ha-long-lived-access-tokens-card.ts (2)
Line range hint
35-35
: Consider replacing non-null assertions with more robust error handling or conditional checks. Non-null assertions can lead to runtime errors if assumptions about data presence are incorrect.// Example refactor for non-null assertion const accessTokens = this._accessTokens(this.refreshTokens ?? []);Also applies to: 63-63
Line range hint
124-124
: The use ofany
type for error handling reduces type safety and can obscure the underlying data structure of errors. It's recommended to define a more specific error type or interface.// Example of specifying a more detailed error type interface CustomError extends Error { code?: string; } catch (err: CustomError) { showAlertDialog(this, { title: this.hass.localize("ui.panel.profile.long_lived_access_tokens.delete_failed"), text: err.message, }); }Also applies to: 135-135, 157-157
src/panels/profile/ha-refresh-tokens-card.ts (1)
Line range hint
211-211
: Similar to the previous file, usingany
for error handling is not recommended due to the lack of type safety. Consider defining a more specific error type to improve code clarity and error management.// Example of specifying a more detailed error type interface CustomError extends Error { code?: string; } catch (err: CustomError) { showAlertDialog(this, { title: this.hass.localize("ui.panel.profile.refresh_tokens.delete_failed"), text: err.message, }); }Also applies to: 285-285, 313-313
Thanks creating this PR! We've written some guidelines about dialogs. May I suggest the following text, @piitaya can you check if this text is correct?
Delete all refresh tokens? Delete long-lived access token? |
Thank you @silamon 👍 |
Proposed change
Fix #20911. The issue mentions:
Consistent dialogs
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
Summary by CodeRabbit
New Features
Localization