Adapt UI app to new data model

This commit is contained in:
Benedikt Kulmann
2020-08-19 10:27:06 +02:00
parent 8282f348eb
commit 0e8be0e195
9 changed files with 130 additions and 125 deletions
+5 -2
View File
@@ -29,13 +29,16 @@ export default {
},
methods: {
async applyValue () {
const value = {
const payload = {
boolValue: this.value
}
if (!isNil(this.persistedValue)) {
payload.id = this.persistedValue.id
}
await this.$emit('onSave', {
bundle: this.bundle,
setting: this.setting,
value
value: payload
})
// TODO: show a spinner while the request for saving the value is running!
}
+12 -8
View File
@@ -65,15 +65,15 @@ export default {
return Array.from(this.selectedOptions).map(option => option.displayValue).join(', ')
},
dropElementId () {
return `multi-choice-drop-${this.bundle.identifier.bundleKey}-${this.setting.settingKey}`
return `multi-choice-drop-${this.setting.id}`
},
buttonElementId () {
return `multi-choice-toggle-${this.bundle.identifier.bundleKey}-${this.setting.settingKey}`
return `multi-choice-toggle-${this.setting.id}`
}
},
methods: {
getOptionElementId (index) {
return `${this.bundle.identifier.bundleKey}-${this.setting.settingKey}-${index}`
return `${this.setting.id}-${index}`
},
async onSelectedOption () {
const values = []
@@ -87,14 +87,18 @@ export default {
}
})
}
const payload = {
listValue: {
values
}
}
if (!isNil(this.persistedValue)) {
payload.id = this.persistedValue.id
}
await this.$emit('onSave', {
bundle: this.bundle,
setting: this.setting,
value: {
listValue: {
values
}
}
payload
})
// TODO: show a spinner while the request for saving the value is running!
}
+5 -2
View File
@@ -69,13 +69,16 @@ export default {
this.value = this.initialValue
},
async applyValue () {
const value = {
const payload = {
intValue: this.value
}
if (!isNil(this.persistedValue)) {
payload.id = this.persistedValue.id
}
await this.$emit('onSave', {
bundle: this.bundle,
setting: this.setting,
value
payload
})
// TODO: show a spinner while the request for saving the value is running!
this.initialValue = this.value
+12 -8
View File
@@ -63,15 +63,15 @@ export default {
},
computed: {
dropElementId () {
return `single-choice-drop-${this.bundle.identifier.bundleKey}-${this.setting.settingKey}`
return `single-choice-drop-${this.setting.id}`
},
buttonElementId () {
return `single-choice-toggle-${this.bundle.identifier.bundleKey}-${this.setting.settingKey}`
return `single-choice-toggle-${this.setting.id}`
}
},
methods: {
getOptionElementId (index) {
return `${this.bundle.identifier.bundleKey}-${this.setting.settingKey}-${index}`
return `${this.setting.id}-${index}`
},
async onSelectedOption () {
const values = []
@@ -83,14 +83,18 @@ export default {
values.push({ stringValue: this.selectedOption.value.stringValue })
}
}
const payload = {
listValue: {
values
}
}
if (!isNil(this.persistedValue)) {
payload.id = this.persistedValue.id
}
await this.$emit('onSave', {
bundle: this.bundle,
setting: this.setting,
value: {
listValue: {
values
}
}
payload
})
// TODO: show a spinner while the request for saving the value is running!
}
+5 -2
View File
@@ -51,13 +51,16 @@ export default {
},
methods: {
async applyValue () {
const value = {
const payload = {
stringValue: this.value
}
if (!isNil(this.persistedValue)) {
payload.id = this.persistedValue.id
}
await this.$emit('onSave', {
bundle: this.bundle,
setting: this.setting,
value
payload
})
// TODO: show a spinner while the request for saving the value is running!
this.initialValue = this.value