diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-10-10 14:59:29 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-10-29 18:03:54 +0100 |
commit | 6878d36e501801daa736a97a3b0137083272bc84 (patch) | |
tree | 4209679dc85f6cb60b663ed13bdc060bc1e020d6 /apps/workflowengine/src | |
parent | 7b82a09a3b2fd19e5af9ac091f33236b1dc2cf44 (diff) | |
download | nextcloud-server-6878d36e501801daa736a97a3b0137083272bc84.tar.gz nextcloud-server-6878d36e501801daa736a97a3b0137083272bc84.zip |
Allow to select multiple events
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/workflowengine/src')
-rw-r--r-- | apps/workflowengine/src/components/Event.vue | 43 | ||||
-rw-r--r-- | apps/workflowengine/src/components/Operation.vue | 3 |
2 files changed, 30 insertions, 16 deletions
diff --git a/apps/workflowengine/src/components/Event.vue b/apps/workflowengine/src/components/Event.vue index a06835f5f82..1afdfa80be7 100644 --- a/apps/workflowengine/src/components/Event.vue +++ b/apps/workflowengine/src/components/Event.vue @@ -1,5 +1,5 @@ <template> - <div> + <div class="event"> <div v-if="operation.isComplex && operation.fixedEntity !== ''" class="isComplex"> <img class="option__icon" :src="entity.icon"> <span class="option__title option__title_single">{{ operation.triggerHint }}</span> @@ -7,14 +7,16 @@ <Multiselect v-else :value="currentEvent" :options="allEvents" - label="eventName" track-by="id" - :allow-empty="false" + :multiple="true" + :auto-limit="false" :disabled="allEvents.length <= 1" @input="updateEvent"> - <template slot="singleLabel" slot-scope="props"> - <img class="option__icon" :src="props.option.entity.icon"> - <span class="option__title option__title_single">{{ props.option.displayName }}</span> + <template slot="selection" slot-scope="{ values, search, isOpen }"> + <div v-if="values.length && !isOpen" class="eventlist"> + <img class="option__icon" :src="values[0].entity.icon"> + <span class="text option__title option__title_single" v-for="(value, index) in values">{{ value.displayName }} <span v-if="index+1 < values.length">, </span></span> + </div> </template> <template slot="option" slot-scope="props"> <img class="option__icon" :src="props.option.entity.icon"> @@ -49,23 +51,22 @@ export default { return this.$store.getters.getEventsForOperation(this.operation) }, currentEvent() { - if (!this.rule.events) { - return this.allEvents.length > 0 ? this.allEvents[0] : null - } - return this.allEvents.find(event => event.entity.id === this.rule.entity && this.rule.events.indexOf(event.eventName) !== -1) + return this.allEvents.filter(event => event.entity.id === this.rule.entity && this.rule.events.indexOf(event.eventName) !== -1) } }, methods: { - updateEvent(event) { - this.$set(this.rule, 'entity', event.entity.id) - this.$set(this.rule, 'events', [event.eventName]) - this.$store.dispatch('updateRule', this.rule) + updateEvent(events) { + this.$set(this.rule, 'events', events.map(event => event.eventName)) + this.$emit('update', this.rule) } } } </script> <style scoped lang="scss"> + .event { + margin-bottom: 5px; + } .isComplex { img { vertical-align: top; @@ -78,6 +79,11 @@ export default { display: inline-block; } } + .multiselect { + width: 100%; + max-width: 550px; + margin-top: 4px; + } .multiselect::v-deep .multiselect__single { display: flex; } @@ -86,8 +92,10 @@ export default { border: 1px solid transparent; } - .multiselect::v-deep .multiselect__tags .multiselect__single { + .multiselect::v-deep .multiselect__tags { background-color: var(--color-main-background) !important; + height: auto; + min-height: 34px; } .multiselect:not(.multiselect--disabled)::v-deep .multiselect__tags .multiselect__single { @@ -107,4 +115,9 @@ export default { .option__title_single { font-weight: 900; } + + .eventlist img, + .eventlist .text { + vertical-align: middle; + } </style> diff --git a/apps/workflowengine/src/components/Operation.vue b/apps/workflowengine/src/components/Operation.vue index ad44d376934..e78366d4ccc 100644 --- a/apps/workflowengine/src/components/Operation.vue +++ b/apps/workflowengine/src/components/Operation.vue @@ -63,7 +63,7 @@ export default { h3 { margin: 0; padding: 0; - font-weight: 500; + font-weight: 600; } small { font-size: 10pt; @@ -82,6 +82,7 @@ export default { .actions__item__description { padding-top: 5px; text-align: left; + width: calc(100% - 105px); small { padding: 0; } |