aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/src
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-12-27 14:29:09 +0100
committerGitHub <noreply@github.com>2019-12-27 14:29:09 +0100
commitf3232fc192ed119705685516f447589c79bfde6e (patch)
tree41d1c98b69ba8ba4aba7baf39b73e11727dfd2e7 /apps/workflowengine/src
parent060b6d30eea83ea9be29372398eb85e985862c49 (diff)
parentb2ba561db3e87919d3ceb8f03aed150d5f5c616a (diff)
downloadnextcloud-server-f3232fc192ed119705685516f447589c79bfde6e.tar.gz
nextcloud-server-f3232fc192ed119705685516f447589c79bfde6e.zip
Merge pull request #18547 from nextcloud/bugfix/flow
Various flow related fixes
Diffstat (limited to 'apps/workflowengine/src')
-rw-r--r--apps/workflowengine/src/components/Check.vue7
-rw-r--r--apps/workflowengine/src/components/Event.vue16
-rw-r--r--apps/workflowengine/src/components/Rule.vue15
-rw-r--r--apps/workflowengine/src/components/Workflow.vue11
-rw-r--r--apps/workflowengine/src/store.js4
-rw-r--r--apps/workflowengine/src/styles/operation.scss2
6 files changed, 46 insertions, 9 deletions
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/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)
},
},
diff --git a/apps/workflowengine/src/components/Rule.vue b/apps/workflowengine/src/components/Rule.vue
index bdcd4bfc0f0..51eb0665eeb 100644
--- a/apps/workflowengine/src/components/Rule.vue
+++ b/apps/workflowengine/src/components/Rule.vue
@@ -30,8 +30,7 @@
@input="updateOperation" />
</Operation>
<div class="buttons">
- <button v-tooltip="ruleStatus.tooltip"
- class="status-button icon"
+ <button class="status-button icon"
:class="ruleStatus.class"
@click="saveRule">
{{ ruleStatus.title }}
@@ -43,6 +42,9 @@
{{ t('workflowengine', 'Delete') }}
</button>
</div>
+ <p v-if="error" class="error-message">
+ {{ error }}
+ </p>
</div>
</div>
</template>
@@ -84,7 +86,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 +176,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/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)" />
- <a :key="'add'" :href="appstoreUrl" class="actions__item colored more">
+ <a v-if="showAppStoreHint"
+ :key="'add'"
+ :href="appstoreUrl"
+ class="actions__item colored more">
<div class="icon icon-add" />
<div class="actions__item__description">
<h3>{{ t('workflowengine', 'More flows') }}</h3>
@@ -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')
diff --git a/apps/workflowengine/src/store.js b/apps/workflowengine/src/store.js
index 70b8b550053..7cb1956b6ff 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 || '',
})
},
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 {