You cannot 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/dist/workflowengine-workflowengi...

3 lines
840 KiB
JavaScript

/*! For license information please see workflowengine-workflowengine.js.LICENSE.txt */
(()=>{var M,z,b,p={74688:(M,z,b)=>{"use strict";var p=b(85471),O=b(95353),A=b(26287),c=b(38613),o=b(63814);const q=0===(0,c.C)("workflowengine","scope")?"global":"user",W=M=>(0,o.KT)("apps/workflowengine/api/v1/workflows/{scopeValue}",{scopeValue:q})+M+"?format=json";var d=b(56760);b(51257),p.Ay.use(O.Ay);const n=new O.il({state:{rules:[],scope:(0,c.C)("workflowengine","scope"),appstoreEnabled:(0,c.C)("workflowengine","appstoreenabled"),operations:(0,c.C)("workflowengine","operators"),plugins:p.Ay.observable({checks:{},operators:{}}),entities:(0,c.C)("workflowengine","entities"),events:(0,c.C)("workflowengine","entities").map((M=>M.events.map((z=>({id:"".concat(M.id,"::").concat(z.eventName),entity:M,...z}))))).flat(),checks:(0,c.C)("workflowengine","checks")},mutations:{addRule(M,z){M.rules.push({...z,valid:!0})},updateRule(M,z){const b=M.rules.findIndex((M=>z.id===M.id)),O=Object.assign({},z);p.Ay.set(M.rules,b,O)},removeRule(M,z){const b=M.rules.findIndex((M=>z.id===M.id));M.rules.splice(b,1)},addPluginCheck(M,z){p.Ay.set(M.plugins.checks,z.class,z)},addPluginOperator(M,z){z=Object.assign({color:"var(--color-primary-element)"},z,M.operations[z.id]||{}),void 0!==M.operations[z.id]&&p.Ay.set(M.operations,z.id,z)}},actions:{async fetchRules(M){const{data:z}=await A.A.get(W(""));Object.values(z.ocs.data).flat().forEach((z=>{M.commit("addRule",z)}))},async createNewRule(M,z){await(0,d.C)();let b=null,p=[];!1===z.isComplex&&""===z.fixedEntity&&(b=M.state.entities.find((M=>z.entities&&z.entities[0]===M.id)),b=b||Object.values(M.state.entities)[0],p=[b.events[0].eventName]),M.commit("addRule",{id:-(new Date).getTime(),class:z.id,entity:b?b.id:z.fixedEntity,events:p,name:"",checks:[{class:null,operator:null,value:""}],operation:z.operation||""})},updateRule(M,z){M.commit("updateRule",{...z,events:"string"==typeof z.events?JSON.parse(z.events):z.events})},removeRule(M,z){M.commit("removeRule",z)},async pushUpdateRule(M,z){let b;await(0,d.C)(),b=z.id<0?await A.A.post(W(""),z):await A.A.put(W("/".concat(z.id)),z),p.Ay.set(z,"id",b.data.ocs.data.id),M.commit("updateRule",z)},async deleteRule(M,z){await(0,d.C)(),await A.A.delete(W("/".concat(z.id))),M.commit("removeRule",z)},setValid(M,z){let{rule:b,valid:p}=z;b.valid=p,M.commit("updateRule",b)}},getters:{getRules:M=>M.rules.filter((z=>void 0!==M.operations[z.class])).sort(((M,z)=>M.id-z.id||z.class-M.class)),getOperationForRule:M=>z=>M.operations[z.class],getEntityForOperation:M=>z=>M.entities.find((M=>z.fixedEntity===M.id)),getEventsForOperation:M=>z=>M.events,getChecksForEntity:M=>z=>Object.values(M.checks).filter((M=>M.supportedEntities.indexOf(z)>-1||0===M.supportedEntities.length)).map((z=>M.plugins.checks[z.id])).reduce(((M,z)=>(M[z.class]=z,M)),{})}});var a=b(57874),e=b(24764),i=b(63420),R=b(9518),r=b(9191),L=b(85338),f=b(24325),u=b(67607),s=b(85168);const l={name:"Event",components:{NcSelect:u.A},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((M=>M.entity.id===this.rule.entity&&-1!==this.rule.events.indexOf(M.eventName)))},placeholderString:()=>t("workflowengine","Select a trigger")},methods:{updateEvent(M){if(0===M.length)return void(0,s.I9)(t("workflowengine","At least one event must be selected"));const z=this.rule.entity,b=M.map((M=>M.entity.id)).filter(((M,z,b)=>b.indexOf(M)===z));let p=null;p=b.length>1?b.filter((M=>M!==z))[0]:b[0],this.$set(this.rule,"entity",p),this.$set(this.rule,"events",M.filter((M=>M.entity.id===p)).map((M=>M.eventName))),this.$emit("update",this.rule)}}};var B=b(85072),N=b.n(B),X=b(97825),m=b.n(X),C=b(77659),T=b.n(C),g=b(55056),h=b.n(g),v=b(10540),w=b.n(v),E=b(41113),k=b.n(E),S=b(49400),x={};x.styleTagTransform=k(),x.setAttributes=h(),x.insert=T().bind(null,"head"),x.domAPI=m(),x.insertStyleElement=w(),N()(S.A,x),S.A&&S.A.locals&&S.A.locals;var y=b(14486);const _=(0,y.A)(l,(fun
//# sourceMappingURL=workflowengine-workflowengine.js.map?v=37fd60e698ddec492d63