From b8779eed3680be88155750e2564465c462007f54 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Mon, 23 Dec 2019 10:25:42 +0100 Subject: Allow selecting other event types (fix #18510) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/workflowengine/src/components/Event.vue | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'apps/workflowengine/src') diff --git a/apps/workflowengine/src/components/Event.vue b/apps/workflowengine/src/components/Event.vue index 9883a8cf93c..bf8e06e5df1 100644 --- a/apps/workflowengine/src/components/Event.vue +++ b/apps/workflowengine/src/components/Event.vue @@ -56,7 +56,21 @@ export default { }, methods: { updateEvent(events) { - this.$set(this.rule, 'events', events.map(event => event.eventName)) + if (events.length === 0) { + window.OCP.Toast.warning(t('workflowengine', 'At least one event must be selected')) + return + } + const existingEntity = this.rule.entity + const newEntities = events.map(event => event.entity.id).filter((value, index, self) => self.indexOf(value) === index) + let newEntity = null + if (newEntities.length > 1) { + newEntity = newEntities.filter(entity => entity !== existingEntity)[0] + } else { + newEntity = newEntities[0] + } + + this.$set(this.rule, 'entity', newEntity) + this.$set(this.rule, 'events', events.filter(event => event.entity.id === newEntity).map(event => event.eventName)) this.$emit('update', this.rule) }, }, -- cgit v1.2.3 From dca861de942282d8536d52a785ae464237bd0d81 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Mon, 23 Dec 2019 10:31:28 +0100 Subject: Fix app store link and hide it for users (fix #18495 #18500) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/workflowengine/src/components/Workflow.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'apps/workflowengine/src') diff --git a/apps/workflowengine/src/components/Workflow.vue b/apps/workflowengine/src/components/Workflow.vue index d94d2bf90a5..29ca2f44ed0 100644 --- a/apps/workflowengine/src/components/Workflow.vue +++ b/apps/workflowengine/src/components/Workflow.vue @@ -13,7 +13,10 @@ :operation="operation" @click.native="createNewRule(operation)" /> - +

{{ t('workflowengine', 'More flows') }}

@@ -49,6 +52,7 @@ import Rule from './Rule' import Operation from './Operation' import { mapGetters, mapState } from 'vuex' import { loadState } from '@nextcloud/initial-state' +import { generateUrl } from '@nextcloud/router' const ACTION_LIMIT = 3 @@ -61,7 +65,7 @@ export default { data() { return { showMoreOperations: false, - appstoreUrl: '/index.php/settings/apps/workflow', + appstoreUrl: generateUrl('settings/apps/workflow'), scope: loadState('workflowengine', 'scope'), } }, @@ -81,6 +85,9 @@ export default { } return Object.values(this.operations).slice(0, ACTION_LIMIT) }, + showAppStoreHint() { + return this.scope === 0 && OC.isUserAdmin() + }, }, mounted() { this.$store.dispatch('fetchRules') -- cgit v1.2.3 From 8ec66d1e954d84900f3f1bdd5cd958aef5abd3eb Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Mon, 23 Dec 2019 12:22:22 +0100 Subject: Autofocus new filter and display proper error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/workflowengine/src/components/Check.vue | 7 ++++++- apps/workflowengine/src/components/Rule.vue | 13 ++++++++++--- apps/workflowengine/src/store.js | 4 +++- 3 files changed, 19 insertions(+), 5 deletions(-) (limited to 'apps/workflowengine/src') diff --git a/apps/workflowengine/src/components/Check.vue b/apps/workflowengine/src/components/Check.vue index 96d686341fe..e447fbeb4bd 100644 --- a/apps/workflowengine/src/components/Check.vue +++ b/apps/workflowengine/src/components/Check.vue @@ -72,7 +72,7 @@ export default { currentOption: null, currentOperator: null, options: [], - valid: true, + valid: false, } }, computed: { @@ -107,6 +107,11 @@ export default { this.options = Object.values(this.checks) this.currentOption = this.checks[this.check.class] this.currentOperator = this.operators.find((operator) => operator.operator === this.check.operator) + + if (this.check.class === null) { + this.$nextTick(() => this.$refs.checkSelector.$el.focus()) + } + this.check.invalid = !this.validate() }, methods: { showDelete() { diff --git a/apps/workflowengine/src/components/Rule.vue b/apps/workflowengine/src/components/Rule.vue index bdcd4bfc0f0..5285005f53b 100644 --- a/apps/workflowengine/src/components/Rule.vue +++ b/apps/workflowengine/src/components/Rule.vue @@ -30,8 +30,7 @@ @input="updateOperation" />
-
+

{{ error }}

@@ -84,7 +84,7 @@ export default { return this.$store.getters.getOperationForRule(this.rule) }, ruleStatus() { - if (this.error || !this.rule.valid || this.rule.checks.some((check) => check.invalid === true)) { + if (this.error || !this.rule.valid || this.rule.checks.length === 0 || this.rule.checks.some((check) => check.invalid === true)) { return { title: t('workflowengine', 'The configuration is invalid'), class: 'icon-close-white invalid', @@ -174,12 +174,19 @@ export default { .buttons { display: block; + overflow: hidden; + button { float: right; height: 34px; } } + .error-message { + float: right; + margin-right: 10px; + } + .status-button { transition: 0.5s ease all; display: block; diff --git a/apps/workflowengine/src/store.js b/apps/workflowengine/src/store.js index 70b8b550053..a8be467193d 100644 --- a/apps/workflowengine/src/store.js +++ b/apps/workflowengine/src/store.js @@ -98,7 +98,9 @@ const store = new Vuex.Store({ entity: entity ? entity.id : rule.fixedEntity, events, name: '', // unused in the new ui, there for legacy reasons - checks: [], + checks: [ + { class: null, operator: null, value: '' } + ], operation: rule.operation || '', }) }, -- cgit v1.2.3 From 5f3e3aee98ac952ac7378d2fcde65c57a5641143 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Mon, 23 Dec 2019 12:35:45 +0100 Subject: Fix spacing between text and icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/workflowengine/src/components/Rule.vue | 6 ++++-- apps/workflowengine/src/store.js | 2 +- apps/workflowengine/src/styles/operation.scss | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'apps/workflowengine/src') diff --git a/apps/workflowengine/src/components/Rule.vue b/apps/workflowengine/src/components/Rule.vue index 5285005f53b..51eb0665eeb 100644 --- a/apps/workflowengine/src/components/Rule.vue +++ b/apps/workflowengine/src/components/Rule.vue @@ -30,7 +30,7 @@ @input="updateOperation" />
-
-

{{ error }}

+

+ {{ error }} +

diff --git a/apps/workflowengine/src/store.js b/apps/workflowengine/src/store.js index a8be467193d..7cb1956b6ff 100644 --- a/apps/workflowengine/src/store.js +++ b/apps/workflowengine/src/store.js @@ -99,7 +99,7 @@ const store = new Vuex.Store({ events, name: '', // unused in the new ui, there for legacy reasons checks: [ - { class: null, operator: null, value: '' } + { class: null, operator: null, value: '' }, ], operation: rule.operation || '', }) diff --git a/apps/workflowengine/src/styles/operation.scss b/apps/workflowengine/src/styles/operation.scss index c3ca64465e0..89c105d58fe 100644 --- a/apps/workflowengine/src/styles/operation.scss +++ b/apps/workflowengine/src/styles/operation.scss @@ -16,7 +16,7 @@ background-size: 50px 50px; background-position: center center; margin-top: 10px; - margin-bottom: 20px; + margin-bottom: 10px; background-repeat: no-repeat; } .actions__item__description { -- cgit v1.2.3