@knoflows/engine 0.1.0-alpha.3 → 0.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine.js +21 -11
- package/package.json +4 -3
- package/static/assets/i18n/en.json +36 -2
- package/static/assets/i18n/es.json +36 -2
- package/static/{chunk-C40TdCIk.js → chunk--cAlvNjP.js} +1 -1
- package/static/{chunk-CCjvFBCX.js → chunk-3tEYpnqu.js} +1 -1
- package/static/chunk-4TrlkpZx.js +1 -0
- package/static/chunk-99HzEG7y.js +1 -0
- package/static/{chunk-ZijlINsH.js → chunk-B4PXIvtd.js} +1 -1
- package/static/chunk-BEPCHPAV.js +1 -0
- package/static/{chunk-CeFjDLjY.js → chunk-BJ_zTxjo.js} +1 -1
- package/static/chunk-BaL0hYvK.js +1 -0
- package/static/{chunk-DK8z5vU5.js → chunk-BnjE7sDc.js} +1 -1
- package/static/{chunk-CSPhdKAb.js → chunk-BqWiMcNp.js} +1 -1
- package/static/{chunk-Cnkrtkdu.js → chunk-BvGpCrD9.js} +1 -1
- package/static/{chunk-BDOL5Qby.js → chunk-Byfh9OPw.js} +1 -1
- package/static/chunk-C5kOvUkS.js +1 -0
- package/static/chunk-C67ITweo.js +1 -0
- package/static/{chunk-Dw1tJgiv.js → chunk-CECejZs9.js} +1 -1
- package/static/{chunk-CPxI4OjB.js → chunk-CWRAmEOi.js} +1 -1
- package/static/{chunk-KyBZUWGU.js → chunk-Ca9rxJZS.js} +1 -1
- package/static/chunk-CbG3rfKf.js +66 -0
- package/static/chunk-Cdhqfnmn.js +1 -0
- package/static/chunk-Cgq1n6kP.js +1 -0
- package/static/chunk-CpxvtoPc.js +1 -0
- package/static/{chunk-Csk1w6sD.js → chunk-D6KYmz2w.js} +1 -1
- package/static/{chunk-DS9-TMN6.js → chunk-DGw7ID-A.js} +1 -1
- package/static/{chunk-C50zASMN.js → chunk-DS5k0b_s.js} +1 -1
- package/static/{chunk-DyP6QbgY.js → chunk-DZ8K8fY1.js} +1 -1
- package/static/{chunk-8DHqiag3.js → chunk-DrMwVUpq.js} +1 -1
- package/static/{chunk-DI-Ex2sC.js → chunk-VW6e_Kls.js} +1 -1
- package/static/{chunk-BJLDaNHl.js → chunk-jDfyi4_G.js} +1 -1
- package/static/chunk-qdbp1qcP.js +1 -0
- package/static/chunk-smuNKEab.js +5 -0
- package/static/index.html +1 -1
- package/static/main-5C7K2447.js +249 -0
- package/static/chunk-B4GVyu_H.js +0 -1
- package/static/chunk-B5hULR_G.js +0 -1
- package/static/chunk-BQYw1slv.js +0 -1
- package/static/chunk-BU5DKI8R.js +0 -1
- package/static/chunk-BquD19tF.js +0 -5
- package/static/chunk-C9CuVcTl.js +0 -1
- package/static/chunk-CgvdAwRh.js +0 -1
- package/static/chunk-DxRo8m4J.js +0 -66
- package/static/main-BK4MAPTK.js +0 -249
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {I,g,b,v,j,y,h,E,P,A,T}from'./chunk--cAlvNjP.js';import {N as Nt,K as Ke$1}from'./chunk-BJ_zTxjo.js';import {f as fr,K as Ki,x,V as Vt,R as Rt$1,w as wt,F as Ft}from'./chunk-C5kOvUkS.js';import {U as Ud,b as b$}from'./chunk-CbG3rfKf.js';import {C,W,I as ue,b as at,a as ar,ac as O,ad as Zn$1,ae as Se,q as qo,H as Hw,R as Rt,s,r,c as qe,Q as QE,F as Fn,n as n8,af as S4,J as J6,k as k3,M as Mt,d as sd,z as zc,e as t7,Z as y7,$ as $b,V as V5,D as D5,f as ec,g as _i,v as vw,K as Kc,h as Rw,j as gh,m as bD,p as gI,P as Ph,O as Ow,w as ch,u as nl,A as _D,a0 as $0,a1 as B0,t,ag as $6,N as ND,a5 as ah,y as xD,B as VD,L as LD,o as oE,S as SD,a7 as MD,x as sE,ah as YE,ai as uu,aj as Y0,ak as Z0,al as N1,am as q0,an as _r,ao as Ee,ap as a3,aq as Le,ar as ga,as as j3,at as m1,au as za,av as Uw,aw as W0,ax as D8,ay as u9,az as a9,aA as Kf,Y as Bw,aB as f9,aC as pt,aD as Se$1,aE as va,aF as vr,aG as BD,aH as nh,aI as Lw,aJ as Sw,aK as h1,aL as B1,aM as wo,aN as rD,aO as R4,aP as cw,aQ as Dh,aR as GD,aS as Eh,aT as U0,l as lh,a2 as Pw,a3 as xw,aU as zD,E as Pu,G as Lu,aV as Vh,aW as jh,aX as $D,a4 as Mh,aY as ww}from'./main-5C7K2447.js';import {U}from'./chunk-VW6e_Kls.js';import {F as Fe,o as oe}from'./chunk-Ca9rxJZS.js';import'./chunk-DS5k0b_s.js';var Ut=["input"],Ht=["inputNumberHost"],Zt=[[["","nzInputAddonBefore",""]],[["","nzInputAddonAfter",""]],[["","nzInputPrefix",""]],[["","nzInputSuffix",""]],[["","nzInputNumberUpIcon",""]],[["","nzInputNumberDownIcon",""]]],Qt=["[nzInputAddonBefore]","[nzInputAddonAfter]","[nzInputPrefix]","[nzInputSuffix]","[nzInputNumberUpIcon]","[nzInputNumberDownIcon]"];function Gt(i,p){}function Yt(i,p){if(i&1&&nh(0,Gt,0,0,"ng-template",8),i&2){VD();let e=zD(4);ch("ngTemplateOutlet",e);}}function Jt(i,p){}function Xt(i,p){if(i&1&&nh(0,Jt,0,0,"ng-template",8),i&2){VD();let e=zD(8);ch("ngTemplateOutlet",e);}}function en(i,p){}function tn(i,p){if(i&1&&nh(0,en,0,0,"ng-template",8),i&2){VD();let e=zD(12);ch("ngTemplateOutlet",e);}}function nn(i,p){if(i&1&&vw(0),i&2){let e=VD(3);Ph(e.nzAddonBefore());}}function on(i,p){i&1&&(_i(0,"div",10),$D(1,0,null,nn,1,1),Kc());}function rn(i,p){}function an(i,p){if(i&1&&nh(0,rn,0,0,"ng-template",8),i&2){VD(2);let e=zD(6);ch("ngTemplateOutlet",e);}}function ln(i,p){}function sn(i,p){if(i&1&&nh(0,ln,0,0,"ng-template",8),i&2){VD(2);let e=zD(10);ch("ngTemplateOutlet",e);}}function pn(i,p){if(i&1&&vw(0),i&2){let e=VD(3);Ph(e.nzAddonAfter());}}function dn(i,p){i&1&&(_i(0,"div",10),$D(1,1,null,pn,1,1),Kc());}function cn(i,p){if(i&1&&(_i(0,"div",9),bD(1,on,3,0,"div",10),bD(2,an,1,1,null,8)(3,sn,1,1,null,8),bD(4,dn,3,0,"div",10),Kc()),i&2){let e=VD();gI(),_D(e.hasAddonBefore()?1:-1),gI(),_D(e.hasAffix()?2:3),gI(2),_D(e.hasAddonAfter()?4:-1);}}function un(i,p){}function mn(i,p){if(i&1&&(_i(0,"div"),nh(1,un,0,0,"ng-template",8),Kc()),i&2){let e=VD(),n=zD(8);cw(e.affixWrapperClass()),gI(),ch("ngTemplateOutlet",n);}}function _n(i,p){if(i&1&&vw(0),i&2){let e=VD(3);Ph(e.nzPrefix());}}function fn(i,p){i&1&&(_i(0,"span",11),$D(1,2,null,_n,1,1),Kc());}function gn(i,p){}function xn(i,p){if(i&1&&vw(0),i&2){let e=VD(3);Ph(e.nzSuffix());}}function Cn(i,p){if(i&1&&lh(0,"nz-form-item-feedback-icon",13),i&2){let e=VD(3);ch("status",e.finalStatus());}}function hn(i,p){if(i&1&&(_i(0,"span",12),$D(1,3,null,xn,1,1),bD(3,Cn,1,1,"nz-form-item-feedback-icon",13),Kc()),i&2){let e=VD(2);gI(3),_D(e.hasFeedback()&&e.finalStatus()?3:-1);}}function wn(i,p){if(i&1&&(bD(0,fn,3,0,"span",11),nh(1,gn,0,0,"ng-template",8),bD(2,hn,4,1,"span",12)),i&2){let e=VD(),n=zD(10);_D(e.hasPrefix()?0:-1),gI(),ch("ngTemplateOutlet",n),gI(),_D(e.hasSuffix()?2:-1);}}function bn(i,p){}function zn(i,p){if(i&1&&(_i(0,"div",null,5),nh(2,bn,0,0,"ng-template",8),Kc()),i&2){let e=VD(),n=zD(12);cw(e.inputNumberClass()),gI(2),ch("ngTemplateOutlet",n);}}function vn(i,p){i&1&&lh(0,"nz-icon",20);}function yn(i,p){i&1&&lh(0,"nz-icon",21);}function Sn(i,p){if(i&1){let e=LD();_i(0,"div",17,7),gh("mouseup",function(){Pu(e);let t=VD(2);return Lu(t.stopAutoStep())})("mouseleave",function(){Pu(e);let t=VD(2);return Lu(t.stopAutoStep())}),_i(2,"span",18),gh("mousedown",function(t){Pu(e);let o=VD(2);return Lu(o.onStepMouseDown(t,true))}),$D(3,4,null,vn,1,0),Kc(),_i(5,"span",19),gh("mousedown",function(t){Pu(e);let o=VD(2);return Lu(o.onStepMouseDown(t,false))}),$D(6,5,null,yn,1,0),Kc()();}if(i&2){let e=VD(2);gI(2),Mh("ant-input-number-handler-up-disabled",e.upDisabled()),ah("aria-disabled",e.upDisabled()),gI(3),Mh("ant-input-number-handler-down-disabled",e.downDisabled()),ah("aria-disabled",e.downDisabled());}}function Mn(i,p){if(i&1){let e=LD();bD(0,Sn,8,6,"div",14),_i(1,"div",15)(2,"input",16,6),gh("input",function(){Pu(e);let t=zD(3),o=VD();return Lu(o.onInput(t.value))})("wheel",function(t){Pu(e);let o=VD();return Lu(o.onWheel(t))}),Kc()();}if(i&2){let e=VD();_D(e.nzControls()?0:-1),gI(2),ch("value",e.displayValue())("placeholder",e.nzPlaceHolder()??"")("disabled",e.finalDisabled())("readOnly",e.nzReadOnly()),ah("aria-valuemin",e.nzMin())("aria-valuemax",e.nzMax())("id",e.nzId())("step",e.nzStep())("value",e.displayValue());}}var Ke=(()=>{class i{nzId=$0(null);nzSize=$0("default");nzPlaceHolder=$0(null);nzStatus=$0("");nzVariant=$0();nzStep=$0(1,{transform:Y0});nzMin=$0(Number.MIN_SAFE_INTEGER,{transform:Y0});nzMax=$0(Number.MAX_SAFE_INTEGER,{transform:Y0});nzPrecision=$0(null);nzParser=$0();nzFormatter=$0();nzDisabled=$0(false,{transform:Z0});nzReadOnly=$0(false,{transform:Z0});nzAutoFocus=$0(false,{transform:Z0});nzKeyboard=$0(true,{transform:Z0});nzControls=$0(true,{transform:Z0});nzChangeOnWheel=$0(true,{transform:Z0});nzPrefix=$0();nzSuffix=$0();nzAddonBefore=$0();nzAddonAfter=$0();nzBlur=B0();nzFocus=B0();nzOnStep=B0();onChange=()=>{};onTouched=()=>{};isDisabledFirstChange=true;compactSize=C(N1,{optional:true});inputRef=q0.required("input");hostRef=q0("inputNumberHost");elementRef=C(_r);injector=C(Ee);focusMonitor=C(a3);directionality=C(Le);nzFormStatusService=C(ga,{optional:true});autoStepTimer=null;defaultFormatter=e=>{let n=this.nzPrecision();return j3(n)?e.toFixed(n):e.toString()};value=qo(null);displayValue=qo("");formSize=C(m1,{optional:true});formVariant=C(za,{optional:true});dir=C(Le).valueSignal;focused=qo(false);hasFeedback=qo(false);finalStatus=Uw(()=>this.nzStatus());finalDisabled=Uw(()=>this.nzDisabled());prefix=W0(Vt);suffix=W0(Rt$1);addonBefore=W0(wt);addonAfter=W0(Ft);hasPrefix=Hw(()=>!!this.nzPrefix()||!!this.prefix());hasSuffix=Hw(()=>!!this.nzSuffix()||!!this.suffix()||this.hasFeedback());hasAffix=Hw(()=>this.hasPrefix()||this.hasSuffix());hasAddonBefore=Hw(()=>!!this.nzAddonBefore()||!!this.addonBefore());hasAddonAfter=Hw(()=>!!this.nzAddonAfter()||!!this.addonAfter());hasAddon=Hw(()=>this.hasAddonBefore()||this.hasAddonAfter());class=Hw(()=>this.hasAddon()?this.groupWrapperClass():this.hasAffix()?this.affixWrapperClass():this.inputNumberClass());inputNumberClass=Hw(()=>r(r({"ant-input-number":true,"ant-input-number-lg":this.finalSize()==="large","ant-input-number-sm":this.finalSize()==="small","ant-input-number-disabled":this.finalDisabled(),"ant-input-number-readonly":this.nzReadOnly(),"ant-input-number-focused":this.focused(),"ant-input-number-rtl":this.dir()==="rtl","ant-input-number-in-form-item":!!this.nzFormStatusService,"ant-input-number-out-of-range":this.value()!==null&&!Oe(this.value(),this.nzMin(),this.nzMax())},u9("ant-input-number",this.finalVariant())),D8("ant-input-number",this.finalStatus(),this.hasFeedback())));affixWrapperClass=Hw(()=>r(r({"ant-input-number-affix-wrapper":true,"ant-input-number-affix-wrapper-disabled":this.finalDisabled(),"ant-input-number-affix-wrapper-readonly":this.nzReadOnly(),"ant-input-number-affix-wrapper-focused":this.focused(),"ant-input-number-affix-wrapper-rtl":this.dir()==="rtl"},D8("ant-input-number-affix-wrapper",this.finalStatus(),this.hasFeedback())),u9("ant-input-number-affix-wrapper",this.finalVariant())));groupWrapperClass=Hw(()=>r(r({"ant-input-number-group-wrapper":true,"ant-input-number-group-wrapper-rtl":this.dir()==="rtl"},D8("ant-input-number-group-wrapper",this.finalStatus(),this.hasFeedback())),u9("ant-input-number-group-wrapper",this.finalVariant())));finalSize=Hw(()=>this.formSize?.()?this.formSize():this.compactSize?this.compactSize():this.nzSize());finalVariant=Hw(()=>this.nzVariant()||this.formVariant?.()||"outlined");upDisabled=Hw(()=>!a9(this.value())&&this.value()>=this.nzMax());downDisabled=Hw(()=>!a9(this.value())&&this.value()<=this.nzMin());constructor(){let e=C(at);Kf(()=>{let n=this.hostRef(),t=n||this.elementRef;this.focusMonitor.monitor(t,true).pipe(Rt(e)).subscribe(o=>{Bw(()=>{this.focused.set(!!o),o?this.nzFocus.emit():(this.fixValue(),this.onTouched(),this.nzBlur.emit());});}),e.onDestroy(()=>{this.focusMonitor.stopMonitoring(t);});}),this.nzFormStatusService?.formStatusChanges.pipe(Rt()).subscribe(({status:n,hasFeedback:t})=>{this.finalStatus.set(n),this.hasFeedback.set(t);});}ngOnInit(){this.nzAutoFocus()&&Kf(()=>this.focus(),{injector:this.injector});}writeValue(e){a9(e)&&(e=null),Bw(()=>{this.value.set(e),this.setValue(e);});}registerOnChange(e){this.onChange=e;}registerOnTouched(e){this.onTouched=e;}setDisabledState(e){Bw(()=>{this.finalDisabled.set(this.isDisabledFirstChange&&this.nzDisabled()||e);}),this.isDisabledFirstChange=false;}focus(e){f9(this.inputRef().nativeElement,e);}blur(){this.inputRef().nativeElement.blur();}step(e,n,t){if(n&&this.upDisabled()||!n&&this.downDisabled())return;let o=e.shiftKey?this.nzStep()*10:this.nzStep();n||(o=-o);let k=10**Bt(o),W=$t((Math.round((this.value()||0)*k)+Math.round(o*k))/k,this.nzMin(),this.nzMax(),this.nzPrecision());this.setValue(W),this.nzOnStep.emit({type:n?"up":"down",value:this.value(),offset:this.nzStep(),emitter:t}),this.focus();}setValue(e){let n=this.nzFormatter()??this.defaultFormatter,t=this.nzPrecision();j3(t)&&(e&&=+e.toFixed(t));let o=a9(e)?"":n(e);this.displayValue.set(o),this.updateValue(e);}setValueByTyping(e){if(this.displayValue.set(e),e===""){this.updateValue(null);return}let t=(this.nzParser()??At)(e);if(Tn(e)||Number.isNaN(t))return;let o=this.nzFormatter();if(o){let d=o(t);this.displayValue.set(d);}Oe(t,this.nzMin(),this.nzMax())&&this.updateValue(t);}updateValue(e){this.value()!==e&&(this.value.set(e),this.onChange(e));}fixValue(){let e=this.displayValue();if(e==="")return;let t=(this.nzParser()??At)(e);if(Number.isNaN(t))t=this.value();else {let o=this.nzPrecision();j3(o)&&Bt(t)!==o&&(t=+t.toFixed(o)),Oe(t,this.nzMin(),this.nzMax())||(t=$t(t,this.nzMin(),this.nzMax(),o));}this.setValue(t);}stopAutoStep(){this.autoStepTimer!==null&&(clearTimeout(this.autoStepTimer),this.autoStepTimer=null);}onStepMouseDown(e,n){e.preventDefault(),this.stopAutoStep(),this.step(e,n,"handler");let t=()=>{this.step(e,n,"handler"),this.autoStepTimer=setTimeout(t,Nn);};this.autoStepTimer=setTimeout(t,kn);}onKeyDown(e){switch(e.keyCode){case 38:e.preventDefault(),this.nzKeyboard()&&this.step(e,true,"keyboard");break;case 40:e.preventDefault(),this.nzKeyboard()&&this.step(e,false,"keyboard");break;case 13:this.fixValue();break}}onInput(e){this.setValueByTyping(e);}onWheel(e){this.finalDisabled()||this.nzReadOnly()||!this.nzChangeOnWheel()||(e.preventDefault(),this.step(e,e.deltaY<0,"wheel"));}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=QE({type:i,selectors:[["nz-input-number"]],contentQueries:function(n,t,o){n&1&&Eh(o,t.prefix,Vt,5)(o,t.suffix,Rt$1,5)(o,t.addonBefore,wt,5)(o,t.addonAfter,Ft,5),n&2&&GD(4);},viewQuery:function(n,t){n&1&&Dh(t.inputRef,Ut,5)(t.hostRef,Ht,5),n&2&&GD(2);},hostVars:2,hostBindings:function(n,t){n&1&&gh("keydown",function(d){return t.onKeyDown(d)}),n&2&&cw(t.class());},inputs:{nzId:[1,"nzId"],nzSize:[1,"nzSize"],nzPlaceHolder:[1,"nzPlaceHolder"],nzStatus:[1,"nzStatus"],nzVariant:[1,"nzVariant"],nzStep:[1,"nzStep"],nzMin:[1,"nzMin"],nzMax:[1,"nzMax"],nzPrecision:[1,"nzPrecision"],nzParser:[1,"nzParser"],nzFormatter:[1,"nzFormatter"],nzDisabled:[1,"nzDisabled"],nzReadOnly:[1,"nzReadOnly"],nzAutoFocus:[1,"nzAutoFocus"],nzKeyboard:[1,"nzKeyboard"],nzControls:[1,"nzControls"],nzChangeOnWheel:[1,"nzChangeOnWheel"],nzPrefix:[1,"nzPrefix"],nzSuffix:[1,"nzSuffix"],nzAddonBefore:[1,"nzAddonBefore"],nzAddonAfter:[1,"nzAddonAfter"]},outputs:{nzBlur:"nzBlur",nzFocus:"nzFocus",nzOnStep:"nzOnStep"},exportAs:["nzInputNumber"],features:[Sw([{provide:h1,useExisting:wo(()=>i),multi:true},{provide:B1,useValue:"input-number"}]),rD([R4])],ngContentSelectors:Qt,decls:13,vars:1,consts:[["inputNumberWithAddonInner",""],["inputNumberWithAffix",""],["inputNumberWithAffixInner",""],["inputNumber",""],["inputNumberInner",""],["inputNumberHost",""],["input",""],["handlers",""],[3,"ngTemplateOutlet"],[1,"ant-input-number-wrapper","ant-input-number-group"],[1,"ant-input-number-group-addon"],[1,"ant-input-number-prefix"],[1,"ant-input-number-suffix"],[3,"status"],[1,"ant-input-number-handler-wrap"],[1,"ant-input-number-input-wrap"],["autocomplete","off","role","spinbutton",1,"ant-input-number-input",3,"input","wheel","value","placeholder","disabled","readOnly"],[1,"ant-input-number-handler-wrap",3,"mouseup","mouseleave"],["role","button","unselectable","on",1,"ant-input-number-handler","ant-input-number-handler-up",3,"mousedown"],["role","button","unselectable","on",1,"ant-input-number-handler","ant-input-number-handler-down",3,"mousedown"],["nzType","up",1,"ant-input-number-handler-up-inner"],["nzType","down",1,"ant-input-number-handler-down-inner"]],template:function(n,t){n&1&&(BD(Zt),bD(0,Yt,1,1,null,8)(1,Xt,1,1,null,8)(2,tn,1,1,null,8),nh(3,cn,5,3,"ng-template",null,0,Lw)(5,mn,2,3,"ng-template",null,1,Lw)(7,wn,3,3,"ng-template",null,2,Lw)(9,zn,3,3,"ng-template",null,3,Lw)(11,Mn,4,10,"ng-template",null,4,Lw)),n&2&&_D(t.hasAddon()?0:t.hasAffix()?1:2);},dependencies:[pt,Se$1,va,vr],encapsulation:2})}return i})(),Nn=200,kn=600;function At(i){let p=i.trim().replace(/,/g,"").replace(/。/g,".");return p.length?+p:NaN}function Oe(i,p,e){return i>=p&&i<=e}function $t(i,p,e,n=null){if(n===null)return i<p?p:i>e?e:i;let t=+i.toFixed(n),o=Math.pow(10,n);return t<p?Math.ceil(p*o)/o:t>e?Math.floor(e*o)/o:t}function Bt(i){return i.toString().split(".")[1]?.length||0}function Tn(i){return /[.。](\d*0)?$/.test(i.toString())}var Pt=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=YE({type:i});static \u0275inj=uu({imports:[Ke]})}return i})();function En(i,p){if(i&1){let e=LD();_i(0,"div",1)(1,"input",3),Vh("ngModelChange",function(t){let o=Pu(e).$implicit;return ww(o.key,t)||(o.key=t),Lu(t)}),gh("ngModelChange",function(){Pu(e);let t=VD();return Lu(t.emitRows())}),Kc(),oE(),_i(2,"input",4),Vh("ngModelChange",function(t){let o=Pu(e).$implicit;return ww(o.value,t)||(o.value=t),Lu(t)}),gh("ngModelChange",function(){Pu(e);let t=VD();return Lu(t.emitRows())}),Kc(),oE(),_i(3,"button",5),gh("click",function(){let t=Pu(e).$index,o=VD();return Lu(o.remove(t))}),vw(4,"Remove"),Kc()();}if(i&2){let e=p.$implicit;gI(),jh("ngModel",e.key),sE(),gI(),jh("ngModel",e.value),sE();}}var jt=(()=>{class i{constructor(){this.rows=U0.required();}add(){this.rows.update(e=>[...e,{key:"",value:""}]);}remove(e){this.rows.update(n=>n.filter((t,o)=>o!==e));}emitRows(){this.rows.set(this.rows().map(e=>r({},e)));}static{this.\u0275fac=function(n){return new(n||i)};}static{this.\u0275cmp=QE({type:i,selectors:[["app-key-value-editor"]],inputs:{rows:[1,"rows"]},outputs:{rows:"rowsChange"},decls:5,vars:0,consts:[[1,"kv-editor"],[1,"kv-row"],["nz-button","","nzType","dashed","type","button",3,"click"],["nz-input","","placeholder","key",3,"ngModelChange","ngModel"],["nz-input","","placeholder","value",3,"ngModelChange","ngModel"],["nz-button","","nzType","default","type","button",3,"click"]],template:function(n,t){n&1&&(_i(0,"div",0),ND(1,En,5,2,"div",1,MD),_i(3,"button",2),gh("click",function(){return t.add()}),vw(4,"Add param"),Kc()()),n&2&&(gI(),xD(t.rows()));},dependencies:[n8,S4,J6,k3,sd,zc,t7,y7,Ki,x],styles:[".kv-editor[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.kv-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}"]});}}return i})();function An(i,p){return this.trackKey(p)}var $n=(i,p)=>p.id;function Bn(i,p){if(i&1&&(lh(0,"nz-option",5),Rw(1,"transloco")),i&2){let e=p.$implicit,n=VD(2);ch("nzValue",e)("nzLabel",Ow(1,2,n.stepTypeKey(e)));}}function Pn(i,p){if(i&1){let e=LD();_i(0,"label",16),gh("ngModelChange",function(t){let o=Pu(e).$implicit,d=VD(2),k=d.$implicit,W=d.$index,L=VD();return Lu(L.toggleKnowledge(W,L.asAgent(k),o,t))}),vw(1),Rw(2,"transloco"),Kc(),oE();}if(i&2){let e=p.$implicit,n=VD(2),t=n.$implicit,o=n.$index,d=VD();ch("ngModel",d.hasKnowledge(d.asAgent(t),e)),ah("data-testid","agent-knowledge-"+e+"-"+o),sE(),gI(),nl(" ",Ow(2,3,d.knowledgeTierKey(e))," ");}}function Wn(i,p){if(i&1&&(lh(0,"nz-option",5),Rw(1,"transloco")),i&2){let e=p.$implicit,n=VD(3);ch("nzValue",e)("nzLabel",Ow(1,2,n.outputFormatKey(e)));}}function Ln(i,p){if(i&1){let e=LD();_i(0,"label",8)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"textarea",12),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.patchAt(o,{objective:t}))}),Kc(),oE(),Kc(),_i(5,"div",8)(6,"span"),vw(7),Rw(8,"transloco"),Kc(),_i(9,"div",13),ND(10,Pn,3,5,"label",14,SD),Kc(),_i(12,"p",11),vw(13),Rw(14,"transloco"),Kc()(),_i(15,"div",8)(16,"span"),vw(17),Rw(18,"transloco"),Kc(),_i(19,"nz-select",15),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.patchAt(o,{outputFormat:t}))}),ND(20,Wn,2,4,"nz-option",5,SD),Kc(),oE(),Kc();}if(i&2){let e=VD(),n=e.$implicit,t=e.$index,o=VD();gI(2),Ph(Ow(3,8,"step-list.objective")),gI(2),ch("ngModel",o.asAgent(n).objective),ah("data-testid","agent-objective-"+t),sE(),gI(3),Ph(Ow(8,10,"step-list.knowledgeScope")),gI(3),xD(o.knowledgeTiers),gI(3),Ph(Ow(14,12,"step-list.knowledgeScopeHint")),gI(4),Ph(Ow(18,14,"step-list.outputFormat.label")),gI(2),ch("ngModel",o.asAgent(n).outputFormat),ah("data-testid","agent-output-"+t),sE(),gI(),xD(o.outputFormats);}}function On(i,p){if(i&1&&(lh(0,"nz-option",5),Rw(1,"transloco")),i&2){let e=p.$implicit,n=VD(3);ch("nzValue",e)("nzLabel",Ow(1,2,n.interactionKey(e)));}}function Rn(i,p){if(i&1&&(lh(0,"nz-option",5),Rw(1,"transloco")),i&2){let e=p.$implicit,n=VD(3);ch("nzValue",e)("nzLabel",Ow(1,2,n.notifyModeKey(e)));}}function Kn(i,p){if(i&1){let e=LD();_i(0,"div",8)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"nz-select",15),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.patchAt(o,{interaction:t}))}),ND(5,On,2,4,"nz-option",5,SD),Kc(),oE(),Kc(),_i(7,"div",8)(8,"span"),vw(9),Rw(10,"transloco"),Kc(),_i(11,"nz-select",15),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.setNotifyMode(o,t))}),ND(12,Rn,2,4,"nz-option",5,SD),Kc(),oE(),Kc();}if(i&2){let e=VD(),n=e.$implicit,t=e.$index,o=VD();gI(2),Ph(Ow(3,6,"step-list.interaction.label")),gI(2),ch("ngModel",o.asInteraction(n).interaction),ah("data-testid","interaction-type-"+t),sE(),gI(),xD(o.interactions),gI(4),Ph(Ow(10,8,"step-list.notify")),gI(2),ch("ngModel",o.notifyMode(o.asInteraction(n))),ah("data-testid","interaction-notify-"+t),sE(),gI(),xD(o.notifyModes);}}function jn(i,p){if(i&1){let e=LD();_i(0,"label",8)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"textarea",12),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.patchAt(o,{command:t}))}),Kc(),oE(),Kc();}if(i&2){let e=VD(),n=e.$implicit,t=e.$index,o=VD();gI(2),Ph(Ow(3,3,"step-list.command")),gI(2),ch("ngModel",o.asShell(n).command),ah("data-testid","shell-command-"+t),sE();}}function qn(i,p){if(i&1&&(lh(0,"nz-option",5),Rw(1,"transloco")),i&2){let e=p.$implicit,n=VD(3);ch("nzValue",e)("nzLabel",Ow(1,2,n.gitOperationKey(e)));}}function Un(i,p){if(i&1){let e=LD();_i(0,"div",8)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"nz-select",15),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.patchAt(o,{operation:t}))}),ND(5,qn,2,4,"nz-option",5,SD),Kc(),oE(),Kc(),_i(7,"div",8)(8,"span"),vw(9),Rw(10,"transloco"),Kc(),_i(11,"app-key-value-editor",17),gh("rowsChange",function(t){Pu(e);let o=VD(),d=o.$implicit,k=o.$index,W=VD();return Lu(W.onParamRowsChange(k,d,t))}),Kc()();}if(i&2){let e=VD(),n=e.$implicit,t=e.$index,o=VD();gI(2),Ph(Ow(3,5,"step-list.operation")),gI(2),ch("ngModel",o.asGit(n).operation),ah("data-testid","git-operation-"+t),sE(),gI(),xD(o.gitOperations),gI(4),Ph(Ow(10,7,"step-list.params")),gI(2),ch("rows",o.paramRows(n));}}function Hn(i,p){if(i&1&&(lh(0,"nz-option",5),Rw(1,"transloco")),i&2){let e=p.$implicit,n=VD(3);ch("nzValue",e)("nzLabel",Ow(1,2,n.providerActionKey(e)));}}function Zn(i,p){if(i&1){let e=LD();_i(0,"div",8)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"nz-select",15),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.patchAt(o,{action:t}))}),ND(5,Hn,2,4,"nz-option",5,SD),Kc(),oE(),Kc(),_i(7,"div",8)(8,"span"),vw(9),Rw(10,"transloco"),Kc(),_i(11,"app-key-value-editor",17),gh("rowsChange",function(t){Pu(e);let o=VD(),d=o.$implicit,k=o.$index,W=VD();return Lu(W.onParamRowsChange(k,d,t))}),Kc()();}if(i&2){let e=VD(),n=e.$implicit,t=e.$index,o=VD();gI(2),Ph(Ow(3,5,"step-list.action")),gI(2),ch("ngModel",o.asProvider(n).action),ah("data-testid","provider-action-"+t),sE(),gI(),xD(o.providerActions),gI(4),Ph(Ow(10,7,"step-list.params")),gI(2),ch("rows",o.paramRows(n));}}function Qn(i,p){if(i&1&&lh(0,"nz-option",5),i&2){let e=p.$implicit,n=VD(3);ch("nzValue",e.id)("nzLabel",n.workflowOptionLabel(e));}}function Gn(i,p){if(i&1){let e=LD();_i(0,"div",8)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"nz-select",18),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.patchAt(o,{workflowId:t}))}),ND(5,Qn,1,2,"nz-option",5,$n),Kc(),oE(),Kc(),_i(7,"p",8)(8,"span"),vw(9),Rw(10,"transloco"),Kc(),_i(11,"code",19),vw(12,"selection"),Kc()();}if(i&2){let e=VD(),n=e.$implicit,t=e.$index,o=VD();gI(2),Ph(Ow(3,4,"step-list.workflowId")),gI(2),ch("ngModel",o.asSubWorkflow(n).workflowId),ah("data-testid","sub-workflow-id-"+t),sE(),gI(),xD(o.availableWorkflows()),gI(4),Ph(Ow(10,6,"step-list.forEach"));}}function Yn(i,p){if(i&1&&(lh(0,"nz-option",5),Rw(1,"transloco")),i&2){let e=p.$implicit,n=VD(3);ch("nzValue",e)("nzLabel",Ow(1,2,n.untilTypeKey(e)));}}function Jn(i,p){if(i&1){let e=LD();_i(0,"label",8)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"input",10),gh("ngModelChange",function(t){Pu(e);let o=VD(2).$index,d=VD();return Lu(d.setUntilValue(o,t))}),Kc(),oE(),Kc();}if(i&2){let e=VD(2),n=e.$implicit,t=e.$index,o=VD();gI(2),Ph(Ow(3,3,"step-list.until.value")),gI(2),ch("ngModel",o.untilValue(o.asLoop(n))),ah("data-testid","loop-until-value-"+t),sE();}}function Xn(i,p){if(i&1&&(lh(0,"nz-option",5),Rw(1,"transloco")),i&2){let e=p.$implicit,n=VD(3);ch("nzValue",e)("nzLabel",Ow(1,2,n.onMaxIterationsKey(e)));}}function ei(i,p){if(i&1){let e=LD();_i(0,"div",20)(1,"div",8)(2,"span"),vw(3),Rw(4,"transloco"),Kc(),_i(5,"nz-select",15),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.setUntilType(o,t))}),ND(6,Yn,2,4,"nz-option",5,SD),Kc(),oE(),Kc(),_i(8,"label",8)(9,"span"),vw(10),Rw(11,"transloco"),Kc(),_i(12,"input",10),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.setUntilField(o,"stepId",t))}),Kc(),oE(),Kc(),_i(13,"label",8)(14,"span"),vw(15),Rw(16,"transloco"),Kc(),_i(17,"input",10),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.setUntilField(o,"field",t))}),Kc(),oE(),Kc(),bD(18,Jn,5,5,"label",8),_i(19,"label",8)(20,"span"),vw(21),Rw(22,"transloco"),Kc(),_i(23,"nz-input-number",21),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.patchAt(o,{maxIterations:t??0}))}),Kc(),oE(),Kc(),_i(24,"div",8)(25,"span"),vw(26),Rw(27,"transloco"),Kc(),_i(28,"nz-select",15),gh("ngModelChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.patchAt(o,{onMaxIterations:{action:t}}))}),ND(29,Xn,2,4,"nz-option",5,SD),Kc(),oE(),Kc()(),_i(31,"div",22)(32,"h4"),vw(33),Rw(34,"transloco"),Kc(),_i(35,"app-step-list",23),gh("stepsChange",function(t){Pu(e);let o=VD().$index,d=VD();return Lu(d.setNestedSteps(o,t))}),Kc()();}if(i&2){let e=VD(),n=e.$implicit,t=e.$index,o=VD();gI(3),Ph(Ow(4,23,"step-list.until.type")),gI(2),ch("ngModel",o.asLoop(n).until.type),ah("data-testid","loop-until-type-"+t),sE(),gI(),xD(o.untilTypes),gI(4),Ph(Ow(11,25,"step-list.until.stepId")),gI(2),ch("ngModel",o.asLoop(n).until.stepId),ah("data-testid","loop-until-stepId-"+t),sE(),gI(3),Ph(Ow(16,27,"step-list.until.field")),gI(2),ch("ngModel",o.asLoop(n).until.field),ah("data-testid","loop-until-field-"+t),sE(),gI(),_D(o.asLoop(n).until.type==="field_equals"?18:-1),gI(3),Ph(Ow(22,29,"step-list.maxIterations")),gI(2),ch("ngModel",o.asLoop(n).maxIterations)("nzMin",0),ah("data-testid","loop-max-"+t),sE(),gI(3),Ph(Ow(27,31,"step-list.onMaxIterations.action")),gI(2),ch("ngModel",o.asLoop(n).onMaxIterations.action),ah("data-testid","loop-on-max-"+t),sE(),gI(),xD(o.maxIterationActions),gI(2),ah("data-testid","loop-nested-"+t),gI(2),Ph(Ow(34,33,"step-list.nestedSteps")),gI(2),ch("steps",o.asLoop(n).steps)("rootSteps",o.effectiveRoot())("availableWorkflows",o.availableWorkflows())("depth",o.depth()+1);}}function ti(i,p){if(i&1){let e=LD();_i(0,"nz-card",1)(1,"div",3)(2,"nz-select",4),gh("ngModelChange",function(t){let o=Pu(e).$index,d=VD();return Lu(d.changeType(o,t))}),ND(3,Bn,2,4,"nz-option",5,SD),Kc(),oE(),_i(5,"button",6),gh("click",function(){let t=Pu(e).$index,o=VD();return Lu(o.moveUp(t))}),vw(6),Rw(7,"transloco"),Kc(),_i(8,"button",6),gh("click",function(){let t=Pu(e).$index,o=VD();return Lu(o.moveDown(t))}),vw(9),Rw(10,"transloco"),Kc(),_i(11,"button",7),gh("click",function(){let t=Pu(e).$index,o=VD();return Lu(o.removeStep(t))}),vw(12),Rw(13,"transloco"),Kc()(),_i(14,"label",8)(15,"span"),vw(16),Rw(17,"transloco"),Kc(),_i(18,"input",9),gh("ngModelChange",function(t){let o=Pu(e).$index,d=VD();return Lu(d.onNameChange(o,t))}),Kc(),oE(),Kc(),_i(19,"label",8)(20,"span"),vw(21),Rw(22,"transloco"),Kc(),_i(23,"input",10),gh("ngModelChange",function(t){let o=Pu(e).$index,d=VD();return Lu(d.onIdChange(o,t))}),Kc(),oE(),_i(24,"p",11),vw(25),Rw(26,"transloco"),Kc()(),bD(27,Ln,22,16)(28,Kn,14,10)(29,jn,5,5,"label",8)(30,Un,12,9)(31,Zn,12,9)(32,Gn,13,8)(33,ei,36,35),Kc();}if(i&2){let e,n=p.$implicit,t=p.$index,o=VD();ch("nzTitle",o.cardTitle(t,n)),ah("data-testid","step-card-"+t),gI(2),ch("ngModel",n.type),ah("data-testid","step-type-"+t),sE(),gI(),xD(o.stepTypes),gI(2),ch("disabled",t===0),ah("data-testid","move-up-"+t),gI(),nl(" ",Ow(7,20,"step-list.moveUp")," "),gI(2),ch("disabled",t===o.steps().length-1),ah("data-testid","move-down-"+t),gI(),nl(" ",Ow(10,22,"step-list.moveDown")," "),gI(2),ah("data-testid","remove-"+t),gI(),nl(" ",Ow(13,24,"step-list.remove")," "),gI(4),Ph(Ow(17,26,"step-list.name")),gI(2),ch("ngModel",n.name),ah("data-testid","step-name-"+t),sE(),gI(3),Ph(Ow(22,28,"step-list.id")),gI(2),ch("ngModel",n.id),ah("data-testid","step-id-"+t),sE(),gI(2),Ph(Ow(26,30,"step-list.idHint")),gI(2),_D((e=n.type)==="agent"?27:e==="interaction"?28:e==="shell"?29:e==="git"?30:e==="provider_action"?31:e==="sub_workflow"?32:e==="loop"?33:-1);}}var qt=(()=>{class i{constructor(){this.transloco=C(ar),this.language=C(O),this.steps=$0.required(),this.rootSteps=$0([]),this.availableWorkflows=$0([]),this.depth=$0(0),this.stepsChange=B0(),this.stepTypes=y,this.outputFormats=["questionnaire","confirmation","comment_suggestions","free_text"],this.interactions=["questionnaire","confirmation","conversation"],this.gitOperations=["create_worktree","checkout","create_branch","commit","push"],this.providerActions=["get_subject","get_comments","post_comment","update_status","get_content"],this.knowledgeTiers=["user","organization","project"],this.untilTypes=["field_empty","field_equals"],this.maxIterationActions=["fail","continue","ask_human"],this.notifyModes=["inherit","on","off"],this.paramRowsByStepKey=new Map;}cardTitle(e,n){this.language.currentLang();let t=this.transloco.translate(this.stepTypeKey(n.type));return n.name?this.transloco.translate("step-list.cardTitleNamed",{index:e+1,type:t,name:n.name}):this.transloco.translate("step-list.cardTitle",{index:e+1,type:t})}stepTypeKey(e){return `step-list.stepType.${e}`}outputFormatKey(e){return `step-list.outputFormat.${e}`}interactionKey(e){return `step-list.interaction.${e}`}notifyModeKey(e){return `step-list.notifyMode.${e}`}gitOperationKey(e){return `step-list.gitOperation.${e}`}providerActionKey(e){return `step-list.providerAction.${e}`}knowledgeTierKey(e){return `step-list.knowledgeTier.${e}`}untilTypeKey(e){return `step-list.untilType.${e}`}onMaxIterationsKey(e){return `step-list.onMaxIterations.${e}`}workflowOptionLabel(e){return this.language.currentLang(),this.transloco.translate("step-list.workflowOption",{name:e.name,id:e.id})}effectiveRoot(){let e=this.rootSteps();return e.length>0?e:this.steps()}trackKey(e){return e._key}addStep(){this.emit([...this.steps(),h("agent")]);}removeStep(e){let n=this.steps()[e];n&&this.paramRowsByStepKey.delete(n._key),this.emit(this.steps().filter((t,o)=>o!==e));}moveUp(e){if(e<=0)return;let n=[...this.steps()],t=n[e-1];n[e-1]=n[e],n[e]=t,this.emit(n);}moveDown(e){if(e>=this.steps().length-1)return;let n=[...this.steps()],t=n[e+1];n[e+1]=n[e],n[e]=t,this.emit(n);}changeType(e,n){let t=this.steps()[e];if(!t||t.type===n)return;this.paramRowsByStepKey.delete(t._key);let o=h(n,{id:t.id,name:t.name,idAutoSync:t._idAutoSync,key:t._key});this.replaceAt(e,o);}patchAt(e,n){let t=this.steps()[e];t&&this.replaceAt(e,r(r({},t),n));}onNameChange(e,n){let t=this.steps()[e];t&&this.replaceAt(e,E(t,n,this.effectiveRoot()));}onIdChange(e,n){let t=this.steps()[e];t&&this.replaceAt(e,P(t,n));}setNestedSteps(e,n){let t=this.steps()[e];!t||t.type!=="loop"||this.replaceAt(e,s(r({},t),{steps:n}));}asAgent(e){return e}asInteraction(e){return e}asShell(e){return e}asGit(e){return e}asProvider(e){return e}asSubWorkflow(e){return e}asLoop(e){return e}hasKnowledge(e,n){return e.knowledgeScope?.includes(n)??false}toggleKnowledge(e,n,t,o){let d=new Set(n.knowledgeScope??[]);o?d.add(t):d.delete(t);let k=[...d];this.patchAt(e,{knowledgeScope:k&&k.length>0?k:void 0});}notifyMode(e){return e.notify===void 0?"inherit":e.notify?"on":"off"}setNotifyMode(e,n){if(n==="inherit"){let t$1=this.asInteraction(this.steps()[e]),{notify:d}=t$1,k=t(t$1,["notify"]);this.replaceAt(e,k);return}this.patchAt(e,{notify:n==="on"});}paramRows(e){let n=this.paramRowsByStepKey.get(e._key);if(!n){let t=e.type==="git"||e.type==="provider_action"?e.params:void 0;n=A(t),this.paramRowsByStepKey.set(e._key,n);}return n}onParamRowsChange(e,n,t){this.paramRowsByStepKey.set(n._key,t),this.patchAt(e,{params:T(t)});}setUntilType(e,n){let t=this.asLoop(this.steps()[e]);if(n==="field_empty"){this.patchAt(e,{until:{type:n,stepId:t.until.stepId,field:t.until.field}});return}let o=t.until.type==="field_equals"?t.until.value:"";this.patchAt(e,{until:{type:n,stepId:t.until.stepId,field:t.until.field,value:o}});}setUntilField(e,n,t){let o=this.asLoop(this.steps()[e]);this.patchAt(e,{until:s(r({},o.until),{[n]:t})});}setUntilValue(e,n){let t=this.asLoop(this.steps()[e]);t.until.type==="field_equals"&&this.patchAt(e,{until:s(r({},t.until),{value:n})});}untilValue(e){return e.until.type==="field_equals"?String(e.until.value??""):""}replaceAt(e,n){this.emit(this.steps().map((t,o)=>o===e?n:t));}emit(e){this.stepsChange.emit(e);}static{this.\u0275fac=function(n){return new(n||i)};}static{this.\u0275cmp=QE({type:i,selectors:[["app-step-list"]],inputs:{steps:[1,"steps"],rootSteps:[1,"rootSteps"],availableWorkflows:[1,"availableWorkflows"],depth:[1,"depth"]},outputs:{stepsChange:"stepsChange"},decls:6,vars:4,consts:[["data-testid","step-list",1,"step-list"],[1,"step-card",3,"nzTitle"],["nz-button","","nzType","dashed","nzBlock","","type","button","data-testid","add-step",3,"click"],[1,"step-toolbar"],[1,"type-select",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],["nz-button","","type","button",3,"click","disabled"],["nz-button","","nzDanger","","type","button",3,"click"],[1,"field"],["nz-input","","required","",3,"ngModelChange","ngModel"],["nz-input","",3,"ngModelChange","ngModel"],[1,"hint"],["nz-input","","rows","3",3,"ngModelChange","ngModel"],[1,"checkbox-row"],["nz-checkbox","",3,"ngModel"],[3,"ngModelChange","ngModel"],["nz-checkbox","",3,"ngModelChange","ngModel"],[3,"rowsChange","rows"],["nzShowSearch","","nzAllowClear","",3,"ngModelChange","ngModel"],["data-testid","sub-workflow-foreach"],[1,"field-grid"],[3,"ngModelChange","ngModel","nzMin"],[1,"nested"],[3,"stepsChange","steps","rootSteps","availableWorkflows","depth"]],template:function(n,t){n&1&&(_i(0,"div",0),ND(1,ti,34,32,"nz-card",1,An,true),_i(3,"button",2),gh("click",function(){return t.addStep()}),vw(4),Rw(5,"transloco"),Kc()()),n&2&&(ah("data-depth",t.depth()),gI(),xD(t.steps()),gI(3),nl(" ",Ow(5,2,"step-list.addStep")," "));},dependencies:[i,Fn,n8,S4,J6,$6,k3,sd,zc,t7,y7,Nt,Ke$1,Fe,oe,Ki,x,Pt,Ke,$b,V5,D5,jt,ec],styles:[".step-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.step-card[_ngcontent-%COMP%]{background:#fff}.step-toolbar[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem;margin-bottom:.75rem;align-items:center}.type-select[_ngcontent-%COMP%]{min-width:11rem}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.65rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.field-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:.5rem 1rem}.checkbox-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.75rem}.hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:#78716c}.nested[_ngcontent-%COMP%]{margin-top:.75rem;padding:.75rem;border-left:3px solid #d6d3d1;background:#fafaf9}.nested[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0 0 .5rem}"]});}}return i})();var ni=i=>({ids:i});function ii(i,p){i&1&&(_i(0,"p",5),vw(1),Rw(2,"transloco"),Kc()),i&2&&(gI(),Ph(Ow(2,1,"workflow-editor.loading")));}function oi(i,p){if(i&1&&(_i(0,"p",6),vw(1),Kc()),i&2){let e=VD();gI(),Ph(e.loadError());}}function ri(i,p){if(i&1&&(_i(0,"li"),vw(1),Kc()),i&2){let e=p.$implicit;gI(),Ph(e);}}function ai(i,p){if(i&1&&(_i(0,"section",7)(1,"h2"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"ul"),ND(5,ri,2,1,"li",null,SD),Kc()()),i&2){let e=VD(2);gI(2),Ph(Ow(3,1,"workflow-editor.validation")),gI(3),xD(e.validationErrors());}}function li(i,p){if(i&1&&(lh(0,"nz-option",13),Rw(1,"transloco")),i&2){let e=p.$implicit,n=VD(2);ch("nzValue",e)("nzLabel",Ow(1,2,n.subjectTypeKey(e)));}}function si(i,p){if(i&1&&(lh(0,"nz-option",13),Rw(1,"transloco")),i&2){let e=p.$implicit,n=VD(2);ch("nzValue",e)("nzLabel",Ow(1,2,n.cardinalityKey(e)));}}function pi(i,p){if(i&1){let e=LD();_i(0,"label",23),gh("ngModelChange",function(t){let o=Pu(e).$implicit,d=VD(2);return Lu(d.toggleTrigger(o,t))}),vw(1),Rw(2,"transloco"),Kc(),oE();}if(i&2){let e=p.$implicit,n=VD(2);ch("ngModel",n.hasTrigger(e)),ah("data-testid","notify-"+e),sE(),gI(),nl(" ",Ow(2,3,n.triggerKey(e))," ");}}function di(i,p){if(i&1&&(lh(0,"nz-option",13),Rw(1,"transloco")),i&2){let e=p.$implicit,n=VD(3);ch("nzValue",e)("nzLabel",Ow(1,2,n.inputTypeKey(e)));}}function ci(i,p){if(i&1){let e=LD();_i(0,"div",19)(1,"label",10)(2,"span"),vw(3),Rw(4,"transloco"),Kc(),_i(5,"input",18),gh("ngModelChange",function(t){let o=Pu(e).$index,d=VD(2);return Lu(d.patchInputField(o,{name:t}))}),Kc(),oE(),Kc(),_i(6,"label",10)(7,"span"),vw(8),Rw(9,"transloco"),Kc(),_i(10,"input",18),gh("ngModelChange",function(t){let o=Pu(e).$index,d=VD(2);return Lu(d.patchInputField(o,{label:t}))}),Kc(),oE(),Kc(),_i(11,"div",10)(12,"span"),vw(13),Rw(14,"transloco"),Kc(),_i(15,"nz-select",24),gh("ngModelChange",function(t){let o=Pu(e).$index,d=VD(2);return Lu(d.patchInputField(o,{type:t}))}),ND(16,di,2,4,"nz-option",13,SD),Kc(),oE(),Kc(),_i(18,"label",23),gh("ngModelChange",function(t){let o=Pu(e).$index,d=VD(2);return Lu(d.patchInputField(o,{required:t}))}),vw(19),Rw(20,"transloco"),Kc(),oE(),_i(21,"button",25),gh("click",function(){let t=Pu(e).$index,o=VD(2);return Lu(o.removeInputField(t))}),vw(22),Rw(23,"transloco"),Kc()();}if(i&2){let e=p.$implicit,n=p.$index,t=VD(2);ah("data-testid","input-field-"+n),gI(3),Ph(Ow(4,10,"workflow-editor.fieldName")),gI(2),ch("ngModel",e.name),sE(),gI(3),Ph(Ow(9,12,"workflow-editor.fieldLabel")),gI(2),ch("ngModel",e.label),sE(),gI(3),Ph(Ow(14,14,"workflow-editor.fieldType")),gI(2),ch("ngModel",e.type),sE(),gI(),xD(t.inputFieldTypes),gI(2),ch("ngModel",e.required),sE(),gI(),nl(" ",Ow(20,16,"workflow-editor.required")," "),gI(3),nl(" ",Ow(23,18,"workflow-editor.remove")," ");}}function ui(i,p){if(i&1&&(_i(0,"p",21),vw(1),Rw(2,"transloco"),Kc()),i&2){let e=VD(2);gI(),nl(" ",Pw(2,1,"workflow-editor.duplicateStepIds",xw(4,ni,e.duplicateStepIds().join(", ")))," ");}}function mi(i,p){if(i&1){let e=LD();bD(0,ai,7,3,"section",7),_i(1,"nz-card",8),Rw(2,"transloco"),_i(3,"div",9)(4,"label",10)(5,"span"),vw(6),Rw(7,"transloco"),Kc(),_i(8,"input",11),gh("ngModelChange",function(t){Pu(e);let o=VD();return Lu(o.patchWorkflow({name:t}))}),Kc(),oE(),Kc(),_i(9,"div",10)(10,"span"),vw(11),Rw(12,"transloco"),Kc(),_i(13,"nz-select",12),gh("ngModelChange",function(t){Pu(e);let o=VD();return Lu(o.setAppliesTo(t))}),ND(14,li,2,4,"nz-option",13,SD),Kc(),oE(),Kc(),_i(16,"div",10)(17,"span"),vw(18),Rw(19,"transloco"),Kc(),_i(20,"nz-select",14),gh("ngModelChange",function(t){Pu(e);let o=VD();return Lu(o.patchWorkflow({cardinality:t}))}),ND(21,si,2,4,"nz-option",13,SD),Kc(),oE(),Kc()(),_i(23,"label",10)(24,"span"),vw(25),Rw(26,"transloco"),Kc(),_i(27,"textarea",15),gh("ngModelChange",function(t){Pu(e);let o=VD();return Lu(o.patchWorkflow({description:t||void 0}))}),Kc(),oE(),Kc()(),_i(28,"nz-card",8),Rw(29,"transloco"),_i(30,"div",16),ND(31,pi,3,5,"label",17,SD),Kc(),_i(33,"label",10)(34,"span"),vw(35),Rw(36,"transloco"),Kc(),_i(37,"input",18),gh("ngModelChange",function(t){Pu(e);let o=VD();return Lu(o.patchWorkflow({notificationPolicy:s(r({},o.workflow().notificationPolicy),{messageTemplate:t||void 0})}))}),Kc(),oE(),Kc()(),_i(38,"nz-card",8),Rw(39,"transloco"),ND(40,ci,24,20,"div",19,MD),_i(42,"button",20),gh("click",function(){Pu(e);let t=VD();return Lu(t.addInputField())}),vw(43),Rw(44,"transloco"),Kc()(),_i(45,"nz-card",8),Rw(46,"transloco"),bD(47,ui,3,6,"p",21),_i(48,"app-step-list",22),gh("stepsChange",function(t){Pu(e);let o=VD();return Lu(o.onStepsChange(t))}),Kc()();}if(i&2){let e=VD();_D(e.validationErrors().length>0?0:-1),gI(),ch("nzTitle",Ow(2,20,"workflow-editor.basics")),gI(5),Ph(Ow(7,22,"workflow-editor.name")),gI(2),ch("ngModel",e.workflow().name),sE(),gI(3),Ph(Ow(12,24,"workflow-editor.appliesTo")),gI(2),ch("ngModel",e.appliesToValue()),sE(),gI(),xD(e.subjectTypes),gI(4),Ph(Ow(19,26,"workflow-editor.cardinality.label")),gI(2),ch("ngModel",e.workflow().cardinality),sE(),gI(),xD(e.cardinalities),gI(4),Ph(Ow(26,28,"workflow-editor.description")),gI(2),ch("ngModel",e.workflow().description??""),sE(),gI(),ch("nzTitle",Ow(29,30,"workflow-editor.notificationPolicy")),gI(3),xD(e.notificationTriggers),gI(4),Ph(Ow(36,32,"workflow-editor.messageTemplate")),gI(2),ch("ngModel",e.workflow().notificationPolicy.messageTemplate??""),sE(),gI(),ch("nzTitle",Ow(39,34,"workflow-editor.inputSchema")),gI(2),xD(e.workflow().inputSchema),gI(3),nl(" ",Ow(44,36,"workflow-editor.addInputField")," "),gI(2),ch("nzTitle",Ow(46,38,"workflow-editor.steps")),gI(2),_D(e.duplicateStepIds().length>0?47:-1),gI(),ch("steps",e.workflow().steps)("rootSteps",e.workflow().steps)("availableWorkflows",e.availableWorkflows());}}var So=(()=>{class i{constructor(){this.route=C(W),this.router=C(ue),this.workflowsApi=C(U),this.message=C(fr),this.destroyRef=C(at),this.transloco=C(ar),this.language=C(O),this.routeId=Zn$1(this.route.paramMap.pipe(Se(e=>e.get("id"))),{initialValue:this.route.snapshot.paramMap.get("id")}),this.workflow=qo(I()),this.availableWorkflows=qo([]),this.loadError=qo(null),this.validationErrors=qo([]),this.duplicateStepIds=qo([]),this.saving=qo(false),this.loading=qo(true),this.isNew=Hw(()=>!this.routeId()),this.pageTitle=Hw(()=>(this.language.currentLang(),this.isNew()?this.transloco.translate("workflow-editor.titleNew"):this.transloco.translate("workflow-editor.titleEdit",{id:this.workflow().id||this.routeId()}))),this.subjectTypes=["none","ticket","pull_request","documentation"],this.cardinalities=["single","batch","aggregate"],this.notificationTriggers=["on_fail","on_complete","on_needs_input"],this.inputFieldTypes=["string","number","boolean","select"],this.workflowsApi.list().pipe(Rt(this.destroyRef)).subscribe({next:e=>this.availableWorkflows.set(e),error:()=>{}}),this.route.paramMap.pipe(Rt(this.destroyRef)).subscribe(e=>{let n=e.get("id");if(this.validationErrors.set([]),this.duplicateStepIds.set([]),this.loadError.set(null),!n){this.workflow.set(I()),this.loading.set(false);return}this.loading.set(true),this.workflowsApi.get(n).subscribe({next:t=>{this.workflow.set(s(r({},structuredClone(t)),{steps:g(t.steps,{idAutoSync:false})})),this.loading.set(false);},error:t=>{this.loading.set(false),this.loadError.set(this.errorMessage(t,`Failed to load workflow ${n}`));}});});}subjectTypeKey(e){return `workflow-editor.subjectType.${e}`}cardinalityKey(e){return `workflow-editor.cardinality.${e}`}triggerKey(e){return `workflow-editor.trigger.${e}`}inputTypeKey(e){return `workflow-editor.inputType.${e}`}patchWorkflow(e){this.workflow.update(n=>r(r({},n),e));}setAppliesTo(e){this.patchWorkflow({appliesTo:e});}appliesToValue(){let e=this.workflow().appliesTo;return Array.isArray(e)?e[0]??"none":e}hasTrigger(e){return this.workflow().notificationPolicy.triggers.includes(e)}toggleTrigger(e,n){let t=this.workflow().notificationPolicy.triggers,o=n?[...new Set([...t,e])]:t.filter(d=>d!==e);this.patchWorkflow({notificationPolicy:s(r({},this.workflow().notificationPolicy),{triggers:o})});}onStepsChange(e){this.patchWorkflow({steps:e}),this.duplicateStepIds.set(Ud(e));}addInputField(){this.patchWorkflow({inputSchema:[...this.workflow().inputSchema,b()]});}removeInputField(e){this.patchWorkflow({inputSchema:this.workflow().inputSchema.filter((n,t)=>t!==e)});}patchInputField(e,n){let t=this.workflow().inputSchema.map((o,d)=>d===e?r(r({},o),n):o);this.patchWorkflow({inputSchema:t});}save(){let e=this.workflow(),n=Ud(e.steps);if(this.duplicateStepIds.set(n),n.length>0){this.validationErrors.set([this.transloco.translate("workflow-editor.duplicateStepIds",{ids:n.join(", ")})]);return}let t=v(e,{omitWorkflowId:this.isNew()}),o=b$.safeParse(t);if(!o.success){this.validationErrors.set(j(o.error));return}this.validationErrors.set([]),this.saving.set(true);let d=o.data,k=this.routeId();(this.isNew()||!k?this.workflowsApi.create(d):this.workflowsApi.update(k,s(r({},d),{id:k}))).subscribe({next:L=>{this.saving.set(false),this.workflow.set(s(r({},structuredClone(L)),{steps:g(L.steps,{idAutoSync:false})})),this.message.success(this.isNew()?"Workflow created":"Workflow saved"),this.isNew()&&this.router.navigate(["/workflows",L.id,"edit"]);},error:L=>{this.saving.set(false),this.message.error(this.errorMessage(L,"Save failed"));}});}errorMessage(e,n){return e instanceof qe||e instanceof Error?e.message:n}static{this.\u0275fac=function(n){return new(n||i)};}static{this.\u0275cmp=QE({type:i,selectors:[["app-workflow-editor"]],decls:15,vars:10,consts:[["data-testid","workflow-editor",1,"editor"],[1,"header"],[1,"header-actions"],["routerLink","/jobs"],["nz-button","","nzType","primary","type","button","data-testid","save-button",3,"click","nzLoading","disabled"],["data-testid","loading"],["data-testid","load-error",1,"error"],["data-testid","validation-errors",1,"errors"],[3,"nzTitle"],[1,"grid"],[1,"field"],["nz-input","","data-testid","workflow-name",3,"ngModelChange","ngModel"],["data-testid","workflow-applies-to",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],["data-testid","workflow-cardinality",3,"ngModelChange","ngModel"],["nz-input","","rows","2","data-testid","workflow-description",3,"ngModelChange","ngModel"],[1,"checkbox-row"],["nz-checkbox","",3,"ngModel"],["nz-input","",3,"ngModelChange","ngModel"],[1,"input-field-row"],["nz-button","","nzType","dashed","type","button",3,"click"],["data-testid","duplicate-step-ids",1,"error"],[3,"stepsChange","steps","rootSteps","availableWorkflows"],["nz-checkbox","",3,"ngModelChange","ngModel"],[3,"ngModelChange","ngModel"],["nz-button","","nzDanger","","type","button",3,"click"]],template:function(n,t){n&1&&(_i(0,"main",0)(1,"header",1)(2,"div")(3,"h1"),vw(4),Kc()(),_i(5,"div",2)(6,"a",3),vw(7),Rw(8,"transloco"),Kc(),_i(9,"button",4),gh("click",function(){return t.save()}),vw(10),Rw(11,"transloco"),Kc()()(),bD(12,ii,3,3,"p",5)(13,oi,2,1,"p",6)(14,mi,49,40),Kc()),n&2&&(gI(4),Ph(t.pageTitle()),gI(3),Ph(Ow(8,6,"workflow-editor.backToJobs")),gI(2),ch("nzLoading",t.saving())("disabled",t.loading()||!!t.loadError()),gI(),nl(" ",Ow(11,8,"common.save")," "),gI(2),_D(t.loading()?12:t.loadError()?13:14));},dependencies:[Fn,n8,S4,J6,k3,Mt,sd,zc,t7,y7,Nt,Ke$1,Fe,oe,Ki,x,$b,V5,D5,qt,ec],styles:[".editor[_ngcontent-%COMP%]{max-width:56rem;margin:0 auto;padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}.header-actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.lede[_ngcontent-%COMP%]{margin:.25rem 0 0;color:#57534e}.grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:.75rem 1rem}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.5rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.checkbox-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.75rem;margin-bottom:.5rem}.input-field-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr 8rem auto auto;gap:.5rem;align-items:end;margin-bottom:.5rem}.input-field-row[_ngcontent-%COMP%] > .field[_ngcontent-%COMP%]{margin:0}.errors[_ngcontent-%COMP%]{border:1px solid #fecdd3;background:#fff1f2;padding:.75rem 1rem}.errors[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 .35rem;font-size:1rem}.error[_ngcontent-%COMP%]{color:#9f1239}"]});}}return i})();export{So as WorkflowEditorComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {j}from'./chunk--cAlvNjP.js';import {f as fr,K as Ki,x}from'./chunk-C5kOvUkS.js';import {w as w$}from'./chunk-CbG3rfKf.js';import {C,W,I as ue$1,ba as u,b as at,a as ar,ac as O,ad as Zn,ae as Se,q as qo,H as Hw,R as Rt,r,c as qe,Q as QE,F as Fn,n as n8,af as S4,J as J6,k as k3,M as Mt,d as sd,z as zc,e as t7,Z as y7,$ as $b,V as V5,D as D5,f as ec,g as _i,v as vw,K as Kc,h as Rw,j as gh,m as bD,p as gI,P as Ph,O as Ow,w as ch,u as nl,A as _D,B as VD,L as LD,o as oE,N as ND,x as sE,y as xD,S as SD,l as lh,E as Pu,G as Lu}from'./main-5C7K2447.js';import {J,K}from'./chunk-D6KYmz2w.js';import {U}from'./chunk-VW6e_Kls.js';import'./chunk-DS5k0b_s.js';var me=(t,s)=>s.id;function ue(t,s){t&1&&(_i(0,"p",5),vw(1),Rw(2,"transloco"),Kc()),t&2&&(gI(),Ph(Ow(2,1,"common.loading")));}function he(t,s){if(t&1&&(_i(0,"p",6),vw(1),Kc()),t&2){let e=VD();gI(),Ph(e.loadError());}}function fe(t,s){if(t&1&&(_i(0,"li"),vw(1),Kc()),t&2){let e=s.$implicit;gI(),Ph(e);}}function ge(t,s){if(t&1&&(_i(0,"section",7)(1,"h2"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"ul"),ND(5,fe,2,1,"li",null,SD),Kc()()),t&2){let e=VD(2);gI(2),Ph(Ow(3,1,"shortcuts.editor.validation")),gI(3),xD(e.validationErrors());}}function _e(t,s){if(t&1&&lh(0,"nz-option",11),t&2){let e=s.$implicit;ch("nzValue",e.id)("nzLabel",e.name);}}function we(t,s){if(t&1){let e=LD();_i(0,"app-workflow-input-form",13),gh("valuesChange",function(i){Pu(e);let u=VD(2);return Lu(u.setInputValues(i))}),Kc();}if(t&2){let e=VD(2);ch("fields",s.inputSchema)("values",e.inputValues());}}function ve(t,s){if(t&1){let e=LD();bD(0,ge,7,3,"section",7),_i(1,"label",8)(2,"span"),vw(3),Rw(4,"transloco"),Kc(),_i(5,"input",9),gh("ngModelChange",function(i){Pu(e);let u=VD();return Lu(u.name.set(i))}),Kc(),oE(),Kc(),_i(6,"div",8)(7,"span"),vw(8),Rw(9,"transloco"),Kc(),_i(10,"nz-select",10),gh("ngModelChange",function(i){Pu(e);let u=VD();return Lu(u.onWorkflowChange(i))}),ND(11,_e,1,2,"nz-option",11,me),Kc(),oE(),Kc(),bD(13,we,1,2,"app-workflow-input-form",12);}if(t&2){let e,o=VD();_D(o.validationErrors().length>0?0:-1),gI(3),Ph(Ow(4,6,"shortcuts.editor.name")),gI(2),ch("ngModel",o.name()),sE(),gI(3),Ph(Ow(9,8,"shortcuts.editor.workflow")),gI(2),ch("ngModel",o.workflowId()),sE(),gI(),xD(o.eligibleWorkflows()),gI(2),_D((e=o.selectedWorkflow())?13:-1,e);}}function Ce(t){let s=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),e=crypto.randomUUID().slice(0,8);return s.length>0?`sc-${s}-${e}`:`sc-${e}`}var Ze=(()=>{class t{constructor(){this.route=C(W),this.router=C(ue$1),this.shortcutsApi=C(u),this.workflowsApi=C(U),this.message=C(fr),this.destroyRef=C(at),this.transloco=C(ar),this.language=C(O),this.routeId=Zn(this.route.paramMap.pipe(Se(e=>e.get("id"))),{initialValue:this.route.snapshot.paramMap.get("id")}),this.name=qo(""),this.workflowId=qo(""),this.workflows=qo([]),this.inputValues=qo({}),this.lastJobId=qo(void 0),this.loadError=qo(null),this.validationErrors=qo([]),this.saving=qo(false),this.loading=qo(true),this.isNew=Hw(()=>!this.routeId()),this.pageTitle=Hw(()=>(this.language.currentLang(),this.isNew()?this.transloco.translate("shortcuts.editor.titleNew"):this.transloco.translate("shortcuts.editor.titleEdit",{id:this.routeId()}))),this.eligibleWorkflows=Hw(()=>this.workflows().filter(e=>e.appliesTo==="none"&&e.cardinality==="single")),this.selectedWorkflow=Hw(()=>this.eligibleWorkflows().find(e=>e.id===this.workflowId())??null),this.workflowsApi.list().pipe(Rt(this.destroyRef)).subscribe({next:e=>this.workflows.set(e),error:e=>{this.workflows.set([]),this.message.error(this.errorMessage(e,this.transloco.translate("shortcuts.editor.loadFailed")));}}),this.route.paramMap.pipe(Rt(this.destroyRef)).subscribe(e=>{let o=e.get("id");if(this.validationErrors.set([]),this.loadError.set(null),!o){this.name.set(""),this.workflowId.set(""),this.inputValues.set({}),this.lastJobId.set(void 0),this.loading.set(false);return}this.loading.set(true),this.shortcutsApi.get(o).subscribe({next:i=>{this.name.set(i.name),this.workflowId.set(i.workflowId),this.inputValues.set(i.inputValues),this.lastJobId.set(i.lastJobId),this.loading.set(false);},error:i=>{this.loading.set(false),this.loadError.set(this.errorMessage(i,this.transloco.translate("shortcuts.editor.loadFailed")));}});});}onWorkflowChange(e){this.workflowId.set(e);let o=this.eligibleWorkflows().find(i=>i.id===e);this.inputValues.set(J(o?.inputSchema??[]));}setInputValues(e){this.inputValues.set(e);}save(){let e=this.routeId(),o=r({id:e??Ce(this.name()),name:this.name().trim(),workflowId:this.workflowId(),inputValues:this.inputValues()},this.lastJobId()?{lastJobId:this.lastJobId()}:{}),i=w$.safeParse(o);if(!i.success){this.validationErrors.set(j(i.error));return}this.validationErrors.set([]),this.saving.set(true),(this.isNew()||!e?this.shortcutsApi.create(i.data):this.shortcutsApi.update(e,i.data)).subscribe({next:b=>{this.saving.set(false),this.message.success(this.transloco.translate(this.isNew()?"shortcuts.editor.created":"shortcuts.editor.saved")),this.isNew()&&this.router.navigate(["/shortcuts",b.id,"edit"]);},error:b=>{this.saving.set(false),this.message.error(this.errorMessage(b,this.transloco.translate("shortcuts.editor.saveFailed")));}});}errorMessage(e,o){return e instanceof qe||e instanceof Error?e.message:o}static{this.\u0275fac=function(o){return new(o||t)};}static{this.\u0275cmp=QE({type:t,selectors:[["app-shortcut-editor"]],decls:15,vars:10,consts:[["data-testid","shortcut-editor",1,"editor"],[1,"header"],[1,"header-actions"],["routerLink","/shortcuts"],["nz-button","","nzType","primary","type","button","data-testid","save-button",3,"click","nzLoading","disabled"],["data-testid","loading"],["data-testid","load-error",1,"error"],["data-testid","validation-errors",1,"errors"],[1,"field"],["nz-input","","data-testid","shortcut-name",3,"ngModelChange","ngModel"],["data-testid","shortcut-workflow",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],[3,"fields","values"],[3,"valuesChange","fields","values"]],template:function(o,i){o&1&&(_i(0,"main",0)(1,"header",1)(2,"div")(3,"h1"),vw(4),Kc()(),_i(5,"div",2)(6,"a",3),vw(7),Rw(8,"transloco"),Kc(),_i(9,"button",4),gh("click",function(){return i.save()}),vw(10),Rw(11,"transloco"),Kc()()(),bD(12,ue,3,3,"p",5)(13,he,2,1,"p",6)(14,ve,14,10),Kc()),o&2&&(gI(4),Ph(i.pageTitle()),gI(3),Ph(Ow(8,6,"shortcuts.editor.backToList")),gI(2),ch("nzLoading",i.saving())("disabled",i.loading()||!!i.loadError()),gI(),nl(" ",Ow(11,8,"common.save")," "),gI(2),_D(i.loading()?12:i.loadError()?13:14));},dependencies:[Fn,n8,S4,J6,k3,Mt,sd,zc,t7,y7,Ki,x,$b,V5,D5,K,ec],styles:[".editor[_ngcontent-%COMP%]{max-width:40rem;margin:0 auto;padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}.header-actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.5rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.errors[_ngcontent-%COMP%]{border:1px solid #fecdd3;background:#fff1f2;padding:.75rem 1rem}.errors[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 .35rem;font-size:1rem}.error[_ngcontent-%COMP%]{color:#9f1239}"]});}}return t})();export{Ze as ShortcutEditorComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {u}from'./chunk-4TrlkpZx.js';import {_ as _n,C as Cn}from'./chunk-BqWiMcNp.js';import'./chunk-CbG3rfKf.js';import {C,aZ as U,a as ar,b as at,q as qo,R as Rt,a9 as Ng,c as qe,Q as QE,F as Fn,M as Mt,d as sd,z as zc,e as t7,f as ec,g as _i,v as vw,h as Rw,K as Kc,m as bD,p as gI,P as Ph,O as Ow,u as nl,A as _D,B as VD,N as ND,w as ch,y as xD,L as LD,j as gh,a5 as ah,a3 as xw,E as Pu,G as Lu}from'./main-5C7K2447.js';import {U as U$1}from'./chunk-VW6e_Kls.js';import {W,I}from'./chunk-CECejZs9.js';import {d as dr,c as ca,r as rr,o as oa,s as sr,V as Vn,p as pa}from'./chunk-BaL0hYvK.js';import'./chunk-Ca9rxJZS.js';import'./chunk-DS5k0b_s.js';var ee=t=>["/views",t],te=t=>["/views",t,"edit"],ie=(t,p)=>p.id;function ne(t,p){t&1&&(_i(0,"p",3),vw(1),Rw(2,"transloco"),Kc()),t&2&&(gI(),Ph(Ow(2,1,"common.loading")));}function oe(t,p){if(t&1&&(_i(0,"p",4),vw(1),Kc()),t&2){let e=VD();gI(),Ph(e.loadError());}}function re(t,p){if(t&1&&(_i(0,"p",5),vw(1),Kc()),t&2){let e=VD(2);gI(),Ph(e.deleteError());}}function ae(t,p){t&1&&(_i(0,"section",6)(1,"p"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"a",8),vw(5),Rw(6,"transloco"),Kc()()),t&2&&(gI(2),Ph(Ow(3,2,"views.list.emptyState")),gI(3),nl(" ",Ow(6,4,"views.list.emptyCreateButton")," "));}function le(t,p){if(t&1){let e=LD();_i(0,"tr")(1,"td")(2,"a",9),vw(3),Kc()(),_i(4,"td")(5,"nz-tag"),vw(6),Rw(7,"transloco"),Kc()(),_i(8,"td")(9,"nz-tag"),vw(10),Kc()(),_i(11,"td",10)(12,"code"),vw(13),Kc()(),_i(14,"td",11)(15,"a",12),vw(16),Rw(17,"transloco"),Kc(),_i(18,"button",13),Rw(19,"transloco"),Rw(20,"transloco"),Rw(21,"transloco"),gh("nzOnConfirm",function(){let u=Pu(e).$implicit,Z=VD(3);return Lu(Z.deleteView(u.id))}),vw(22),Rw(23,"transloco"),Kc()()();}if(t&2){let e=p.$implicit,r=VD(3);ah("data-testid","view-"+e.id),gI(2),ch("routerLink",xw(30,ee,e.id)),ah("data-testid","name-"+e.id),gI(),nl(" ",e.name," "),gI(2),ah("data-testid","subject-type-"+e.id),gI(),Ph(Ow(7,18,r.subjectTypeKey(e.subjectType))),gI(3),ah("data-testid","workflow-"+e.id),gI(),Ph(r.workflowName(e)),gI(2),ah("data-testid","query-"+e.id),gI(),Ph(r.queryText(e)),gI(2),ch("routerLink",xw(32,te,e.id)),ah("data-testid","edit-"+e.id),gI(),nl(" ",Ow(17,20,"views.list.edit")," "),gI(2),ch("nzPopconfirmTitle",Ow(19,22,"views.list.deleteConfirm"))("nzOkText",Ow(20,24,"views.list.delete"))("nzCancelText",Ow(21,26,"common.cancel")),ah("data-testid","delete-"+e.id),gI(4),nl(" ",Ow(23,28,"views.list.delete")," ");}}function se(t,p){if(t&1&&(_i(0,"nz-table",7)(1,"thead")(2,"tr")(3,"th"),vw(4),Rw(5,"transloco"),Kc(),_i(6,"th"),vw(7),Rw(8,"transloco"),Kc(),_i(9,"th"),vw(10),Rw(11,"transloco"),Kc(),_i(12,"th"),vw(13),Rw(14,"transloco"),Kc(),_i(15,"th"),vw(16),Rw(17,"transloco"),Kc()()(),_i(18,"tbody"),ND(19,le,24,34,"tr",null,ie),Kc()()),t&2){let e=VD(2);ch("nzData",e.views())("nzFrontPagination",false)("nzShowPagination",false),gI(4),Ph(Ow(5,8,"views.list.column.name")),gI(3),Ph(Ow(8,10,"views.list.column.subjectType")),gI(3),Ph(Ow(11,12,"views.list.column.workflow")),gI(3),Ph(Ow(14,14,"views.list.column.query")),gI(3),Ph(Ow(17,16,"views.list.column.actions")),gI(3),xD(e.views());}}function de(t,p){if(t&1&&(bD(0,re,2,1,"p",5),bD(1,ae,7,6,"section",6)(2,se,21,18,"nz-table",7)),t&2){let e=VD();_D(e.deleteError()?0:-1),gI(),_D(e.views().length===0?1:2);}}var Be=(()=>{class t{constructor(){this.viewsApi=C(U),this.workflowsApi=C(U$1),this.transloco=C(ar),this.destroyRef=C(at),this.views=qo([]),this.workflows=qo([]),this.loading=qo(true),this.loadError=qo(null),this.deleteError=qo(null),this.load();}subjectTypeKey(e){return `workflow-editor.subjectType.${e}`}workflowName(e){return this.workflows().find(r=>r.id===e.workflowId)?.name??e.workflowId}queryText(e){return u(e.query)}deleteView(e){this.deleteError.set(null),this.viewsApi.delete(e).pipe(Rt(this.destroyRef)).subscribe({next:()=>{this.views.update(r=>r.filter(u=>u.id!==e));},error:r=>{this.deleteError.set(this.errorMessage(r,this.transloco.translate("views.list.deleteFailed")));}});}load(){this.loading.set(true),this.loadError.set(null),Ng({views:this.viewsApi.list(),workflows:this.workflowsApi.list()}).pipe(Rt(this.destroyRef)).subscribe({next:({views:e,workflows:r})=>{this.views.set(e),this.workflows.set(r),this.loading.set(false);},error:e=>{this.loading.set(false),this.loadError.set(this.errorMessage(e,this.transloco.translate("views.list.loadFailed")));}});}errorMessage(e,r){return e instanceof qe||e instanceof Error?e.message:r}static{this.\u0275fac=function(r){return new(r||t)};}static{this.\u0275cmp=QE({type:t,selectors:[["app-view-list"]],decls:11,vars:7,consts:[["data-testid","views-list",1,"list-page"],[1,"header"],["nz-button","","nzType","primary","routerLink","/views/new","data-testid","create-view"],["data-testid","loading"],["data-testid","load-error",1,"error"],["data-testid","delete-error",1,"error"],["data-testid","empty-state",1,"empty"],["data-testid","view-items",3,"nzData","nzFrontPagination","nzShowPagination"],["nz-button","","nzType","primary","routerLink","/views/new","data-testid","empty-create"],[3,"routerLink"],[1,"query-cell"],[1,"actions"],["nz-button","","nzType","link",3,"routerLink"],["nz-button","","nzType","link","nzDanger","","type","button","nz-popconfirm","",3,"nzOnConfirm","nzPopconfirmTitle","nzOkText","nzCancelText"]],template:function(r,u){r&1&&(_i(0,"main",0)(1,"header",1)(2,"h1"),vw(3),Rw(4,"transloco"),Kc(),_i(5,"a",2),vw(6),Rw(7,"transloco"),Kc()(),bD(8,ne,3,3,"p",3)(9,oe,2,1,"p",4)(10,de,3,2),Kc()),r&2&&(gI(3),Ph(Ow(4,3,"views.list.title")),gI(3),nl(" ",Ow(7,5,"views.list.createButton")," "),gI(2),_D(u.loading()?8:u.loadError()?9:10));},dependencies:[Fn,Mt,sd,zc,t7,_n,Cn,dr,ca,rr,oa,sr,Vn,pa,W,I,ec],styles:[".list-page[_ngcontent-%COMP%]{max-width:72rem;margin:0 auto;padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}.empty[_ngcontent-%COMP%]{text-align:center;padding:2.5rem 1rem;border:1px dashed #d6d3d1;background:#fff9}.empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 1rem;color:#57534e}.error[_ngcontent-%COMP%]{color:#9f1239}.actions[_ngcontent-%COMP%]{white-space:nowrap}[_nghost-%COMP%] td.query-cell{overflow-wrap:anywhere;word-break:break-word;max-width:28rem;vertical-align:top}[_nghost-%COMP%] .ant-table-tbody>tr>td{white-space:normal;vertical-align:top}code[_ngcontent-%COMP%]{font-family:ui-monospace,Consolas,monospace;font-size:.85rem}"]});}}return t})();export{Be as ViewListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a0 as $0,a1 as B0,s,r,Q as QE,F as Fn,
|
|
1
|
+
import {a0 as $0,a1 as B0,s,r,Q as QE,F as Fn,cB as Jc,N as ND,cD as Xc,p as gI,y as xD,v as vw,m as bD,u as nl,A as _D,L as LD,cG as mh,B as VD,cA as ph,a5 as ah,S as SD,a6 as Nw,P as Ph,E as Pu,G as Lu}from'./main-5C7K2447.js';var P=()=>[],$=(t,r)=>r.name;function S(t,r){t&1&&(Jc(0,"span",1),vw(1,"*"),Xc());}function O(t,r){if(t&1){let e=LD();Jc(0,"input",6),mh("change",function(o){Pu(e);let a=VD().$implicit,c=VD();return Lu(c.setValue(a,o))}),Xc();}if(t&2){let e=VD().$implicit,n=VD();ph("checked",n.checked(e)),ah("data-testid","input-"+e.name);}}function D(t,r){if(t&1){let e=LD();Jc(0,"input",7),mh("input",function(o){Pu(e);let a=VD().$implicit,c=VD();return Lu(c.setValue(a,o))}),Xc();}if(t&2){let e=VD().$implicit,n=VD();ph("value",n.displayValue(e)),ah("data-testid","input-"+e.name);}}function L(t,r){if(t&1&&(Jc(0,"option",4),vw(1),Xc()),t&2){let e=r.$implicit;ph("value",e),gI(),Ph(e);}}function q(t,r){if(t&1){let e=LD();Jc(0,"select",8),mh("change",function(o){Pu(e);let a=VD().$implicit,c=VD();return Lu(c.setValue(a,o))}),ND(1,L,2,2,"option",4,SD),Xc();}if(t&2){let e=VD().$implicit,n=VD();ph("value",n.displayValue(e)),ah("data-testid","input-"+e.name),gI(),xD(e.options??Nw(2,P));}}function N(t,r){if(t&1){let e=LD();Jc(0,"input",9),mh("input",function(o){Pu(e);let a=VD().$implicit,c=VD();return Lu(c.setValue(a,o))}),Xc();}if(t&2){let e=VD().$implicit,n=VD();ph("value",n.displayValue(e)),ah("data-testid","input-"+e.name);}}function B(t,r){if(t&1&&(Jc(0,"label"),vw(1),bD(2,S,2,0,"span",1),bD(3,O,1,2,"input",2)(4,D,1,2,"input",3)(5,q,3,3,"select",4)(6,N,1,2,"input",5),Xc()),t&2){let e,n=r.$implicit;gI(),nl(" ",n.label," "),gI(),_D(n.required?2:-1),gI(),_D((e=n.type)==="boolean"?3:e==="number"?4:e==="select"?5:6);}}function z(t){if(t.defaultValue!==void 0)return t.defaultValue;switch(t.type){case "boolean":return false;case "number":return "";case "select":return t.options?.[0]??"";default:return ""}}function J(t){let r={};for(let e of t)r[e.name]=z(e);return r}var K=(()=>{class t{constructor(){this.fields=$0([]),this.values=$0({}),this.valuesChange=B0();}displayValue(e){let n=this.values()[e.name];return n==null?"":String(n)}checked(e){return !!this.values()[e.name]}setValue(e,n){let o=n.target,a=o.value;e.type==="boolean"?a=o.checked:e.type==="number"&&(a=o.value===""?"":Number(o.value)),this.valuesChange.emit(s(r({},this.values()),{[e.name]:a}));}static{this.\u0275fac=function(n){return new(n||t)};}static{this.\u0275cmp=QE({type:t,selectors:[["app-workflow-input-form"]],inputs:{fields:[1,"fields"],values:[1,"values"]},outputs:{valuesChange:"valuesChange"},decls:3,vars:0,consts:[["data-testid","workflow-input-form",1,"input-form"],[1,"required"],["type","checkbox",3,"checked"],["type","number",3,"value"],[3,"value"],["type","text",3,"value"],["type","checkbox",3,"change","checked"],["type","number",3,"input","value"],[3,"change","value"],["type","text",3,"input","value"]],template:function(n,o){n&1&&(Jc(0,"div",0),ND(1,B,7,3,"label",null,$),Xc()),n&2&&(gI(),xD(o.fields()));},dependencies:[Fn],styles:["label[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.75rem 0;font-size:.95rem}input[type=text][_ngcontent-%COMP%], input[type=number][_ngcontent-%COMP%], select[_ngcontent-%COMP%]{font:inherit;padding:.4rem .5rem;border:1px solid #a8a29e;background:#fff}input[type=checkbox][_ngcontent-%COMP%]{width:1.1rem;height:1.1rem}.required[_ngcontent-%COMP%]{color:#9f1239}"]});}}return t})();export{J,K};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {J,K as K$1}from'./chunk-
|
|
1
|
+
import {J,K as K$1}from'./chunk-D6KYmz2w.js';import {U}from'./chunk-VW6e_Kls.js';import {C,U as U$1,I as ue,a as ar,W,q as qo,H as Hw,s,r,c as qe,Q as QE,F as Fn,M as Mt,f as ec,g as _i,v as vw,h as Rw,K as Kc,m as bD,j as gh,N as ND,p as gI,P as Ph,O as Ow,A as _D,u as nl,w as ch,y as xD,B as VD,T as Lh,L as LD,E as Pu,G as Lu}from'./main-5C7K2447.js';var L=(t,p)=>p.id;function $(t,p){if(t&1&&(_i(0,"p",3),vw(1),Kc()),t&2){let e=VD();gI(),Ph(e.loadError());}}function z(t,p){if(t&1&&(_i(0,"option",6),vw(1),Kc()),t&2){let e=p.$implicit;ch("value",e.id),gI(),Lh("",e.name," (",e.id,")");}}function G(t,p){if(t&1){let e=LD();_i(0,"label"),vw(1),Rw(2,"transloco"),_i(3,"input",10),Rw(4,"transloco"),gh("input",function(o){Pu(e);let s=VD(2);return Lu(s.setSubjectId(o))}),Kc()();}if(t&2){let e=VD(2);gI(),nl(" ",Ow(2,3,"jobs.start.subjectId")," "),gI(2),ch("value",e.subjectId())("placeholder",Ow(4,5,"jobs.start.subjectIdPlaceholder"));}}function H(t,p){if(t&1){let e=LD();bD(0,G,5,7,"label"),_i(1,"app-workflow-input-form",9),gh("valuesChange",function(o){Pu(e);let s=VD();return Lu(s.inputValues.set(o))}),Kc();}if(t&2){let e=VD();_D(e.needsSubjectId()?0:-1),gI(),ch("fields",p.inputSchema)("values",e.inputValues());}}function K(t,p){if(t&1&&(_i(0,"p",8),vw(1),Kc()),t&2){let e=VD();gI(),Ph(e.actionError());}}var re=(()=>{class t{constructor(){this.workflowsApi=C(U),this.jobsApi=C(U$1),this.router=C(ue),this.transloco=C(ar),this.route=C(W),this.workflows=qo([]),this.selectedWorkflowId=qo(""),this.subjectId=qo(""),this.inputValues=qo({}),this.loadError=qo(null),this.actionError=qo(null),this.starting=qo(false),this.selectedWorkflow=Hw(()=>this.workflows().find(e=>e.id===this.selectedWorkflowId())??null),this.needsSubjectId=Hw(()=>{let e=this.selectedWorkflow();return e!=null&&e.appliesTo!=="none"}),this.workflowsApi.list({cardinality:"single"}).subscribe({next:e=>{this.workflows.set(e);let n=this.route.snapshot.queryParamMap.get("workflowId"),o=n&&e.some(C=>C.id===n)?n:e[0]?.id;o&&this.selectWorkflow(o);let s=this.route.snapshot.queryParamMap.get("subjectId");s&&this.subjectId.set(s);},error:e=>{this.loadError.set(this.errorMessage(e,this.transloco.translate("jobs.errors.loadWorkflows")));}});}selectWorkflow(e){this.selectedWorkflowId.set(e);let n=this.workflows().find(o=>o.id===e);this.inputValues.set(J(n?.inputSchema??[])),this.actionError.set(null);}onWorkflowChange(e){let n=e.target.value;this.selectWorkflow(n);}setSubjectId(e){this.subjectId.set(e.target.value);}start(){let e=this.selectedWorkflow();if(e){if(this.needsSubjectId()&&!this.subjectId().trim()){this.actionError.set(this.transloco.translate("jobs.errors.subjectIdRequired"));return}this.actionError.set(null),this.starting.set(true),this.jobsApi.start(s(r({workflowId:e.id},this.needsSubjectId()?{subjectId:this.subjectId().trim()}:{}),{inputValues:r({},this.inputValues())})).subscribe({next:n=>{this.starting.set(false),this.router.navigate(["/jobs",n.id]);},error:n=>{this.starting.set(false),this.actionError.set(this.errorMessage(n,this.transloco.translate("jobs.errors.startFailed")));}});}}errorMessage(e,n){return e instanceof qe||e instanceof Error?e.message:n}static{this.\u0275fac=function(n){return new(n||t)};}static{this.\u0275cmp=QE({type:t,selectors:[["app-job-runner"]],decls:26,vars:23,consts:[[1,"runner"],["routerLink","/jobs"],[1,"lede"],["data-testid","load-error",1,"error"],["data-testid","start-form",1,"panel"],["data-testid","workflow-select",3,"change","value"],[3,"value"],["data-testid","start-button","type","button",3,"click","disabled"],["data-testid","action-error",1,"error"],[3,"valuesChange","fields","values"],["data-testid","subject-id","type","text",3,"input","value","placeholder"]],template:function(n,o){if(n&1&&(_i(0,"main",0)(1,"a",1),vw(2),Rw(3,"transloco"),Kc(),_i(4,"h1"),vw(5),Rw(6,"transloco"),Kc(),_i(7,"p",2),vw(8),Rw(9,"transloco"),Kc(),bD(10,$,2,1,"p",3),_i(11,"section",4)(12,"h2"),vw(13),Rw(14,"transloco"),Kc(),_i(15,"label"),vw(16),Rw(17,"transloco"),_i(18,"select",5),gh("change",function(C){return o.onWorkflowChange(C)}),ND(19,z,2,3,"option",6,L),Kc()(),bD(21,H,2,3),_i(22,"button",7),gh("click",function(){return o.start()}),vw(23),Rw(24,"transloco"),Kc()(),bD(25,K,2,1,"p",8),Kc()),n&2){let s;gI(2),Ph(Ow(3,11,"jobs.detail.backToStart")),gI(3),Ph(Ow(6,13,"jobs.title")),gI(3),Ph(Ow(9,15,"jobs.lede")),gI(2),_D(o.loadError()?10:-1),gI(3),Ph(Ow(14,17,"jobs.start.heading")),gI(3),nl(" ",Ow(17,19,"jobs.start.workflow")," "),gI(2),ch("value",o.selectedWorkflowId()),gI(),xD(o.workflows()),gI(2),_D((s=o.selectedWorkflow())?21:-1,s),gI(),ch("disabled",o.starting()),gI(),nl(" ",Ow(24,21,o.starting()?"jobs.start.starting":"jobs.start.button")," "),gI(2),_D(o.actionError()?25:-1);}},dependencies:[Fn,Mt,K$1,ec],styles:[".runner[_ngcontent-%COMP%]{max-width:52rem;margin:0 auto;padding:1.5rem;color:#1c1917;line-height:1.45}.lede[_ngcontent-%COMP%]{color:#57534e}.panel[_ngcontent-%COMP%]{margin-top:1.25rem;padding:1rem 0;border-top:1px solid #d6d3d1}label[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.75rem 0;font-size:.95rem}input[type=text][_ngcontent-%COMP%], select[_ngcontent-%COMP%]{font:inherit;padding:.4rem .5rem;border:1px solid #a8a29e;background:#fff}button[_ngcontent-%COMP%]{font:inherit;margin-top:.5rem;padding:.45rem .9rem;border:1px solid #44403c;background:#f5f5f4;cursor:pointer}button[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.error[_ngcontent-%COMP%]{color:#9f1239}"]});}}return t})();export{re as JobRunnerComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {C,
|
|
1
|
+
import {C,d2 as ms,R as Rt,c5 as Wl,ae as Se,bK as Kg,i as ie,cf as oe,b as at,bf as re,d3 as Dr,d4 as Qg,bk as Ul}from'./main-5C7K2447.js';var u=()=>{},R=(()=>{class e{ngZone=C(oe);destroyRef=C(at);resizeSource$=new re;listeners=0;renderer=C(Dr).createRenderer(null,null);disposeHandle=u;handler=()=>{this.ngZone.run(()=>{this.resizeSource$.next();});};constructor(){this.destroyRef.onDestroy(()=>{this.handler=u;});}connect(){return this.registerListener(),this.resizeSource$.pipe(Qg(16),Ul(()=>this.unregisterListener()))}disconnet(){this.unregisterListener();}registerListener(){this.listeners===0&&this.ngZone.runOutsideAngular(()=>{this.disposeHandle=this.renderer.listen("window","resize",this.handler);}),this.listeners+=1;}unregisterListener(){this.listeners-=1,this.listeners===0&&(this.disposeHandle(),this.disposeHandle=u);}static \u0275fac=function(n){return new(n||e)};static \u0275prov=ie({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),$=(()=>{class e{get singletonRegistry(){return this._singletonRegistry}_singletonRegistry=new Map;registerSingletonWithKey(t,n){let i=this.singletonRegistry.has(t),r=i?this.singletonRegistry.get(t):this.withNewTarget(n);i||this.singletonRegistry.set(t,r);}unregisterSingletonWithKey(t){this.singletonRegistry.has(t)&&this.singletonRegistry.delete(t);}getSingletonWithKey(t){return this.singletonRegistry.has(t)?this.singletonRegistry.get(t).target:null}withNewTarget(t){return {target:t}}static \u0275fac=function(n){return new(n||e)};static \u0275prov=ie({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var M=(function(e){return e.xxxl="xxxl",e.xxl="xxl",e.xl="xl",e.lg="lg",e.md="md",e.sm="sm",e.xs="xs",e})(M||{});var b={xs:"(max-width: 575px)",sm:"(min-width: 576px)",md:"(min-width: 768px)",lg:"(min-width: 992px)",xl:"(min-width: 1200px)",xxl:"(min-width: 1600px)",xxxl:"(min-width: 1920px)"};var z=(()=>{class e{resizeService=C(R);mediaMatcher=C(ms);constructor(){this.resizeService.connect().pipe(Rt()).subscribe();}subscribe(t,n){return n?this.resizeService.connect().pipe(Wl(void 0),Se(()=>this.matchMedia(t,true)),Kg((i,r)=>i[0]===r[0]),Se(i=>i[1])):this.resizeService.connect().pipe(Wl(void 0),Se(()=>this.matchMedia(t)),Kg())}matchMedia(t,n){let i=M.md,r={};return Object.keys(t).map(S=>{let d=S,g=this.mediaMatcher.matchMedia(b[d]).matches;r[d]=g,g&&(i=d);}),n?[i,r]:i}static \u0275fac=function(n){return new(n||e)};static \u0275prov=ie({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{$,M,R,b,z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {q as qo,H as Hw,a8 as sc,i as ie}from'./main-
|
|
1
|
+
import {q as qo,H as Hw,a8 as sc,i as ie}from'./main-5C7K2447.js';var f=(()=>{class e{connect(t){let n=new URLSearchParams;t?.jobId&&n.set("jobId",t.jobId),t?.batchId&&n.set("batchId",t.batchId);let r=n.toString(),p=`${sc.apiBaseUrl}/events${r?`?${r}`:""}`,a=qo([]),b=Hw(()=>{let o=a();return o.length>0?o[o.length-1]:void 0}),s=new EventSource(p);return s.onmessage=o=>{let c;try{c=JSON.parse(o.data);}catch(d){return}a.update(d=>[...d,c]);},{events:a.asReadonly(),latest:b,close:()=>{s.onmessage=null,s.close();}}}static{this.\u0275fac=function(n){return new(n||e)};}static{this.\u0275prov=ie({token:e,factory:e.\u0275fac,providedIn:"root"});}}return e})();export{f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {U}from'./chunk-
|
|
1
|
+
import {U}from'./chunk-jDfyi4_G.js';import {f}from'./chunk-DZ8K8fY1.js';import {v as vt}from'./chunk-BnjE7sDc.js';import {W as W$1,I}from'./chunk-CECejZs9.js';import'./chunk-BaL0hYvK.js';import'./chunk-Ca9rxJZS.js';import'./chunk-DS5k0b_s.js';import {C,W,U as U$1,a as ar,b as at,q as qo,R as Rt,X as rd,Y as Bw,c as qe,Q as QE,F as Fn,M as Mt,f as ec,g as _i,m as bD,K as Kc,p as gI,A as _D,v as vw,h as Rw,P as Ph,O as Ow,B as VD,l as lh,a2 as Pw,a3 as xw,w as ch}from'./main-5C7K2447.js';var z=i=>({count:i});function F(i,h){i&1&&(_i(0,"p",1),vw(1),Rw(2,"transloco"),Kc()),i&2&&(gI(),Ph(Ow(2,1,"common.loading")));}function K(i,h){if(i&1&&(_i(0,"p",2),vw(1),Kc()),i&2){let t=VD();gI(),Ph(t.loadError());}}function L(i,h){if(i&1&&(_i(0,"header",3)(1,"div")(2,"a",4),vw(3),Rw(4,"transloco"),Kc(),_i(5,"h1",5),vw(6),Kc(),_i(7,"p",6)(8,"nz-tag",7),vw(9),Rw(10,"transloco"),Kc(),_i(11,"span",8),vw(12),Kc(),vw(13," \xB7 "),_i(14,"span",9),vw(15),Rw(16,"transloco"),Kc(),vw(17," \xB7 "),_i(18,"span",10),vw(19),Rw(20,"transloco"),Kc()()()(),_i(21,"section",11)(22,"h2"),vw(23),Rw(24,"transloco"),Kc(),lh(25,"app-job-status-table",12),Kc()),i&2){let t=h,e=VD();gI(3),Ph(Ow(4,8,"batches.detail.backHint")),gI(3),Ph(t.id),gI(3),Ph(Ow(10,10,e.statusKey(t.status))),gI(3),Ph(t.workflowId),gI(3),Ph(Pw(16,12,"batches.detail.subjectCount",xw(19,z,t.resolvedSubjects.length))),gI(4),Ph(Ow(20,15,e.triggeredByKey(t.triggeredBy))),gI(4),Ph(Ow(24,17,"batches.detail.membersHeading")),gI(2),ch("jobs",e.memberJobs());}}var $=3e3;function g(i){return i!=="running"}var rt=(()=>{class i{constructor(){this.route=C(W),this.batchesApi=C(U),this.jobsApi=C(U$1),this.eventsService=C(f),this.transloco=C(ar),this.destroyRef=C(at),this.batch=qo(null),this.memberJobs=qo([]),this.loading=qo(true),this.loadError=qo(null),this.polling=qo(false),this.eventStream=qo(null),this.pollHandle=null,this.batchId=null,this.destroyRef.onDestroy(()=>{this.stopPolling(),this.closeStream();}),this.route.paramMap.pipe(Rt(this.destroyRef)).subscribe(t=>{let e=t.get("id");if(!e){this.loading.set(false),this.loadError.set(this.transloco.translate("batches.detail.loadFailed"));return}this.load(e);}),rd(()=>{let t=this.eventStream();if(!t)return;let e=t.latest();!e||e.type!=="batch_completed"||e.batchId===this.batchId&&Bw(()=>{this.refreshBatch(),this.refreshMembers(),this.stopPolling(),this.closeStream();});});}statusKey(t){return `batches.status.${t}`}triggeredByKey(t){return `batches.triggeredBy.${t}`}isPolling(){return this.polling()}load(t){this.batchId=t,this.loading.set(true),this.loadError.set(null),this.stopPolling(),this.closeStream(),this.batchesApi.get(t).pipe(Rt(this.destroyRef)).subscribe({next:e=>{this.batch.set(e),this.loading.set(false),this.refreshMembers(),g(e.status)||(this.startPolling(),this.eventStream.set(this.eventsService.connect({batchId:t})));},error:e=>{this.loading.set(false),this.loadError.set(this.errorMessage(e,this.transloco.translate("batches.detail.loadFailed")));}});}refreshBatch(){let t=this.batchId;t&&this.batchesApi.get(t).subscribe({next:e=>{this.batch.set(e),g(e.status)&&this.stopPolling();},error:()=>{}});}refreshMembers(){let t=this.batchId;t&&this.jobsApi.list({batchId:t}).subscribe({next:e=>this.memberJobs.set(e),error:()=>{}});}startPolling(){this.pollHandle==null&&(this.polling.set(true),this.pollHandle=setInterval(()=>{let t=this.batch();if(!t||g(t.status)){this.stopPolling();return}this.refreshMembers();},$));}stopPolling(){this.pollHandle!=null&&(clearInterval(this.pollHandle),this.pollHandle=null),this.polling.set(false);}closeStream(){let t=this.eventStream();t&&(t.close(),this.eventStream.set(null));}errorMessage(t,e){return t instanceof qe||t instanceof Error?t.message:e}static{this.\u0275fac=function(e){return new(e||i)};}static{this.\u0275cmp=QE({type:i,selectors:[["app-batch-detail"]],decls:4,vars:1,consts:[["data-testid","batch-detail",1,"detail-page"],["data-testid","loading"],["data-testid","load-error",1,"error"],[1,"header"],["routerLink","/views"],["data-testid","batch-id"],[1,"meta"],["data-testid","batch-status"],["data-testid","batch-workflow"],["data-testid","batch-subjects"],["data-testid","batch-triggered-by"],["data-testid","batch-members",1,"members"],[3,"jobs"]],template:function(e,p){if(e&1&&(_i(0,"main",0),bD(1,F,3,3,"p",1)(2,K,2,1,"p",2)(3,L,26,21),Kc()),e&2){let f;gI(),_D(p.loading()?1:p.loadError()?2:(f=p.batch())?3:-1,f);}},dependencies:[Fn,Mt,W$1,I,vt,ec],styles:[".detail-page[_ngcontent-%COMP%]{max-width:72rem;margin:0 auto;padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:1.35rem;word-break:break-all}.meta[_ngcontent-%COMP%]{margin:.35rem 0 0;color:#57534e;display:flex;flex-wrap:wrap;gap:.35rem;align-items:center}.members[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1.1rem}.error[_ngcontent-%COMP%]{color:#9f1239}"]});}}return i})();export{rt as BatchDetailComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {C,
|
|
1
|
+
import {C,b7 as Kn,a8 as sc,b9 as Xa,b8 as lc,i as ie}from'./main-5C7K2447.js';var U=(()=>{class r{constructor(){this.http=C(Kn),this.baseUrl=`${sc.apiBaseUrl}/workflows`;}list(t){return this.http.get(this.baseUrl,{params:Xa(t)}).pipe(lc())}get(t){return this.http.get(`${this.baseUrl}/${encodeURIComponent(t)}`).pipe(lc())}create(t){return this.http.post(this.baseUrl,t).pipe(lc())}update(t,i){return this.http.patch(`${this.baseUrl}/${encodeURIComponent(t)}`,i).pipe(lc())}delete(t){return this.http.delete(`${this.baseUrl}/${encodeURIComponent(t)}`).pipe(lc())}static{this.\u0275fac=function(i){return new(i||r)};}static{this.\u0275prov=ie({token:r,factory:r.\u0275fac,providedIn:"root"});}}return r})();export{U};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {C,
|
|
1
|
+
import {C,b7 as Kn,a8 as sc,b9 as Xa,b8 as lc,i as ie}from'./main-5C7K2447.js';var U=(()=>{class r{constructor(){this.http=C(Kn),this.baseUrl=`${sc.apiBaseUrl}/batches`;}list(t){return this.http.get(this.baseUrl,{params:Xa(t)}).pipe(lc())}get(t){return this.http.get(`${this.baseUrl}/${encodeURIComponent(t)}`).pipe(lc())}jobs(t){return this.http.get(`${this.baseUrl}/${encodeURIComponent(t)}/jobs`).pipe(lc())}launch(t){return this.http.post(this.baseUrl,t).pipe(lc())}static{this.\u0275fac=function(a){return new(a||r)};}static{this.\u0275prov=ie({token:r,factory:r.\u0275fac,providedIn:"root"});}}return r})();export{U};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {N as Nt,K as Ke$1}from'./chunk-BJ_zTxjo.js';import {f as fr,K as Ki,x}from'./chunk-C5kOvUkS.js';import {O as O$}from'./chunk-CbG3rfKf.js';import {C,b6 as l,b as at,a as ar,q as qo,a9 as Ng,R as Rt,s,r,c as qe,Q as QE,F as Fn,n as n8,af as S4,J as J6,k as k3,d as sd,z as zc,e as t7,Z as y7,f as ec,g as _i,v as vw,h as Rw,K as Kc,j as gh,m as bD,p as gI,P as Ph,O as Ow,w as ch,u as nl,A as _D,a0 as $0,a1 as B0,$ as $b,V as V5,D as D5,aG as BD,N as ND,o as oE,a5 as ah,x as sE,y as xD,a4 as Mh,l as lh,B as VD,L as LD,E as Pu,G as Lu,aX as $D,S as SD}from'./main-5C7K2447.js';import {G as Gn,u as un}from'./chunk-B4PXIvtd.js';import'./chunk-DS5k0b_s.js';function W(t){return {ticket:t.activeProviders?.ticket??"manual",repo:t.activeProviders?.repo??"manual",agent:t.activeProviders?.agent??"claude",jira:{baseUrl:t.jira?.baseUrl??"",email:t.jira?.email??""},bitbucket:{baseUrl:t.bitbucket?.baseUrl??"",email:t.bitbucket?.email??"",workspace:t.bitbucket?.workspace??""}}}function _e(t){let s={};for(let e of Object.keys(t)){let n=t[e].trim();n&&(s[e]=n);}return Object.keys(s).length>0?s:void 0}function Z(t){let s=_e(t.jira),e=_e(t.bitbucket);return r(r({activeProviders:{ticket:t.ticket,repo:t.repo,agent:t.agent}},s?{jira:s}:{}),e?{bitbucket:e}:{})}function E(t,s){return (t??"")===(s??"")}function Ce(t,s){let e=Z(s),n={},i=t.activeProviders?.ticket??"manual",c=t.activeProviders?.repo??"manual",P=t.activeProviders?.agent??"claude";return (i!==s.ticket||c!==s.repo||P!==s.agent)&&(n.activeProviders=e.activeProviders),(!E(t.jira?.baseUrl,e.jira?.baseUrl)||!E(t.jira?.email,e.jira?.email))&&(n.jira=e.jira??{}),(!E(t.bitbucket?.baseUrl,e.bitbucket?.baseUrl)||!E(t.bitbucket?.email,e.bitbucket?.email)||!E(t.bitbucket?.workspace,e.bitbucket?.workspace))&&(n.bitbucket=e.bitbucket??{}),n}function he(t){return t.issues.map(s=>`${s.path.length>0?s.path.map(String).join("."):"(root)"}: ${s.message}`)}function ve(t){return t==="cursor"?"cursor":"anthropic"}var we=["*"],Pe=(t,s)=>s.value;function ze(t,s){if(t&1&&(lh(0,"nz-option",3),Rw(1,"transloco")),t&2){let e=s.$implicit;ch("nzValue",e.value)("nzLabel",Ow(1,2,e.labelKey));}}function Ee(t,s){if(t&1&&(_i(0,"div",4),$D(1),Kc()),t&2){let e=VD();ah("data-testid",e.sectionId()+"-config");}}function Te(t,s){t&1&&(vw(0),Rw(1,"transloco")),t&2&&nl(" ",Ow(1,1,"settings.apiKey.configured")," ");}function Ne(t,s){t&1&&(vw(0),Rw(1,"transloco")),t&2&&nl(" ",Ow(1,1,"settings.apiKey.notConfigured")," ");}var be=(()=>{class t{constructor(){this.sectionId=$0.required(),this.titleKey=$0.required(),this.implementationLabelKey=$0.required(),this.options=$0.required(),this.selected=$0.required(),this.selectedChange=B0(),this.showConfig=$0(false),this.status=$0(),this.secretDraft=$0(""),this.secretDraftChange=B0(),this.settingSecret=$0(false),this.setSecret=B0();}static{this.\u0275fac=function(n){return new(n||t)};}static{this.\u0275cmp=QE({type:t,selectors:[["app-settings-provider-section"]],inputs:{sectionId:[1,"sectionId"],titleKey:[1,"titleKey"],implementationLabelKey:[1,"implementationLabelKey"],options:[1,"options"],selected:[1,"selected"],showConfig:[1,"showConfig"],status:[1,"status"],secretDraft:[1,"secretDraft"],settingSecret:[1,"settingSecret"]},outputs:{selectedChange:"selectedChange",secretDraftChange:"secretDraftChange",setSecret:"setSecret"},ngContentSelectors:we,decls:24,vars:29,consts:[[3,"nzTitle"],[1,"field"],[3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],[1,"config"],[1,"secret"],[1,"secret-heading"],[1,"secret-status"],[1,"secret-row"],["nz-input","","type","password","autocomplete","off",3,"ngModelChange","ngModel","placeholder"],["nz-button","","type","button",3,"click","nzLoading","disabled"]],template:function(n,i){n&1&&(BD(),_i(0,"nz-card",0),Rw(1,"transloco"),_i(2,"div",1)(3,"span"),vw(4),Rw(5,"transloco"),Kc(),_i(6,"nz-select",2),gh("ngModelChange",function(P){return i.selectedChange.emit(P)}),ND(7,ze,2,4,"nz-option",3,Pe),Kc(),oE(),Kc(),bD(9,Ee,2,1,"div",4),_i(10,"div",5)(11,"div",6)(12,"span"),vw(13),Rw(14,"transloco"),Kc(),_i(15,"span",7),bD(16,Te,2,3)(17,Ne,2,3),Kc()(),_i(18,"div",8)(19,"input",9),Rw(20,"transloco"),gh("ngModelChange",function(P){return i.secretDraftChange.emit(P)}),Kc(),oE(),_i(21,"button",10),gh("click",function(){return i.setSecret.emit()}),vw(22),Rw(23,"transloco"),Kc()()()()),n&2&&(ch("nzTitle",Ow(1,19,i.titleKey())),ah("data-testid",i.sectionId()+"-section"),gI(4),Ph(Ow(5,21,i.implementationLabelKey())),gI(2),ch("ngModel",i.selected()),ah("data-testid",i.sectionId()+"-provider-select"),sE(),gI(),xD(i.options()),gI(2),_D(i.showConfig()?9:-1),gI(),ah("data-testid",i.sectionId()+"-api-key"),gI(3),Ph(Ow(14,23,"settings.apiKey.label")),gI(2),Mh("configured",i.status()?.configured),ah("data-testid",i.sectionId()+"-secret-status"),gI(),_D(i.status()?.configured?16:17),gI(3),ch("ngModel",i.secretDraft())("placeholder",Ow(20,25,"settings.apiKey.placeholder")),ah("data-testid",i.sectionId()+"-secret-input"),sE(),gI(2),ch("nzLoading",i.settingSecret())("disabled",!i.secretDraft().trim()||!i.status()?.secretKey),ah("data-testid",i.sectionId()+"-set-key"),gI(),nl(" ",Ow(23,27,"settings.apiKey.set")," "));},dependencies:[n8,S4,J6,k3,sd,zc,t7,y7,Nt,Ke$1,Ki,x,$b,V5,D5,ec],styles:[".field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.5rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.config[_ngcontent-%COMP%]{margin-top:.5rem}.secret[_ngcontent-%COMP%]{margin-top:1rem;padding-top:.75rem;border-top:1px solid #e7e5e4}.secret-heading[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:baseline;gap:.75rem;margin-bottom:.5rem}.secret-status[_ngcontent-%COMP%]{font-size:.85rem;color:#9f1239}.secret-status.configured[_ngcontent-%COMP%]{color:#166534}.secret-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center}.secret-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{flex:1 1 16rem}"]});}}return t})();function Ie(t,s){t&1&&(_i(0,"div",5),lh(1,"nz-alert",8),Rw(2,"transloco"),Kc()),t&2&&(gI(),ch("nzMessage",Ow(2,1,"settings.restartRequired.message")));}function Ke(t,s){t&1&&(_i(0,"p",6),vw(1),Rw(2,"transloco"),Kc()),t&2&&(gI(),Ph(Ow(2,1,"common.loading")));}function Oe(t,s){if(t&1&&(_i(0,"p",7),vw(1),Kc()),t&2){let e=VD();gI(),Ph(e.loadError());}}function Ve(t,s){if(t&1&&(_i(0,"li"),vw(1),Kc()),t&2){let e=s.$implicit;gI(),Ph(e);}}function je(t,s){if(t&1&&(_i(0,"section",9)(1,"h2"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"ul"),ND(5,Ve,2,1,"li",null,SD),Kc()()),t&2){let e=VD(2);gI(2),Ph(Ow(3,1,"settings.validation")),gI(3),xD(e.validationErrors());}}function Be(t,s){if(t&1){let e=LD();bD(0,je,7,3,"section",9),_i(1,"app-settings-provider-section",10),gh("selectedChange",function(i){Pu(e);let c=VD();return Lu(c.setTicket(i))})("secretDraftChange",function(i){Pu(e);let c=VD();return Lu(c.setSecretDraft("ticket",i))})("setSecret",function(){Pu(e);let i=VD();return Lu(i.setSecret("ticket"))}),_i(2,"div",11)(3,"label",12)(4,"span"),vw(5),Rw(6,"transloco"),Kc(),_i(7,"input",13),gh("ngModelChange",function(i){Pu(e);let c=VD();return Lu(c.patchJira({baseUrl:i}))}),Kc(),oE(),Kc(),_i(8,"label",12)(9,"span"),vw(10),Rw(11,"transloco"),Kc(),_i(12,"input",14),gh("ngModelChange",function(i){Pu(e);let c=VD();return Lu(c.patchJira({email:i}))}),Kc(),oE(),Kc()()(),_i(13,"app-settings-provider-section",15),gh("selectedChange",function(i){Pu(e);let c=VD();return Lu(c.setRepo(i))})("secretDraftChange",function(i){Pu(e);let c=VD();return Lu(c.setSecretDraft("repo",i))})("setSecret",function(){Pu(e);let i=VD();return Lu(i.setSecret("repo"))}),_i(14,"div",11)(15,"label",12)(16,"span"),vw(17),Rw(18,"transloco"),Kc(),_i(19,"input",16),gh("ngModelChange",function(i){Pu(e);let c=VD();return Lu(c.patchBitbucket({baseUrl:i}))}),Kc(),oE(),Kc(),_i(20,"label",12)(21,"span"),vw(22),Rw(23,"transloco"),Kc(),_i(24,"input",17),gh("ngModelChange",function(i){Pu(e);let c=VD();return Lu(c.patchBitbucket({email:i}))}),Kc(),oE(),Kc(),_i(25,"label",12)(26,"span"),vw(27),Rw(28,"transloco"),Kc(),_i(29,"input",18),gh("ngModelChange",function(i){Pu(e);let c=VD();return Lu(c.patchBitbucket({workspace:i}))}),Kc(),oE(),Kc()()(),_i(30,"app-settings-provider-section",19),gh("selectedChange",function(i){Pu(e);let c=VD();return Lu(c.setAgent(i))})("secretDraftChange",function(i){Pu(e);let c=VD();return Lu(c.setSecretDraft("agent",i))})("setSecret",function(){Pu(e);let i=VD();return Lu(i.setSecret("agent"))}),Kc();}if(t&2){let e=VD();_D(e.validationErrors().length>0?0:-1),gI(),ch("options",e.ticketOptions)("selected",e.draft().ticket)("showConfig",e.draft().ticket==="jira")("status",e.statusFor("jira"))("secretDraft",e.secretDrafts().ticket)("settingSecret",e.settingSecret()==="ticket"),gI(4),Ph(Ow(6,28,"settings.jira.baseUrl")),gI(2),ch("ngModel",e.draft().jira.baseUrl),sE(),gI(3),Ph(Ow(11,30,"settings.jira.email")),gI(2),ch("ngModel",e.draft().jira.email),sE(),gI(),ch("options",e.repoOptions)("selected",e.draft().repo)("showConfig",e.draft().repo==="bitbucket")("status",e.statusFor("bitbucket"))("secretDraft",e.secretDrafts().repo)("settingSecret",e.settingSecret()==="repo"),gI(4),Ph(Ow(18,32,"settings.bitbucket.baseUrl")),gI(2),ch("ngModel",e.draft().bitbucket.baseUrl),sE(),gI(3),Ph(Ow(23,34,"settings.bitbucket.email")),gI(2),ch("ngModel",e.draft().bitbucket.email),sE(),gI(3),Ph(Ow(28,36,"settings.bitbucket.workspace")),gI(2),ch("ngModel",e.draft().bitbucket.workspace),sE(),gI(),ch("options",e.agentOptions)("selected",e.draft().agent)("status",e.agentStatus())("secretDraft",e.secretDrafts().agent)("settingSecret",e.settingSecret()==="agent");}}var ft=(()=>{class t{constructor(){this.api=C(l),this.message=C(fr),this.destroyRef=C(at),this.transloco=C(ar),this.draft=qo(W({})),this.loaded=qo({}),this.status=qo([]),this.secretDrafts=qo({ticket:"",repo:"",agent:""}),this.settingSecret=qo(null),this.loading=qo(true),this.saving=qo(false),this.loadError=qo(null),this.validationErrors=qo([]),this.restartRequired=qo(false),this.ticketOptions=[{value:"manual",labelKey:"settings.ticket.manual"},{value:"jira",labelKey:"settings.ticket.jira"}],this.repoOptions=[{value:"manual",labelKey:"settings.repo.manual"},{value:"bitbucket",labelKey:"settings.repo.bitbucket"}],this.agentOptions=[{value:"claude",labelKey:"settings.agent.claude"},{value:"cursor",labelKey:"settings.agent.cursor"}],Ng({settings:this.api.getSettings(),status:this.api.getProviderStatus()}).pipe(Rt(this.destroyRef)).subscribe({next:({settings:e,status:n})=>{this.loaded.set(e),this.draft.set(W(e)),this.status.set(n),this.loading.set(false);},error:e=>{this.loading.set(false),this.loadError.set(this.errorMessage(e,this.transloco.translate("settings.loadFailed")));}});}statusFor(e){return this.status().find(n=>n.providerId===e)}agentStatus(){return this.statusFor(ve(this.draft().agent))}setTicket(e){this.draft.update(n=>s(r({},n),{ticket:e}));}setRepo(e){this.draft.update(n=>s(r({},n),{repo:e}));}setAgent(e){this.draft.update(n=>s(r({},n),{agent:e}));}patchJira(e){this.draft.update(n=>s(r({},n),{jira:r(r({},n.jira),e)}));}patchBitbucket(e){this.draft.update(n=>s(r({},n),{bitbucket:r(r({},n.bitbucket),e)}));}setSecretDraft(e,n){this.secretDrafts.update(i=>s(r({},i),{[e]:n}));}save(){let e=O$.safeParse(Z(this.draft()));if(!e.success){this.validationErrors.set(he(e.error));return}this.validationErrors.set([]);let n=Ce(this.loaded(),this.draft());this.saving.set(true),this.api.updateSettings(n).subscribe({next:i=>{this.saving.set(false),this.loaded.set(i.settings),this.draft.set(W(i.settings)),i.restartRequired?this.restartRequired.set(true):this.message.success(this.transloco.translate("settings.saveSuccess"));},error:i=>{this.saving.set(false),this.message.error(this.errorMessage(i,this.transloco.translate("settings.saveFailed")));}});}setSecret(e){let n=e==="ticket"?this.statusFor("jira"):e==="repo"?this.statusFor("bitbucket"):this.agentStatus(),i=this.secretDrafts()[e]?.trim()??"";!n?.secretKey||!i||(this.settingSecret.set(e),this.api.setSecret(n.secretKey,i).subscribe({next:()=>{this.settingSecret.set(null),this.setSecretDraft(e,""),this.message.success(this.transloco.translate("settings.apiKey.setSuccess")),this.api.getProviderStatus().subscribe({next:c=>this.status.set(c),error:()=>{}});},error:c=>{this.settingSecret.set(null),this.message.error(this.errorMessage(c,this.transloco.translate("settings.apiKey.setFailed")));}}));}errorMessage(e,n){return e instanceof qe||e instanceof Error?e.message:n}static{this.\u0275fac=function(n){return new(n||t)};}static{this.\u0275cmp=QE({type:t,selectors:[["app-settings"]],decls:17,vars:13,consts:[["data-testid","settings-page",1,"settings"],[1,"header"],[1,"lede"],[1,"header-actions"],["nz-button","","nzType","primary","type","button","data-testid","save-button",3,"click","nzLoading","disabled"],["data-testid","restart-required-banner"],["data-testid","loading"],["data-testid","load-error",1,"error"],["nzType","warning","nzShowIcon","","nzBanner","",3,"nzMessage"],["data-testid","validation-errors",1,"errors"],["sectionId","ticket","titleKey","settings.section.ticket","implementationLabelKey","settings.ticketProvider.label",3,"selectedChange","secretDraftChange","setSecret","options","selected","showConfig","status","secretDraft","settingSecret"],[1,"grid"],[1,"field"],["nz-input","","data-testid","jira-base-url",3,"ngModelChange","ngModel"],["nz-input","","data-testid","jira-email",3,"ngModelChange","ngModel"],["sectionId","repo","titleKey","settings.section.repo","implementationLabelKey","settings.repoProvider.label",3,"selectedChange","secretDraftChange","setSecret","options","selected","showConfig","status","secretDraft","settingSecret"],["nz-input","","data-testid","bitbucket-base-url",3,"ngModelChange","ngModel"],["nz-input","","data-testid","bitbucket-email",3,"ngModelChange","ngModel"],["nz-input","","data-testid","bitbucket-workspace",3,"ngModelChange","ngModel"],["sectionId","agent","titleKey","settings.section.agent","implementationLabelKey","settings.agentProvider.label",3,"selectedChange","secretDraftChange","setSecret","options","selected","status","secretDraft","settingSecret"]],template:function(n,i){n&1&&(_i(0,"main",0)(1,"header",1)(2,"div")(3,"h1"),vw(4),Rw(5,"transloco"),Kc(),_i(6,"p",2),vw(7),Rw(8,"transloco"),Kc()(),_i(9,"div",3)(10,"button",4),gh("click",function(){return i.save()}),vw(11),Rw(12,"transloco"),Kc()()(),bD(13,Ie,3,3,"div",5),bD(14,Ke,3,3,"p",6)(15,Oe,2,1,"p",7)(16,Be,31,38),Kc()),n&2&&(gI(4),Ph(Ow(5,7,"settings.title")),gI(3),Ph(Ow(8,9,"settings.lede")),gI(3),ch("nzLoading",i.saving())("disabled",i.loading()||!!i.loadError()),gI(),nl(" ",Ow(12,11,"common.save")," "),gI(2),_D(i.restartRequired()?13:-1),gI(),_D(i.loading()?14:i.loadError()?15:16));},dependencies:[Fn,n8,S4,J6,k3,Gn,un,sd,zc,t7,y7,Ki,x,be,ec],styles:[".settings[_ngcontent-%COMP%]{max-width:56rem;margin:0 auto;padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}.header-actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.lede[_ngcontent-%COMP%]{margin:.25rem 0 0;color:#57534e}.grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:.75rem 1rem}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.5rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.errors[_ngcontent-%COMP%]{border:1px solid #fecdd3;background:#fff1f2;padding:.75rem 1rem}.errors[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 .35rem;font-size:1rem}.error[_ngcontent-%COMP%]{color:#9f1239}"]});}}return t})();export{ft as SettingsComponent};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {j}from'./chunk--cAlvNjP.js';import {f as fr,K as Ki,x}from'./chunk-C5kOvUkS.js';import {z as z$,d as d$}from'./chunk-CbG3rfKf.js';import {C,W,I as ue,aZ as U,b6 as l,b as at,a as ar,ac as O,ad as Zn,ae as Se$1,q as qo,H as Hw,R as Rt,s,r,c as qe$1,Q as QE,F as Fn,n as n8,af as S4,J as J6,k as k3,M as Mt,d as sd,z as zc,e as t7,Z as y7,$ as $b,V as V5,D as D5,f as ec,g as _i,v as vw,K as Kc,h as Rw,j as gh,m as bD,p as gI,P as Ph,O as Ow,w as ch,u as nl,A as _D,b7 as Kn,a8 as sc,b8 as lc,i as ie,B as VD,L as LD,o as oE,N as ND,x as sE,y as xD,S as SD,l as lh,E as Pu,G as Lu,a5 as ah,a6 as Nw}from'./main-5C7K2447.js';import {U as U$1}from'./chunk-VW6e_Kls.js';import'./chunk-DS5k0b_s.js';var Te=(()=>{class t{constructor(){this.http=C(Kn),this.baseUrl=`${sc.apiBaseUrl}/providers`;}listQueryTemplates(e){return this.http.get(`${this.baseUrl}/${encodeURIComponent(e)}/query-templates`).pipe(lc())}resolveQueryTemplate(e,i,n){return this.http.post(`${this.baseUrl}/${encodeURIComponent(e)}/query-templates/${encodeURIComponent(i)}/resolve`,{params:n}).pipe(lc())}static{this.\u0275fac=function(i){return new(i||t)};}static{this.\u0275prov=ie({token:t,factory:t.\u0275fac,providedIn:"root"});}}return t})();function A(t,o){let e=t?.activeProviders;if(o==="ticket")return e?.ticket;if(o==="pull_request")return e?.repo}var Ee=()=>[],be=(t,o)=>o.id,Ve=(t,o)=>o.name;function Ie(t,o){t&1&&(_i(0,"p",5),vw(1),Rw(2,"transloco"),Kc()),t&2&&(gI(),Ph(Ow(2,1,"common.loading")));}function ke(t,o){if(t&1&&(_i(0,"p",6),vw(1),Kc()),t&2){let e=VD();gI(),Ph(e.loadError());}}function ze(t,o){if(t&1&&(_i(0,"li"),vw(1),Kc()),t&2){let e=o.$implicit;gI(),Ph(e);}}function Se(t,o){if(t&1&&(_i(0,"section",7)(1,"h2"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"ul"),ND(5,ze,2,1,"li",null,SD),Kc()()),t&2){let e=VD(2);gI(2),Ph(Ow(3,1,"views.editor.validation")),gI(3),xD(e.validationErrors());}}function qe(t,o){if(t&1&&lh(0,"nz-option",11),t&2){let e=o.$implicit;ch("nzValue",e.id)("nzLabel",e.name);}}function Pe(t,o){if(t&1&&(lh(0,"nz-option",11),Rw(1,"transloco")),t&2){let e=o.$implicit,i=VD(3);ch("nzValue",e)("nzLabel",Ow(1,2,i.subjectTypeKey(e)));}}function je(t,o){if(t&1){let e=LD();_i(0,"div",8)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"nz-select",14),gh("ngModelChange",function(n){Pu(e);let d=VD(2);return Lu(d.onSubjectTypeChange(n))}),ND(5,Pe,2,4,"nz-option",11,SD),Kc(),oE(),Kc();}if(t&2){let e=VD(2);gI(2),Ph(Ow(3,2,"views.editor.subjectType")),gI(2),ch("ngModel",e.subjectType()),sE(),gI(),xD(e.subjectTypeOptions());}}function Ne(t,o){if(t&1&&(_i(0,"p",12),vw(1),Rw(2,"transloco"),Kc()),t&2){let e=VD(2);gI(),nl(" ",Ow(2,1,e.subjectTypeKey(o))," ");}}function De(t,o){if(t&1){let e=LD();_i(0,"div",13)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"div",15)(5,"button",16),gh("click",function(){Pu(e);let n=VD(2);return Lu(n.setQueryMode("template"))}),vw(6),Rw(7,"transloco"),Kc(),_i(8,"button",17),gh("click",function(){Pu(e);let n=VD(2);return Lu(n.setQueryMode("raw"))}),vw(9),Rw(10,"transloco"),Kc()()();}if(t&2){let e=VD(2);gI(2),Ph(Ow(3,5,"views.editor.queryMode")),gI(3),ch("nzType",e.queryMode()==="template"?"primary":"default"),gI(),nl(" ",Ow(7,7,"views.editor.queryMode.template")," "),gI(2),ch("nzType",e.queryMode()==="raw"?"primary":"default"),gI(),nl(" ",Ow(10,9,"views.editor.queryMode.raw")," ");}}function Fe(t,o){if(t&1&&lh(0,"nz-option",11),t&2){let e=o.$implicit;ch("nzValue",e.id)("nzLabel",e.label);}}function $e(t,o){t&1&&(_i(0,"span",19),vw(1,"*"),Kc());}function Ae(t,o){if(t&1&&lh(0,"nz-option",11),t&2){let e=o.$implicit;ch("nzValue",e)("nzLabel",e);}}function Be(t,o){if(t&1){let e=LD();_i(0,"nz-select",22),gh("ngModelChange",function(n){Pu(e);let d=VD().$implicit,m=VD(4);return Lu(m.setTemplateParam(d.name,n))}),ND(1,Ae,1,2,"nz-option",11,SD),Kc(),oE();}if(t&2){let e=VD().$implicit,i=VD(4);ch("ngModel",i.templateParamValue(e.name)),ah("data-testid","template-param-"+e.name),sE(),gI(),xD(e.options??Nw(2,Ee));}}function Oe(t,o){if(t&1){let e=LD();_i(0,"input",23),gh("ngModelChange",function(n){Pu(e);let d=VD().$implicit,m=VD(4);return Lu(m.setTemplateParam(d.name,n))}),Kc(),oE();}if(t&2){let e=VD().$implicit,i=VD(4);ch("ngModel",i.templateParamValue(e.name)),ah("data-testid","template-param-"+e.name),sE();}}function Le(t,o){if(t&1&&(_i(0,"label",8)(1,"span"),vw(2),bD(3,$e,2,0,"span",19),Kc(),bD(4,Be,3,3,"nz-select",20)(5,Oe,1,2,"input",21),Kc()),t&2){let e=o.$implicit;gI(2),nl(" ",e.label," "),gI(),_D(e.required?3:-1),gI(),_D(e.type==="select"?4:5);}}function Re(t,o){t&1&&ND(0,Le,6,3,"label",8,Ve),t&2&&xD(o.params);}function We(t,o){if(t&1){let e=LD();_i(0,"div",8)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"nz-select",18),gh("ngModelChange",function(n){Pu(e);let d=VD(2);return Lu(d.selectTemplate(n))}),ND(5,Fe,1,2,"nz-option",11,be),Kc(),oE(),Kc(),bD(7,Re,2,0);}if(t&2){let e,i=VD(2);gI(2),Ph(Ow(3,3,"views.editor.template")),gI(2),ch("ngModel",i.selectedTemplateId()),sE(),gI(),xD(i.templates()),gI(2),_D((e=i.selectedTemplate())?7:-1,e);}}function Ue(t,o){if(t&1){let e=LD();_i(0,"label",8)(1,"span"),vw(2),Rw(3,"transloco"),Kc(),_i(4,"textarea",24),gh("ngModelChange",function(n){Pu(e);let d=VD(2);return Lu(d.queryText.set(n))}),Kc(),oE(),_i(5,"span",25),vw(6),Rw(7,"transloco"),Kc()();}if(t&2){let e=VD(2);gI(2),Ph(Ow(3,3,"views.editor.query")),gI(2),ch("ngModel",e.queryText()),sE(),gI(2),Ph(Ow(7,5,"views.editor.queryHint"));}}function Qe(t,o){if(t&1){let e=LD();bD(0,Se,7,3,"section",7),_i(1,"label",8)(2,"span"),vw(3),Rw(4,"transloco"),Kc(),_i(5,"input",9),gh("ngModelChange",function(n){Pu(e);let d=VD();return Lu(d.name.set(n))}),Kc(),oE(),Kc(),_i(6,"div",8)(7,"span"),vw(8),Rw(9,"transloco"),Kc(),_i(10,"nz-select",10),gh("ngModelChange",function(n){Pu(e);let d=VD();return Lu(d.onWorkflowChange(n))}),ND(11,qe,1,2,"nz-option",11,be),Kc(),oE(),Kc(),bD(13,je,7,4,"div",8)(14,Ne,3,3,"p",12),bD(15,De,11,11,"div",13),bD(16,We,8,5)(17,Ue,8,7,"label",8);}if(t&2){let e,i=VD();_D(i.validationErrors().length>0?0:-1),gI(3),Ph(Ow(4,8,"views.editor.name")),gI(2),ch("ngModel",i.name()),sE(),gI(3),Ph(Ow(9,10,"views.editor.workflow")),gI(2),ch("ngModel",i.workflowId()),sE(),gI(),xD(i.bindableWorkflows()),gI(2),_D(i.needsSubjectTypePicker()?13:(e=i.subjectType())?14:-1,e),gI(2),_D(i.hasTemplates()?15:-1),gI(),_D(i.queryMode()==="template"&&i.hasTemplates()?16:17);}}function Je(t){let o=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),e=crypto.randomUUID().slice(0,8);return o.length>0?`${o}-${e}`:`view-${e}`}function xe(t){let o={};for(let e of t.params)o[e.name]=e.type==="select"?e.options?.[0]??"":"";return o}var kt=(()=>{class t{constructor(){this.route=C(W),this.router=C(ue),this.viewsApi=C(U),this.workflowsApi=C(U$1),this.settingsApi=C(l),this.providersApi=C(Te),this.message=C(fr),this.destroyRef=C(at),this.transloco=C(ar),this.language=C(O),this.routeId=Zn(this.route.paramMap.pipe(Se$1(e=>e.get("id"))),{initialValue:this.route.snapshot.paramMap.get("id")}),this.name=qo(""),this.workflowId=qo(""),this.workflows=qo([]),this.subjectType=qo(null),this.queryText=qo(`{
|
|
2
|
+
|
|
3
|
+
}`),this.queryMode=qo("template"),this.templates=qo([]),this.selectedTemplateId=qo(null),this.templateParams=qo({}),this.settings=qo(null),this.loadError=qo(null),this.validationErrors=qo([]),this.saving=qo(false),this.loading=qo(true),this.bindableWorkflows=Hw(()=>this.workflows().filter(e=>e.appliesTo!=="none")),this.selectedWorkflow=Hw(()=>this.bindableWorkflows().find(e=>e.id===this.workflowId())??null),this.subjectTypeOptions=Hw(()=>z$(this.selectedWorkflow()?.appliesTo??"none")),this.needsSubjectTypePicker=Hw(()=>this.subjectTypeOptions().length>1),this.isNew=Hw(()=>!this.routeId()),this.pageTitle=Hw(()=>(this.language.currentLang(),this.isNew()?this.transloco.translate("views.editor.titleNew"):this.transloco.translate("views.editor.titleEdit",{id:this.routeId()}))),this.selectedTemplate=Hw(()=>this.templates().find(e=>e.id===this.selectedTemplateId())??null),this.hasTemplates=Hw(()=>this.templates().length>0),this.workflowsApi.list().pipe(Rt(this.destroyRef)).subscribe({next:e=>this.workflows.set(e),error:e=>{this.workflows.set([]),this.message.error(this.errorMessage(e,this.transloco.translate("views.editor.loadFailed")));}}),this.settingsApi.getSettings().pipe(Rt(this.destroyRef)).subscribe({next:e=>{this.settings.set(e),this.refreshTemplates();},error:e=>{this.settings.set({}),this.refreshTemplates(),this.message.error(this.errorMessage(e,this.transloco.translate("views.editor.loadFailed")));}}),this.route.paramMap.pipe(Rt(this.destroyRef)).subscribe(e=>{let i=e.get("id");if(this.validationErrors.set([]),this.loadError.set(null),this.pendingProvenance=void 0,!i){this.name.set(""),this.workflowId.set(""),this.subjectType.set(null),this.queryText.set(`{
|
|
4
|
+
|
|
5
|
+
}`),this.queryMode.set("template"),this.selectedTemplateId.set(null),this.templateParams.set({}),this.loading.set(false),this.refreshTemplates();return}this.loading.set(true),this.viewsApi.get(i).subscribe({next:n=>{this.name.set(n.name),this.workflowId.set(n.workflowId),this.subjectType.set(n.subjectType),this.queryText.set(JSON.stringify(n.query,null,2)),this.pendingProvenance=n.queryTemplate,this.queryMode.set(n.queryTemplate?"template":"raw"),this.loading.set(false),this.refreshTemplates();},error:n=>{this.loading.set(false),this.loadError.set(this.errorMessage(n,this.transloco.translate("views.editor.loadFailed")));}});});}subjectTypeKey(e){return `workflow-editor.subjectType.${e}`}onWorkflowChange(e){this.workflowId.set(e);let i=z$(this.bindableWorkflows().find(n=>n.id===e)?.appliesTo??"none");if(this.pendingProvenance=void 0,this.queryMode.set("template"),this.selectedTemplateId.set(null),this.templateParams.set({}),i.length===1)this.subjectType.set(i[0]);else if(i.length>1){let n=this.subjectType();this.subjectType.set(n&&i.includes(n)?n:null);}else this.subjectType.set(null);this.refreshTemplates();}onSubjectTypeChange(e){this.subjectType.set(e),this.pendingProvenance=void 0,this.queryMode.set("template"),this.selectedTemplateId.set(null),this.templateParams.set({}),this.refreshTemplates();}setQueryMode(e){this.queryMode.set(e),e==="template"&&!this.selectedTemplateId()&&this.templates()[0]&&this.selectTemplate(this.templates()[0].id);}selectTemplate(e){let i=this.templates().find(n=>n.id===e);this.selectedTemplateId.set(e),this.templateParams.set(i?xe(i):{});}templateParamValue(e){let i=this.templateParams()[e];return i==null?"":String(i)}setTemplateParam(e,i){this.templateParams.set(s(r({},this.templateParams()),{[e]:i}));}save(){if(this.queryMode()==="template"&&this.hasTemplates()){this.saveFromTemplate();return}this.saveFromRawJson();}saveFromTemplate(){let e=this.selectedTemplate(),i=this.subjectType(),n=i?A(this.settings(),i):void 0;if(!e||!n){this.validationErrors.set([this.transloco.translate("views.editor.pickTemplate")]);return}let d=e.params.filter(m=>{if(!m.required)return false;let z=this.templateParams()[m.name];return z==null||String(z).trim()===""});if(d.length>0){this.validationErrors.set(d.map(m=>this.transloco.translate("views.editor.missingParam",{label:m.label})));return}this.validationErrors.set([]),this.saving.set(true),this.providersApi.resolveQueryTemplate(n,e.id,this.templateParams()).subscribe({next:m=>{this.persist({query:m.query,queryTemplate:{templateId:e.id,params:this.templateParams()}});},error:m=>{this.saving.set(false),this.message.error(this.errorMessage(m,this.transloco.translate("views.editor.resolveFailed")));}});}saveFromRawJson(){let e;try{e=JSON.parse(this.queryText());}catch(i){this.validationErrors.set([this.transloco.translate("views.editor.invalidJson")]);return}if(e===null||typeof e!="object"||Array.isArray(e)){this.validationErrors.set([this.transloco.translate("views.editor.invalidJson")]);return}this.persist({query:e});}persist(e){let i=this.routeId(),n=this.subjectType(),d=r({id:i??Je(this.name()),name:this.name().trim(),subjectType:n??"",workflowId:this.workflowId(),query:e.query},e.queryTemplate?{queryTemplate:e.queryTemplate}:{}),m=d$.safeParse(d);if(!m.success){this.saving.set(false),this.validationErrors.set(j(m.error));return}this.validationErrors.set([]),this.saving.set(true);let z=m.data;(this.isNew()||!i?this.viewsApi.create(z):this.viewsApi.update(i,z)).subscribe({next:N=>{this.saving.set(false),this.message.success(this.transloco.translate(this.isNew()?"views.editor.created":"views.editor.saved")),this.isNew()&&this.router.navigate(["/views",N.id,"edit"]);},error:N=>{this.saving.set(false),this.message.error(this.errorMessage(N,this.transloco.translate("views.editor.saveFailed")));}});}refreshTemplates(){let e=this.subjectType(),i=e?A(this.settings(),e):null;if(!i){this.templates.set([]),this.applyLoadedTemplates([]);return}this.providersApi.listQueryTemplates(i).subscribe({next:n=>{this.templates.set(n),this.applyLoadedTemplates(n);},error:()=>{this.templates.set([]),this.applyLoadedTemplates([]);}});}applyLoadedTemplates(e){let i=this.pendingProvenance;if(i){let n=e.find(d=>d.id===i.templateId);n?(this.queryMode.set("template"),this.selectedTemplateId.set(n.id),this.templateParams.set(r(r({},xe(n)),i.params))):(this.queryMode.set("raw"),this.selectedTemplateId.set(null)),this.pendingProvenance=void 0;return}if(this.queryMode()!=="raw"){if(e.length===0){this.queryMode.set("raw"),this.selectedTemplateId.set(null),this.templateParams.set({});return}e.some(n=>n.id===this.selectedTemplateId())||this.selectTemplate(e[0].id);}}errorMessage(e,i){return e instanceof qe$1||e instanceof Error?e.message:i}static{this.\u0275fac=function(i){return new(i||t)};}static{this.\u0275cmp=QE({type:t,selectors:[["app-view-editor"]],decls:15,vars:10,consts:[["data-testid","view-editor",1,"editor"],[1,"header"],[1,"header-actions"],["routerLink","/views"],["nz-button","","nzType","primary","type","button","data-testid","save-button",3,"click","nzLoading","disabled"],["data-testid","loading"],["data-testid","load-error",1,"error"],["data-testid","validation-errors",1,"errors"],[1,"field"],["nz-input","","data-testid","view-name",3,"ngModelChange","ngModel"],["data-testid","view-workflow",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],["data-testid","view-subject-type-resolved",1,"hint"],["data-testid","query-mode-toggle",1,"field"],["data-testid","view-subject-type",3,"ngModelChange","ngModel"],[1,"mode-toggle"],["nz-button","","type","button","data-testid","query-mode-template",3,"click","nzType"],["nz-button","","type","button","data-testid","query-mode-raw",3,"click","nzType"],["data-testid","view-template",3,"ngModelChange","ngModel"],[1,"required"],[3,"ngModel"],["nz-input","",3,"ngModel"],[3,"ngModelChange","ngModel"],["nz-input","",3,"ngModelChange","ngModel"],["nz-input","","rows","8","data-testid","view-query",3,"ngModelChange","ngModel"],[1,"hint"]],template:function(i,n){i&1&&(_i(0,"main",0)(1,"header",1)(2,"div")(3,"h1"),vw(4),Kc()(),_i(5,"div",2)(6,"a",3),vw(7),Rw(8,"transloco"),Kc(),_i(9,"button",4),gh("click",function(){return n.save()}),vw(10),Rw(11,"transloco"),Kc()()(),bD(12,Ie,3,3,"p",5)(13,ke,2,1,"p",6)(14,Qe,18,12),Kc()),i&2&&(gI(4),Ph(n.pageTitle()),gI(3),Ph(Ow(8,6,"views.editor.backToList")),gI(2),ch("nzLoading",n.saving())("disabled",n.loading()||!!n.loadError()),gI(),nl(" ",Ow(11,8,"common.save")," "),gI(2),_D(n.loading()?12:n.loadError()?13:14));},dependencies:[Fn,n8,S4,J6,k3,Mt,sd,zc,t7,y7,Ki,x,$b,V5,D5,ec],styles:[".editor[_ngcontent-%COMP%]{max-width:40rem;margin:0 auto;padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}.header-actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.5rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.hint[_ngcontent-%COMP%]{font-size:.8rem;color:#78716c}.mode-toggle[_ngcontent-%COMP%]{display:flex;gap:.5rem}.required[_ngcontent-%COMP%]{color:#9f1239}.errors[_ngcontent-%COMP%]{border:1px solid #fecdd3;background:#fff1f2;padding:.75rem 1rem}.errors[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 .35rem;font-size:1rem}.error[_ngcontent-%COMP%]{color:#9f1239}textarea[_ngcontent-%COMP%]{font-family:ui-monospace,Consolas,monospace}"]});}}return t})();export{kt as ViewEditorComponent};
|
package/static/index.html
CHANGED
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
<style>body{font-family:Roboto,sans-serif}body,html{width:100%;height:100%}*,:after,:before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;-ms-overflow-style:scrollbar;-webkit-tap-highlight-color:transparent}body{margin:0;color:#000000d9;font-size:14px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-variant:tabular-nums;line-height:1.5715;background-color:#fff;font-feature-settings:"tnum"}html{--antd-wave-shadow-color:#1890ff;--scroll-bar:0}</style><link rel="stylesheet" href="styles-6MW3GE4V.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles-6MW3GE4V.css"></noscript></head>
|
|
11
11
|
<body>
|
|
12
12
|
<app-root></app-root>
|
|
13
|
-
<script src="polyfills-YMBILSHJ.js" type="module"></script><script src="main-
|
|
13
|
+
<script src="polyfills-YMBILSHJ.js" type="module"></script><script src="main-5C7K2447.js" type="module"></script></body>
|
|
14
14
|
</html>
|