Skip to content

Commit

Permalink
Merge pull request #48 from simonsobs/fix-synacc
Browse files Browse the repository at this point in the history
Fix synacc
  • Loading branch information
mhasself authored Nov 14, 2023
2 parents 055bc1d + d1807ac commit e31f303
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
16 changes: 13 additions & 3 deletions src/components/OpDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- options_style='array' -->
<select class="ocs_double"
:value="modelValue"
@input="$emit('update:modelValue', $event.target.value)"
@input="emitValue($event.target.value)"
v-if="options_style == 'array'">
<option v-for="opt in options" v-bind:key="opt" v-bind:value="opt">
{{ opt }}
Expand All @@ -15,7 +15,7 @@
<!-- options_style='object' -->
<select class="ocs_double"
:value="modelValue"
@input="$emit('update:modelValue', $event.target.value)"
@input="emitValue($event.target.value)"
v-if="options_style == 'object'">
<option v-for="(value, key) in options" v-bind:key="key" :value="key">
{{ value }}
Expand All @@ -41,8 +41,18 @@
},
modelValue: {
required: true},
modelModifiers: { default: () => ({}) },
},
}
//emits:
methods: {
emitValue(value) {
// Handle the "vmodel.boolean"
if (this.modelModifiers.boolean)
value = (value == "true");
this.$emit('update:modelValue', value);
},
},
}
</script>

<style scoped>
Expand Down
19 changes: 10 additions & 9 deletions src/panels/SynaccessAgent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@
v-model.number="ops.set_outlet.params.outlet" />
<OpDropdown
caption="State"
:options="['on', 'off']"
v-model="ops.set_outlet.params.state" />
options_style="object"
:options="{true: 'on', false: 'off'}"
v-model.boolean="ops.set_outlet.params.on" />
</OcsTask>

<OcsTask
Expand All @@ -88,11 +89,11 @@

<OcsTask
:op_data="ops.set_all">
<div class="ocs_row">
<label>Set On</label>
<input type="checkbox" id="checkbox" v-model="ops.set_all.params.on"
/>
</div>
<OpDropdown
caption="State"
options_style="object"
:options="{true: 'on', false: 'off'}"
v-model.boolean="ops.set_all.params.on" />
</OcsTask>

<OcsTask
Expand All @@ -114,7 +115,7 @@
outlets: {},
ops: window.ocs_bundle.web.ops_data_init({
'status_acq': {},
'set_outlet': {params: {state: 'off'}},
'set_outlet': {params: {}},
'get_status': {},
'set_all': {},
'reboot': {},
Expand Down Expand Up @@ -162,7 +163,7 @@
} else {
this.panel.client.run_task('set_outlet', {
outlet: idx + 1,
state: state});
on: (state == 'on')});
}
},
getIndicator(name) {
Expand Down

0 comments on commit e31f303

Please sign in to comment.