mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
1 line
6.6 KiB
JavaScript
Vendored
1 line
6.6 KiB
JavaScript
Vendored
"use strict";(self["webpackChunkfirefly_iii"]=self["webpackChunkfirefly_iii"]||[]).push([[1444],{1444:(e,s,r)=>{r.r(s),r.d(s,{default:()=>H});var t=r(9835),o=r(6970);const l={class:"row q-mx-md"},i={class:"col-12"},a={class:"row q-mx-md q-mt-md"},n={class:"col-12"},d=(0,t._)("div",{class:"text-h6"},"Edit webhook",-1),u={class:"row"},m={class:"col-12 q-mb-xs"},c={class:"row"},b={class:"col-12 q-mb-xs"},h={class:"row"},p={class:"col-12 q-mb-xs"},g={class:"row"},v={class:"col-12 q-mb-xs"},_={class:"row"},E={class:"col-12 q-mb-xs"},w={class:"row q-mx-md"},f={class:"col-12"},S={class:"row"},k={class:"col-12 text-right"},W={class:"row"},q={class:"col-12 text-right"};function R(e,s,r,R,x,y){const I=(0,t.up)("q-btn"),V=(0,t.up)("q-banner"),C=(0,t.up)("q-card-section"),N=(0,t.up)("q-input"),T=(0,t.up)("q-select"),O=(0,t.up)("q-card"),A=(0,t.up)("q-checkbox"),U=(0,t.up)("q-page");return(0,t.wg)(),(0,t.j4)(U,null,{default:(0,t.w5)((()=>[(0,t._)("div",l,[(0,t._)("div",i,[""!==x.errorMessage?((0,t.wg)(),(0,t.j4)(V,{key:0,"inline-actions":"",rounded:"",class:"bg-orange text-white"},{action:(0,t.w5)((()=>[(0,t.Wm)(I,{flat:"",onClick:y.dismissBanner,label:"Dismiss"},null,8,["onClick"])])),default:(0,t.w5)((()=>[(0,t.Uk)((0,o.zw)(x.errorMessage)+" ",1)])),_:1})):(0,t.kq)("",!0)])]),(0,t._)("div",a,[(0,t._)("div",n,[(0,t.Wm)(O,{bordered:""},{default:(0,t.w5)((()=>[(0,t.Wm)(C,null,{default:(0,t.w5)((()=>[d])),_:1}),(0,t.Wm)(C,null,{default:(0,t.w5)((()=>[(0,t._)("div",u,[(0,t._)("div",m,[(0,t.Wm)(N,{"error-message":x.submissionErrors.title,error:x.hasSubmissionErrors.title,"bottom-slots":"",disable:y.disabledInput,type:"text",clearable:"",modelValue:x.title,"onUpdate:modelValue":s[0]||(s[0]=e=>x.title=e),label:e.$t("form.title"),outlined:""},null,8,["error-message","error","disable","modelValue","label"])])]),(0,t._)("div",c,[(0,t._)("div",b,[(0,t.Wm)(N,{"error-message":x.submissionErrors.url,error:x.hasSubmissionErrors.url,"bottom-slots":"",disable:y.disabledInput,type:"text",clearable:"",modelValue:x.url,"onUpdate:modelValue":s[1]||(s[1]=e=>x.url=e),label:e.$t("form.url"),outlined:""},null,8,["error-message","error","disable","modelValue","label"])])]),(0,t._)("div",h,[(0,t._)("div",p,[(0,t.Wm)(T,{"error-message":x.submissionErrors.response,error:x.hasSubmissionErrors.response,"bottom-slots":"",disable:y.disabledInput,outlined:"",modelValue:x.response,"onUpdate:modelValue":s[2]||(s[2]=e=>x.response=e),"emit-value":"",class:"q-pr-xs","map-options":"",options:x.responses,label:"Response"},null,8,["error-message","error","disable","modelValue","options"])])]),(0,t._)("div",g,[(0,t._)("div",v,[(0,t.Wm)(T,{"error-message":x.submissionErrors.delivery,error:x.hasSubmissionErrors.delivery,"bottom-slots":"",disable:y.disabledInput,outlined:"",modelValue:x.delivery,"onUpdate:modelValue":s[3]||(s[3]=e=>x.delivery=e),"emit-value":"",class:"q-pr-xs","map-options":"",options:x.deliveries,label:"Delivery"},null,8,["error-message","error","disable","modelValue","options"])])]),(0,t._)("div",_,[(0,t._)("div",E,[(0,t.Wm)(T,{"error-message":x.submissionErrors.trigger,error:x.hasSubmissionErrors.trigger,"bottom-slots":"",disable:y.disabledInput,outlined:"",modelValue:x.trigger,"onUpdate:modelValue":s[4]||(s[4]=e=>x.trigger=e),"emit-value":"",class:"q-pr-xs","map-options":"",options:x.triggers,label:"Triggers"},null,8,["error-message","error","disable","modelValue","options"])])])])),_:1})])),_:1})])]),(0,t._)("div",w,[(0,t._)("div",f,[(0,t.Wm)(O,{class:"q-mt-xs"},{default:(0,t.w5)((()=>[(0,t.Wm)(C,null,{default:(0,t.w5)((()=>[(0,t._)("div",S,[(0,t._)("div",k,[(0,t.Wm)(I,{disable:y.disabledInput,color:"primary",label:"Update",onClick:y.submitWebhook},null,8,["disable","onClick"])])]),(0,t._)("div",W,[(0,t._)("div",q,[(0,t.Wm)(A,{disable:y.disabledInput,modelValue:x.doReturnHere,"onUpdate:modelValue":s[5]||(s[5]=e=>x.doReturnHere=e),"left-label":"",label:"Return here"},null,8,["disable","modelValue"])])])])),_:1})])),_:1})])])])),_:1})}var x=r(9599),y=r(1569);class I{put(e,s){let r="/api/v1/webhooks/"+e;return y.api.put(r,s)}}var V=r(3555);const C={name:"Edit",data(){return{submissionErrors:{},hasSubmissionErrors:{},submitting:!1,doReturnHere:!1,doResetForm:!1,errorMessage:"",triggers:[{value:"TRIGGER_STORE_TRANSACTION",label:"When transaction stored"},{value:"TRIGGER_UPDATE_TRANSACTION",label:"When transaction updated"},{value:"TRIGGER_DESTROY_TRANSACTION",label:"When transaction deleted"}],responses:[{value:"RESPONSE_TRANSACTIONS",label:"Send transaction"},{value:"RESPONSE_ACCOUNTS",label:"Send accounts"},{value:"RESPONSE_NONE",label:"Send nothing"}],deliveries:[{value:"DELIVERY_JSON",label:"JSON"}],id:0,title:"",url:"",response:"",delivery:"",trigger:"",store:null}},computed:{disabledInput:function(){return this.submitting}},created(){this.id=parseInt(this.$route.params.id),this.store=(0,V.S)(),this.collectWebhook()},methods:{collectWebhook:function(){let e=new x.Z;e.get(this.id).then((e=>this.parseWebhook(e)))},parseWebhook:function(e){this.title=e.data.data.attributes.title,this.url=e.data.data.attributes.url,this.response=e.data.data.attributes.response,this.delivery=e.data.data.attributes.delivery,this.trigger=e.data.data.attributes.trigger},resetErrors:function(){this.submissionErrors={title:"",url:"",response:"",delivery:"",trigger:""},this.hasSubmissionErrors={title:!1,url:!1,response:!1,delivery:!1,trigger:!1}},submitWebhook:function(){this.submitting=!0,this.errorMessage="",this.resetErrors();const e=this.buildWebhook();(new I).put(this.id,e).catch(this.processErrors).then(this.processSuccess)},buildWebhook:function(){return{title:this.title,url:this.url,response:this.response,delivery:this.delivery,trigger:this.trigger}},dismissBanner:function(){this.errorMessage=""},processSuccess:function(e){if(this.store.refreshCacheKey(),!e)return;this.submitting=!1;let s={level:"success",text:"Webhook is updated",show:!0,action:{show:!0,text:"Go to webhook",link:{name:"webhooks.show",params:{id:parseInt(e.data.data.id)}}}};this.$q.localStorage.set("flash",s),this.doReturnHere&&window.dispatchEvent(new CustomEvent("flash",{detail:{flash:this.$q.localStorage.getItem("flash")}})),this.doReturnHere||this.$router.go(-1)},processErrors:function(e){if(e.response){let s=e.response.data;this.errorMessage=s.message,console.log(s);for(let e in s.errors)s.errors.hasOwnProperty(e)&&(this.submissionErrors[e]=s.errors[e][0],this.hasSubmissionErrors[e]=!0)}this.submitting=!1}}};var N=r(1639),T=r(9885),O=r(7128),A=r(8879),U=r(4458),Z=r(3190),Q=r(6611),G=r(7887),M=r(1221),P=r(9984),$=r.n(P);const D=(0,N.Z)(C,[["render",R]]),H=D;$()(C,"components",{QPage:T.Z,QBanner:O.Z,QBtn:A.Z,QCard:U.Z,QCardSection:Z.Z,QInput:Q.Z,QSelect:G.Z,QCheckbox:M.Z})}}]); |