Skip to content

Commit

Permalink
Setup wizard: Fix server-set region and location not shown on later w…
Browse files Browse the repository at this point in the history
…izard launch (openhab#2558)

This makes the setup wizard load the region and the location from the
server.
Useful when the wizard is re-launched later.

Signed-off-by: Florian Hotze <[email protected]>
  • Loading branch information
florian-h05 authored May 2, 2024
1 parent 93f758b commit 6f5a59f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bundles/org.openhab.ui/web/src/pages/wizards/setup-wizard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,12 @@ export default {
}
},
mounted () {
this.$oh.api.get('/rest/config-descriptions/system:i18n').then((data) => {
this.availableLanguages = data.parameters.find(p => p.name === 'language').options
this.availableRegions = data.parameters.find(p => p.name === 'region').options
this.availableTimezones = data.parameters.find(p => p.name === 'timezone').options
Promise.all([this.$oh.api.get('/rest/config-descriptions/system:i18n'), this.$oh.api.get('/rest/services/org.openhab.i18n/config')]).then((data) => {
this.availableLanguages = data[0].parameters.find(p => p.name === 'language').options
this.availableRegions = data[0].parameters.find(p => p.name === 'region').options
this.availableTimezones = data[0].parameters.find(p => p.name === 'timezone').options
if (data[1].region) this.region = data[1].region
if (data[1].location) this.location = data[1].location
if (Intl && Intl.DateTimeFormat().resolvedOptions()) {
const intlOptions = Intl.DateTimeFormat().resolvedOptions()
if (intlOptions.locale) {
Expand Down

0 comments on commit 6f5a59f

Please sign in to comment.