From e00bcc9f48b76b9f331f5452d0a91a828621bb85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Thu, 3 Jun 2021 19:01:12 +0200 Subject: [PATCH 01/15] Better exit navigation for my-ingress (#9342) --- hassio/src/ingress-view/hassio-ingress-view.ts | 13 ++++++++++--- src/translations/en.json | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hassio/src/ingress-view/hassio-ingress-view.ts b/hassio/src/ingress-view/hassio-ingress-view.ts index 710cf3b5e3..24d050acb9 100644 --- a/hassio/src/ingress-view/hassio-ingress-view.ts +++ b/hassio/src/ingress-view/hassio-ingress-view.ts @@ -97,16 +97,23 @@ class HassioIngressView extends LitElement { title: requestedAddon, }); await nextRender(); - history.back(); + navigate("/hassio/store", { replace: true }); return; } - if (!addonInfo.ingress) { + if (!addonInfo.version) { + await showAlertDialog(this, { + text: this.supervisor.localize("my.error_addon_not_installed"), + title: addonInfo.name, + }); + await nextRender(); + navigate(`/hassio/addon/${addonInfo.slug}/info`, { replace: true }); + } else if (!addonInfo.ingress) { await showAlertDialog(this, { text: this.supervisor.localize("my.error_addon_no_ingress"), title: addonInfo.name, }); await nextRender(); - history.back(); + navigate(`/hassio/addon/${addonInfo.slug}/info`, { replace: true }); } else { navigate(`/hassio/ingress/${addonInfo.slug}`, { replace: true }); } diff --git a/src/translations/en.json b/src/translations/en.json index 458e140bc3..6d41d8e276 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -3813,6 +3813,8 @@ "faq_link": "[%key:ui::panel::my::faq_link%]", "error": "[%key:ui::panel::my::error%]", "error_addon_not_found": "Add-on not found", + "error_addon_not_started": "The requested add-on are not running. Please start it first", + "error_addon_not_installed": "The requested add-on is not installed. Please install it first", "error_addon_no_ingress": "The requested add-on does not support ingress" }, "system": { From 509c5b497a111eb26c3291834dd9bbe7bf0d9c0e Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 3 Jun 2021 21:34:30 +0200 Subject: [PATCH 02/15] Disable babel compact option (#9335) --- build-scripts/bundle.js | 7 +------ build-scripts/rollup.js | 1 - build-scripts/webpack.js | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/build-scripts/bundle.js b/build-scripts/bundle.js index 1183a5ce06..dc4b59b02a 100644 --- a/build-scripts/bundle.js +++ b/build-scripts/bundle.js @@ -52,6 +52,7 @@ module.exports.terserOptions = (latestBuild) => ({ module.exports.babelOptions = ({ latestBuild }) => ({ babelrc: false, + compact: false, presets: [ !latestBuild && [ "@babel/preset-env", @@ -79,12 +80,6 @@ module.exports.babelOptions = ({ latestBuild }) => ({ ].filter(Boolean), }); -// Are already ES5, cause warnings when babelified. -module.exports.babelExclude = () => [ - require.resolve("@mdi/js/mdi.js"), - require.resolve("hls.js"), -]; - const outputPath = (outputRoot, latestBuild) => path.resolve(outputRoot, latestBuild ? "frontend_latest" : "frontend_es5"); diff --git a/build-scripts/rollup.js b/build-scripts/rollup.js index 7d9cf93046..f57e9f7e64 100644 --- a/build-scripts/rollup.js +++ b/build-scripts/rollup.js @@ -57,7 +57,6 @@ const createRollupConfig = ({ babel({ ...bundle.babelOptions({ latestBuild }), extensions, - exclude: bundle.babelExclude(), babelHelpers: isWDS ? "inline" : "bundled", }), string({ diff --git a/build-scripts/webpack.js b/build-scripts/webpack.js index fe025abac2..3dcac91de9 100644 --- a/build-scripts/webpack.js +++ b/build-scripts/webpack.js @@ -47,7 +47,6 @@ const createWebpackConfig = ({ rules: [ { test: /\.m?js$|\.ts$/, - exclude: bundle.babelExclude(), use: { loader: "babel-loader", options: bundle.babelOptions({ latestBuild }), From 8836ba6ceb091825c73ae5a99ba0e06b1827fc59 Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Thu, 3 Jun 2021 22:48:52 +0200 Subject: [PATCH 03/15] Pick the correct backend-selected active theme (#9357) --- src/panels/profile/ha-pick-theme-row.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/panels/profile/ha-pick-theme-row.ts b/src/panels/profile/ha-pick-theme-row.ts index bb2ac4a86d..5ae1ecc679 100644 --- a/src/panels/profile/ha-pick-theme-row.ts +++ b/src/panels/profile/ha-pick-theme-row.ts @@ -36,7 +36,9 @@ export class HaPickThemeRow extends LitElement { const hasThemes = this.hass.themes.themes && Object.keys(this.hass.themes.themes).length; const curTheme = - this.hass.selectedTheme?.theme || this.hass.themes.default_theme; + this.hass.selectedTheme?.theme || this.hass.themes.darkMode + ? this.hass.themes.default_dark_theme || this.hass.themes.default_theme + : this.hass.themes.default_theme; const themeSettings = this.hass.selectedTheme; From 5418474f640953e224c77661b20f049bdd0708a7 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 3 Jun 2021 22:50:33 +0200 Subject: [PATCH 04/15] Polyfill `globalThis` in latest build (#9352) --- src/html/authorize.html.template | 3 +++ src/html/index.html.template | 3 +++ src/html/onboarding.html.template | 3 +++ src/resources/compatibility.ts | 19 ++++++++++++++++--- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/html/authorize.html.template b/src/html/authorize.html.template index 1cf1c7bba4..555aea9e0e 100644 --- a/src/html/authorize.html.template +++ b/src/html/authorize.html.template @@ -48,6 +48,9 @@ window.providersPromise = fetch("/auth/providers", { credentials: "same-origin", }); + if (!window.globalThis) { + window.globalThis = window; + }