Skip to content

Commit

Permalink
Fix various supervisor tooltip and aria-label issues (#10878)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacegaier authored Jan 25, 2022
1 parent c4cad5b commit ffaff30
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 30 deletions.
2 changes: 1 addition & 1 deletion hassio/src/addon-view/config/hassio-addon-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class HassioAddonConfig extends LitElement {
<div class="card-menu">
<ha-button-menu corner="BOTTOM_START" @action=${this._handleAction}>
<ha-icon-button
.label=${this.hass.localize("common.menu")}
.label=${this.supervisor.localize("common.menu")}
.path=${mdiDotsVertical}
slot="trigger"
></ha-icon-button>
Expand Down
2 changes: 1 addition & 1 deletion hassio/src/backups/hassio-backups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class HassioBackups extends LitElement {
@action=${this._handleAction}
>
<ha-icon-button
.label=${this.hass.localize("common.menu")}
.label=${this.supervisor?.localize("common.menu")}
.path=${mdiDotsVertical}
slot="trigger"
></ha-icon-button>
Expand Down
26 changes: 15 additions & 11 deletions hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ export class DialogHassioBackupUpload
{
@property({ attribute: false }) public hass?: HomeAssistant;

@state() private _params?: HassioBackupUploadDialogParams;
@state() private _dialogParams?: HassioBackupUploadDialogParams;

public async showDialog(
params: HassioBackupUploadDialogParams
dialogParams: HassioBackupUploadDialogParams
): Promise<void> {
this._params = params;
this._dialogParams = dialogParams;
await this.updateComplete;
}

public closeDialog(): void {
if (this._params && !this._params.onboarding) {
if (this._params.reloadBackup) {
this._params.reloadBackup();
if (this._dialogParams && !this._dialogParams.onboarding) {
if (this._dialogParams.reloadBackup) {
this._dialogParams.reloadBackup();
}
}
this._params = undefined;
this._dialogParams = undefined;
fireEvent(this, "dialog-closed", { dialog: this.localName });
}

protected render(): TemplateResult {
if (!this._params) {
if (!this._dialogParams) {
return html``;
}

Expand All @@ -52,9 +52,13 @@ export class DialogHassioBackupUpload
>
<div slot="heading">
<ha-header-bar>
<span slot="title"> Upload backup </span>
<span slot="title"
>${this.hass?.localize(
"ui.panel.page-onboarding.restore.upload_backup"
) || "Upload backup"}</span
>
<ha-icon-button
.label=${this.hass?.localize("common.close") || "close"}
.label=${this.hass?.localize("ui.common.close") || "Close"}
.path=${mdiClose}
slot="actionItems"
dialogAction="cancel"
Expand All @@ -71,7 +75,7 @@ export class DialogHassioBackupUpload

private _backupUploaded(ev) {
const backup = ev.detail.backup;
this._params?.showBackup(backup.slug);
this._dialogParams?.showBackup(backup.slug);
this.closeDialog();
}

Expand Down
22 changes: 15 additions & 7 deletions hassio/src/dialogs/backup/dialog-hassio-backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class HassioBackupDialog
@query("supervisor-backup-content")
private _backupContent!: SupervisorBackupContent;

public async showDialog(params: HassioBackupDialogParams) {
this._backup = await fetchHassioBackupInfo(this.hass, params.slug);
this._dialogParams = params;
public async showDialog(dialogParams: HassioBackupDialogParams) {
this._backup = await fetchHassioBackupInfo(this.hass, dialogParams.slug);
this._dialogParams = dialogParams;
this._restoringBackup = false;
}

Expand All @@ -77,7 +77,7 @@ class HassioBackupDialog
<ha-header-bar>
<span slot="title">${this._backup.name}</span>
<ha-icon-button
.label=${this.hass?.localize("common.close") || "close"}
.label=${this.hass?.localize("ui.common.close") || "Close"}
.path=${mdiClose}
slot="actionItems"
dialogAction="cancel"
Expand Down Expand Up @@ -114,12 +114,20 @@ class HassioBackupDialog
@closed=${stopPropagation}
>
<ha-icon-button
.label=${this.hass!.localize("common.menu")}
.label=${this.hass!.localize("ui.common.menu") || "Menu"}
.path=${mdiDotsVertical}
slot="trigger"
></ha-icon-button>
<mwc-list-item>Download Backup</mwc-list-item>
<mwc-list-item class="error">Delete Backup</mwc-list-item>
<mwc-list-item
>${this._dialogParams.supervisor?.localize(
"backup.download_backup"
)}</mwc-list-item
>
<mwc-list-item class="error"
>${this._dialogParams.supervisor?.localize(
"backup.delete_backup_title"
)}</mwc-list-item
>
</ha-button-menu>`
: ""}
</ha-dialog>
Expand Down
6 changes: 3 additions & 3 deletions hassio/src/dialogs/backup/dialog-hassio-create-backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class HassioCreateBackupDialog extends LitElement {
@query("supervisor-backup-content")
private _backupContent!: SupervisorBackupContent;

public showDialog(params: HassioCreateBackupDialogParams) {
this._dialogParams = params;
public showDialog(dialogParams: HassioCreateBackupDialogParams) {
this._dialogParams = dialogParams;
this._creatingBackup = false;
}

Expand All @@ -57,7 +57,7 @@ class HassioCreateBackupDialog extends LitElement {
)}
>
${this._creatingBackup
? html` <ha-circular-progress active></ha-circular-progress>`
? html`<ha-circular-progress active></ha-circular-progress>`
: html`<supervisor-backup-content
.hass=${this.hass}
.supervisor=${this._dialogParams.supervisor}
Expand Down
6 changes: 3 additions & 3 deletions hassio/src/dialogs/hardware/dialog-hassio-hardware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class HassioHardwareDialog extends LitElement {

@state() private _filter?: string;

public showDialog(params: HassioHardwareDialogParams) {
this._dialogParams = params;
public showDialog(dialogParams: HassioHardwareDialogParams) {
this._dialogParams = dialogParams;
}

public closeDialog() {
Expand Down Expand Up @@ -72,7 +72,7 @@ class HassioHardwareDialog extends LitElement {
${this._dialogParams.supervisor.localize("dialog.hardware.title")}
</h2>
<ha-icon-button
.label=${this.hass.localize("common.close")}
.label=${this._dialogParams.supervisor.localize("common.close")}
.path=${mdiClose}
dialogAction="close"
></ha-icon-button>
Expand Down
2 changes: 1 addition & 1 deletion hassio/src/dialogs/network/dialog-hassio-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class DialogHassioNetwork
${this.supervisor.localize("dialog.network.title")}
</span>
<ha-icon-button
.label=${this.hass.localize("common.close")}
.label=${this.supervisor.localize("common.close")}
.path=${mdiClose}
slot="actionItems"
dialogAction="cancel"
Expand Down
2 changes: 1 addition & 1 deletion hassio/src/system/hassio-host-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class HassioHostInfo extends LitElement {
<ha-button-menu corner="BOTTOM_START">
<ha-icon-button
.label=${this.hass.localize("common.menu")}
.label=${this.supervisor.localize("common.menu")}
.path=${mdiDotsVertical}
slot="trigger"
></ha-icon-button>
Expand Down
2 changes: 1 addition & 1 deletion src/common/translations/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const computeLocalize = async (

await loadPolyfillLocales(language);

// Everytime any of the parameters change, invalidate the strings cache.
// Every time any of the parameters change, invalidate the strings cache.
cache._localizationCache = {};

return (key, ...args) => {
Expand Down
7 changes: 6 additions & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@
}
},
"ui": {
"backup": {
"upload_backup": "Upload backup"
},
"card": {
"alarm_control_panel": {
"code": "Code",
Expand Down Expand Up @@ -4068,7 +4071,8 @@
"addons": "[%key:supervisor::backup::addons%]",
"password_protection": "[%key:supervisor::backup::password_protection%]",
"password": "[%key:supervisor::backup::password%]",
"confirm_password": "[%key:supervisor::backup::confirm_password%]"
"confirm_password": "[%key:supervisor::backup::confirm_password%]",
"upload_backup": "[%key:supervisor::backup::upload_backup%]"
}
},
"custom": {
Expand Down Expand Up @@ -4444,6 +4448,7 @@
"failed_to_delete": "Failed to delete",
"could_not_create": "Could not create backup",
"upload_backup": "Upload backup",
"download_backup": "Download backup",
"create_backup": "Create backup",
"create": "Create",
"created": "Created",
Expand Down

0 comments on commit ffaff30

Please sign in to comment.