Integrate loaded settings values into ui

Not yet done for single choice and multi choice, but getting there...
This commit is contained in:
Benedikt Kulmann
2020-05-07 07:42:50 +02:00
parent 8a6a06fcb8
commit e44654dc9d
21 changed files with 2416 additions and 1494 deletions
+10 -2
View File
@@ -5,6 +5,7 @@
</template>
<script>
import isNil from "lodash/isNil"
export default {
name: 'SettingBoolean',
props: {
@@ -15,6 +16,10 @@ export default {
setting: {
type: Object,
required: true
},
persistedValue: {
type: Object,
required: false
}
},
data() {
@@ -35,10 +40,13 @@ export default {
}
},
mounted() {
// TODO: load the settings value of the authenticated user and apply it to the value
if (this.value === null) {
if (!isNil(this.persistedValue)) {
this.value = this.persistedValue.boolValue
}
if (isNil(this.value) && !isNil(this.setting.boolValue.default)) {
this.value = this.setting.boolValue.default
}
this.initialValue = this.value
}
}
</script>
@@ -48,6 +48,10 @@ export default {
setting: {
type: Object,
required: true
},
persistedValue: {
type: Object,
required: false
}
},
data() {
+15 -4
View File
@@ -22,6 +22,7 @@
</template>
<script>
import isNil from "lodash/isNil"
export default {
name: 'SettingNumber',
props: {
@@ -32,6 +33,10 @@ export default {
setting: {
type: Object,
required: true
},
persistedValue: {
type: Object,
required: false
}
},
data() {
@@ -46,13 +51,13 @@ export default {
},
inputAttributes() {
const attributes = {}
if (this.setting.intValue.min !== null && this.setting.intValue.min !== undefined) {
if (!isNil(this.setting.intValue.min)) {
attributes.min = this.setting.intValue.min
}
if (this.setting.intValue.max !== null && this.setting.intValue.max !== undefined) {
if (!isNil(this.setting.intValue.max)) {
attributes.max = this.setting.intValue.max
}
if (this.setting.intValue.step !== null && this.setting.intValue.step !== undefined) {
if (!isNil(this.setting.intValue.step)) {
attributes.step = this.setting.intValue.step
}
return attributes
@@ -69,7 +74,13 @@ export default {
}
},
mounted() {
// TODO: load the settings value of the authenticated user and apply it to the value
if (!isNil(this.persistedValue)) {
this.value = this.persistedValue.intValue
}
if (isNil(this.value) && !isNil(this.setting.intValue.default)) {
this.value = this.setting.intValue.default
}
this.initialValue = this.value
}
}
</script>
@@ -49,6 +49,10 @@ export default {
setting: {
type: Object,
required: true
},
persistedValue: {
type: Object,
required: false
}
},
data() {
+12 -1
View File
@@ -20,6 +20,7 @@
</template>
<script>
import isNil from "lodash/isNil"
export default {
name: 'SettingString',
props: {
@@ -30,6 +31,10 @@ export default {
setting: {
type: Object,
required: true
},
persistedValue: {
type: Object,
required: false
}
},
data() {
@@ -54,7 +59,13 @@ export default {
}
},
mounted() {
// TODO: load the settings value of the authenticated user and apply it to the value
if (!isNil(this.persistedValue)) {
this.value = this.persistedValue.stringValue
}
if (isNil(this.value) && !isNil(this.setting.stringValue.default)) {
this.value = this.setting.stringValue.default
}
this.initialValue = this.value
}
}
</script>
@@ -15,6 +15,10 @@ export default {
setting: {
type: Object,
required: true
},
persistedValue: {
type: Object,
required: false
}
}
}