@whoz-oss/coday-client 3.23.0 → 3.25.0
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/browser/{chunk-KccQKSLr.js → chunk--j9cf9d6.js} +2 -2
- package/browser/chunk-2dXF6kxO.js +1 -0
- package/browser/{chunk-YGA4ansj.js → chunk-6ZQ87jQV.js} +1 -1
- package/browser/{chunk-BpzIo3TO.js → chunk-AfeufHde.js} +1 -1
- package/browser/{chunk-CqZF9JZo.js → chunk-B2UoGfZ3.js} +6 -6
- package/browser/{chunk-BfzDf8xE.js → chunk-B6pr9Now.js} +1 -1
- package/browser/{chunk-DNlBxwgK.js → chunk-BAyZlfDb.js} +1 -1
- package/browser/{chunk-VyuxzGHt.js → chunk-BH0AuKDN.js} +1 -1
- package/browser/{chunk-DVGYZ6ty.js → chunk-BP7WYYNR.js} +1 -1
- package/browser/{chunk-BIOQZPFJ.js → chunk-BRAKs_V4.js} +2 -2
- package/browser/{chunk-CMHnK5hV.js → chunk-BSmtz5y3.js} +2 -2
- package/browser/{chunk-BQFfxCd3.js → chunk-BUi4VbRk.js} +1 -1
- package/browser/{chunk-B3Yorxwd.js → chunk-BWE4takb.js} +1 -1
- package/browser/chunk-BZIfffSY.js +1 -0
- package/browser/chunk-BaAG5SRs.js +9 -0
- package/browser/{chunk-CWQR6xJk.js → chunk-BkZ4nMy0.js} +1 -1
- package/browser/{chunk-Cg68_3Ns.js → chunk-Bkl_Vpe1.js} +1 -1
- package/browser/{chunk-Bc0TgO1-.js → chunk-BorcVzNx.js} +1 -1
- package/browser/{chunk-COoOJuQT.js → chunk-Bsd6cfhc.js} +1 -1
- package/browser/{chunk-CXhfjTCk.js → chunk-Btjdv26a.js} +1 -1
- package/browser/{chunk-BrNRhqhm.js → chunk-Bv19t8Yr.js} +1 -1
- package/browser/{chunk-C3MIs5_Y.js → chunk-ByqToPFV.js} +1 -1
- package/browser/{chunk-BQwFVWSb.js → chunk-C0cIJD6B.js} +1 -1
- package/browser/{chunk-DHr7_ikE.js → chunk-C3uyXZ11.js} +1 -1
- package/browser/{chunk-BZCIYJOL.js → chunk-C4kiVp0I.js} +1 -1
- package/browser/{chunk-sz0CVF1-.js → chunk-CBsoAXBW.js} +1 -1
- package/browser/chunk-CCSxTkZ-.js +1 -0
- package/browser/{chunk-lkvHsW8k.js → chunk-CDteNbQE.js} +1 -1
- package/browser/{chunk-CuOGglmC.js → chunk-CIFgO2HT.js} +1 -1
- package/browser/{chunk-DH3pQb49.js → chunk-CKdscASQ.js} +1 -1
- package/browser/{chunk-B3kY-GQk.js → chunk-CPuMGlfm.js} +1 -1
- package/browser/{chunk-BCqtwdIe.js → chunk-CU9SkJlG.js} +1 -1
- package/browser/{chunk-CJD8ErVH.js → chunk-CWfLK-02.js} +1 -1
- package/browser/{chunk-CXwHeDac.js → chunk-CXFeBkf0.js} +1 -1
- package/browser/{chunk-D9wXETZp.js → chunk-Cc6av_kK.js} +2 -2
- package/browser/{chunk-D89TfP1E.js → chunk-Ccwn8U1w.js} +1 -1
- package/browser/chunk-Ce6h2FeE.js +1 -0
- package/browser/chunk-CfZ8rkw0.js +1 -0
- package/browser/{chunk-CT4atmse.js → chunk-CgtOp5dr.js} +3 -3
- package/browser/{chunk-CaL6ZXsO.js → chunk-CmWqV8dc.js} +6 -6
- package/browser/{chunk-CRyr4oOy.js → chunk-ComIIQUU.js} +1 -1
- package/browser/{chunk-D7p9n5a9.js → chunk-Cyh4DuAi.js} +1 -1
- package/browser/{chunk-DdUOdkVr.js → chunk-D26Rjl-2.js} +1 -1
- package/browser/{chunk-SsHAmybq.js → chunk-D62ekcvB.js} +1 -1
- package/browser/{chunk-bl1pitLA.js → chunk-DEUnwPWC.js} +1 -1
- package/browser/{chunk-DL11Jf1L.js → chunk-DIKc_N9D.js} +1 -1
- package/browser/{chunk-O1I9EEmj.js → chunk-DIY-0Lon.js} +1 -1
- package/browser/{chunk-DkP2MwMu.js → chunk-DT0j_Tak.js} +1 -1
- package/browser/{chunk-ChsKwSBf.js → chunk-DaphJW96.js} +1 -1
- package/browser/{chunk-BqC6QWDU.js → chunk-Dgr7xggj.js} +3 -3
- package/browser/chunk-DpWl8Hmh.js +2 -0
- package/browser/{chunk-BdZ0xOqX.js → chunk-DrcS-IIH.js} +5 -5
- package/browser/{chunk-DrKKLE1-.js → chunk-DuGczpUf.js} +2 -2
- package/browser/{chunk-BT7IPqmu.js → chunk-DwD-3Qe0.js} +1 -1
- package/browser/{chunk-CyJ_au6Y.js → chunk-Dx97073t.js} +5 -5
- package/browser/{chunk-BoiQFZ4H.js → chunk-DyyifT6r.js} +1 -1
- package/browser/chunk-GWd9G-Nj.js +1 -0
- package/browser/{chunk-B2FRxZw1.js → chunk-L0O9mlbO.js} +1 -1
- package/browser/{chunk-oqOgDyIj.js → chunk-OZvSiKvx.js} +1 -1
- package/browser/chunk-OpIcFxMt.js +1 -0
- package/browser/{chunk-B4K0ULQ8.js → chunk-OqElmTmR.js} +1 -1
- package/browser/{chunk-bHVjhtHf.js → chunk-RFOuzDB-.js} +1 -1
- package/browser/{chunk-B0USjT_j.js → chunk-bEyVnMri.js} +1 -1
- package/browser/{chunk-CZ4gj_xn.js → chunk-ehgi4mB8.js} +1 -1
- package/browser/{chunk-uY_BCJ93.js → chunk-iT-BBh_o.js} +1 -1
- package/browser/{chunk-C9T7UBD_.js → chunk-iiREShnX.js} +1 -1
- package/browser/{chunk-DF3Ha0Tb.js → chunk-pyvVjc-9.js} +1 -1
- package/browser/{chunk-BSc7HTHd.js → chunk-rWPj3GdK.js} +1 -1
- package/browser/{chunk-oIPYJtHA.js → chunk-sI2K91LE.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-RXIVNUWK.js → main-4LGWVPVH.js} +18 -18
- package/package.json +1 -1
- package/browser/chunk-7dyrHGkF.js +0 -1
- package/browser/chunk-BXGcSbBl.js +0 -1
- package/browser/chunk-BujvNLrF.js +0 -1
- package/browser/chunk-C4IJySYO.js +0 -2
- package/browser/chunk-CjgyOse7.js +0 -1
- package/browser/chunk-CzL7jU35.js +0 -1
- package/browser/chunk-D8dXXVY5.js +0 -9
- package/browser/chunk-DqfAYcrx.js +0 -1
- package/browser/chunk-yfVcVvz_.js +0 -1
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {i}from'./chunk-CzL7jU35.js';import {l}from'./chunk-D8dXXVY5.js';import {g,d9 as F,dj as be,aJ as Tr,aD as Hy,bS as Da,a7 as va,I as br,r as re,cE as kd,bU as Fd,K as x}from'./main-RXIVNUWK.js';var y="none",O="me",N=class f{nsController=g(F);exportService=g(be);userState=g(l);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Hy([this.namespaceId$,this.refresh$]).pipe(Da(([e])=>{let n=this.loadPlatformConfigs().pipe(va(()=>br([]))),t=this.loadUserConfigs("global").pipe(va(()=>br([])));return e?Hy([n,this.loadNamespaceConfigs(e).pipe(va(()=>br([]))),this.loadUserConfigs(e).pipe(va(()=>br([]))),t]).pipe(re(([i,r,c,s])=>({platform:i,namespace:r,userOnNs:c,userGlobal:s}))):Hy([n,t]).pipe(re(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),kd({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig(y)}loadUserConfigs(e){let n=e==="global"?y:e;return this.nsController.listIntegrationConfig(n,O)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):br([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let s={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(s).pipe(Fd(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let s={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(s).pipe(Fd(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(c).pipe(Fd(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0};return this.nsController.updateIntegrationConfig(e,r).pipe(Fd(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(Fd(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||f)};static \u0275prov=x({token:f,factory:f.\u0275fac,providedIn:"root"})};export{N};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {c}from'./chunk-DdUOdkVr.js';import {g,ao as V,G,C as Ce$1,da as M,db as Ae$1,dc as ye$1,W as Wi,dd as ve$1,F,bR as Sd,T as TT,$ as $y,b as U,a7 as va,I as br,z as z$1,a as P,j as jw,k as Cs,n as kg,J as JC,m as hl,o as aC,t as sI,a5 as Dl,u as cC,a9 as vC,M as Mg,a3 as ZI,q as dC,ac as CC,_ as _g,w as zg,a6 as QI,v as fC,a8 as Kg,aa as Cf,ab as Tf,bk as Dh}from'./main-RXIVNUWK.js';import {o as z,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,C as Cn,E as En}from'./chunk-B3kY-GQk.js';var A=(n,t)=>t.value,me=(n,t)=>t.id;function pe(n,t){n&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function ue(n,t){n&1&&(Cs(0,"span",12),JC(1," Name is required. "),hl());}function fe(n,t){if(n&1&&(Cs(0,"p",42),JC(1),hl(),Cs(2,"span",13),JC(3,"Agent Config cannot be changed after creation."),hl()),n&2){let e=CC(2);sI(),Kg(e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function _e(n,t){if(n&1&&(Cs(0,"a",43),JC(1,"Add an agent config"),hl(),JC(2," first. ")),n&2){let e=CC(3);_g("href","/agentos/"+e.namespaceId+"/agent-configs/new",Dh);}}function he(n,t){if(n&1&&(Cs(0,"p",13),JC(1," No agent configs available in this scope yet. "),aC(2,_e,3,1),hl()),n&2){let e=CC(2);sI(2),cC(e.isPlatformMode?-1:2);}}function ge(n,t){if(n&1&&(Cs(0,"option",23),JC(1),hl()),n&2){let e=t.$implicit;_g("value",e.id),sI(),Kg(e.name);}}function Ce(n,t){n&1&&(Cs(0,"span",12),JC(1,"Agent Config is required."),hl());}function ve(n,t){if(n&1&&(Cs(0,"select",44)(1,"option",45),JC(2,"Select an agent config\u2026"),hl(),dC(3,ge,2,2,"option",23,me),hl(),ZI(),aC(5,Ce,2,0,"span",12),Cs(6,"span",13),JC(7,"Immutable after creation."),hl()),n&2){let e=CC(2);_g("formControl",e.agentConfigIdControl),QI(),sI(3),fC(e.availableAgentConfigs()),sI(2),cC(e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?5:-1);}}function xe(n,t){n&1&&(Cs(0,"span",12),JC(1,"Opening message is required."),hl());}function ye(n,t){if(n&1&&(Cs(0,"option",23),JC(1),hl()),n&2){let e=t.$implicit;_g("value",e.value),sI(),Kg(e.label);}}function be(n,t){if(n&1){let e=vC();Cs(0,"label",48)(1,"input",49),kg("change",function(){let g=Cf(e).$implicit,v=CC(3);return Tf(v.toggleDay(g.value))}),hl(),Cs(2,"span",50),JC(3),hl()();}if(n&2){let e=t.$implicit,d=CC(3);sI(),_g("checked",d.isDaySelected(e.value)),sI(2),Kg(e.label);}}function Se(n,t){if(n&1&&(Cs(0,"div",8)(1,"span",46),JC(2,"Days of week"),hl(),Cs(3,"div",47),dC(4,be,4,2,"label",48,A),hl(),Cs(6,"span",13),JC(7,"Leave empty to run every day of the week."),hl()()),n&2){let e=CC(2);sI(4),fC(e.dayOptions);}}function Ee(n,t){n&1&&(Cs(0,"span",12),JC(1,"Valid time is required (HH:mm)."),hl());}function Pe(n,t){n&1&&(Cs(0,"span",12),JC(1,"Start date is required."),hl());}function Me(n,t){if(n&1&&(Cs(0,"option",23),JC(1),hl()),n&2){let e=t.$implicit;_g("value",e.value),sI(),Kg(e.label);}}function Oe(n,t){n&1&&(Cs(0,"span",12),JC(1,"End date is required."),hl());}function De(n,t){if(n&1&&(Cs(0,"div",8)(1,"label",51),JC(2," End date "),Cs(3,"span",10),JC(4,"*"),hl()(),Mg(5,"input",52),ZI(),aC(6,Oe,2,0,"span",12),hl()),n&2){let e=CC(2);sI(5),zg("scheduled-prompt-form__input--invalid",e.form.hasError("endDateRequired")&&e.endDateControl.touched),_g("formControl",e.endDateControl),QI(),sI(),cC(e.form.hasError("endDateRequired")&&e.endDateControl.touched?6:-1);}}function Te(n,t){n&1&&(Cs(0,"span",12),JC(1,"Must be at least 1."),hl());}function we(n,t){if(n&1&&(Cs(0,"div",8)(1,"label",53),JC(2," Number of occurrences "),Cs(3,"span",10),JC(4,"*"),hl()(),Mg(5,"input",54),ZI(),aC(6,Te,2,0,"span",12),hl()),n&2){let e=CC(2);sI(5),zg("scheduled-prompt-form__input--invalid",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched),_g("formControl",e.occurrenceCountControl),QI(),sI(),cC(e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?6:-1);}}function ke(n,t){n&1&&(Cs(0,"span",12),JC(1,"Invalid JSON."),hl());}function Ne(n,t){if(n&1&&(Cs(0,"p",38),JC(1),hl()),n&2){let e=CC(2);sI(),Kg(e.errorMessage());}}function Fe(n,t){if(n&1){let e=vC();Cs(0,"form",7),kg("ngSubmit",function(){Cf(e);let g=CC();return Tf(g.submit())}),Cs(1,"div",8)(2,"label",9),JC(3," Name "),Cs(4,"span",10),JC(5,"*"),hl()(),Mg(6,"input",11),ZI(),aC(7,ue,2,0,"span",12),Cs(8,"span",13),JC(9,'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.'),hl()(),Cs(10,"div",8)(11,"label",14),JC(12,"Description"),hl(),Mg(13,"input",15),ZI(),hl(),Cs(14,"div",8)(15,"label",16),JC(16," Agent Config "),Cs(17,"span",10),JC(18,"*"),hl()(),aC(19,fe,4,1)(20,he,3,1,"p",13)(21,ve,8,2),hl(),Cs(22,"div",8)(23,"label",17),JC(24," Opening message "),Cs(25,"span",10),JC(26,"*"),hl()(),Mg(27,"textarea",18),ZI(),aC(28,xe,2,0,"span",12),Cs(29,"span",13),JC(30," The message sent to the agent when the scheduled prompt fires. "),hl()(),Cs(31,"fieldset",19)(32,"legend",20),JC(33,"Recurrence"),hl(),Cs(34,"div",8)(35,"label",21),JC(36," Unit "),Cs(37,"span",10),JC(38,"*"),hl()(),Cs(39,"select",22),dC(40,ye,2,2,"option",23,A),hl(),ZI(),hl(),aC(42,Se,8,0,"div",8),Cs(43,"div",8)(44,"label",24),JC(45," Time (UTC) "),Cs(46,"span",10),JC(47,"*"),hl()(),Cs(48,"div",25),Mg(49,"input",26),ZI(),Cs(50,"span",27),JC(51,"UTC"),hl()(),aC(52,Ee,2,0,"span",12),hl()(),Cs(53,"fieldset",19)(54,"legend",20),JC(55,"Planning"),hl(),Cs(56,"div",8)(57,"label",28),JC(58," Start date "),Cs(59,"span",10),JC(60,"*"),hl()(),Mg(61,"input",29),ZI(),aC(62,Pe,2,0,"span",12),hl(),Cs(63,"div",8)(64,"label",30),JC(65," Ends "),Cs(66,"span",10),JC(67,"*"),hl()(),Cs(68,"select",31),dC(69,Me,2,2,"option",23,A),hl(),ZI(),hl(),aC(71,De,7,4,"div",8),aC(72,we,7,4,"div",8),hl(),Cs(73,"div",8)(74,"label",32),Mg(75,"input",33),ZI(),Cs(76,"span",34),JC(77,"Enabled"),hl()(),Cs(78,"p",35),JC(79," When disabled, the scheduled prompt is saved but will not run on schedule. "),hl()(),Cs(80,"div",8)(81,"label",36),JC(82,"External Metadata"),hl(),Mg(83,"textarea",37),ZI(),aC(84,ke,2,0,"span",12),Cs(85,"span",13),JC(86,"Optional. Opaque JSON object stored as-is. Leave empty to clear."),hl()(),aC(87,Ne,2,1,"p",38),Cs(88,"div",39)(89,"button",40),JC(90),hl(),Cs(91,"button",41),kg("click",function(){Cf(e);let g=CC();return Tf(g.cancel())}),JC(92,"Cancel"),hl()()();}if(n&2){let e=CC();_g("formGroup",e.form),sI(6),zg("scheduled-prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),_g("formControl",e.nameControl),QI(),sI(),cC(e.nameControl.invalid&&e.nameControl.touched?7:-1),sI(6),_g("formControl",e.descriptionControl),QI(),sI(6),cC(e.isEditMode()?19:e.availableAgentConfigs().length===0?20:21),sI(8),zg("scheduled-prompt-form__textarea--invalid",e.promptContentControl.invalid&&e.promptContentControl.touched),_g("formControl",e.promptContentControl),QI(),sI(),cC(e.promptContentControl.invalid&&e.promptContentControl.touched?28:-1),sI(11),_g("formControl",e.unitControl),QI(),sI(),fC(e.schedulerUnits),sI(2),cC(e.showDayFilter()?42:-1),sI(7),_g("formControl",e.timeUtcControl),QI(),sI(3),cC(e.timeUtcControl.invalid&&e.timeUtcControl.touched?52:-1),sI(9),zg("scheduled-prompt-form__input--invalid",e.startDateControl.invalid&&e.startDateControl.touched),_g("formControl",e.startDateControl),QI(),sI(),cC(e.startDateControl.invalid&&e.startDateControl.touched?62:-1),sI(6),_g("formControl",e.endTypeControl),QI(),sI(),fC(e.endTypes),sI(2),cC(e.showEndDate()?71:-1),sI(),cC(e.showOccurrenceCount()?72:-1),sI(3),_g("formControl",e.enabledControl),QI(),sI(8),_g("formControl",e.externalMetadataJsonControl),QI(),sI(),cC(e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?84:-1),sI(3),cC(e.errorMessage()?87:-1),sI(2),_g("disabled",e.form.invalid||e.isSubmitting()),sI(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var se=class n{route=g(V);router=g(G);destroyRef=g(Ce$1);state=g(c);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required]}),description:new _t(null),agentConfigId:new _t("",{nonNullable:true,validators:[_e$1.required]}),promptContent:new _t("",{nonNullable:true,validators:[_e$1.required]}),unit:new _t(ye$1.WEEK,{nonNullable:true,validators:[_e$1.required]}),days:new _t([],{nonNullable:true}),timeUtc:new _t("09:00",{nonNullable:true,validators:[_e$1.required,_e$1.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new _t("",{nonNullable:true,validators:[_e$1.required]}),endType:new _t(Ae$1.NEVER,{nonNullable:true,validators:[_e$1.required]}),endDate:new _t(null),occurrenceCount:new _t(null),enabled:new _t(true,{nonNullable:true}),externalMetadataJson:new _t("",{nonNullable:true,validators:[Ae]})},{validators:[Ie,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=Wi(false);isSubmitting=Wi(false);isLoading=Wi(false);errorMessage=Wi(null);SchedulerUnit=ye$1;SchedulerEndType=Ae$1;schedulerUnits=[{value:ye$1.WEEK,label:"Week(s)"},{value:ye$1.MONTH,label:"Month(s)"}];endTypes=[{value:Ae$1.NEVER,label:"Never"},{value:Ae$1.ON_DATE,label:"On date"},{value:Ae$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(ve$1).map(([t,e])=>({value:t,label:e}));unitSignal=F(this.unitControl.valueChanges.pipe(Sd(this.unitControl.value)));endTypeSignal=F(this.endTypeControl.valueChanges.pipe(Sd(this.endTypeControl.value)));showDayFilter=TT(()=>this.unitSignal()===ye$1.WEEK);showEndDate=TT(()=>this.endTypeSignal()===Ae$1.ON_DATE);showOccurrenceCount=TT(()=>this.endTypeSignal()===Ae$1.OCCURRENCES);agentConfigs=Wi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),$y({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:d})=>{this.existingPrompt=e,this.agentConfigs.set(d),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(va(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,d=e.includes(t)?e.filter(g=>g!==t):[...e,t];this.daysControl.setValue(d);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,d=z$1(P({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===Ae$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Ae$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let v=this.externalMetadataJsonControl.value.trim();return v?JSON.parse(v):null})()});(t?this.state.update(this.existingPrompt.id,d):this.state.create(d)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:v=>{this.isSubmitting.set(false),v.status===409?this.errorMessage.set(`A scheduled prompt named "${d.name}" already exists in this scope.`):v.status===400?this.errorMessage.set(v.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=jw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:10,vars:3,consts:[[1,"scheduled-prompt-form"],[1,"scheduled-prompt-form__header"],["type","button","title","Back to scheduled prompts",1,"scheduled-prompt-form__back",3,"click"],[1,"scheduled-prompt-form__back-icon"],[1,"scheduled-prompt-form__title"],[1,"scheduled-prompt-form__loading"],[1,"scheduled-prompt-form__form",3,"formGroup"],[1,"scheduled-prompt-form__form",3,"ngSubmit","formGroup"],[1,"scheduled-prompt-form__field"],["for","sp-name",1,"scheduled-prompt-form__label"],["aria-hidden","true"],["id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],[1,"scheduled-prompt-form__field-error"],[1,"scheduled-prompt-form__field-hint"],["for","sp-description",1,"scheduled-prompt-form__label"],["id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-agent-config",1,"scheduled-prompt-form__label"],["for","sp-prompt-content",1,"scheduled-prompt-form__label"],["id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",1,"scheduled-prompt-form__textarea",3,"formControl"],[1,"scheduled-prompt-form__fieldset"],[1,"scheduled-prompt-form__legend"],["for","sp-unit",1,"scheduled-prompt-form__label"],["id","sp-unit",1,"scheduled-prompt-form__select",3,"formControl"],[3,"value"],["for","sp-time",1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__time-wrapper"],["id","sp-time","type","time",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--time",3,"formControl"],[1,"scheduled-prompt-form__utc-badge"],["for","sp-start-date",1,"scheduled-prompt-form__label"],["id","sp-start-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-end-type",1,"scheduled-prompt-form__label"],["id","sp-end-type",1,"scheduled-prompt-form__select",3,"formControl"],[1,"scheduled-prompt-form__toggle-label"],["type","checkbox",1,"scheduled-prompt-form__toggle-checkbox",3,"formControl"],[1,"scheduled-prompt-form__toggle-text"],[1,"scheduled-prompt-form__toggle-hint"],["for","sp-external-metadata",1,"scheduled-prompt-form__label"],["id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",1,"scheduled-prompt-form__textarea","scheduled-prompt-form__textarea--code",3,"formControl"],[1,"scheduled-prompt-form__error"],[1,"scheduled-prompt-form__actions"],["type","submit",1,"scheduled-prompt-form__btn","scheduled-prompt-form__btn--primary",3,"disabled"],["type","button",1,"scheduled-prompt-form__btn",3,"click"],[1,"scheduled-prompt-form__readonly-value"],[3,"href"],["id","sp-agent-config",1,"scheduled-prompt-form__select",3,"formControl"],["value","","disabled",""],[1,"scheduled-prompt-form__label"],[1,"scheduled-prompt-form__day-grid"],[1,"scheduled-prompt-form__day-label"],["type","checkbox",1,"scheduled-prompt-form__day-checkbox",3,"change","checked"],[1,"scheduled-prompt-form__day-text"],["for","sp-end-date",1,"scheduled-prompt-form__label"],["id","sp-end-date","type","date",1,"scheduled-prompt-form__input",3,"formControl"],["for","sp-occurrence-count",1,"scheduled-prompt-form__label"],["id","sp-occurrence-count","type","number","min","1",1,"scheduled-prompt-form__input","scheduled-prompt-form__input--number",3,"formControl"]],template:function(e,d){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),kg("click",function(){return d.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5),hl(),Cs(6,"h1",4),JC(7),hl()(),aC(8,pe,2,0,"p",5)(9,Fe,93,28,"form",6),hl()),e&2&&(sI(5),Dl(" ",d.isPlatformMode?"Platform Scheduled Prompts":"Scheduled Prompts"," "),sI(2),Dl(" ",d.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"," "),sI(),cC(d.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Cn,En],styles:[".scheduled-prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.scheduled-prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.scheduled-prompt-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.scheduled-prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.scheduled-prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.scheduled-prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.scheduled-prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.scheduled-prompt-form__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.scheduled-prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__input[_ngcontent-%COMP%], .scheduled-prompt-form__select[_ngcontent-%COMP%], .scheduled-prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.scheduled-prompt-form__input[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__select[_ngcontent-%COMP%]:focus, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.scheduled-prompt-form__input[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__select[_ngcontent-%COMP%]::placeholder, .scheduled-prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__select[_ngcontent-%COMP%]{cursor:pointer;appearance:auto}.scheduled-prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.scheduled-prompt-form__input--time[_ngcontent-%COMP%]{flex:1;min-width:0}.scheduled-prompt-form__input--number[_ngcontent-%COMP%]{max-width:120px}.scheduled-prompt-form__time-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.scheduled-prompt-form__utc-badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem;font-weight:600;font-family:monospace;color:var(--color-text-secondary, #6e6e73);background:var(--color-surface, rgba(0, 0, 0, .05));padding:.25rem .5rem;border-radius:4px;text-transform:uppercase;letter-spacing:.06em}.scheduled-prompt-form__fieldset[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem 1.25rem 1.25rem;margin:0;display:flex;flex-direction:column;gap:1.25rem}.scheduled-prompt-form__legend[_ngcontent-%COMP%]{font-size:.8125rem;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--color-text-secondary, #6e6e73);padding:0 .375rem}.scheduled-prompt-form__day-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.scheduled-prompt-form__day-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__day-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__day-text[_ngcontent-%COMP%]{font-size:.875rem;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6e6e73)}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);margin:0}.scheduled-prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30)}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #007aff);text-decoration:none}.scheduled-prompt-form__field-hint[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}.scheduled-prompt-form__readonly-value[_ngcontent-%COMP%]{margin:0;font-size:.9375rem;color:var(--color-text, #1d1d1f);padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--color-surface, rgba(0, 0, 0, .03))}.scheduled-prompt-form__input--invalid[_ngcontent-%COMP%], .scheduled-prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.scheduled-prompt-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.scheduled-prompt-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-primary, #007aff);cursor:pointer}.scheduled-prompt-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text, #1d1d1f)}.scheduled-prompt-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.scheduled-prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.scheduled-prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.scheduled-prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.scheduled-prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"]})};function Ie(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Ae$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Ae$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function Ae(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),d=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${d}`}export{se as ScheduledPromptFormComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {O}from'./chunk-sz0CVF1-.js';import {v}from'./chunk-yfVcVvz_.js';import {g,ao as V,G,C as Ce,W as Wi,F as F$1,de as me$1,cd as $f,b as U,j as jw,k as Cs,n as kg,J as JC,m as hl,o as aC,t as sI,a8 as Kg,u as cC,a9 as vC,q as dC,a4 as lC,a3 as ZI,M as Mg,bo as uC,ac as CC,_ as _g,a6 as QI,v as fC,a5 as Dl,cH as iC,aa as Cf,ab as Tf}from'./main-RXIVNUWK.js';import'./chunk-D8dXXVY5.js';import {o as z,z as ze,k as _t,b as _e$1,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En,p as An,q as Ct,V as Vt}from'./chunk-B3kY-GQk.js';import'./chunk-CzL7jU35.js';import'./chunk-YGA4ansj.js';import'./chunk-CaL6ZXsO.js';import'./chunk-CqZF9JZo.js';function ce(a,r){a&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function me(a,r){if(a&1&&(Cs(0,"label",30),Mg(1,"input",31),ZI(),Cs(2,"span"),JC(3),hl()()),a&2){let e=r.$implicit,l=CC(3);sI(),_g("formControl",l.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!l.isAdmin()),QI(),sI(2),Kg(e.label);}}function ue(a,r){if(a&1&&(Cs(0,"fieldset",8)(1,"legend",24),JC(2,"Port\xE9e de la configuration"),hl(),dC(3,me,4,4,"label",30,iC().trackByScope,true),hl()),a&2){let e=CC(2);_g("disabled",e.isEditMode()),sI(3),fC(e.scopeOptions);}}function ve(a,r){if(a&1&&(Cs(0,"option",13),JC(1),hl()),a&2){let e=r.$implicit;_g("value",e),sI(),Kg(e);}}function fe(a,r){if(a&1){let e=vC();Cs(0,"div",26),Mg(1,"input",32),ZI(),Mg(2,"input",33),ZI(),Cs(3,"button",34),kg("click",function(){let s=Cf(e).$index,f=CC(2);return Tf(f.removeHeader(s))}),JC(4," \xD7 "),hl()();}if(a&2){let e=r.$index;_g("formGroupName",e),sI(),QI(),sI(),QI();}}function _e(a,r){if(a&1){let e=vC();Cs(0,"form",7),kg("ngSubmit",function(){Cf(e);let s=CC();return Tf(s.submit())}),aC(1,ue,5,1,"fieldset",8),Cs(2,"div",9)(3,"label",10),JC(4,"API type "),Cs(5,"span",11),JC(6,"*"),hl()(),Cs(7,"select",12),dC(8,ve,2,2,"option",13,lC),hl(),ZI(),hl(),Cs(10,"div",9)(11,"label",14),JC(12,"Name "),Cs(13,"span",11),JC(14,"*"),hl()(),Mg(15,"input",15),ZI(),hl(),Cs(16,"div",9)(17,"label",16),JC(18,"Description"),hl(),Mg(19,"input",17),ZI(),hl(),Cs(20,"div",9)(21,"label",18),JC(22,"Base URL"),hl(),Mg(23,"input",19),ZI(),hl(),Cs(24,"div",9)(25,"label",20),JC(26,"API key"),hl(),Mg(27,"input",21),ZI(),hl(),Cs(28,"div",22)(29,"div",23)(30,"span",24),JC(31,"Custom headers"),hl(),Cs(32,"button",25),kg("click",function(){Cf(e);let s=CC();return Tf(s.addHeader())}),JC(33,"+ Add header"),hl()(),dC(34,fe,5,1,"div",26,uC),hl(),Cs(36,"div",27)(37,"button",28),JC(38),hl(),Cs(39,"button",29),kg("click",function(){Cf(e);let s=CC();return Tf(s.cancel())}),JC(40,"Cancel"),hl()()();}if(a&2){let e=CC();_g("formGroup",e.form),sI(),cC(e.isPlatformMode?-1:1),sI(6),_g("formControl",e.apiTypeControl),QI(),sI(),fC(e.apiTypeOptions),sI(7),_g("formControl",e.nameControl),QI(),sI(4),_g("formControl",e.descriptionControl),QI(),sI(4),_g("formControl",e.baseUrlControl),QI(),sI(4),_g("formControl",e.apiKeyControl),QI(),sI(),_g("formArrayName","headers"),sI(6),fC(e.headersArray.controls),sI(3),_g("disabled",e.form.invalid||e.isSubmitting()),sI(),Dl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ge=new Set(["namespace","userOnNs","userGlobal"]),F=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),se=class a{route=g(V);router=g(G);destroyRef=g(Ce);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Wi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});apiTypeOptions=Object.values(me$1);scopeOptions=[{value:"namespace",label:F.namespace},{value:"userOnNs",label:F.userOnNs},{value:"userGlobal",label:F.userGlobal}];form=new z({name:new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]}),description:new _t(null),apiType:new _t("OpenAI",{nonNullable:true,validators:[_e$1.required]}),baseUrl:new _t("",{nonNullable:true}),apiKey:new _t("",{nonNullable:true}),scope:new _t("namespace",{nonNullable:true}),headers:new ze([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new z({key:new _t("",{nonNullable:true,validators:[_e$1.required]}),value:new _t("",{nonNullable:true})}));}removeHeader(r){this.headersArray.removeAt(r);}isEditMode=Wi(false);isSubmitting=Wi(false);isLoading=Wi(false);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||$f(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let r=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,l=r.get("aiProviderId"),s=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(l){this.isEditMode.set(true),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(l);return}this.scopeControl.setValue(s);let f=e.get("template");f&&this.hydrateFromTemplate(f);}parseScope(r){return r&&ge.has(r)?r:"namespace"}deriveScopeFromConfig(r){return !r.userId?"namespace":r.namespaceId?"userOnNs":"userGlobal"}loadConfig(r){this.isLoading.set(true),this.state.getById(r).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AiProviderForm] Could not load provider '${r}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(r){this.isLoading.set(true),this.state.getById(r).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${r}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(r){this.nameControl.setValue(r.name),this.descriptionControl.setValue(r.description??null),this.apiTypeControl.setValue(r.apiType),this.baseUrlControl.setValue(r.baseUrl??"");let e=r.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[l,s]of Object.entries(r.headers??{}))this.headersArray.push(new z({key:new _t(l,{nonNullable:true,validators:[_e$1.required]}),value:new _t(s,{nonNullable:true})}));}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let r=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),l=this.apiKeyControl.value,s=this.isEditMode()&&l===this.initialApiKey?null:l,f=this.headersArray.controls.filter(x=>x.controls.key.value.trim()).map(x=>[x.controls.key.value.trim(),x.controls.value.value]),de=f.length>0?Object.fromEntries(f):null,N={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:r||null,baseUrl:e||null,apiKey:s,headers:de},T=this.form.getRawValue().scope,pe=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,N,T,this.existingConfig):this.state.create(N,T,pe)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"]);}trackByScope(r,e){return e.value}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=jw({type:a,selectors:[["agentos-ai-provider-form"]],decls:10,vars:2,consts:[[1,"ai-provider-form"],[1,"ai-provider-form__header"],["type","button","title","Back to AI providers",1,"ai-provider-form__back",3,"click"],[1,"ai-provider-form__back-icon"],[1,"ai-provider-form__title"],[1,"ai-provider-form__loading"],[1,"ai-provider-form__form",3,"formGroup"],[1,"ai-provider-form__form",3,"ngSubmit","formGroup"],[1,"ai-provider-form__scope",3,"disabled"],[1,"ai-provider-form__field"],["for","llm-api-type",1,"ai-provider-form__label"],["aria-hidden","true"],["id","llm-api-type",1,"ai-provider-form__select",3,"formControl"],[3,"value"],["for","llm-name",1,"ai-provider-form__label"],["id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-description",1,"ai-provider-form__label"],["id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-base-url",1,"ai-provider-form__label"],["id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-api-key",1,"ai-provider-form__label"],["id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",1,"ai-provider-form__input","ai-provider-form__input--secret",3,"formControl"],[1,"ai-provider-form__headers",3,"formArrayName"],[1,"ai-provider-form__headers-title"],[1,"ai-provider-form__label"],["type","button",1,"ai-provider-form__headers-add",3,"click"],[1,"ai-provider-form__header-row",3,"formGroupName"],[1,"ai-provider-form__actions"],["type","submit",1,"ai-provider-form__btn","ai-provider-form__btn--primary",3,"disabled"],["type","button",1,"ai-provider-form__btn",3,"click"],[1,"ai-provider-form__scope-option"],["type","radio",3,"formControl","value","disabled"],["type","text","placeholder","Header name","formControlName","key","autocomplete","off",1,"ai-provider-form__input"],["type","text","placeholder","Value","formControlName","value","autocomplete","off",1,"ai-provider-form__input"],["type","button","title","Remove header","aria-label","Remove header",1,"ai-provider-form__header-remove",3,"click"]],template:function(e,l){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),kg("click",function(){return l.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5," AI Providers "),hl(),Cs(6,"h1",4),JC(7),hl()(),aC(8,ce,2,0,"p",5)(9,_e,41,10,"form",6),hl()),e&2&&(sI(7),Kg(l.isEditMode()?"Edit AI provider":"New AI provider"),sI(),cC(l.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En,An,Ct,Vt],styles:[".ai-provider-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-provider-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;margin:0}.ai-provider-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.ai-provider-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:.85rem;color:var(--color-text);cursor:pointer}.ai-provider-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.ai-provider-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-provider-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.ai-provider-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.ai-provider-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-provider-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-provider-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.ai-provider-form__input[_ngcontent-%COMP%], .ai-provider-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-provider-form__input[_ngcontent-%COMP%]:focus, .ai-provider-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.ai-provider-form__input[_ngcontent-%COMP%]::placeholder, .ai-provider-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.ai-provider-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.ai-provider-form__headers[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__headers-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.ai-provider-form__headers-add[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.8125rem;color:var(--color-accent)}.ai-provider-form__headers-add[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__header-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}.ai-provider-form__header-remove[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;background:none;border:1px solid transparent;border-radius:0;cursor:pointer;font-size:1rem;color:var(--color-neutral-500);transition:background .15s ease,color .15s ease,border-color .15s ease;flex-shrink:0}.ai-provider-form__header-remove[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.ai-provider-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-provider-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-provider-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.ai-provider-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-provider-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.ai-provider-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{se as AiProviderFormComponent};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {R}from'./chunk-CWQR6xJk.js';import {g,ao as V,G,dr as G$1,C as Ce,W as Wi,T as TT,$ as $y,a7 as va,I as br,b as U,j as jw,k as Cs,n as kg,J as JC,m as hl,o as aC,t as sI,u as cC,a9 as vC,a3 as ZI,q as dC,ac as CC,_ as _g,a6 as QI,v as fC,a5 as Dl,a8 as Kg,w as zg,b0 as Xg,aa as Cf,ab as Tf}from'./main-RXIVNUWK.js';import'./chunk-D8dXXVY5.js';import {t as ti,Q as Qn,e as ei,Y as Ye,A as At,Z as Zn,c as cn}from'./chunk-B3kY-GQk.js';import'./chunk-CzL7jU35.js';import'./chunk-YGA4ansj.js';import'./chunk-CaL6ZXsO.js';import'./chunk-CqZF9JZo.js';var $=(i,e)=>e.id;function J(i,e){i&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function q(i,e){if(i&1&&(Cs(0,"p",8),JC(1),hl()),i&2){let t=CC(2);sI(),Kg(t.errorMessage());}}function Q(i,e){if(i&1&&(Cs(0,"span",26),JC(1),hl()),i&2){let t=CC(3);sI(),Kg(t.association()?.checkoutFailureReason);}}function W(i,e){if(i&1&&(Cs(0,"p",25),JC(1),aC(2,Q,2,1,"span",26),hl()),i&2){let t=CC(2);zg("namespace-git__status--failed",t.checkoutStatus()==="FAILED")("namespace-git__status--ready",t.checkoutStatus()==="READY"),sI(),Dl(" Repository: ",t.checkoutStatus()," "),sI(),cC(t.association()?.checkoutFailureReason?2:-1);}}function X(i,e){if(i&1&&(Cs(0,"option",19),JC(1),hl()),i&2){let t=e.$implicit,l=CC(2);_g("value",t.id),sI(),Xg("",t.name," (",l.authTypeLabel(t.authType),")");}}function Z(i,e){i&1&&(Cs(0,"span",20),JC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),hl());}function ee(i,e){if(i&1){let t=vC();Cs(0,"button",27),kg("click",function(){Cf(t);let c=CC(2);return Tf(c.remove())}),JC(1," Remove association "),hl();}if(i&2){let t=CC(2);_g("disabled",t.isSaving());}}function te(i,e){if(i&1){let t=vC();Cs(0,"div",6)(1,"p",7),JC(2," Associate a repository with this namespace and prepare an internal clone. Namespace files remain shared documents outside Git. "),hl(),aC(3,q,2,1,"p",8),aC(4,W,3,6,"p",9),Cs(5,"fieldset",10)(6,"legend",11),JC(7,"Repository"),hl(),Cs(8,"label",12)(9,"span",13),JC(10,"Repository URL"),hl(),Cs(11,"input",14),kg("ngModelChange",function(c){Cf(t);let v=CC();return Tf(v.repositoryUrl.set(c))}),hl(),ZI(),Cs(12,"span",15),JC(13,"HTTPS only, without credentials in the URL."),hl()(),Cs(14,"label",12)(15,"span",13),JC(16,"Main branch"),hl(),Cs(17,"input",16),kg("ngModelChange",function(c){Cf(t);let v=CC();return Tf(v.mainBranch.set(c))}),hl(),ZI(),Cs(18,"span",15),JC(19,"The internal clone starts from this remote branch."),hl()(),Cs(20,"label",12)(21,"span",13),JC(22,"Service account"),hl(),Cs(23,"select",17),kg("ngModelChange",function(c){Cf(t);let v=CC();return Tf(v.serviceAuthSettingId.set(c))}),Cs(24,"option",18),JC(25,"Select an auth setting\u2026"),hl(),dC(26,X,2,3,"option",19,$),hl(),ZI(),Cs(28,"span",15),JC(29," Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case. "),hl(),aC(30,Z,2,0,"span",20),hl()(),Cs(31,"div",21)(32,"button",22),kg("click",function(){Cf(t);let c=CC();return Tf(c.save())}),JC(33),hl(),aC(34,ee,2,1,"button",23),Cs(35,"button",24),kg("click",function(){Cf(t);let c=CC();return Tf(c.cancel())}),JC(36,"Cancel"),hl()()();}if(i&2){let t=CC();sI(3),cC(t.errorMessage()?3:-1),sI(),cC(t.isAssociated()&&t.checkoutStatus()?4:-1),sI(7),_g("ngModel",t.repositoryUrl()),QI(),sI(6),_g("ngModel",t.mainBranch()),QI(),sI(6),_g("ngModel",t.serviceAuthSettingId()),QI(),sI(3),fC(t.eligibleAuthSettings()),sI(4),cC(t.eligibleAuthSettings().length===0?30:-1),sI(2),_g("disabled",!t.canSave()),sI(),Dl(" ",t.isSaving()?"Saving\u2026":t.isAssociated()?"Update":"Associate"," "),sI(),cC(t.isAssociated()?34:-1);}}var ne=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],ie={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},j=class i{route=g(V);router=g(G);gitApi=g(G$1);authSettingState=g(R);destroyRef=g(Ce);isLoading=Wi(true);isSaving=Wi(false);errorMessage=Wi(null);association=Wi(null);authSettings=Wi([]);repositoryUrl=Wi("");mainBranch=Wi("main");serviceAuthSettingId=Wi("");namespaceId="";isAssociated=TT(()=>this.association()?.associated===true);eligibleAuthSettings=TT(()=>this.authSettings().filter(e=>ne.includes(e.authType)));authTypeLabel(e){return ie[e??""]??e??"unknown"}canSave=TT(()=>this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0&&!this.isSaving());checkoutStatus=TT(()=>this.association()?.checkoutStatus??null);ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}load(){this.isLoading.set(true),$y({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId).pipe(va(e=>(console.error("Failed to load the Git association",e),this.errorMessage.set(this.messageOf(e)),br(null)))),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId).pipe(va(e=>(console.error("Failed to load namespace auth settings",e),br([]))))}).pipe(U(this.destroyRef)).subscribe(({association:e,authSettings:t})=>{this.authSettings.set(t??[]),e&&(this.association.set(e),this.applyToForm(e)),this.isLoading.set(false);});}applyToForm(e){this.repositoryUrl.set(e.repositoryUrl??""),this.mainBranch.set(e.mainBranch??"main"),this.serviceAuthSettingId.set(e.serviceAuthSettingId??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId()}).pipe(U(this.destroyRef),va(e=>(console.error("Failed to save the Git association",e),this.errorMessage.set(this.messageOf(e)),this.isSaving.set(false),br(null)))).subscribe(e=>{e&&(this.association.set(e),this.applyToForm(e)),this.isSaving.set(false);}));}remove(){confirm("Remove the repository association? The internal clone is preserved.")&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),va(e=>(console.error("Failed to remove the Git association",e),this.errorMessage.set(this.messageOf(e)),this.isSaving.set(false),br(null)))).subscribe(e=>{e&&(this.association.set(e),this.applyToForm(e)),this.isSaving.set(false);}));}cancel(){this.router.navigate(["/agentos/namespaces"]);}messageOf(e){return e.error?.message??e.message??"Unexpected error"}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=jw({type:i,selectors:[["agentos-namespace-git"]],decls:10,vars:1,consts:[[1,"namespace-git"],[1,"namespace-git__header"],["type","button","title","Back to namespaces",1,"namespace-git__back",3,"click"],[1,"namespace-git__back-icon"],[1,"namespace-git__title"],[1,"namespace-git__loading"],[1,"namespace-git__body"],[1,"namespace-git__hint"],["role","alert",1,"namespace-git__error"],[1,"namespace-git__status",3,"namespace-git__status--failed","namespace-git__status--ready"],[1,"namespace-git__section"],[1,"namespace-git__label"],[1,"namespace-git__field"],[1,"namespace-git__field-label"],["type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__field-hint"],["type","text","placeholder","main","name","mainBranch",1,"namespace-git__input",3,"ngModelChange","ngModel"],["name","serviceAuthSettingId",1,"namespace-git__input",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"namespace-git__field-hint","namespace-git__field-hint--warn"],[1,"namespace-git__actions"],["type","button",1,"namespace-git__save",3,"click","disabled"],["type","button",1,"namespace-git__remove",3,"disabled"],["type","button",1,"namespace-git__cancel",3,"click"],[1,"namespace-git__status"],[1,"namespace-git__status-reason"],["type","button",1,"namespace-git__remove",3,"click","disabled"]],template:function(t,l){t&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),kg("click",function(){return l.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5," Namespaces "),hl(),Cs(6,"h1",4),JC(7,"Git repository"),hl()(),aC(8,J,2,0,"p",5)(9,te,37,9,"div",6),hl()),t&2&&(sI(8),cC(l.isLoading()?8:9));},dependencies:[ti,Qn,ei,Ye,At,Zn,cn],styles:[".namespace-git[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.namespace-git__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-git__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-git__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-git__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem}.namespace-git__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.namespace-git__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__error[_ngcontent-%COMP%]{margin:0;padding:.75rem;border-radius:.375rem;background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c);font-size:.875rem}.namespace-git__status[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:.375rem;background:var(--color-surface-secondary, #f3f4f6);font-size:.875rem;display:flex;flex-direction:column;gap:.25rem}.namespace-git__status--ready[_ngcontent-%COMP%]{background:var(--color-success-bg, #ecfdf5);color:var(--color-success, #047857)}.namespace-git__status--failed[_ngcontent-%COMP%]{background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c)}.namespace-git__status-reason[_ngcontent-%COMP%]{font-size:.8125rem;opacity:.9}.namespace-git__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.5rem;padding:1rem;margin:0}.namespace-git__label[_ngcontent-%COMP%]{font-weight:600;font-size:.9375rem;padding:0 .25rem}.namespace-git__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-git__field-label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500}.namespace-git__field-hint[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__field-hint--warn[_ngcontent-%COMP%]{color:var(--color-warning, #b45309)}.namespace-git__input[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem .625rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.375rem;background:var(--color-surface, #fff);color:inherit}.namespace-git__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.namespace-git__save[_ngcontent-%COMP%], .namespace-git__remove[_ngcontent-%COMP%], .namespace-git__cancel[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem 1rem;border-radius:.375rem;cursor:pointer;border:1px solid transparent}.namespace-git__save[_ngcontent-%COMP%]:disabled, .namespace-git__remove[_ngcontent-%COMP%]:disabled, .namespace-git__cancel[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.namespace-git__save[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);color:var(--color-text-on-accent, #fff)}.namespace-git__remove[_ngcontent-%COMP%]{background:none;border-color:var(--color-error, #b91c1c);color:var(--color-error, #b91c1c)}.namespace-git__cancel[_ngcontent-%COMP%]{background:none;border-color:var(--color-border, #e5e7eb);color:inherit}"]})};
|
|
2
|
-
export{j as NamespaceGitComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {v}from'./chunk-yfVcVvz_.js';import {R}from'./chunk-CWQR6xJk.js';import {N as N$1}from'./chunk-7dyrHGkF.js';import {g,ao as V,G,C as Ce,d8 as N$2,F,I as br,W as Wi,T as TT,cd as $f,b as U,j as jw,k as Cs,n as kg,J as JC,m as hl,o as aC,t as sI,a8 as Kg,u as cC,a9 as vC,q as dC,cH as iC,a3 as ZI,M as Mg,a4 as lC,ac as CC,_ as _g,v as fC,a6 as QI,a5 as Dl,aa as Cf,ab as Tf}from'./main-RXIVNUWK.js';import'./chunk-D8dXXVY5.js';import {n as nt}from'./chunk-CaL6ZXsO.js';import'./chunk-CqZF9JZo.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-B3kY-GQk.js';import'./chunk-CzL7jU35.js';import'./chunk-YGA4ansj.js';function ae(r,t){r&1&&(Cs(0,"p",5),JC(1,"Loading\u2026"),hl());}function le(r,t){if(r&1&&(Cs(0,"label",10),Mg(1,"input",29),ZI(),Cs(2,"span"),JC(3),hl()()),r&2){let e=t.$implicit,n=CC(2);sI(),_g("value",e.value)("formControl",n.scopeControl)("disabled",e.value==="namespace"&&!n.isAdmin()),QI(),sI(2),Kg(e.label);}}function se(r,t){if(r&1&&(Cs(0,"option",16),JC(1),hl()),r&2){let e=t.$implicit;_g("value",e.type),sI(),Kg(e.displayName);}}function ce(r,t){if(r&1&&(Cs(0,"option",16),JC(1),hl()),r&2){let e=t.$implicit;_g("value",e),sI(),Kg(e);}}function me(r,t){if(r&1){let e=vC();Cs(0,"div",24)(1,"ds-json-schema-form",30),kg("valueChange",function(s){Cf(e);let m=CC(2);return Tf(m.onParamsChange(s))}),hl()();}if(r&2){let e=CC(2);sI(),_g("schema",t)("value",e.initialParams());}}function de(r,t){if(r&1){let e=vC();Cs(0,"button",31),kg("click",function(){Cf(e);let s=CC(2);return Tf(s.exportYaml())}),JC(1),hl();}if(r&2){let e=CC(2);_g("disabled",e.isExporting()),sI(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function pe(r,t){if(r&1){let e=vC();Cs(0,"form",7),kg("ngSubmit",function(){Cf(e);let s=CC();return Tf(s.submit())}),Cs(1,"fieldset",8)(2,"legend",9),JC(3,"Scope"),hl(),dC(4,le,4,4,"label",10,iC().trackByScope,true),hl(),Cs(6,"div",11)(7,"label",12),JC(8,"Type "),Cs(9,"span",13),JC(10,"*"),hl()(),Cs(11,"select",14)(12,"option",15),JC(13,"Select type"),hl(),dC(14,se,2,2,"option",16,iC().trackByType,true),hl(),ZI(),hl(),Cs(16,"div",11)(17,"label",17),JC(18,"Name "),Cs(19,"span",13),JC(20,"*"),hl()(),Mg(21,"input",18),ZI(),hl(),Cs(22,"div",11)(23,"label",19),JC(24,"Description"),hl(),Mg(25,"textarea",20),ZI(),hl(),Cs(26,"div",11)(27,"label",21),JC(28,"Auth Setting"),hl(),Cs(29,"select",22)(30,"option",23),JC(31,"None"),hl(),dC(32,ce,2,2,"option",16,lC),hl(),ZI(),hl(),aC(34,me,2,2,"div",24),Cs(35,"div",25)(36,"button",26),JC(37),hl(),aC(38,de,2,2,"button",27),Cs(39,"button",28),kg("click",function(){Cf(e);let s=CC();return Tf(s.cancel())}),JC(40,"Cancel"),hl()()();}if(r&2){let e,n=CC();_g("formGroup",n.form),sI(),_g("disabled",n.isEditMode()),sI(3),fC(n.scopeOptions),sI(7),_g("formControl",n.typeControl),QI(),sI(3),fC(n.integrationTypes()),sI(7),_g("formControl",n.nameControl),QI(),sI(4),_g("formControl",n.descriptionControl),QI(),sI(4),_g("formControl",n.authSettingNameControl),QI(),sI(),_g("ngValue",null),sI(2),fC(n.availableAuthSettings()),sI(2),cC((e=n.schema())?34:-1,e),sI(2),_g("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),sI(),Dl(" ",n.isEditMode()?"Save changes":"Create"," "),sI(),cC(n.isEditMode()?38:-1);}}var ge=new Set(["platform","namespace","userOnNs","userGlobal"]),N=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ie=class r{route=g(V);router=g(G);destroyRef=g(Ce);state=g(N$1);integrationTypeController=g(N$2);authSettingState=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=F(this.isPlatformMode?br(true):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new z({name:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),type:new _t("",{nonNullable:true,validators:[_e.required]}),scope:new _t("namespace",{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}isEditMode=Wi(false);isSubmitting=Wi(false);isLoading=Wi(false);isExporting=Wi(false);scopeOptions=[{value:"platform",label:N.platform},{value:"namespace",label:N.namespace},{value:"userOnNs",label:N.userOnNs},{value:"userGlobal",label:N.userGlobal}];authSettingNameControl=new _t(null);availableAuthSettings=Wi([]);paramsValue=Wi(null);initialParams=Wi(null);integrationTypes=F(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=F(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});schema=TT(()=>{let t=this.selectedType();return t?this.integrationTypes().find(n=>n.type===t)?.configSchema??null:null});existingConfig=null;constructor(){$f(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,n=t.get("integrationId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable(),this.loadAuthSettingsForScope("platform");return}let s=this.parseScope(e.get("scope"));this.scopeControl.setValue(s),this.loadAuthSettingsForScope(s),this.scopeControl.valueChanges.pipe(U(this.destroyRef)).subscribe(re=>{this.loadAuthSettingsForScope(re);});let m=e.get("template");m&&this.hydrateFromTemplate(m);}parseScope(t){return t&&ge.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e;let n=this.deriveScopeFromConfig(e);this.scopeControl.setValue(n),this.applyConfigToForm(e),this.loadAuthSettingsForScope(n),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[IntegrationForm] Could not load config '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.applyConfigToForm(e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[IntegrationForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.typeControl.setValue(t.integrationType),this.initialParams.set(t.parameters),this.paramsValue.set(t.parameters),this.authSettingNameControl.setValue(t.authSettingName??null);}loadAuthSettingsForScope(t){let e;switch(t){case "platform":e=this.authSettingState.loadPlatformSettings();break;case "namespace":e=this.authSettingState.loadNamespaceSettings(this.namespaceId);break;case "userOnNs":e=this.authSettingState.loadUserSettings(this.namespaceId);break;case "userGlobal":e=this.authSettingState.loadUserSettings("global");break}e.pipe(U(this.destroyRef)).subscribe({next:n=>{let s=n.map(m=>m.name).filter(Boolean);this.availableAuthSettings.set([...new Set(s)]);},error:()=>this.availableAuthSettings.set([])});}onParamsChange(t){this.paramsValue.set(t);}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.descriptionControl.value?.trim(),e={name:this.nameControl.value.trim(),description:t||null,integrationType:this.typeControl.value,parameters:this.paramsValue(),authSettingName:this.authSettingNameControl.value||null},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,e,n,this.existingConfig):this.state.create(e,n,this.namespaceId??null)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.state.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let n=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(n),m=document.createElement("a");m.href=s,m.download=`${this.existingConfig?.name??"integration"}.yaml`,m.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"]);}trackByType(t,e){return e.type}trackByScope(t,e){return e.value}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=jw({type:r,selectors:[["agentos-integration-form"]],decls:10,vars:2,consts:[[1,"integration-form"],[1,"integration-form__header"],["type","button","title","Back to integrations",1,"integration-form__back",3,"click"],[1,"integration-form__back-icon"],[1,"integration-form__title"],[1,"integration-form__loading"],[1,"integration-form__form",3,"formGroup"],[1,"integration-form__form",3,"ngSubmit","formGroup"],[1,"integration-form__field","integration-form__scope",3,"disabled"],[1,"integration-form__label"],[1,"integration-form__scope-option"],[1,"integration-form__field"],["for","integration-type",1,"integration-form__label"],["aria-hidden","true"],["id","integration-type",1,"integration-form__select",3,"formControl"],["value","","disabled",""],[3,"value"],["for","integration-name",1,"integration-form__label"],["id","integration-name","type","text","placeholder","Integration name","autocomplete","off",1,"integration-form__input",3,"formControl"],["for","integration-description",1,"integration-form__label"],["id","integration-description","placeholder","Optional description","rows","3",1,"integration-form__textarea",3,"formControl"],["for","integration-auth-setting",1,"integration-form__label"],["id","integration-auth-setting",1,"integration-form__select",3,"formControl"],[3,"ngValue"],[1,"integration-form__schema-form"],[1,"integration-form__actions"],["type","submit",1,"integration-form__btn","integration-form__btn--primary",3,"disabled"],["type","button",1,"integration-form__btn","integration-form__btn--export",3,"disabled"],["type","button",1,"integration-form__btn",3,"click"],["type","radio",3,"value","formControl","disabled"],[3,"valueChange","schema","value"],["type","button",1,"integration-form__btn","integration-form__btn--export",3,"click","disabled"]],template:function(e,n){e&1&&(Cs(0,"div",0)(1,"header",1)(2,"button",2),kg("click",function(){return n.cancel()}),Cs(3,"span",3),JC(4,"\u2190"),hl(),JC(5," Integrations "),hl(),Cs(6,"h1",4),JC(7),hl()(),aC(8,ae,2,0,"p",5)(9,pe,41,11,"form",6),hl()),e&2&&(sI(7),Kg(n.isEditMode()?"Edit integration":"New integration"),sI(),cC(n.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En,nt],styles:[".integration-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.integration-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.integration-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.integration-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.integration-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.integration-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.integration-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.integration-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.integration-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-divider);border-radius:0;padding:.75rem 1rem;background:transparent;margin:0}.integration-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.integration-form__scope-option[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--color-text);cursor:pointer}.integration-form__scope-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin:0}.integration-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.integration-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.integration-form__input[_ngcontent-%COMP%], .integration-form__textarea[_ngcontent-%COMP%], .integration-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.integration-form__input[_ngcontent-%COMP%]:focus, .integration-form__textarea[_ngcontent-%COMP%]:focus, .integration-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.integration-form__input[_ngcontent-%COMP%]::placeholder, .integration-form__textarea[_ngcontent-%COMP%]::placeholder, .integration-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.integration-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:4.5rem;line-height:1.5}.integration-form__select[_ngcontent-%COMP%]{cursor:pointer}.integration-form__select[_ngcontent-%COMP%] option[disabled][_ngcontent-%COMP%]{color:var(--color-text-secondary)}.integration-form__schema-form[_ngcontent-%COMP%]{padding:1rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface)}.integration-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.integration-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.integration-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.integration-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.integration-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.integration-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.integration-form__btn--export[_ngcontent-%COMP%]{border-color:var(--color-divider);color:var(--color-text-secondary)}.integration-form__btn--export[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--color-accent);color:var(--color-accent)}"]})};export{ie as IntegrationFormComponent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {bS as Da,a7 as va,I as br,cE as kd}from'./main-RXIVNUWK.js';function i(t,o,p){return t.pipe(Da(()=>o().pipe(va(()=>br(p)))),kd({bufferSize:1,refCount:true}))}export{i};
|