diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-09-10 09:44:20 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-09-10 09:44:20 +0200 |
commit | 7683208dfa4cf5f0ff196ee0cabdacf8046592eb (patch) | |
tree | e4923006ebe0a67e7e512886fb3322c5a2570f92 /apps/workflowengine/src | |
parent | 9e0078824e1303c78575c4287ce3f228659d8ab5 (diff) | |
download | nextcloud-server-7683208dfa4cf5f0ff196ee0cabdacf8046592eb.tar.gz nextcloud-server-7683208dfa4cf5f0ff196ee0cabdacf8046592eb.zip |
Workflow vue cleanup
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/workflowengine/src')
7 files changed, 28 insertions, 41 deletions
diff --git a/apps/workflowengine/src/components/Check.vue b/apps/workflowengine/src/components/Check.vue index 905c2c989b1..06667b1a7ee 100644 --- a/apps/workflowengine/src/components/Check.vue +++ b/apps/workflowengine/src/components/Check.vue @@ -14,8 +14,8 @@ <input v-else v-model="check.value" type="text" :class="{ invalid: !valid }" :disabled="!currentOption" :placeholder="valuePlaceholder" @input="updateCheck"> - <Actions> - <ActionButton v-if="deleteVisible || !currentOption" icon="icon-delete" @click="$emit('remove')" /> + <Actions v-if="deleteVisible || !currentOption"> + <ActionButton icon="icon-delete" @click="$emit('remove')" /> </Actions> </div> </template> diff --git a/apps/workflowengine/src/components/Checks/FileSystemTag.vue b/apps/workflowengine/src/components/Checks/FileSystemTag.vue index 2875b64d48e..e2f66b30a4b 100644 --- a/apps/workflowengine/src/components/Checks/FileSystemTag.vue +++ b/apps/workflowengine/src/components/Checks/FileSystemTag.vue @@ -42,7 +42,6 @@ export default { }, data() { return { - valid: false, newValue: [] } }, @@ -62,16 +61,8 @@ export default { this.newValue = null } }, - validate() { - return true - }, update() { - if (this.validate()) { - this.$emit('input', this.newValue || '') - this.valid = false - } else { - this.valid = false - } + this.$emit('input', this.newValue || '') } } } diff --git a/apps/workflowengine/src/components/Checks/MultiselectTag/MultiselectTag.vue b/apps/workflowengine/src/components/Checks/MultiselectTag/MultiselectTag.vue index a046861b132..88b56a1d4e9 100644 --- a/apps/workflowengine/src/components/Checks/MultiselectTag/MultiselectTag.vue +++ b/apps/workflowengine/src/components/Checks/MultiselectTag/MultiselectTag.vue @@ -28,8 +28,7 @@ :custom-label="tagLabel" class="multiselect-vue" :multiple="multiple" :close-on-select="false" :tag-width="60" - :disabled="disabled" @input="update" - @search-change="asyncFind"> + :disabled="disabled" @input="update"> <span slot="noResult">{{ t('core', 'No results') }}</span> <template #option="scope"> {{ tagLabel(scope.option) }} @@ -88,11 +87,9 @@ export default { searchTags().then((result) => { this.tags = result this.inputValObjects = this.getValueObject() - }) + }).catch(console.error.bind(this)) }, methods: { - asyncFind(query) { - }, getValueObject() { if (this.tags.length === 0) { return [] @@ -118,10 +115,10 @@ export default { }, tagLabel({ displayName, userVisible, userAssignable }) { if (userVisible === false) { - return `${displayName} (invisible)` + return t('systemtags', '%s (invisible)').replace('%s', displayName) } if (userAssignable === false) { - return `${displayName} (restricted)` + return t('systemtags', '%s (restricted)').replace('%s', displayName) } return displayName } diff --git a/apps/workflowengine/src/components/Checks/RequestTime.vue b/apps/workflowengine/src/components/Checks/RequestTime.vue index d41f76c2c21..ce306c0541e 100644 --- a/apps/workflowengine/src/components/Checks/RequestTime.vue +++ b/apps/workflowengine/src/components/Checks/RequestTime.vue @@ -30,6 +30,7 @@ export default { }, data() { return { + timezones: zones, valid: false, newValue: { startTime: null, @@ -38,11 +39,6 @@ export default { } } }, - computed: { - timezones() { - return zones - } - }, methods: { updateInternalValue(value) { var data = JSON.parse(value) diff --git a/apps/workflowengine/src/components/Checks/RequestURL.vue b/apps/workflowengine/src/components/Checks/RequestURL.vue index 7de8b0637ff..2ddba526d1e 100644 --- a/apps/workflowengine/src/components/Checks/RequestURL.vue +++ b/apps/workflowengine/src/components/Checks/RequestURL.vue @@ -81,12 +81,14 @@ export default { } return 'https://localhost/index.php' }, + matchingPredefined() { + return this.predefinedTypes + .map(groups => groups.children) + .flat() + .find((type) => this.newValue === type.pattern) + }, isPredefined() { - const matchingPredefined = this.predefinedTypes.map(groups => groups.children).flat().find((type) => this.newValue === type.pattern) - if (matchingPredefined) { - return true - } - return false + return !!this.matchingPredefined }, customValue() { return { @@ -101,9 +103,8 @@ export default { } }, currentValue() { - const matchingPredefined = this.predefinedTypes.map(groups => groups.children).flat().find((type) => this.newValue === type.pattern) - if (matchingPredefined) { - return matchingPredefined + if (this.matchingPredefined) { + return this.matchingPredefined } return { icon: 'icon-settings-dark', diff --git a/apps/workflowengine/src/components/Checks/RequestUserAgent.vue b/apps/workflowengine/src/components/Checks/RequestUserAgent.vue index c65bba50353..e80071ab9fa 100644 --- a/apps/workflowengine/src/components/Checks/RequestUserAgent.vue +++ b/apps/workflowengine/src/components/Checks/RequestUserAgent.vue @@ -77,12 +77,14 @@ export default { options() { return [...this.predefinedTypes, this.customValue] }, + matchingPredefined() { + return this.predefinedTypes + .map(groups => groups.children) + .flat() + .find((type) => this.newValue === type.pattern) + }, isPredefined() { - const matchingPredefined = this.predefinedTypes.map(groups => groups.children).flat().find((type) => this.newValue === type.pattern) - if (matchingPredefined) { - return true - } - return false + return !!this.matchingPredefined }, customValue() { return { @@ -97,9 +99,8 @@ export default { } }, currentValue() { - const matchingPredefined = this.predefinedTypes.map(groups => groups.children).flat().find((type) => this.newValue === type.pattern) - if (matchingPredefined) { - return matchingPredefined + if (this.matchingPredefined) { + return this.matchingPredefined } return { icon: 'icon-settings-dark', diff --git a/apps/workflowengine/src/components/Checks/file.js b/apps/workflowengine/src/components/Checks/file.js index 80bd120079f..ce6887316c2 100644 --- a/apps/workflowengine/src/components/Checks/file.js +++ b/apps/workflowengine/src/components/Checks/file.js @@ -20,9 +20,10 @@ * */ -import FileMimeType from './FileMimeType' import { stringValidator, validateIPv4, validateIPv6 } from './../../helpers/validators' +import FileMimeType from './FileMimeType' import FileSystemTag from './FileSystemTag' + const FileChecks = [ { class: 'OCA\\WorkflowEngine\\Check\\FileName', |