diff --git a/src/panels/config/storage/dialog-move-datadisk.ts b/src/panels/config/storage/dialog-move-datadisk.ts
index a005f29ebd..cfe29c95ca 100644
--- a/src/panels/config/storage/dialog-move-datadisk.ts
+++ b/src/panels/config/storage/dialog-move-datadisk.ts
@@ -52,7 +52,23 @@ class MoveDatadiskDialog extends LitElement {
try {
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) {
+ this.closeDialog();
await showAlertDialog(this, {
title: this.hass.localize(
"ui.panel.config.hardware.available_hardware.failed_to_get"
@@ -60,10 +76,6 @@ class MoveDatadiskDialog extends LitElement {
text: extractApiErrorMessage(err),
});
}
-
- listDatadisks(this.hass).then((data) => {
- this._devices = data.devices;
- });
}
public closeDialog(): void {
@@ -76,9 +88,10 @@ class MoveDatadiskDialog extends LitElement {
}
protected render(): TemplateResult {
- if (!this._hostInfo || !this._osInfo) {
+ if (!this._hostInfo || !this._osInfo || !this._devices) {
return html``;
}
+
return html`
${this.hass.localize(
"ui.panel.config.storage.datadisk.moving_desc"
)}
-
+