Ingress: Wait for dialog to close before navigating (#9250)

This commit is contained in:
Bram Kragten 2021-05-25 22:11:52 +02:00 committed by GitHub
parent 0dd3757df2
commit d97fb19f05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,7 @@ import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../../../src/common/dom/fire_event"; import { fireEvent } from "../../../src/common/dom/fire_event";
import { navigate } from "../../../src/common/navigate"; import { navigate } from "../../../src/common/navigate";
import { extractSearchParam } from "../../../src/common/url/search-params"; import { extractSearchParam } from "../../../src/common/url/search-params";
import { nextRender } from "../../../src/common/util/render-status";
import { import {
fetchHassioAddonInfo, fetchHassioAddonInfo,
HassioAddonDetails, HassioAddonDetails,
@ -95,6 +96,7 @@ class HassioIngressView extends LitElement {
text: extractApiErrorMessage(err), text: extractApiErrorMessage(err),
title: requestedAddon, title: requestedAddon,
}); });
await nextRender();
history.back(); history.back();
return; return;
} }
@ -103,6 +105,7 @@ class HassioIngressView extends LitElement {
text: this.supervisor.localize("my.error_addon_no_ingress"), text: this.supervisor.localize("my.error_addon_no_ingress"),
title: addonInfo.name, title: addonInfo.name,
}); });
await nextRender();
history.back(); history.back();
} else { } else {
navigate(`/hassio/ingress/${addonInfo.slug}`, { replace: true }); navigate(`/hassio/ingress/${addonInfo.slug}`, { replace: true });
@ -140,6 +143,7 @@ class HassioIngressView extends LitElement {
text: "Unable to fetch add-on info to start Ingress", text: "Unable to fetch add-on info to start Ingress",
title: "Supervisor", title: "Supervisor",
}); });
await nextRender();
history.back(); history.back();
return; return;
} }
@ -149,6 +153,7 @@ class HassioIngressView extends LitElement {
text: "Add-on does not support Ingress", text: "Add-on does not support Ingress",
title: addon.name, title: addon.name,
}); });
await nextRender();
history.back(); history.back();
return; return;
} }
@ -157,8 +162,9 @@ class HassioIngressView extends LitElement {
await showAlertDialog(this, { await showAlertDialog(this, {
text: "Add-on is not running. Please start it first", text: "Add-on is not running. Please start it first",
title: addon.name, title: addon.name,
confirm: () => navigate(`/hassio/addon/${addon.slug}`),
}); });
await nextRender();
navigate(`/hassio/addon/${addon.slug}/info`, { replace: true });
return; return;
} }
@ -171,6 +177,7 @@ class HassioIngressView extends LitElement {
text: "Unable to create an Ingress session", text: "Unable to create an Ingress session",
title: addon.name, title: addon.name,
}); });
await nextRender();
history.back(); history.back();
return; return;
} }