diff options
Diffstat (limited to 'apps/workflowengine/src/components/Checks/RequestUserAgent.vue')
-rw-r--r-- | apps/workflowengine/src/components/Checks/RequestUserAgent.vue | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/apps/workflowengine/src/components/Checks/RequestUserAgent.vue b/apps/workflowengine/src/components/Checks/RequestUserAgent.vue index be4075a1370..825a112f6fc 100644 --- a/apps/workflowengine/src/components/Checks/RequestUserAgent.vue +++ b/apps/workflowengine/src/components/Checks/RequestUserAgent.vue @@ -4,7 +4,7 @@ --> <template> <div> - <NcSelect :value="currentValue" + <NcSelect v-model="currentValue" :placeholder="t('workflowengine', 'Select a user agent')" label="label" :options="options" @@ -24,15 +24,15 @@ </template> </NcSelect> <input v-if="!isPredefined" + v-model="newValue" type="text" - :value="currentValue.id" @input="updateCustom"> </div> </template> <script> -import NcEllipsisedOption from '@nextcloud/vue/dist/Components/NcEllipsisedOption.js' -import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js' +import NcEllipsisedOption from '@nextcloud/vue/components/NcEllipsisedOption' +import NcSelect from '@nextcloud/vue/components/NcSelect' import valueMixin from '../../mixins/valueMixin.js' export default { @@ -44,6 +44,13 @@ export default { mixins: [ valueMixin, ], + props: { + modelValue: { + type: String, + default: '', + }, + }, + emits: ['update:model-value'], data() { return { newValue: '', @@ -73,15 +80,20 @@ export default { id: '', } }, - currentValue() { - if (this.matchingPredefined) { - return this.matchingPredefined - } - return { - icon: 'icon-settings-dark', - label: t('workflowengine', 'Custom user agent'), - id: this.newValue, - } + currentValue: { + get() { + if (this.matchingPredefined) { + return this.matchingPredefined + } + return { + icon: 'icon-settings-dark', + label: t('workflowengine', 'Custom user agent'), + id: this.newValue, + } + }, + set(value) { + this.newValue = value + }, }, }, methods: { @@ -94,12 +106,12 @@ export default { // TODO: check if value requires a regex and set the check operator according to that if (value !== null) { this.newValue = value.id - this.$emit('input', this.newValue) + this.$emit('update:model-value', this.newValue) } }, - updateCustom(event) { - this.newValue = event.target.value - this.$emit('input', this.newValue) + updateCustom() { + this.newValue = this.currentValue.id + this.$emit('update:model-value', this.newValue) }, }, } |