UPD: Allow updating knob values
This commit is contained in:
@@ -17,14 +17,14 @@ const deviceStore = useDeviceStore()
|
||||
|
||||
const knobValues = computed({
|
||||
get() {
|
||||
return Object.values(deviceStore.currentProfile.knob).map((value, index) => ({
|
||||
if (!deviceStore.currentProfile) return []
|
||||
return Object.values(deviceStore.currentProfile!.knob).map((value, index) => ({
|
||||
id: index.toString(),
|
||||
value: value
|
||||
}))
|
||||
},
|
||||
set(newValues) {
|
||||
//TODO: Update deviceStore & device
|
||||
//deviceStore.setValues(newValues)
|
||||
deviceStore.setKnobValues(newValues.map((value) => value.value))
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -405,6 +405,16 @@ export const useDeviceStore = defineStore('device', {
|
||||
)
|
||||
this.setDirtyState(true)
|
||||
}
|
||||
},
|
||||
setKnobValues(values: Value[], updateDevice: boolean = true) {
|
||||
this.currentProfile!.knob = values
|
||||
if (updateDevice) {
|
||||
sendDebounced(
|
||||
this.currentDeviceId!,
|
||||
JSON.stringify({ profile: this.currentProfileName, updates: { knob: values } })
|
||||
)
|
||||
this.setDirtyState(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user