mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Update Move datadisk (not found) dialog (#13812)
This commit is contained in:
parent
fc104e7280
commit
4b8960c236
@ -52,7 +52,23 @@ class MoveDatadiskDialog extends LitElement {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
this._osInfo = await fetchHassioHassOsInfo(this.hass);
|
this._osInfo = await fetchHassioHassOsInfo(this.hass);
|
||||||
|
|
||||||
|
const data = await listDatadisks(this.hass);
|
||||||
|
if (data.devices.length > 0) {
|
||||||
|
this._devices = data.devices;
|
||||||
|
} else {
|
||||||
|
this.closeDialog();
|
||||||
|
await showAlertDialog(this, {
|
||||||
|
title: this.hass.localize(
|
||||||
|
"ui.panel.config.storage.datadisk.no_devices_title"
|
||||||
|
),
|
||||||
|
text: this.hass.localize(
|
||||||
|
"ui.panel.config.storage.datadisk.no_devices_text"
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
this.closeDialog();
|
||||||
await showAlertDialog(this, {
|
await showAlertDialog(this, {
|
||||||
title: this.hass.localize(
|
title: this.hass.localize(
|
||||||
"ui.panel.config.hardware.available_hardware.failed_to_get"
|
"ui.panel.config.hardware.available_hardware.failed_to_get"
|
||||||
@ -60,10 +76,6 @@ class MoveDatadiskDialog extends LitElement {
|
|||||||
text: extractApiErrorMessage(err),
|
text: extractApiErrorMessage(err),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
listDatadisks(this.hass).then((data) => {
|
|
||||||
this._devices = data.devices;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public closeDialog(): void {
|
public closeDialog(): void {
|
||||||
@ -76,9 +88,10 @@ class MoveDatadiskDialog extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
if (!this._hostInfo || !this._osInfo) {
|
if (!this._hostInfo || !this._osInfo || !this._devices) {
|
||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog
|
||||||
open
|
open
|
||||||
@ -91,47 +104,40 @@ class MoveDatadiskDialog extends LitElement {
|
|||||||
?hideActions=${this._moving}
|
?hideActions=${this._moving}
|
||||||
>
|
>
|
||||||
${this._moving
|
${this._moving
|
||||||
? html` <ha-circular-progress alt="Moving" size="large" active>
|
? html`
|
||||||
|
<ha-circular-progress alt="Moving" size="large" active>
|
||||||
</ha-circular-progress>
|
</ha-circular-progress>
|
||||||
<p class="progress-text">
|
<p class="progress-text">
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.storage.datadisk.moving_desc"
|
"ui.panel.config.storage.datadisk.moving_desc"
|
||||||
)}
|
)}
|
||||||
</p>`
|
</p>
|
||||||
: html`${this._devices?.length
|
`
|
||||||
? html`
|
: html`
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.config.storage.datadisk.description",
|
"ui.panel.config.storage.datadisk.description",
|
||||||
{
|
{
|
||||||
current_path: this._osInfo.data_disk,
|
current_path: this._osInfo.data_disk,
|
||||||
time: calculateMoveTime(this._hostInfo),
|
time: calculateMoveTime(this._hostInfo),
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
<ha-select
|
<ha-select
|
||||||
.label=${this.hass.localize(
|
.label=${this.hass.localize(
|
||||||
"ui.panel.config.storage.datadisk.select_device"
|
"ui.panel.config.storage.datadisk.select_device"
|
||||||
)}
|
)}
|
||||||
@selected=${this._select_device}
|
@selected=${this._select_device}
|
||||||
@closed=${stopPropagation}
|
@closed=${stopPropagation}
|
||||||
dialogInitialFocus
|
dialogInitialFocus
|
||||||
>
|
>
|
||||||
${this._devices.map(
|
${this._devices.map(
|
||||||
(device) =>
|
(device) =>
|
||||||
html`<mwc-list-item .value=${device}
|
html`<mwc-list-item .value=${device}
|
||||||
>${device}</mwc-list-item
|
>${device}</mwc-list-item
|
||||||
>`
|
>`
|
||||||
)}
|
)}
|
||||||
</ha-select>
|
</ha-select>
|
||||||
`
|
|
||||||
: this._devices === undefined
|
|
||||||
? this.hass.localize(
|
|
||||||
"ui.panel.config.storage.datadisk.loading_devices"
|
|
||||||
)
|
|
||||||
: this.hass.localize(
|
|
||||||
"ui.panel.config.storage.datadisk.no_devices"
|
|
||||||
)}
|
|
||||||
|
|
||||||
<mwc-button
|
<mwc-button
|
||||||
slot="secondaryAction"
|
slot="secondaryAction"
|
||||||
@ -147,7 +153,8 @@ class MoveDatadiskDialog extends LitElement {
|
|||||||
@click=${this._moveDatadisk}
|
@click=${this._moveDatadisk}
|
||||||
>
|
>
|
||||||
${this.hass.localize("ui.panel.config.storage.datadisk.move")}
|
${this.hass.localize("ui.panel.config.storage.datadisk.move")}
|
||||||
</mwc-button>`}
|
</mwc-button>
|
||||||
|
`}
|
||||||
</ha-dialog>
|
</ha-dialog>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@ -3507,7 +3507,8 @@
|
|||||||
"title": "Move datadisk",
|
"title": "Move datadisk",
|
||||||
"description": "You are currently using ''{current_path}'' as datadisk. Moving data disks will reboot your device and it's estimated to take {time} minutes. Your Home Assistant installation will not be accessible during this period. Do not disconnect the power during the move!",
|
"description": "You are currently using ''{current_path}'' as datadisk. Moving data disks will reboot your device and it's estimated to take {time} minutes. Your Home Assistant installation will not be accessible during this period. Do not disconnect the power during the move!",
|
||||||
"select_device": "Select new datadisk",
|
"select_device": "Select new datadisk",
|
||||||
"no_devices": "No suitable attached devices found",
|
"no_devices_title": "No suitable storage found",
|
||||||
|
"no_devices_text": "There is no suitable external device found. The storage capacity of the external data disk must be larger than the storage capacity of the existing disk",
|
||||||
"moving_desc": "Rebooting and moving datadisk. Please have patience",
|
"moving_desc": "Rebooting and moving datadisk. Please have patience",
|
||||||
"moving": "Moving datadisk",
|
"moving": "Moving datadisk",
|
||||||
"loading_devices": "Loading devices",
|
"loading_devices": "Loading devices",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user