mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 06:08:46 -04:00
fix(workflowengine): adapt check operator RequestURL to use web component
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
5fbe00870b
commit
c24ead810d
3 changed files with 22 additions and 6 deletions
|
|
@ -23,7 +23,7 @@
|
|||
v-if="currentElement"
|
||||
ref="checkComponent"
|
||||
:disabled="!currentOption"
|
||||
:check="check"
|
||||
:operator="check.operator"
|
||||
:model-value="check.value"
|
||||
class="option"
|
||||
@update:model-value="updateCheck"
|
||||
|
|
@ -166,7 +166,8 @@ export default {
|
|||
this.$emit('validate', this.valid)
|
||||
},
|
||||
updateCheck(event) {
|
||||
const matchingOperator = this.operators.findIndex((operator) => this.check.operator === operator.operator)
|
||||
const selectedOperator = event?.operator || this.currentOperator?.operator || this.check.operator
|
||||
const matchingOperator = this.operators.findIndex((operator) => selectedOperator === operator.operator)
|
||||
if (this.check.class !== this.currentOption.class || matchingOperator === -1) {
|
||||
this.currentOperator = this.operators[0]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<template>
|
||||
<div>
|
||||
<NcSelect :value="currentValue"
|
||||
v-model="newValue"
|
||||
:placeholder="t('workflowengine', 'Select a request URL')"
|
||||
label="label"
|
||||
:clearable="false"
|
||||
|
|
@ -45,6 +46,9 @@ export default {
|
|||
mixins: [
|
||||
valueMixin,
|
||||
],
|
||||
|
||||
emits: ['update:model-value'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
newValue: '',
|
||||
|
|
@ -57,12 +61,22 @@ export default {
|
|||
],
|
||||
}
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
operator: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
options() {
|
||||
return [...this.predefinedTypes, this.customValue]
|
||||
},
|
||||
placeholder() {
|
||||
if (this.check.operator === 'matches' || this.check.operator === '!matches') {
|
||||
if (this.operator === 'matches' || this.operator === '!matches') {
|
||||
return '/^https\\:\\/\\/localhost\\/index\\.php$/i'
|
||||
}
|
||||
return 'https://localhost/index.php'
|
||||
|
|
@ -102,12 +116,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)
|
||||
this.$emit('update:model-value', this.newValue)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { registerCustomElement } from '../../helpers/window.js'
|
||||
import RequestUserAgent from './RequestUserAgent.vue'
|
||||
import RequestTime from './RequestTime.vue'
|
||||
import RequestURL from './RequestURL.vue'
|
||||
|
|
@ -18,7 +19,7 @@ const RequestChecks = [
|
|||
{ operator: 'matches', name: t('workflowengine', 'matches') },
|
||||
{ operator: '!matches', name: t('workflowengine', 'does not match') },
|
||||
],
|
||||
component: RequestURL,
|
||||
element: registerCustomElement(RequestURL, 'oca-workflowengine-checks-request_url'),
|
||||
},
|
||||
{
|
||||
class: 'OCA\\WorkflowEngine\\Check\\RequestTime',
|
||||
|
|
|
|||
Loading…
Reference in a new issue