UPD: Allow updating knob values
This commit is contained in:
@@ -17,14 +17,14 @@ const deviceStore = useDeviceStore()
|
|||||||
|
|
||||||
const knobValues = computed({
|
const knobValues = computed({
|
||||||
get() {
|
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(),
|
id: index.toString(),
|
||||||
value: value
|
value: value
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
set(newValues) {
|
set(newValues) {
|
||||||
//TODO: Update deviceStore & device
|
deviceStore.setKnobValues(newValues.map((value) => value.value))
|
||||||
//deviceStore.setValues(newValues)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -405,6 +405,16 @@ export const useDeviceStore = defineStore('device', {
|
|||||||
)
|
)
|
||||||
this.setDirtyState(true)
|
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