Skip to content

Commit

Permalink
Add-on config page: Fix dirty handling (#2370)
Browse files Browse the repository at this point in the history
Fix regressions & leftovers from #2314.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
  • Loading branch information
florian-h05 committed Feb 17, 2024
1 parent 2c01829 commit 644a1fc
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions bundles/org.openhab.ui/web/src/pages/addons/addon-config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export default {
bindingId: null,
loggerPackages: [],
serviceId: null,
strippedAddonId: ''
strippedAddonId: '',
loadingConfig: true,
loadingLoggers: true
}
},
computed: {
Expand All @@ -106,7 +108,15 @@ export default {
watch: {
config: {
handler: function () {
if (!this.loading) {
if (!this.loadingConfig) {
this.dirty = true
}
},
deep: true
},
loggerPackages: {
handler: function () {
if (!this.loadingLoggers) {
this.dirty = true
}
},
Expand Down Expand Up @@ -172,21 +182,32 @@ export default {
this.$oh.api.get(requestUri).then(data => {
this.addon = data
let configDescriptionURI = this.addon.configDescriptionURI || ''
const configDescriptionURI = this.addon.configDescriptionURI
if (configDescriptionURI) {
this.$oh.api.get('/rest/config-descriptions/' + configDescriptionURI).then(data2 => {
this.configDescription = data2
this.$oh.api.get('/rest/addons/' + this.strippedAddonId + '/config' + (this.serviceId ? '?serviceId=' + this.serviceId : '')).then(data3 => {
this.config = data3
this.$nextTick(() => {
this.loadingConfig = false
})
})
})
} else {
this.loadingConfig = false
}
if (Array.isArray(this.addon.loggerPackages)) {
this.addon.loggerPackages.forEach(loggerPackage => {
this.$oh.api.get('/rest/logging/' + loggerPackage).then(data4 => {
data4.loggers.forEach(logger => this.loggerPackages.push(logger))
this.$nextTick(() => {
this.loadingLoggers = false
})
})
})
} else {
this.loadingLoggers = false
}
})
}
Expand Down

0 comments on commit 644a1fc

Please sign in to comment.