diff --git a/apps/workflowengine/js/workflowengine.js b/apps/workflowengine/js/workflowengine.js index afe03ef257bb2..d698f9154e055 100644 --- a/apps/workflowengine/js/workflowengine.js +++ b/apps/workflowengine/js/workflowengine.js @@ -394,7 +394,7 @@ r.a.options.defaultTemplate='
. * - */o.default.use(i.a);var _,v,b,g=new i.a.Store({state:{rules:[],scope:Object(c.loadState)("workflowengine","scope"),operations:Object(c.loadState)("workflowengine","operators"),plugins:o.default.observable({checks:{},operators:{}}),entities:Object(c.loadState)("workflowengine","entities"),events:Object(c.loadState)("workflowengine","entities").map((function(e){return e.events.map((function(t){return m({id:"".concat(e.id,"::").concat(t.eventName),entity:e},t)}))})).flat(),checks:Object(c.loadState)("workflowengine","checks")},mutations:{addRule:function(e,t){e.rules.push(m({},t,{valid:!0}))},updateRule:function(e,t){var n=e.rules.findIndex((function(e){return t.id===e.id})),r=Object.assign({},t);o.default.set(e.rules,n,r)},removeRule:function(e,t){var n=e.rules.findIndex((function(e){return t.id===e.id}));e.rules.splice(n,1)},addPluginCheck:function(e,t){o.default.set(e.plugins.checks,t.class,t)},addPluginOperator:function(e,t){t=Object.assign({color:"var(--color-primary-element)"},t,e.operations[t.id]||{}),void 0!==e.operations[t.id]&&o.default.set(e.operations,t.id,t)}},actions:{fetchRules:(b=A(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.a.get(l(""));case 2:n=e.sent,r=n.data,Object.values(r.ocs.data).flat().forEach((function(e){t.commit("addRule",e)}));case 5:case"end":return e.stop()}}),e)}))),function(e){return b.apply(this,arguments)}),createNewRule:function(e,t){var n=null,r=[];!1===t.isComplex&&""===t.fixedEntity&&(r=[(n=(n=e.state.entities.find((function(e){return t.entities&&t.entities[0]===e.id})))||Object.values(e.state.entities)[0]).events[0].eventName]),e.commit("addRule",{id:-(new Date).getTime(),class:t.id,entity:n?n.id:t.fixedEntity,events:r,name:"",checks:[{class:null,operator:null,value:""}],operation:t.operation||""})},updateRule:function(e,t){e.commit("updateRule",m({},t,{events:"string"==typeof t.events?JSON.parse(t.events):t.events}))},removeRule:function(e,t){e.commit("removeRule",t)},pushUpdateRule:(v=A(regeneratorRuntime.mark((function e(t,n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==t.state.scope){e.next=3;break}return e.next=3,f()();case 3:if(!(n.id<0)){e.next=9;break}return e.next=6,s.a.post(l(""),n);case 6:r=e.sent,e.next=12;break;case 9:return e.next=11,s.a.put(l("/".concat(n.id)),n);case 11:r=e.sent;case 12:o.default.set(n,"id",r.data.ocs.data.id),t.commit("updateRule",n);case 14:case"end":return e.stop()}}),e)}))),function(e,t){return v.apply(this,arguments)}),deleteRule:(_=A(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f()();case 2:return e.next=4,s.a.delete(l("/".concat(n.id)));case 4:t.commit("removeRule",n);case 5:case"end":return e.stop()}}),e)}))),function(e,t){return _.apply(this,arguments)}),setValid:function(e,t){var n=t.rule,r=t.valid;n.valid=r,e.commit("updateRule",n)}},getters:{getRules:function(e){return e.rules.filter((function(t){return void 0!==e.operations[t.class]})).sort((function(e,t){return e.id-t.id||t.class-e.class}))},getOperationForRule:function(e){return function(t){return e.operations[t.class]}},getEntityForOperation:function(e){return function(t){return e.entities.find((function(e){return t.fixedEntity===e.id}))}},getEventsForOperation:function(e){return function(t){return e.events}},getChecksForEntity:function(e){return function(t){return Object.values(e.checks).filter((function(e){return e.supportedEntities.indexOf(t)>-1||0===e.supportedEntities.length})).map((function(t){return e.plugins.checks[t.id]})).reduce((function(e,t){return e[t.class]=t,e}),{})}}}}),y=r(441),L=r(127),w=r(128),O=r(11),T={name:"Event",components:{Multiselect:O.Multiselect},props:{rule:{type:Object,required:!0}},computed:{entity:function(){return this.$store.getters.getEntityForOperation(this.operation)},operation:function(){return this.$store.getters.getOperationForRule(this.rule)},allEvents:function(){return this.$store.getters.getEventsForOperation(this.operation)},currentEvent:function(){var e=this;return this.allEvents.filter((function(t){return t.entity.id===e.rule.entity&&-1!==e.rule.events.indexOf(t.eventName)}))}},methods:{updateEvent:function(e){if(0!==e.length){var n=this.rule.entity,r=e.map((function(e){return e.entity.id})).filter((function(e,t,n){return n.indexOf(e)===t})),o=null;o=r.length>1?r.filter((function(e){return e!==n}))[0]:r[0],this.$set(this.rule,"entity",o),this.$set(this.rule,"events",e.filter((function(e){return e.entity.id===o})).map((function(e){return e.eventName}))),this.$emit("update",this.rule)}else window.OCP.Toast.warning(t("workflowengine","At least one event must be selected"))}}};r(724);function z(e,t,n,r,o,i,a,s){var c,u="function"==typeof e?e.options:e;if(t&&(u.render=t,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),a?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},u._ssrRegister=c):o&&(c=s?function(){o.call(this,this.$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var l=u.render;u.render=function(e,t){return c.call(t),l(e,t)}}else{var d=u.beforeCreate;u.beforeCreate=d?[].concat(d,c):[c]}return{exports:e,options:u}}var x=z(T,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"event"},[e.operation.isComplex&&""!==e.operation.fixedEntity?n("div",{staticClass:"isComplex"},[n("img",{staticClass:"option__icon",attrs:{src:e.entity.icon}}),e._v(" "),n("span",{staticClass:"option__title option__title_single"},[e._v(e._s(e.operation.triggerHint))])]):n("Multiselect",{attrs:{value:e.currentEvent,options:e.allEvents,"track-by":"id",multiple:!0,"auto-limit":!1,disabled:e.allEvents.length<=1},on:{input:e.updateEvent},scopedSlots:e._u([{key:"selection",fn:function(t){var r=t.values,o=(t.search,t.isOpen);return[r.length&&!o?n("div",{staticClass:"eventlist"},[n("img",{staticClass:"option__icon",attrs:{src:r[0].entity.icon}}),e._v(" "),e._l(r,(function(t,o){return n("span",{key:t.id,staticClass:"text option__title option__title_single"},[e._v(e._s(t.displayName)+" "),o+1\n\t\t\t\t{{ t('workflowengine', 'When') }}\n\t\t\t\t
\n\t\t\t\t{{ t('workflowengine', 'and') }}\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\n\t\t\t\t{{ t('workflowengine', 'For details on how to write your own flow, check out the development documentation.') }}\n\t\t\t
\n\n\t\t\t\n\t\t\t{{ t('workflowengine', 'Please enter a valid time span') }}\n\t\t
\n\t\t\n\t\t\t\t{{ t('workflowengine', 'When') }}\n\t\t\t\t
\n\t\t\t\t{{ t('workflowengine', 'and') }}\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\n\t\t\t\t{{ t('workflowengine', 'For details on how to write your own flow, check out the development documentation.') }}\n\t\t\t
\n\n\t\t\t\n\t\t\t{{ t('workflowengine', 'Please enter a valid time span') }}\n\t\t
\n\t\t