You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud-server/dist/workflowengine-workflowengi...

3 lines
71 KiB

/*! For license information please see workflowengine-workflowengine.js.LICENSE.txt */
(()=>{var e,n={27607:(e,n,i)=>{"use strict";var o=i(20144),a=i(20629),s=i(4820),r=i(79954),l=i(79753);const c=0===(0,r.j)("workflowengine","scope")?"global":"user",p=t=>(0,l.generateOcsUrl)("apps/workflowengine/api/v1/workflows/{scopeValue}",{scopeValue:c})+t+"?format=json";var d=i(10128);i(65509),o.default.use(a.ZP);const A=new a.yh({state:{rules:[],scope:(0,r.j)("workflowengine","scope"),appstoreEnabled:(0,r.j)("workflowengine","appstoreenabled"),operations:(0,r.j)("workflowengine","operators"),plugins:o.default.observable({checks:{},operators:{}}),entities:(0,r.j)("workflowengine","entities"),events:(0,r.j)("workflowengine","entities").map((t=>t.events.map((e=>({id:"".concat(t.id,"::").concat(e.eventName),entity:t,...e}))))).flat(),checks:(0,r.j)("workflowengine","checks")},mutations:{addRule(t,e){t.rules.push({...e,valid:!0})},updateRule(t,e){const n=t.rules.findIndex((t=>e.id===t.id)),i=Object.assign({},e);o.default.set(t.rules,n,i)},removeRule(t,e){const n=t.rules.findIndex((t=>e.id===t.id));t.rules.splice(n,1)},addPluginCheck(t,e){o.default.set(t.plugins.checks,e.class,e)},addPluginOperator(t,e){e=Object.assign({color:"var(--color-primary-element)"},e,t.operations[e.id]||{}),void 0!==t.operations[e.id]&&o.default.set(t.operations,e.id,e)}},actions:{async fetchRules(t){const{data:e}=await s.default.get(p(""));Object.values(e.ocs.data).flat().forEach((e=>{t.commit("addRule",e)}))},createNewRule(t,e){let n=null,i=[];!1===e.isComplex&&""===e.fixedEntity&&(n=t.state.entities.find((t=>e.entities&&e.entities[0]===t.id)),n=n||Object.values(t.state.entities)[0],i=[n.events[0].eventName]),t.commit("addRule",{id:-(new Date).getTime(),class:e.id,entity:n?n.id:e.fixedEntity,events:i,name:"",checks:[{class:null,operator:null,value:""}],operation:e.operation||""})},updateRule(t,e){t.commit("updateRule",{...e,events:"string"==typeof e.events?JSON.parse(e.events):e.events})},removeRule(t,e){t.commit("removeRule",e)},async pushUpdateRule(t,e){let n;0===t.state.scope&&await(0,d.confirmPassword)(),n=e.id<0?await s.default.post(p(""),e):await s.default.put(p("/".concat(e.id)),e),o.default.set(e,"id",n.data.ocs.data.id),t.commit("updateRule",e)},async deleteRule(t,e){await(0,d.confirmPassword)(),await s.default.delete(p("/".concat(e.id))),t.commit("removeRule",e)},setValid(t,e){let{rule:n,valid:i}=e;n.valid=i,t.commit("updateRule",n)}},getters:{getRules:t=>t.rules.filter((e=>void 0!==t.operations[e.class])).sort(((t,e)=>t.id-e.id||e.class-t.class)),getOperationForRule:t=>e=>t.operations[e.class],getEntityForOperation:t=>e=>t.entities.find((t=>e.fixedEntity===t.id)),getEventsForOperation:t=>e=>t.events,getChecksForEntity:t=>e=>Object.values(t.checks).filter((t=>t.supportedEntities.indexOf(e)>-1||0===t.supportedEntities.length)).map((e=>t.plugins.checks[e.id])).reduce(((t,e)=>(t[e.class]=e,t)),{})}});var u=i(15168),m=i.n(u),h=i(12945),g=i.n(h),C=i(45400),v=i.n(C),f=i(10861),w=i.n(f),x=i(39429),k=i(80419),b=i(82675),_=i(98266),y=i.n(_),j=i(64024);const O={name:"Event",components:{NcMultiselect:y()},props:{rule:{type:Object,required:!0}},computed:{entity(){return this.$store.getters.getEntityForOperation(this.operation)},operation(){return this.$store.getters.getOperationForRule(this.rule)},allEvents(){return this.$store.getters.getEventsForOperation(this.operation)},currentEvent(){return this.allEvents.filter((t=>t.entity.id===this.rule.entity&&-1!==this.rule.events.indexOf(t.eventName)))}},methods:{updateEvent(e){if(0===e.length)return void(0,j.K2)(t("workflowengine","At least one event must be selected"));const n=this.rule.entity,i=e.map((t=>t.entity.id)).filter(((t,e,n)=>n.indexOf(t)===e));let o=null;o=i.length>1?i.filter((t=>t!==n))[0]:i[0],this.$set(this.rule,"entity",o),this.$set(this.rule,"events",e.filter((t=>t.entity.id===o)).map((t=>t.eventName))),this.$emit("update",this.rule)}}};var B=i(93379),E=i.n(B),R=i(7795),V=i.n(R),T=i(90569),D=i.n(T),P=i(3565),N=i.n(P),S=i(19216),z=i.n(S),F=i(44589),U=i.n(F),Z=i(53667),M={};M.styleTagTransform=U(),M.setAttributes=N(),M.insert=D().bind(null,"head"),M.domAPI=V(),M.insertStyleElement=z(),
//# sourceMappingURL=workflowengine-workflowengine.js.map?v=5610fbc27e1f7f1b2f15