Workflow vue cleanup

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-09-10 09:44:20 +02:00
parent 9e0078824e
commit 7683208dfa
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
7 changed files with 28 additions and 41 deletions

View File

@ -14,8 +14,8 @@
<input v-else v-model="check.value" type="text" <input v-else v-model="check.value" type="text"
:class="{ invalid: !valid }" :class="{ invalid: !valid }"
:disabled="!currentOption" :placeholder="valuePlaceholder" @input="updateCheck"> :disabled="!currentOption" :placeholder="valuePlaceholder" @input="updateCheck">
<Actions> <Actions v-if="deleteVisible || !currentOption">
<ActionButton v-if="deleteVisible || !currentOption" icon="icon-delete" @click="$emit('remove')" /> <ActionButton icon="icon-delete" @click="$emit('remove')" />
</Actions> </Actions>
</div> </div>
</template> </template>

View File

@ -42,7 +42,6 @@ export default {
}, },
data() { data() {
return { return {
valid: false,
newValue: [] newValue: []
} }
}, },
@ -62,16 +61,8 @@ export default {
this.newValue = null this.newValue = null
} }
}, },
validate() {
return true
},
update() { update() {
if (this.validate()) {
this.$emit('input', this.newValue || '') this.$emit('input', this.newValue || '')
this.valid = false
} else {
this.valid = false
}
} }
} }
} }

View File

@ -28,8 +28,7 @@
:custom-label="tagLabel" :custom-label="tagLabel"
class="multiselect-vue" :multiple="multiple" class="multiselect-vue" :multiple="multiple"
:close-on-select="false" :tag-width="60" :close-on-select="false" :tag-width="60"
:disabled="disabled" @input="update" :disabled="disabled" @input="update">
@search-change="asyncFind">
<span slot="noResult">{{ t('core', 'No results') }}</span> <span slot="noResult">{{ t('core', 'No results') }}</span>
<template #option="scope"> <template #option="scope">
{{ tagLabel(scope.option) }} {{ tagLabel(scope.option) }}
@ -88,11 +87,9 @@ export default {
searchTags().then((result) => { searchTags().then((result) => {
this.tags = result this.tags = result
this.inputValObjects = this.getValueObject() this.inputValObjects = this.getValueObject()
}) }).catch(console.error.bind(this))
}, },
methods: { methods: {
asyncFind(query) {
},
getValueObject() { getValueObject() {
if (this.tags.length === 0) { if (this.tags.length === 0) {
return [] return []
@ -118,10 +115,10 @@ export default {
}, },
tagLabel({ displayName, userVisible, userAssignable }) { tagLabel({ displayName, userVisible, userAssignable }) {
if (userVisible === false) { if (userVisible === false) {
return `${displayName} (invisible)` return t('systemtags', '%s (invisible)').replace('%s', displayName)
} }
if (userAssignable === false) { if (userAssignable === false) {
return `${displayName} (restricted)` return t('systemtags', '%s (restricted)').replace('%s', displayName)
} }
return displayName return displayName
} }

View File

@ -30,6 +30,7 @@ export default {
}, },
data() { data() {
return { return {
timezones: zones,
valid: false, valid: false,
newValue: { newValue: {
startTime: null, startTime: null,
@ -38,11 +39,6 @@ export default {
} }
} }
}, },
computed: {
timezones() {
return zones
}
},
methods: { methods: {
updateInternalValue(value) { updateInternalValue(value) {
var data = JSON.parse(value) var data = JSON.parse(value)

View File

@ -81,12 +81,14 @@ export default {
} }
return 'https://localhost/index.php' return 'https://localhost/index.php'
}, },
matchingPredefined() {
return this.predefinedTypes
.map(groups => groups.children)
.flat()
.find((type) => this.newValue === type.pattern)
},
isPredefined() { isPredefined() {
const matchingPredefined = this.predefinedTypes.map(groups => groups.children).flat().find((type) => this.newValue === type.pattern) return !!this.matchingPredefined
if (matchingPredefined) {
return true
}
return false
}, },
customValue() { customValue() {
return { return {
@ -101,9 +103,8 @@ export default {
} }
}, },
currentValue() { currentValue() {
const matchingPredefined = this.predefinedTypes.map(groups => groups.children).flat().find((type) => this.newValue === type.pattern) if (this.matchingPredefined) {
if (matchingPredefined) { return this.matchingPredefined
return matchingPredefined
} }
return { return {
icon: 'icon-settings-dark', icon: 'icon-settings-dark',

View File

@ -77,12 +77,14 @@ export default {
options() { options() {
return [...this.predefinedTypes, this.customValue] return [...this.predefinedTypes, this.customValue]
}, },
matchingPredefined() {
return this.predefinedTypes
.map(groups => groups.children)
.flat()
.find((type) => this.newValue === type.pattern)
},
isPredefined() { isPredefined() {
const matchingPredefined = this.predefinedTypes.map(groups => groups.children).flat().find((type) => this.newValue === type.pattern) return !!this.matchingPredefined
if (matchingPredefined) {
return true
}
return false
}, },
customValue() { customValue() {
return { return {
@ -97,9 +99,8 @@ export default {
} }
}, },
currentValue() { currentValue() {
const matchingPredefined = this.predefinedTypes.map(groups => groups.children).flat().find((type) => this.newValue === type.pattern) if (this.matchingPredefined) {
if (matchingPredefined) { return this.matchingPredefined
return matchingPredefined
} }
return { return {
icon: 'icon-settings-dark', icon: 'icon-settings-dark',

View File

@ -20,9 +20,10 @@
* *
*/ */
import FileMimeType from './FileMimeType'
import { stringValidator, validateIPv4, validateIPv6 } from './../../helpers/validators' import { stringValidator, validateIPv4, validateIPv6 } from './../../helpers/validators'
import FileMimeType from './FileMimeType'
import FileSystemTag from './FileSystemTag' import FileSystemTag from './FileSystemTag'
const FileChecks = [ const FileChecks = [
{ {
class: 'OCA\\WorkflowEngine\\Check\\FileName', class: 'OCA\\WorkflowEngine\\Check\\FileName',