From 5f3d6daa21c245dc451722c852430389c5095ea2 Mon Sep 17 00:00:00 2001 From: Mark Herwege Date: Tue, 7 May 2024 12:54:30 +0200 Subject: [PATCH] Setup wizard: Add primary IP config (#2565) Add-on finders scan the network for devices supported by OH add-ons to suggest suitable add-ons. These are presented in the setup-wizard (and add-ons store). To limit network traffic, especially for IP broadcast and multicast scans, finders could limit the traffic to one subnet. This is especially relevant if the setup would be on servers with many network interfaces or when using Docker. This commit adds setting up a primary IP address to the setup, which will also default the broadcast address accordingly to the primary address. Querying add-on suggestions is delayed until after this step, and some delay is built into the process to allow suggestions finders to scan the network. See discussion in https://github.com/openhab/openhab-core/pull/4036. --------- Also-by: Florian Hotze Signed-off-by: Mark Herwege --- .../web/src/assets/i18n/setup-wizard/en.json | 7 +- .../components/addons/addons-setup-wizard.vue | 12 ++ .../web/src/pages/wizards/setup-wizard.vue | 199 +++++++++++++++--- 3 files changed, 182 insertions(+), 36 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/assets/i18n/setup-wizard/en.json b/bundles/org.openhab.ui/web/src/assets/i18n/setup-wizard/en.json index c60883283c..55e0d74ca1 100644 --- a/bundles/org.openhab.ui/web/src/assets/i18n/setup-wizard/en.json +++ b/bundles/org.openhab.ui/web/src/assets/i18n/setup-wizard/en.json @@ -6,6 +6,7 @@ "setupwizard.skipSetup": "Skip Setup", "setupwizard.skipSetup.confirm.title": "Skip Setup", "setupwizard.skipSetup.confirm.message": "Are you sure? Setup saves you time by performing just a few basic configuration tasks. You should only skip it if you know what you're doing.", + "setupwizard.configureLater": "Configure in Settings Later", "setupwizard.location.title": "Set your Location", "setupwizard.location.header1": "Would you like to set your home's location?", "setupwizard.location.header2": "It will help determining data dependent on your position, like sunrise/sunset times or the weather.", @@ -17,7 +18,10 @@ "setupwizard.location.retrieveFromDevice.notAvailable.message": "Geolocation is not available", "setupwizard.location.footer": "This will ask your device for the permission to use its current location, only to help you fill in your current latitude and longitude above. You can revoke the permission afterwards.", "setupwizard.location.setLocation": "Set Location", - "setupwizard.location.configureLater": "Configure in Settings Later", + "setupwizard.network.title": "Select Primary Network", + "setupwizard.network.header1": "openHAB by default restricts some discovery broadcast network traffic to your primary network.", + "setupwizard.network.header2": "Select your server's primary IP address that is part of your primary network.", + "setupwizard.network.setNetwork": "Set Primary Network", "setupwizard.persistence.title": "Choose Persistence Add-ons", "setupwizard.persistence.header1": "openHAB relies on persistence add-ons to store and retrieve historic states.", "setupwizard.persistence.header2": "Select persistence add-ons to match the functionality you require.", @@ -46,6 +50,7 @@ "setupwizard.addons.installingAddon": "Installing Add-on: {addon}", "setupwizard.addons.progress": "{current} of {total}", "setupwizard.addons.pleaseWait": "Please Wait...", + "setupwizard.addons.suggestionsWaitMessage": "We are searching the most relevant add-ons for you...", "setupwizard.addons.waitMessage": "It may take a few minutes to install the add-ons you selected.", "setupwizard.welcome.title": "Welcome to openHAB!", "setupwizard.welcome.bindingsInstalled": "You have installed one or more bindings. Things provided by these bindings will appear in the Things Inbox. You can accept and further configure from there.", diff --git a/bundles/org.openhab.ui/web/src/components/addons/addons-setup-wizard.vue b/bundles/org.openhab.ui/web/src/components/addons/addons-setup-wizard.vue index d5dcbcad1c..1e4d7d7782 100644 --- a/bundles/org.openhab.ui/web/src/components/addons/addons-setup-wizard.vue +++ b/bundles/org.openhab.ui/web/src/components/addons/addons-setup-wizard.vue @@ -173,6 +173,18 @@ export default { } } }) + + // Add event listener for locale change + this.$f7.on('localeChange', () => { + if (this.autocompleteAddons) { + this.autocompleteAddons.params.pageTitle = this.$t('setupwizard.addons.selectAddons') + this.autocompleteAddons.params.searchbarPlaceholder = this.$t('setupwizard.addons.selectAddons.placeholder') + this.autocompleteAddons.params.searchbarDisableText = this.$t('dialogs.cancel') + this.autocompleteAddons.params.popupCloseLinkText = this.$t('dialogs.close') + this.autocompleteAddons.params.pageBackLinkText = this.$t('dialogs.back') + this.autocompleteAddons.params.notFoundText = this.$t('dialogs.search.nothingFound') + } + }) } } diff --git a/bundles/org.openhab.ui/web/src/pages/wizards/setup-wizard.vue b/bundles/org.openhab.ui/web/src/pages/wizards/setup-wizard.vue index 82ba4b1c3b..22fe1b403b 100644 --- a/bundles/org.openhab.ui/web/src/pages/wizards/setup-wizard.vue +++ b/bundles/org.openhab.ui/web/src/pages/wizards/setup-wizard.vue @@ -92,15 +92,15 @@ - +
- +
- + + +
+ +
+ {{ $t('setupwizard.network.title') }} +
+
+ + {{ $t('setupwizard.network.header1') }} {{ $t('setupwizard.network.header2') }} + + + + + +
+ + +
+
+
+ + + +
@@ -120,7 +150,13 @@ {{ $t('setupwizard.persistence.header1') }} {{ $t('setupwizard.persistence.header2') }} - +
+ +
+
+ + @@ -128,7 +164,10 @@
- +
@@ -155,7 +194,13 @@ - +
+ +
+
+ +
- @@ -229,6 +274,12 @@ width 240px .page-content margin-top inherit + .network + .block-header + .item-label + text-align left + margin-left 0 !important + margin-right 0 !important .tab-active scroll-snap-align start @@ -247,19 +298,18 @@