@sava-info-systems/api-maker-with-extensions 1.10.0 → 1.12.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.
Files changed (65) hide show
  1. package/dist/1025.js +1 -1
  2. package/dist/1097.js +1 -1
  3. package/dist/148.js +1 -1
  4. package/dist/1558.js +1 -1
  5. package/dist/1678.js +1 -1
  6. package/dist/1754.js +1 -1
  7. package/dist/1928.js +1 -1
  8. package/dist/1957.js +1 -1
  9. package/dist/2140.js +1 -1
  10. package/dist/2295.js +1 -1
  11. package/dist/2473.js +1 -1
  12. package/dist/2714.js +1 -1
  13. package/dist/2735.js +1 -1
  14. package/dist/2908.js +1 -1
  15. package/dist/3081.js +1 -0
  16. package/dist/3139.js +1 -1
  17. package/dist/3450.js +1 -1
  18. package/dist/4110.js +1 -1
  19. package/dist/4181.js +1 -1
  20. package/dist/4186.js +1 -1
  21. package/dist/4211.js +1 -1
  22. package/dist/4575.js +1 -1
  23. package/dist/4842.js +1 -1
  24. package/dist/485.js +1 -1
  25. package/dist/4895.js +1 -1
  26. package/dist/5249.js +1 -1
  27. package/dist/5334.js +1 -1
  28. package/dist/5421.js +1 -1
  29. package/dist/5679.js +1 -1
  30. package/dist/5761.js +1 -1
  31. package/dist/5765.js +1 -1
  32. package/dist/6236.js +1 -1
  33. package/dist/6393.js +1 -1
  34. package/dist/6401.js +1 -1
  35. package/dist/7368.js +1 -1
  36. package/dist/7436.js +1 -1
  37. package/dist/7470.js +1 -1
  38. package/dist/7649.js +1 -1
  39. package/dist/7975.js +1 -1
  40. package/dist/7977.js +1 -1
  41. package/dist/7987.js +1 -1
  42. package/dist/8125.js +1 -1
  43. package/dist/8266.js +1 -1
  44. package/dist/8296.js +1 -1
  45. package/dist/8841.js +1 -1
  46. package/dist/885.js +1 -1
  47. package/dist/891.js +1 -1
  48. package/dist/913.js +1 -1
  49. package/dist/9243.js +1 -1
  50. package/dist/9575.js +1 -1
  51. package/dist/9939.js +1 -1
  52. package/dist/assets/images/icons/api-maker-deployment.svg +5 -0
  53. package/dist/assets/schema-types/InterfaceProps.ts +3 -1
  54. package/dist/assets/schema-types/types.ts +664 -15
  55. package/dist/assets/styles/out/styles.css +1 -1
  56. package/dist/assets/styles/out/styles.css.map +1 -1
  57. package/dist/assets/styles/styles.scss +22 -0
  58. package/dist/common.js +1 -1
  59. package/dist/main.js +1 -1
  60. package/main.js +1 -1
  61. package/package.json +4 -4
  62. package/sandbox/assets/schema-types/types.js +79 -0
  63. package/sandbox/sandbox.js +1 -1
  64. package/src/assets/schema-types/types.ts +664 -15
  65. package/src/public/dist-db-masters/browser/main.js +70 -68
package/dist/6393.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkapi_maker_fe=self.webpackChunkapi_maker_fe||[]).push([[6393],{6393:(ae,v,r)=>{r.r(v),r.d(v,{AdminUserM:()=>te});var b=r(7664),E=r(8176),e=r(4946),m=r(5861),c=r(3157),p=r(328),f=r(6212),M=r(6990),u=r(921),h=r(1162),U=r(3835),C=r(7240),A=r(9961),Z=r(5219),x=r(2189),y=r(204),N=r(2915),S=r(6814),_=r(5431),D=r(7680),P=r(3259),o=r(95),T=r(553),O=r(5852),R=r(2660);function Y(n,l){1&n&&(e.TgZ(0,"span"),e._UZ(1,"i",22),e._uU(2," Add User"),e.qZA())}function k(n,l){1&n&&(e.TgZ(0,"span"),e._UZ(1,"i",23),e._uU(2," View User"),e.qZA())}function J(n,l){1&n&&(e.TgZ(0,"span"),e._UZ(1,"i",24),e._uU(2," Edit User"),e.qZA())}function Q(n,l){1&n&&(e.TgZ(0,"div",10)(1,"label",11),e._uU(2,"Password"),e.qZA(),e.TgZ(3,"div",12),e._UZ(4,"input",25),e.qZA()())}function V(n,l){1&n&&(e.TgZ(0,"span"),e._uU(1,"Save User"),e.qZA())}function q(n,l){1&n&&(e.TgZ(0,"span"),e._uU(1,"Update User"),e.qZA())}function G(n,l){if(1&n){const t=e.EpF();e.TgZ(0,"button",26),e.NdJ("click",function(){e.CHM(t);const a=e.oxw();return e.KtG(a.save())}),e._UZ(1,"i",27),e.YNc(2,V,2,0,"span",4),e.YNc(3,q,2,0,"span",4),e.qZA()}if(2&n){const t=e.oxw();e.Q6J("disabled",t.form.invalid),e.xp6(2),e.Q6J("ngIf",t.data.mode===t.EFormMode.ADD),e.xp6(1),e.Q6J("ngIf",t.data.mode===t.EFormMode.EDIT)}}function W(n,l){1&n&&e._UZ(0,"p-progressSpinner",28)}let w=(()=>{class n{fb;ns;userS;generalS;constantsCS;authCS;data;loading={form:!1};EFormMode=p.D;form;subscriptions=[];constructor(t,s,a,i,d,g){this.fb=t,this.ns=s,this.userS=a,this.generalS=i,this.constantsCS=d,this.authCS=g}ngOnInit(){var t=this;this.createForm(),this.subscriptions.push(this.data.eventChannel.subscribe(function(){var s=(0,m.Z)(function*(a){if(a)if(t.form.enable(),a.action===c.F.OPEN_FORM_IN_EDIT_MODE){const i=yield t.userS.getById(t.data.formData._id).toPromise();t.form.reset(),t.form.patchValue(i.data),t.form.get("password").setValidators([]),t.form.get("password").updateValueAndValidity()}else if(a.action===c.F.OPEN_FORM_IN_VIEW_MODE){const i=yield t.userS.getById(t.data.formData._id).toPromise();t.form.reset(),t.form.patchValue(i.data),t.form.disable()}else a.action===c.F.OPEN_FORM_IN_ADD_MODE&&(t.form.reset(),t.form.get("password").setValidators([o.kI.required,o.kI.minLength(4),o.kI.maxLength(40)]),t.form.get("password").updateValueAndValidity())});return function(a){return s.apply(this,arguments)}}()))}createForm(){this.form=this.fb.group({name:[null,[o.kI.required]],email:[null,[o.kI.required,o.kI.email]],apiPath:[null,[o.kI.required,o.kI.minLength(3),o.kI.maxLength(25),o.kI.pattern("[a-z0-9]*")]],password:[null,[]]})}showModal(){$("#idAMUsersForm").modal("show")}hideModal(){$("#idAMUsersForm").modal("hide")}save(){var t=this;return(0,m.Z)(function*(){const s=t.form.getRawValue();s.user=t.authCS.getUserId(),s.userType=u.dN.ADMIN;try{let a;t.loading.form=!0,t.data.mode===p.D.ADD?(s.password=t.generalS.getEncryptedString(s.password,T.N.crypto.passCommunication),a=yield t.userS.post(s).toPromise(),t.ns.showSuccess(t.constantsCS.user.addSuccess)):t.data.mode===p.D.EDIT&&(t.data.formData._id&&(s.userType=t.data.formData.userType,t.form.get("password").value?s.password=t.generalS.getEncryptedString(s.password,T.N.crypto.passCommunication):delete s.password),a=yield t.userS.put(t.data.formData._id,s,{select:h.iH._id}).toPromise(),t.ns.showSuccess(t.constantsCS.user.editSuccess)),t.data.eventChannel.emit({action:t.data.mode===p.D.ADD?c.F.SAVED:c.F.UPDATED}),t.loading.form=!1}catch(a){t.loading.form=!1,t.ns.showErrorFromResponse(a.error||a,"Unable to save user info.")}})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(s){return new(s||n)(e.Y36(o.qu),e.Y36(A.W),e.Y36(U.K),e.Y36(C.b),e.Y36(y.s),e.Y36(O.D))};static \u0275cmp=e.Xpm({type:n,selectors:[["app-w-admin-user-form"]],inputs:{data:"data"},decls:34,vars:7,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idAMUsersForm","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog"],[1,"modal-content"],[1,"modal-header"],[4,"ngIf"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],[1,"container","pt-3",3,"formGroup"],[1,"form-group","row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["formControlName","name","name","name","spellcheck","false","type","text","placeholder","Please provide name",1,"form-control","form-control-sm"],["formControlName","email","name","email","spellcheck","false","type","text","placeholder","Please provide email",1,"form-control","form-control-sm"],["class","form-group row",4,"ngIf"],["formControlName","apiPath","name","apiPath","spellcheck","false","type","text","placeholder","Please provide api path",1,"form-control","text-lowercase","form-control-sm"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["class","btn btn-primary btn-sm","sava-no-dbl-click","","type","button",3,"disabled","click",4,"ngIf"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],[1,"far","fa-eye","text-info","fa-fw","mr-1"],[1,"fas","fa-pencil-alt","text-light","fa-fw","mr-1"],["formControlName","password","name","password","spellcheck","false","type","password","placeholder","Please provide password",1,"form-control","form-control-sm"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,a){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),e.YNc(4,Y,3,0,"span",4),e.YNc(5,k,3,0,"span",4),e.YNc(6,J,3,0,"span",4),e.TgZ(7,"button",5)(8,"span",6),e._UZ(9,"i",7),e.qZA()()(),e.TgZ(10,"div",8)(11,"form",9)(12,"div",10)(13,"label",11),e._uU(14,"Name"),e.qZA(),e.TgZ(15,"div",12),e._UZ(16,"input",13),e.qZA()(),e.TgZ(17,"div",10)(18,"label",11),e._uU(19,"Email"),e.qZA(),e.TgZ(20,"div",12),e._UZ(21,"input",14),e.qZA()(),e.YNc(22,Q,5,0,"div",15),e.TgZ(23,"div",10)(24,"label",11),e._uU(25,"API Path"),e.qZA(),e.TgZ(26,"div",12),e._UZ(27,"input",16),e.qZA()()()(),e.TgZ(28,"div",17)(29,"button",18),e._UZ(30,"i",19),e._uU(31," Close"),e.qZA(),e.YNc(32,G,4,3,"button",20),e.qZA(),e.YNc(33,W,1,0,"p-progressSpinner",21),e.qZA()()()),2&s&&(e.xp6(4),e.Q6J("ngIf",a.data.mode===a.EFormMode.ADD),e.xp6(1),e.Q6J("ngIf",a.data.mode===a.EFormMode.VIEW),e.xp6(1),e.Q6J("ngIf",a.data.mode===a.EFormMode.EDIT),e.xp6(5),e.Q6J("formGroup",a.form),e.xp6(11),e.Q6J("ngIf",a.data.mode!==a.EFormMode.VIEW),e.xp6(10),e.Q6J("ngIf",a.data.mode!==a.EFormMode.VIEW),e.xp6(1),e.Q6J("ngIf",a.loading.form))},dependencies:[o._Y,o.Fj,o.JJ,o.JL,o.sg,o.u,S.O5,R.y,D.G],encapsulation:2})}return n})();const K=["adminUserFormC"];function H(n,l){if(1&n){const t=e.EpF();e.TgZ(0,"span",14),e.NdJ("click",function(){e.CHM(t);const a=e.oxw();return e.KtG(a.edit())}),e._UZ(1,"i",15),e.qZA()}}function L(n,l){if(1&n){const t=e.EpF();e.TgZ(0,"span",16),e.NdJ("click",function(){e.CHM(t);const a=e.oxw();return e.KtG(a.removePermanentDialog())}),e._UZ(1,"i",17),e.qZA()}}function B(n,l){1&n&&(e.TgZ(0,"tr")(1,"th"),e._uU(2,"Name"),e.qZA(),e.TgZ(3,"th"),e._uU(4,"Email"),e.qZA(),e.TgZ(5,"th"),e._uU(6,"API Path"),e.qZA()())}function j(n,l){if(1&n&&(e.TgZ(0,"tr",18)(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e._uU(4),e.qZA(),e.TgZ(5,"td"),e._uU(6),e.qZA()()),2&n){const t=l.$implicit;e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Oqu(t.email),e.xp6(2),e.Oqu(t.apiPath)}}function X(n,l){1&n&&e._UZ(0,"p-progressSpinner",19)}let I=(()=>{class n{userS;generalS;notificationS;confirmationService;navigationCS;constantsCS;eventCenterS;loading={grid:!1};subscriptions=[];data={mode:p.D.ADD,eventChannel:new e.vpe,formData:void 0};rows=[];rowsMap={};showAll=!1;selectedRows=[];gridKey=h.iH._id;adminUserFormC;constructor(t,s,a,i,d,g,se){this.userS=t,this.generalS=s,this.notificationS=a,this.confirmationService=i,this.navigationCS=d,this.constantsCS=g,this.eventCenterS=se}ngOnInit(){this.eventCenterS.user.selectedUsers.next([]),this.loadGridData(),this.subscriptions.push(this.data.eventChannel.subscribe(t=>{(t.action===c.F.SAVED||t.action===c.F.UPDATED)&&(this.adminUserFormC.hideModal(),this.loadGridData())}))}loadGridData(){var t=this;this.loading.grid=!0;const s={find:{active:!0,userType:{$in:[u.dN.ROOT,u.dN.ADMIN]}},select:{name:1,email:1,apiPath:1,active:1,userType:1},sort:{name:1}};this.showAll&&delete s.find.active,this.subscriptions.push(this.userS.query(s).subscribe(function(){var a=(0,m.Z)(function*(i){i.success&&(t.selectedRows=[],t.rows=i.data,t.rowsMap=M.keyBy(t.rows,h.iH._id));const d=t.navigationCS.getQueryParam(f.p.user);t.rowsMap[d]&&(t.eventCenterS.user.selectedUsers.next([t.rowsMap[d]]),t.selectedRows=[t.rowsMap[d]],yield t.fillData()),t.loading.grid=!1});return function(i){return a.apply(this,arguments)}}()))}add(){this.data.formData=void 0,this.data.mode=p.D.ADD,this.data.eventChannel.emit({action:c.F.OPEN_FORM_IN_ADD_MODE}),this.adminUserFormC.showModal()}view(){this.data.formData=this.selectedRows[0],this.data.mode=p.D.VIEW,this.data.eventChannel.emit({action:c.F.OPEN_FORM_IN_VIEW_MODE}),this.adminUserFormC.showModal()}edit(){this.data.formData=this.selectedRows[0],this.data.mode=p.D.EDIT,this.data.eventChannel.emit({action:c.F.OPEN_FORM_IN_EDIT_MODE}),this.adminUserFormC.showModal()}removePermanentDialog(){var t=this;return(0,m.Z)(function*(){var s;t.confirmationService.confirm({message:t.constantsCS.user.removePermanentConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(s=(0,m.Z)(function*(){yield t.removePermanent()}),function(){return s.apply(this,arguments)})})})()}removePermanent(){var t=this;return(0,m.Z)(function*(){t.loading.grid=!0;const s=yield t.userS.permanentDelete(t.selectedRows[0]._id).toPromise();t.loading.grid=!1,s.success?(t.notificationS.showSuccess(t.constantsCS.user.removePermanent),t.resetSelectedRows(),t.loadGridData()):t.notificationS.showErrorFromResponse(s,t.constantsCS.user.removePermanentError)})()}resetSelectedRows(){this.selectedRows.length=0,this.eventCenterS.user.selectedUsers.next([])}resetDependents(){var t=this;return(0,m.Z)(function*(){t.eventCenterS.user.selectedUsers.next([]),yield t.navigationCS.setQueryParam(f.p.user,null)})()}adminUserSelected(t){var s=this;return(0,m.Z)(function*(){s.selectedRows=t,s.resetDependents(),s.fillData()})()}fillData(){var t=this;return(0,m.Z)(function*(){if(!t.selectedRows.length)return yield t.navigationCS.setQueryParam(f.p.user,""),void t.eventCenterS.user.selectedUsers.next([]);const s=(yield t.userS.getById(t.selectedRows[0]._id).toPromise()).data;s._id?(yield t.navigationCS.setQueryParam(f.p.user,s._id),t.eventCenterS.user.selectedUsers.next([s])):t.resetDependents()})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}dblClickUsers(){this.selectedRows.length&&this.edit()}static \u0275fac=function(s){return new(s||n)(e.Y36(U.K),e.Y36(C.b),e.Y36(A.W),e.Y36(Z.YP),e.Y36(x.S),e.Y36(y.s),e.Y36(N.u))};static \u0275cmp=e.Xpm({type:n,selectors:[["app-w-admin-users"]],viewQuery:function(s,a){if(1&s&&e.Gf(K,5),2&s){let i;e.iGM(i=e.CRH())&&(a.adminUserFormC=i.first)}},decls:16,vars:10,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-users","text-info","fa-fw","mr-1"],["pTooltip","Add New",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],["class","float-right cursor-pointer ml-3","pTooltip","Edit",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Make Inactive",3,"click",4,"ngIf"],[1,"card-body","p-0","h-100","overflow-hidden"],["styleClass","p-datatable-striped","scrollHeight","calc(100vh - 94px)",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange","dblclick"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[3,"data"],["adminUserFormC",""],["pTooltip","Edit",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-pencil-alt","text-light","fa-fw"],["pTooltip","Make Inactive",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"far","fa-trash-alt","fa-fw","text-danger"],[3,"pSelectableRow"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,a){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"span"),e._UZ(3,"i",2),e._uU(4," Users"),e.qZA(),e.TgZ(5,"span",3),e.NdJ("click",function(){return a.add()}),e._UZ(6,"i",4),e.qZA(),e.YNc(7,H,2,0,"span",5),e.YNc(8,L,2,0,"span",6),e.qZA(),e.TgZ(9,"div",7)(10,"p-table",8),e.NdJ("selectionChange",function(d){return a.selectedRows=d})("dblclick",function(){return a.dblClickUsers()})("selectionChange",function(d){return a.adminUserSelected(d)}),e.YNc(11,B,7,0,"ng-template",9),e.YNc(12,j,7,4,"ng-template",10),e.qZA(),e.YNc(13,X,1,0,"p-progressSpinner",11),e.qZA()(),e._UZ(14,"app-w-admin-user-form",12,13)),2&s&&(e.xp6(7),e.Q6J("ngIf",a.selectedRows.length),e.xp6(1),e.Q6J("ngIf",a.selectedRows.length),e.xp6(2),e.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",a.selectedRows)("dataKey",a.gridKey)("scrollable",!0)("value",a.rows),e.xp6(3),e.Q6J("ngIf",a.loading.grid),e.xp6(1),e.Q6J("data",a.data))},dependencies:[S.O5,_.iA,Z.jx,_.Ei,D.G,P.u,w],encapsulation:2})}return n})();const ee=[{path:"",component:(()=>{class n{constructor(){}ngOnInit(){}static \u0275fac=function(s){return new(s||n)};static \u0275cmp=e.Xpm({type:n,selectors:[["app-admin-user-layout"]],decls:2,vars:0,consts:[[1,"pt-1","pl-1","pr-1"],[1,"w-100"]],template:function(s,a){1&s&&(e.TgZ(0,"div",0),e._UZ(1,"app-w-admin-users",1),e.qZA())},dependencies:[I],encapsulation:2})}return n})(),canActivate:[r(1490).g]}];let te=(()=>{class n{static \u0275fac=function(s){return new(s||n)};static \u0275mod=e.oAB({type:n});static \u0275inj=e.cJS({imports:[b.Bz.forChild(ee),E.u]})}return n})()}}]);
1
+ "use strict";(self.webpackChunkapi_maker_fe=self.webpackChunkapi_maker_fe||[]).push([[6393],{6393:(ae,v,r)=>{r.r(v),r.d(v,{AdminUserM:()=>te});var b=r(7664),E=r(7359),e=r(4946),m=r(5861),c=r(3157),p=r(328),f=r(6212),M=r(6990),u=r(921),h=r(1162),U=r(3835),C=r(7240),A=r(9961),Z=r(5219),x=r(2189),y=r(204),N=r(2915),S=r(6814),_=r(5431),D=r(7680),P=r(3259),o=r(95),T=r(553),O=r(5852),R=r(2660);function Y(n,l){1&n&&(e.TgZ(0,"span"),e._UZ(1,"i",22),e._uU(2," Add User"),e.qZA())}function k(n,l){1&n&&(e.TgZ(0,"span"),e._UZ(1,"i",23),e._uU(2," View User"),e.qZA())}function J(n,l){1&n&&(e.TgZ(0,"span"),e._UZ(1,"i",24),e._uU(2," Edit User"),e.qZA())}function Q(n,l){1&n&&(e.TgZ(0,"div",10)(1,"label",11),e._uU(2,"Password"),e.qZA(),e.TgZ(3,"div",12),e._UZ(4,"input",25),e.qZA()())}function V(n,l){1&n&&(e.TgZ(0,"span"),e._uU(1,"Save User"),e.qZA())}function q(n,l){1&n&&(e.TgZ(0,"span"),e._uU(1,"Update User"),e.qZA())}function G(n,l){if(1&n){const t=e.EpF();e.TgZ(0,"button",26),e.NdJ("click",function(){e.CHM(t);const a=e.oxw();return e.KtG(a.save())}),e._UZ(1,"i",27),e.YNc(2,V,2,0,"span",4),e.YNc(3,q,2,0,"span",4),e.qZA()}if(2&n){const t=e.oxw();e.Q6J("disabled",t.form.invalid),e.xp6(2),e.Q6J("ngIf",t.data.mode===t.EFormMode.ADD),e.xp6(1),e.Q6J("ngIf",t.data.mode===t.EFormMode.EDIT)}}function W(n,l){1&n&&e._UZ(0,"p-progressSpinner",28)}let w=(()=>{class n{fb;ns;userS;generalS;constantsCS;authCS;data;loading={form:!1};EFormMode=p.D;form;subscriptions=[];constructor(t,s,a,i,d,g){this.fb=t,this.ns=s,this.userS=a,this.generalS=i,this.constantsCS=d,this.authCS=g}ngOnInit(){var t=this;this.createForm(),this.subscriptions.push(this.data.eventChannel.subscribe(function(){var s=(0,m.Z)(function*(a){if(a)if(t.form.enable(),a.action===c.F.OPEN_FORM_IN_EDIT_MODE){const i=yield t.userS.getById(t.data.formData._id).toPromise();t.form.reset(),t.form.patchValue(i.data),t.form.get("password").setValidators([]),t.form.get("password").updateValueAndValidity()}else if(a.action===c.F.OPEN_FORM_IN_VIEW_MODE){const i=yield t.userS.getById(t.data.formData._id).toPromise();t.form.reset(),t.form.patchValue(i.data),t.form.disable()}else a.action===c.F.OPEN_FORM_IN_ADD_MODE&&(t.form.reset(),t.form.get("password").setValidators([o.kI.required,o.kI.minLength(4),o.kI.maxLength(40)]),t.form.get("password").updateValueAndValidity())});return function(a){return s.apply(this,arguments)}}()))}createForm(){this.form=this.fb.group({name:[null,[o.kI.required]],email:[null,[o.kI.required,o.kI.email]],apiPath:[null,[o.kI.required,o.kI.minLength(3),o.kI.maxLength(25),o.kI.pattern("[a-z0-9]*")]],password:[null,[]]})}showModal(){$("#idAMUsersForm").modal("show")}hideModal(){$("#idAMUsersForm").modal("hide")}save(){var t=this;return(0,m.Z)(function*(){const s=t.form.getRawValue();s.user=t.authCS.getUserId(),s.userType=u.dN.ADMIN;try{let a;t.loading.form=!0,t.data.mode===p.D.ADD?(s.password=t.generalS.getEncryptedString(s.password,T.N.crypto.passCommunication),a=yield t.userS.post(s).toPromise(),t.ns.showSuccess(t.constantsCS.user.addSuccess)):t.data.mode===p.D.EDIT&&(t.data.formData._id&&(s.userType=t.data.formData.userType,t.form.get("password").value?s.password=t.generalS.getEncryptedString(s.password,T.N.crypto.passCommunication):delete s.password),a=yield t.userS.put(t.data.formData._id,s,{select:h.iH._id}).toPromise(),t.ns.showSuccess(t.constantsCS.user.editSuccess)),t.data.eventChannel.emit({action:t.data.mode===p.D.ADD?c.F.SAVED:c.F.UPDATED}),t.loading.form=!1}catch(a){t.loading.form=!1,t.ns.showErrorFromResponse(a.error||a,"Unable to save user info.")}})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(s){return new(s||n)(e.Y36(o.qu),e.Y36(A.W),e.Y36(U.K),e.Y36(C.b),e.Y36(y.s),e.Y36(O.D))};static \u0275cmp=e.Xpm({type:n,selectors:[["app-w-admin-user-form"]],inputs:{data:"data"},decls:34,vars:7,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idAMUsersForm","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog"],[1,"modal-content"],[1,"modal-header"],[4,"ngIf"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],[1,"container","pt-3",3,"formGroup"],[1,"form-group","row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["formControlName","name","name","name","spellcheck","false","type","text","placeholder","Please provide name",1,"form-control","form-control-sm"],["formControlName","email","name","email","spellcheck","false","type","text","placeholder","Please provide email",1,"form-control","form-control-sm"],["class","form-group row",4,"ngIf"],["formControlName","apiPath","name","apiPath","spellcheck","false","type","text","placeholder","Please provide api path",1,"form-control","text-lowercase","form-control-sm"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["class","btn btn-primary btn-sm","sava-no-dbl-click","","type","button",3,"disabled","click",4,"ngIf"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],[1,"far","fa-eye","text-info","fa-fw","mr-1"],[1,"fas","fa-pencil-alt","text-light","fa-fw","mr-1"],["formControlName","password","name","password","spellcheck","false","type","password","placeholder","Please provide password",1,"form-control","form-control-sm"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,a){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),e.YNc(4,Y,3,0,"span",4),e.YNc(5,k,3,0,"span",4),e.YNc(6,J,3,0,"span",4),e.TgZ(7,"button",5)(8,"span",6),e._UZ(9,"i",7),e.qZA()()(),e.TgZ(10,"div",8)(11,"form",9)(12,"div",10)(13,"label",11),e._uU(14,"Name"),e.qZA(),e.TgZ(15,"div",12),e._UZ(16,"input",13),e.qZA()(),e.TgZ(17,"div",10)(18,"label",11),e._uU(19,"Email"),e.qZA(),e.TgZ(20,"div",12),e._UZ(21,"input",14),e.qZA()(),e.YNc(22,Q,5,0,"div",15),e.TgZ(23,"div",10)(24,"label",11),e._uU(25,"API Path"),e.qZA(),e.TgZ(26,"div",12),e._UZ(27,"input",16),e.qZA()()()(),e.TgZ(28,"div",17)(29,"button",18),e._UZ(30,"i",19),e._uU(31," Close"),e.qZA(),e.YNc(32,G,4,3,"button",20),e.qZA(),e.YNc(33,W,1,0,"p-progressSpinner",21),e.qZA()()()),2&s&&(e.xp6(4),e.Q6J("ngIf",a.data.mode===a.EFormMode.ADD),e.xp6(1),e.Q6J("ngIf",a.data.mode===a.EFormMode.VIEW),e.xp6(1),e.Q6J("ngIf",a.data.mode===a.EFormMode.EDIT),e.xp6(5),e.Q6J("formGroup",a.form),e.xp6(11),e.Q6J("ngIf",a.data.mode!==a.EFormMode.VIEW),e.xp6(10),e.Q6J("ngIf",a.data.mode!==a.EFormMode.VIEW),e.xp6(1),e.Q6J("ngIf",a.loading.form))},dependencies:[o._Y,o.Fj,o.JJ,o.JL,o.sg,o.u,S.O5,R.y,D.G],encapsulation:2})}return n})();const K=["adminUserFormC"];function H(n,l){if(1&n){const t=e.EpF();e.TgZ(0,"span",14),e.NdJ("click",function(){e.CHM(t);const a=e.oxw();return e.KtG(a.edit())}),e._UZ(1,"i",15),e.qZA()}}function L(n,l){if(1&n){const t=e.EpF();e.TgZ(0,"span",16),e.NdJ("click",function(){e.CHM(t);const a=e.oxw();return e.KtG(a.removePermanentDialog())}),e._UZ(1,"i",17),e.qZA()}}function B(n,l){1&n&&(e.TgZ(0,"tr")(1,"th"),e._uU(2,"Name"),e.qZA(),e.TgZ(3,"th"),e._uU(4,"Email"),e.qZA(),e.TgZ(5,"th"),e._uU(6,"API Path"),e.qZA()())}function j(n,l){if(1&n&&(e.TgZ(0,"tr",18)(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e._uU(4),e.qZA(),e.TgZ(5,"td"),e._uU(6),e.qZA()()),2&n){const t=l.$implicit;e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Oqu(t.email),e.xp6(2),e.Oqu(t.apiPath)}}function X(n,l){1&n&&e._UZ(0,"p-progressSpinner",19)}let I=(()=>{class n{userS;generalS;notificationS;confirmationService;navigationCS;constantsCS;eventCenterS;loading={grid:!1};subscriptions=[];data={mode:p.D.ADD,eventChannel:new e.vpe,formData:void 0};rows=[];rowsMap={};showAll=!1;selectedRows=[];gridKey=h.iH._id;adminUserFormC;constructor(t,s,a,i,d,g,se){this.userS=t,this.generalS=s,this.notificationS=a,this.confirmationService=i,this.navigationCS=d,this.constantsCS=g,this.eventCenterS=se}ngOnInit(){this.eventCenterS.user.selectedUsers.next([]),this.loadGridData(),this.subscriptions.push(this.data.eventChannel.subscribe(t=>{(t.action===c.F.SAVED||t.action===c.F.UPDATED)&&(this.adminUserFormC.hideModal(),this.loadGridData())}))}loadGridData(){var t=this;this.loading.grid=!0;const s={find:{active:!0,userType:{$in:[u.dN.ROOT,u.dN.ADMIN]}},select:{name:1,email:1,apiPath:1,active:1,userType:1},sort:{name:1}};this.showAll&&delete s.find.active,this.subscriptions.push(this.userS.query(s).subscribe(function(){var a=(0,m.Z)(function*(i){i.success&&(t.selectedRows=[],t.rows=i.data,t.rowsMap=M.keyBy(t.rows,h.iH._id));const d=t.navigationCS.getQueryParam(f.p.user);t.rowsMap[d]&&(t.eventCenterS.user.selectedUsers.next([t.rowsMap[d]]),t.selectedRows=[t.rowsMap[d]],yield t.fillData()),t.loading.grid=!1});return function(i){return a.apply(this,arguments)}}()))}add(){this.data.formData=void 0,this.data.mode=p.D.ADD,this.data.eventChannel.emit({action:c.F.OPEN_FORM_IN_ADD_MODE}),this.adminUserFormC.showModal()}view(){this.data.formData=this.selectedRows[0],this.data.mode=p.D.VIEW,this.data.eventChannel.emit({action:c.F.OPEN_FORM_IN_VIEW_MODE}),this.adminUserFormC.showModal()}edit(){this.data.formData=this.selectedRows[0],this.data.mode=p.D.EDIT,this.data.eventChannel.emit({action:c.F.OPEN_FORM_IN_EDIT_MODE}),this.adminUserFormC.showModal()}removePermanentDialog(){var t=this;return(0,m.Z)(function*(){var s;t.confirmationService.confirm({message:t.constantsCS.user.removePermanentConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(s=(0,m.Z)(function*(){yield t.removePermanent()}),function(){return s.apply(this,arguments)})})})()}removePermanent(){var t=this;return(0,m.Z)(function*(){t.loading.grid=!0;const s=yield t.userS.permanentDelete(t.selectedRows[0]._id).toPromise();t.loading.grid=!1,s.success?(t.notificationS.showSuccess(t.constantsCS.user.removePermanent),t.resetSelectedRows(),t.loadGridData()):t.notificationS.showErrorFromResponse(s,t.constantsCS.user.removePermanentError)})()}resetSelectedRows(){this.selectedRows.length=0,this.eventCenterS.user.selectedUsers.next([])}resetDependents(){var t=this;return(0,m.Z)(function*(){t.eventCenterS.user.selectedUsers.next([]),yield t.navigationCS.setQueryParam(f.p.user,null)})()}adminUserSelected(t){var s=this;return(0,m.Z)(function*(){s.selectedRows=t,s.resetDependents(),s.fillData()})()}fillData(){var t=this;return(0,m.Z)(function*(){if(!t.selectedRows.length)return yield t.navigationCS.setQueryParam(f.p.user,""),void t.eventCenterS.user.selectedUsers.next([]);const s=(yield t.userS.getById(t.selectedRows[0]._id).toPromise()).data;s._id?(yield t.navigationCS.setQueryParam(f.p.user,s._id),t.eventCenterS.user.selectedUsers.next([s])):t.resetDependents()})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}dblClickUsers(){this.selectedRows.length&&this.edit()}static \u0275fac=function(s){return new(s||n)(e.Y36(U.K),e.Y36(C.b),e.Y36(A.W),e.Y36(Z.YP),e.Y36(x.S),e.Y36(y.s),e.Y36(N.u))};static \u0275cmp=e.Xpm({type:n,selectors:[["app-w-admin-users"]],viewQuery:function(s,a){if(1&s&&e.Gf(K,5),2&s){let i;e.iGM(i=e.CRH())&&(a.adminUserFormC=i.first)}},decls:16,vars:10,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-users","text-info","fa-fw","mr-1"],["pTooltip","Add New",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],["class","float-right cursor-pointer ml-3","pTooltip","Edit",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Make Inactive",3,"click",4,"ngIf"],[1,"card-body","p-0","h-100","overflow-hidden"],["styleClass","p-datatable-striped","scrollHeight","calc(100vh - 94px)",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange","dblclick"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[3,"data"],["adminUserFormC",""],["pTooltip","Edit",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-pencil-alt","text-light","fa-fw"],["pTooltip","Make Inactive",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"far","fa-trash-alt","fa-fw","text-danger"],[3,"pSelectableRow"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,a){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"span"),e._UZ(3,"i",2),e._uU(4," Users"),e.qZA(),e.TgZ(5,"span",3),e.NdJ("click",function(){return a.add()}),e._UZ(6,"i",4),e.qZA(),e.YNc(7,H,2,0,"span",5),e.YNc(8,L,2,0,"span",6),e.qZA(),e.TgZ(9,"div",7)(10,"p-table",8),e.NdJ("selectionChange",function(d){return a.selectedRows=d})("dblclick",function(){return a.dblClickUsers()})("selectionChange",function(d){return a.adminUserSelected(d)}),e.YNc(11,B,7,0,"ng-template",9),e.YNc(12,j,7,4,"ng-template",10),e.qZA(),e.YNc(13,X,1,0,"p-progressSpinner",11),e.qZA()(),e._UZ(14,"app-w-admin-user-form",12,13)),2&s&&(e.xp6(7),e.Q6J("ngIf",a.selectedRows.length),e.xp6(1),e.Q6J("ngIf",a.selectedRows.length),e.xp6(2),e.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",a.selectedRows)("dataKey",a.gridKey)("scrollable",!0)("value",a.rows),e.xp6(3),e.Q6J("ngIf",a.loading.grid),e.xp6(1),e.Q6J("data",a.data))},dependencies:[S.O5,_.iA,Z.jx,_.Ei,D.G,P.u,w],encapsulation:2})}return n})();const ee=[{path:"",component:(()=>{class n{constructor(){}ngOnInit(){}static \u0275fac=function(s){return new(s||n)};static \u0275cmp=e.Xpm({type:n,selectors:[["app-admin-user-layout"]],decls:2,vars:0,consts:[[1,"pt-1","pl-1","pr-1"],[1,"w-100"]],template:function(s,a){1&s&&(e.TgZ(0,"div",0),e._UZ(1,"app-w-admin-users",1),e.qZA())},dependencies:[I],encapsulation:2})}return n})(),canActivate:[r(1490).g]}];let te=(()=>{class n{static \u0275fac=function(s){return new(s||n)};static \u0275mod=e.oAB({type:n});static \u0275inj=e.cJS({imports:[b.Bz.forChild(ee),E.u]})}return n})()}}]);
package/dist/6401.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkapi_maker_fe=self.webpackChunkapi_maker_fe||[]).push([[6401],{6401:($e,F,i)=>{i.r(F),i.d(F,{GroupM:()=>Ve});var q=i(7664),B=i(8176),K=i(3726),L=i(1025),Z=i(5085),e=i(4946),I=i(2915),w=i(5219),H=i(5043),V=i(3885),j=i(559),z=i(6937),X=i(740),ee=i(7595),te=i(9329),ne=i(356),se=i(3824),ae=i(8651),oe=i(2726),d=i(5861),C=i(3157),y=i(328),g=i(6212),c=i(6990),m=i(1162),R=i(8883),D=i(3429),ie=i(7629),re=i(2559),le=i(262),A=i(7240),E=i(9961),O=i(2189),N=i(5852),P=i(7414),pe=i(3065),M=i(6814),U=i(5431),T=i(7680),J=i(3259),h=i(95),ce=i(2660);function de(o,l){1&o&&(e.TgZ(0,"span"),e._UZ(1,"i",19),e._uU(2," Add Group"),e.qZA())}function ue(o,l){1&o&&(e.TgZ(0,"span"),e._UZ(1,"i",20),e._uU(2," View Group"),e.qZA())}function ge(o,l){1&o&&(e.TgZ(0,"span"),e._UZ(1,"i",21),e._uU(2," Edit Group"),e.qZA())}function me(o,l){1&o&&(e.TgZ(0,"span"),e._uU(1,"Save Group"),e.qZA())}function he(o,l){1&o&&(e.TgZ(0,"span"),e._uU(1,"Update Group"),e.qZA())}function fe(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"button",22),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.save())}),e._UZ(1,"i",23),e.YNc(2,me,2,0,"span",4),e.YNc(3,he,2,0,"span",4),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.form.invalid),e.xp6(2),e.Q6J("ngIf",t.data.mode===t.EFormMode.ADD),e.xp6(1),e.Q6J("ngIf",t.data.mode===t.EFormMode.EDIT)}}function ve(o,l){1&o&&e._UZ(0,"p-progressSpinner",24)}let k=(()=>{class o{fb;ns;groupS;generalS;authCS;constantsS;data;loading={form:!1};EFormMode=y.D;form;subscriptions=[];constructor(t,s,n,a,r,u){this.fb=t,this.ns=s,this.groupS=n,this.generalS=a,this.authCS=r,this.constantsS=u}ngOnInit(){var t=this;this.createForm(),this.subscriptions.push(this.data.eventChannel.subscribe(function(){var s=(0,d.Z)(function*(n){if(n)if(t.form.enable(),n.action===C.F.OPEN_FORM_IN_EDIT_MODE){const a=yield t.groupS.getById(t.data.formData._id).toPromise();t.form.reset(),t.form.patchValue(a.data)}else if(n.action===C.F.OPEN_FORM_IN_VIEW_MODE){const a=yield t.groupS.getById(t.data.formData._id).toPromise();t.form.reset(),t.form.patchValue(a.data),t.form.disable()}else n.action===C.F.OPEN_FORM_IN_ADD_MODE&&t.form.reset()});return function(n){return s.apply(this,arguments)}}()))}createForm(){this.form=this.fb.group({name:[null,[h.kI.required]]})}showModal(){$("#idGroupsForm").modal("show")}hideModal(){$("#idGroupsForm").modal("hide")}save(){var t=this;return(0,d.Z)(function*(){const s=t.form.getRawValue();let n;n=t.data.formData&&t.data.formData._id?(yield t.groupS.getById(t.data.formData._id).toPromise()).data:{};const a=Object.assign({},n,s);a.user=t.authCS.getUserId();try{let r;t.loading.form=!0,t.data.mode===y.D.ADD?r=yield t.groupS.post(a).toPromise():t.data.mode===y.D.EDIT&&(r=yield t.groupS.put(t.data.formData._id,a,{select:m.iH._id}).toPromise()),t.ns.showSuccess(t.data.mode===y.D.ADD?t.constantsS.group.addSuccess:t.constantsS.group.editSuccess),t.data.eventChannel.emit({action:t.data.mode===y.D.ADD?C.F.SAVED:C.F.UPDATED}),t.loading.form=!1}catch(r){t.loading.form=!1,t.ns.showErrorFromResponse(r.error||r,"Unable to save group.")}})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(s){return new(s||o)(e.Y36(h.qu),e.Y36(E.W),e.Y36(R.e),e.Y36(A.b),e.Y36(N.D),e.Y36(P.L))};static \u0275cmp=e.Xpm({type:o,selectors:[["app-w-groups-form"]],inputs:{data:"data"},decls:23,vars:6,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idGroupsForm","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog"],[1,"modal-content"],[1,"modal-header"],[4,"ngIf"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],[1,"container","pt-3",3,"formGroup"],[1,"form-group","row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["formControlName","name","name","name","spellcheck","false","type","text","placeholder","Please provide name",1,"form-control","form-control-sm"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["class","btn btn-primary btn-sm","sava-no-dbl-click","","type","button",3,"disabled","click",4,"ngIf"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],[1,"far","fa-eye","text-info","fa-fw","mr-1"],[1,"fas","fa-pencil-alt","text-light","fa-fw","mr-1"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,n){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),e.YNc(4,de,3,0,"span",4),e.YNc(5,ue,3,0,"span",4),e.YNc(6,ge,3,0,"span",4),e.TgZ(7,"button",5)(8,"span",6),e._UZ(9,"i",7),e.qZA()()(),e.TgZ(10,"div",8)(11,"form",9)(12,"div",10)(13,"label",11),e._uU(14,"Name"),e.qZA(),e.TgZ(15,"div",12),e._UZ(16,"input",13),e.qZA()()()(),e.TgZ(17,"div",14)(18,"button",15),e._UZ(19,"i",16),e._uU(20," Close"),e.qZA(),e.YNc(21,fe,4,3,"button",17),e.qZA(),e.YNc(22,ve,1,0,"p-progressSpinner",18),e.qZA()()()),2&s&&(e.xp6(4),e.Q6J("ngIf",n.data.mode===n.EFormMode.ADD),e.xp6(1),e.Q6J("ngIf",n.data.mode===n.EFormMode.VIEW),e.xp6(1),e.Q6J("ngIf",n.data.mode===n.EFormMode.EDIT),e.xp6(5),e.Q6J("formGroup",n.form),e.xp6(10),e.Q6J("ngIf",n.data.mode!==n.EFormMode.VIEW),e.xp6(1),e.Q6J("ngIf",n.loading.form))},dependencies:[h._Y,h.Fj,h.JJ,h.JL,h.sg,h.u,M.O5,ce.y,T.G],encapsulation:2})}return o})();const Ce=["groupsFormC"];function Se(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"span",18),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.edit())}),e._UZ(1,"i",19),e.qZA()}}function ye(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"span",20),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.clone())}),e._UZ(1,"i",21),e.qZA()}}function _e(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"span",22),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.removePermanentDialog())}),e._UZ(1,"i",23),e.qZA()}}function be(o,l){1&o&&(e.TgZ(0,"tr")(1,"th"),e._uU(2,"Name"),e.qZA(),e._UZ(3,"th",24),e.qZA())}function Ie(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"i",27),e.NdJ("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw();return e.KtG(r.saveGroupPermissions(n,a))}),e.qZA()}}function we(o,l){if(1&o&&(e.TgZ(0,"tr",25)(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e.YNc(4,Ie,1,0,"i",26),e.qZA()()),2&o){const t=l.$implicit,s=e.oxw();e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Q6J("ngIf",s.selectedRows.indexOf(t)>-1)}}function Ae(o,l){1&o&&e._UZ(0,"p-progressSpinner",28)}let Y=(()=>{class o{groupS;instanceS;functionS;tpInstalledApisS;webSocketEventsS;generalS;notificationS;navigationCS;authCS;constantsS;apiS;eventCenterS;confirmationService;loading={grid:!1};subscriptions=[];data={mode:y.D.ADD,eventChannel:new e.vpe,formData:void 0};rows=[];rowsMap={};showAll=!1;selectedRows=[];gridKey=m.iH._id;groupsFormC;constructor(t,s,n,a,r,u,_,p,f,S,v,b,x){this.groupS=t,this.instanceS=s,this.functionS=n,this.tpInstalledApisS=a,this.webSocketEventsS=r,this.generalS=u,this.notificationS=_,this.navigationCS=p,this.authCS=f,this.constantsS=S,this.apiS=v,this.eventCenterS=b,this.confirmationService=x}ngOnInit(){this.eventCenterS.group.selectedGroups.next([]),this.loadGridData(),this.subscriptions.push(this.data.eventChannel.subscribe(t=>{(t.action===C.F.SAVED||t.action===C.F.UPDATED)&&(this.groupsFormC.hideModal(),this.loadGridData())})),this.generalS.setNewTitle("API Maker - Groups")}loadGridData(){var t=this;this.loading.grid=!0;const s={find:{user:this.authCS.getUserId(),active:!0},select:{name:1,active:1},sort:{name:1}};this.showAll&&delete s.find.active,this.subscriptions.push(this.groupS.query(s).subscribe(function(){var n=(0,d.Z)(function*(a){a.success&&(t.selectedRows=[],t.rows=a.data,t.rowsMap=c.keyBy(t.rows,m.iH._id));const r=t.navigationCS.getQueryParam(g.p.group);t.rowsMap[r]&&(t.selectedRows.length=0,t.selectedRows.push(t.rowsMap[r]),yield t.fillData()),t.generalS.setNewTitle("API Maker - Groups"),t.loading.grid=!1});return function(a){return n.apply(this,arguments)}}()))}add(){this.data.formData=void 0,this.data.mode=y.D.ADD,this.data.eventChannel.emit({action:C.F.OPEN_FORM_IN_ADD_MODE}),this.groupsFormC.showModal()}view(){this.data.formData=this.selectedRows[0],this.data.mode=y.D.VIEW,this.data.eventChannel.emit({action:C.F.OPEN_FORM_IN_VIEW_MODE}),this.groupsFormC.showModal()}edit(){this.data.formData=this.selectedRows[0],this.data.mode=y.D.EDIT,this.data.eventChannel.emit({action:C.F.OPEN_FORM_IN_EDIT_MODE}),this.groupsFormC.showModal()}clone(){var t=this;return(0,d.Z)(function*(){try{if(!t.selectedRows[0])return;const s=(yield t.groupS.getById(t.selectedRows[0]._id).toPromise()).data;delete s._id,delete s.queryParamsMap,s.name=`${s.name}-clone`,(yield t.groupS.post(s).toPromise()).success?(t.notificationS.showSuccess(t.constantsS.group.cloneSuccess),t.loadGridData()):t.notificationS.showSuccess(t.constantsS.group.cloneSuccess)}catch{t.notificationS.showError(t.constantsS.group.cloneError)}})()}removePermanentDialog(){var t=this;return(0,d.Z)(function*(){var s;t.confirmationService.confirm({message:t.constantsS.group.removePermanentConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(s=(0,d.Z)(function*(){yield t.removePermanent()}),function(){return s.apply(this,arguments)})})})()}removePermanent(){var t=this;return(0,d.Z)(function*(){t.loading.grid=!0;const s=yield t.groupS.permanentDelete(t.selectedRows[0]._id).toPromise();t.loading.grid=!1,s.success?(t.notificationS.showSuccess(t.constantsS.group.removePermanent),t.resetSelectedRows(),t.loadGridData()):t.notificationS.showErrorFromResponse(s,t.constantsS.group.removePermanentError)})()}resetSelectedRows(){this.selectedRows.length=0,this.eventCenterS.group.selectedGroups.next([])}resetDependents(){var t=this;return(0,d.Z)(function*(){t.eventCenterS.group.selectedGroups.next([]),yield t.generalS.resetUrlParams([g.p.group,g.p.api_category]),t.eventCenterS.apiCategory.selectedApiCategory.next([]),t.eventCenterS.group.instanceIds.next([]),t.eventCenterS.group.databaseNames.next([]),t.eventCenterS.group.collectionNames.next([]),t.eventCenterS.group.supportedApiIds.next([]),t.eventCenterS.group.fields.next([]),t.eventCenterS.group.customApiIds.next([]),t.eventCenterS.group.thirdPartyApiIds.next([]),t.eventCenterS.group.systemApiIds.next([]),t.eventCenterS.group.webSocketIds.next([]),t.eventCenterS.group.apisRegex={}})()}groupSelected(){var t=this;return(0,d.Z)(function*(){yield t.resetDependents(),yield t.fillData()})()}fillData(){var t=this;return(0,d.Z)(function*(){if(!t.selectedRows.length)return void(yield t.resetDependents());const s=(yield t.groupS.getById(t.selectedRows[0]._id).toPromise()).data;s&&s.queryParams&&(t.eventCenterS.group.instanceIds.next((yield t.apiS.getIdArrFromNames(s.queryParams.instanceNames,t.instanceS))||[]),t.eventCenterS.group.databaseNames.next(s.queryParams.databaseNames||[]),t.eventCenterS.group.collectionNames.next(s.queryParams.collectionNames||[]),t.eventCenterS.group.supportedApiIds.next(s.queryParams.supportedApiNames||[]),t.eventCenterS.group.fields.next(s.queryParams.fields||[]),t.eventCenterS.group.customApiIds.next((yield t.apiS.getIdArrFromNames(s.queryParams.customApiNames,t.functionS))||[]),t.eventCenterS.group.systemApiIds.next(s.queryParams.systemApiNames||[]),t.eventCenterS.group.thirdPartyApiIds.next((yield t.apiS.getIdArrFromNames(s.queryParams.thirdPartyApiNames,t.tpInstalledApisS,Z.R.THIRD_PARTY_APIS))||[]),t.eventCenterS.group.webSocketIds.next(yield t.apiS.getIdArrFromNamesWebSocketEvents(s.queryParams.webSocketEventNames))),s&&(t.eventCenterS.group.selectedGroups.next([s]),t.eventCenterS.group.apisRegex=s.apisRegex,yield t.navigationCS.setQueryParam(g.p.group,t.selectedRows[0]._id)),s?.queryParams||t.resetDependents()})()}saveGroupPermissions(t,s){var n=this;return(0,d.Z)(function*(){t.stopImmediatePropagation();const a=JSON.parse(JSON.stringify(s));a.fields=n.getPermissionMap(n.eventCenterS.group.schemaFields.value,["path","allowRead","allowWrite"]),a.apisRegex=n.eventCenterS.group.apisRegex,a.queryParams={},a.user=n.authCS.getUserId(),a.queryParams.instanceNames=yield n.apiS.getNameArrFromIds(n.eventCenterS.group.instanceIds.value,n.instanceS),a.queryParams.databaseNames=c.uniq(n.eventCenterS.group.databaseNames.value),a.queryParams.collectionNames=c.uniq(n.eventCenterS.group.collectionNames.value),a.queryParams.supportedApiNames=c.uniq(n.eventCenterS.group.supportedApiIds.value),a.queryParams.fields=c.uniq(n.eventCenterS.group.fields.value),a.queryParams.customApiNames=yield n.apiS.getNameArrFromIds(n.eventCenterS.group.customApiIds.value,n.functionS),a.queryParams.systemApiNames=c.uniq(n.eventCenterS.group.systemApiIds.value),a.queryParams.thirdPartyApiNames=yield n.apiS.getNameArrFromIds(n.eventCenterS.group.thirdPartyApiIds.value,n.tpInstalledApisS,Z.R.THIRD_PARTY_APIS),a.queryParams.webSocketEventNames=yield n.apiS.getNameArrFromIdsWebSocketEvents(n.eventCenterS.group.webSocketIds.value);const r=yield n.groupS.put(a._id,a,{select:m.iH._id}).toPromise();r&&r.success&&n.notificationS.showSuccess(n.constantsS.group.editSuccess)})()}getPermissionMap(t,s){const n=s.slice(1),a=c.groupBy(t,m.W$.instanceName);for(const r in a){const u=a[r]=c.groupBy(a[r],m.W$.databaseName);for(const _ in u){const p=u[_]=c.groupBy(u[_],m.W$.collectionName);for(const f in p)if(1===s.length){const S={};for(const v of p[f])S[v[s[0]]]=!0;p[f]=S}else{const S={};for(const v of p[f])S[v[s[0]]]=c.pick(v,n);p[f]=S}}}return a}getPermissionMapThirdPartyAPIs(t){const s=c.groupBy(t,m.W$.apiBundleName);for(const n in s){if("undefined"===n){delete s[n];continue}const a=s[n]=c.groupBy(s[n],m.W$.apiVersionName);for(const r in a){if("undefined"===r){delete a[r];continue}const u=a[r]=c.groupBy(a[r],m.W$.apiName);for(const _ in u)"undefined"!==_?u[_]=!0:delete u[_]}}return s}getPermissionMapFunctionsAndWSEventAndSysApis(t){const s={};for(const n of t||[])s[n._id]=!0;return s}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}dblClickGroups(){this.selectedRows.length&&this.edit()}static \u0275fac=function(s){return new(s||o)(e.Y36(R.e),e.Y36(D.E),e.Y36(ie.d),e.Y36(re.d),e.Y36(le.a),e.Y36(A.b),e.Y36(E.W),e.Y36(O.S),e.Y36(N.D),e.Y36(P.L),e.Y36(pe.k),e.Y36(I.u),e.Y36(w.YP))};static \u0275cmp=e.Xpm({type:o,selectors:[["app-w-groups"]],viewQuery:function(s,n){if(1&s&&e.Gf(Ce,5),2&s){let a;e.iGM(a=e.CRH())&&(n.groupsFormC=a.first)}},decls:20,vars:11,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],["src","/assets/images/icons/api-group.svg","alt","API Group Permissions",1,"fa-fw","mr-1"],[1,"float-right"],["href","https://docs.apimaker.dev/v1/docs/apis-security/api-group-permission.html","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"fa-fw","ml-3","mr-1","mt-n1",2,"font-size","25px"],["pTooltip","Add New",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],["class","float-right cursor-pointer ml-3","pTooltip","Edit",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Clone",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Permanent Delete",3,"click",4,"ngIf"],[1,"card-body","p-0","h-100","overflow-hidden"],["styleClass","p-datatable-striped log-profile-grid-height","scrollHeight","flex",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange","dblclick"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[3,"data"],["groupsFormC",""],["pTooltip","Edit",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-pencil-alt","text-light","fa-fw"],["pTooltip","Clone",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-copy","text-warning","fa-fw"],["pTooltip","Permanent Delete",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"far","fa-trash-alt","fa-fw","text-danger"],[2,"width","40px"],[3,"pSelectableRow"],["class","fas fa-save text-success fa-fw cursor-pointer","pTooltip","Save group settings",3,"click",4,"ngIf"],["pTooltip","Save group settings",1,"fas","fa-save","text-success","fa-fw","cursor-pointer",3,"click"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,n){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"span"),e._UZ(3,"img",2),e._uU(4," Groups"),e.qZA(),e.TgZ(5,"div",3)(6,"a",4),e._UZ(7,"img",5),e.qZA()(),e.TgZ(8,"span",6),e.NdJ("click",function(){return n.add()}),e._UZ(9,"i",7),e.qZA(),e.YNc(10,Se,2,0,"span",8),e.YNc(11,ye,2,0,"span",9),e.YNc(12,_e,2,0,"span",10),e.qZA(),e.TgZ(13,"div",11)(14,"p-table",12),e.NdJ("selectionChange",function(r){return n.selectedRows=r})("selectionChange",function(){return n.groupSelected()})("dblclick",function(){return n.dblClickGroups()}),e.YNc(15,be,4,0,"ng-template",13),e.YNc(16,we,5,3,"ng-template",14),e.qZA(),e.YNc(17,Ae,1,0,"p-progressSpinner",15),e.qZA()(),e._UZ(18,"app-w-groups-form",16,17)),2&s&&(e.xp6(10),e.Q6J("ngIf",n.selectedRows.length),e.xp6(1),e.Q6J("ngIf",n.selectedRows.length),e.xp6(1),e.Q6J("ngIf",n.selectedRows.length),e.xp6(2),e.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",n.selectedRows)("dataKey",n.gridKey)("scrollable",!0)("value",n.rows),e.xp6(3),e.Q6J("ngIf",n.loading.grid),e.xp6(1),e.Q6J("data",n.data))},dependencies:[M.O5,U.iA,w.jx,U.Ei,T.G,J.u,k]})}return o})();var Me=i(1426),Te=i(7526),Ze=i(8057);function De(o,l){if(1&o&&(e.TgZ(0,"div")(1,"div",10),e._uU(2),e.qZA()()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(t.constantsS.group.allFieldsPermitted)}}function Ne(o,l){if(1&o&&(e.TgZ(0,"span",18),e._uU(1),e.qZA()),2&o){const t=e.oxw().$implicit;e.xp6(1),e.AsE(" [",t.instanceName.substr(0,3).toUpperCase(),"] [",t.databaseName.substr(0,3).toUpperCase(),"] ")}}function Pe(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"span",19)(1,"label",20)(2,"p-checkbox",21),e.NdJ("ngModelChange",function(n){e.CHM(t);const a=e.oxw().$implicit;return e.KtG(a.allowRead=n)})("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw(2);return r.generalS.stopPropagation(n),e.KtG(r.removeDataItemFromSelectedRows(a))}),e.qZA()(),e.TgZ(3,"label",22)(4,"p-checkbox",23),e.NdJ("ngModelChange",function(n){e.CHM(t);const a=e.oxw().$implicit;return e.KtG(a.allowWrite=n)})("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw(2);return r.generalS.stopPropagation(n),e.KtG(r.removeDataItemFromSelectedRows(a))}),e.qZA()()()}if(2&o){const t=e.oxw().$implicit;e.xp6(2),e.Q6J("ngModel",t.allowRead)("binary",!0),e.xp6(2),e.Q6J("ngModel",t.allowWrite)("binary",!0)}}function xe(o,l){if(1&o&&(e.TgZ(0,"div",15),e._uU(1),e.YNc(2,Ne,2,2,"span",16),e.YNc(3,Pe,5,4,"span",17),e.qZA()),2&o){const t=l.$implicit,s=e.oxw(2);e.xp6(1),e.hij(" ",t.label||t.name," "),e.xp6(1),e.Q6J("ngIf",t.level1),e.xp6(1),e.Q6J("ngIf",!t.level1&&(!t.children||0===t.children.length)&&s.selectedRows.indexOf(t)>=0)}}function Ge(o,l){1&o&&e._UZ(0,"p-progressSpinner",24)}function Fe(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"div",11)(1,"p-tree",12),e.NdJ("selectionChange",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.selectedRows=n)})("selectionChange",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.checkedChange())})("onNodeSelect",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.nodeSelected(n))})("onNodeUnselect",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.nodeUnSelected(n))}),e.YNc(2,xe,4,3,"ng-template",13),e.qZA(),e.YNc(3,Ge,1,0,"p-progressSpinner",14),e.qZA()}if(2&o){const t=e.oxw();e.xp6(1),e.Q6J("value",t.propertiesListData)("selection",t.selectedRows)("metaKeySelection",!1),e.xp6(2),e.Q6J("ngIf",t.loading.grid)}}let Q=(()=>{class o{instanceS;eventCenterS;constantsS;generalS;loading={grid:!1};subscriptions=[];propertiesListData=[];allTreeItemsMap={};selectedRows=[];checkedKeysMap={};key="_id";constructor(t,s,n,a){this.instanceS=t,this.eventCenterS=s,this.constantsS=n,this.generalS=a}ngOnInit(){var t=this;this.subscriptions.push(this.eventCenterS.collection.selectedCollections.pipe((0,Me.b)(300)).subscribe(function(){var s=(0,d.Z)(function*(n){yield t.loadSchemas()});return function(n){return s.apply(this,arguments)}}()))}loadSchemas(){var t=this;return(0,d.Z)(function*(){const s=t.eventCenterS.collection.selectedCollections.value;if(!s.length)return void(yield t.resetGridAndUrl());t.loading.grid=!0;const n=t.eventCenterS.group.selectedGroups.value[0];yield t.resetGridAndUrl(),t.allTreeItemsMap={};const a=(yield t.instanceS.getSchemas(s).toPromise()).data,r=[],u=[];for(const p of a){const f=[];if(p.propertyItems){const b=[];for(const x of p.propertyItems){const G=t.generalS.convertKTreeItemToPrimeNGTreeItem(x);t.setReadWriteRecursively(n,G),b.push(G),f.push(G)}u.push(b)}const S=p.instanceName+":"+p.databaseName+":"+p.collectionName,v={label:`${p.collectionName}`,children:f,_id:S,level1:!0,instanceName:p.instanceName,databaseName:p.databaseName,collectionName:p.collectionName};r.push(v),t.allTreeItemsMap[S]=v;for(const b of v?.children||[])b.parent=v}t.propertiesListData=r;for(const p of u)t.generateIdMap(p,t.allTreeItemsMap);if(t.eventCenterS.group.fields.value.join(",")){const p=c.intersection(c.keys(t.allTreeItemsMap),t.eventCenterS.group.fields.value);t.selectedRows=[];for(const f of p)t.allTreeItemsMap[f]&&t.selectedRows.push(t.allTreeItemsMap[f]);t.generalS.setDataInSelectedRowsFromIdArr(p,t.selectedRows,t.allTreeItemsMap),t.setDataInEventCenter()}t.loading.grid=!1})()}setReadWriteRecursively(t,s){const n=t?.fields?.[s.instanceName]?.[s.databaseName]?.[s.collectionName];if(!n)return;const a=n[s.path];if(a?(s.allowRead=a.allowRead,s.allowWrite=a.allowWrite):s.allowRead=s.allowWrite=!1,s.children&&s.children.length)for(const r of s.children)this.setReadWriteRecursively(t,r)}resetGridAndUrl(){var t=this;return(0,d.Z)(function*(){t.propertiesListData=[],t.allTreeItemsMap={},t.selectedRows=[],t.checkedKeysMap={},t.eventCenterS.group.schemaFields.next([])})()}checkedChange(){this.setDataInEventCenter()}nodeSelected(t){t.node.allowRead=!0}nodeUnSelected(t){const s=t.node;s.allowRead=!1,s.allowWrite=!1}removeDataItemFromSelectedRows(t){if(!t.allowRead&&!t.allowWrite){const s=this.selectedRows.indexOf(t);s>=0&&this.selectedRows.splice(s,1)}}calculateCheckedKeysMap(){this.checkedKeysMap={};for(const t of this.selectedRows)this.checkedKeysMap[t._id]=t}setDataInEventCenter(){this.calculateCheckedKeysMap(),this.eventCenterS.group.fields.next(c.map(this.selectedRows,"_id"));const t=[];for(const s of this.selectedRows)this.allTreeItemsMap[s._id]&&t.push(s);this.eventCenterS.group.schemaFields.next(t)}generateIdMap(t,s){if(Array.isArray(t))for(const n of t)this.generateIdMap(n,s);else s[t._id]=t,t.children&&this.generateIdMap(t.children,s)}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(s){return new(s||o)(e.Y36(D.E),e.Y36(I.u),e.Y36(P.L),e.Y36(A.b))};static \u0275cmp=e.Xpm({type:o,selectors:[["app-w-schema-fields"]],decls:12,vars:4,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-indent","text-success","fa-fw","mr-1"],["pTooltip","All Fields",1,"float-right","cursor-pointer"],[1,"mb-0","mt--2px"],[3,"ngModel","binary","ngModelChange"],[1,"card-body","p-0","h-100","overflow-hidden"],[1,"position-relative","border-top","h-100"],[4,"ngIf"],["class","h-100",4,"ngIf"],[1,"p-2","text-center","text-success"],[1,"h-100"],["scrollHeight","flex","selectionMode","checkbox",1,"w-full",3,"value","selection","metaKeySelection","selectionChange","onNodeSelect","onNodeUnselect"],["pTemplate","default"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"w-100","prevent-text-selection","cursor-pointer"],["class","text-monospace font-weight-bold font-italic float-right mr-1","style","font-size: xx-small;",4,"ngIf"],["class","float-right small mr-2",4,"ngIf"],[1,"text-monospace","font-weight-bold","font-italic","float-right","mr-1",2,"font-size","xx-small"],[1,"float-right","small","mr-2"],[1,"align-middle","mb-0","mr-2"],["label","R",3,"ngModel","binary","ngModelChange","click"],[1,"align-middle","mb-0"],["label","W",3,"ngModel","binary","ngModelChange","click"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,n){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"span"),e._UZ(3,"i",2),e._uU(4," Schema Fields"),e.qZA(),e.TgZ(5,"span",3)(6,"label",4)(7,"p-checkbox",5),e.NdJ("ngModelChange",function(r){return n.eventCenterS.group.apisRegex.allFields=r}),e.qZA()()()(),e.TgZ(8,"div",6)(9,"div",7),e.YNc(10,De,3,1,"div",8),e.YNc(11,Fe,4,4,"div",9),e.qZA()()()),2&s&&(e.xp6(7),e.Q6J("ngModel",n.eventCenterS.group.apisRegex.allFields)("binary",!0),e.xp6(3),e.Q6J("ngIf",n.eventCenterS.group.apisRegex.allInstances||n.eventCenterS.group.apisRegex.allDatabases||n.eventCenterS.group.apisRegex.allCollections||n.eventCenterS.group.apisRegex.allFields),e.xp6(1),e.Q6J("ngIf",!(n.eventCenterS.group.apisRegex.allInstances||n.eventCenterS.group.apisRegex.allDatabases||n.eventCenterS.group.apisRegex.allCollections||n.eventCenterS.group.apisRegex.allFields)))},dependencies:[h.JJ,h.On,M.O5,w.jx,Te.mp,T.G,J.u,Ze.XZ],encapsulation:2})}return o})();function Re(o,l){1&o&&(e.TgZ(0,"div",21),e._UZ(1,"app-w-instances",10),e.qZA()),2&o&&(e.xp6(1),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0))}function Ee(o,l){1&o&&(e.TgZ(0,"div",22),e._UZ(1,"app-w-databases",10),e.qZA()),2&o&&(e.xp6(1),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0))}const Oe=function(){return[50,50]};let W=(()=>{class o{eventCenterS;EAPICategory=Z.R;constructor(t){this.eventCenterS=t}ngOnInit(){}ngOnDestroy(){this.eventCenterS.group.apisRegex={}}static \u0275fac=function(s){return new(s||o)(e.Y36(I.u))};static \u0275cmp=e.Xpm({type:o,selectors:[["app-group-layout"]],decls:34,vars:42,consts:[[1,"pt-1","pl-1","pr-1","overflow-auto"],[2,"width","max-content"],[1,"v-div","w-groups"],[1,"vertical-height-max"],[1,"v-div","w-categories"],[3,"typeIsGroup"],[1,"v-div","w-ins-db"],["layout","vertical",3,"panelSizes"],["pTemplate",""],[1,"v-div","w-collection"],[3,"metaKeySelection","IsReadOnly","IsDependentOnGroup"],[1,"v-div","w-ins-apis"],[3,"isLPM","isDependentOnGroup","treeViewId"],[1,"v-div","w-schema-fields"],[1,"v-div","w-third-party"],[3,"IsDependentOnGroup","isLPM"],[1,"v-div","w-custom-apis"],[3,"metaKeySelection","IsReadOnly","IsDependentOnGroup","isLPM"],[1,"v-div","w-system-apis"],[1,"v-div","w-web-sockets"],[3,"metaKeySelection","IsReadOnly","IsDependentOnGroup","showCheckbox","isLPM"],[1,"vertical-height-instances","w-100"],[1,"vertical-height-db","w-100"]],template:function(s,n){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),e._UZ(4,"app-w-groups"),e.qZA()(),e.TgZ(5,"div",4)(6,"div",3),e._UZ(7,"app-w-api-categories",5),e.qZA()(),e.TgZ(8,"div",6)(9,"p-splitter",7),e.YNc(10,Re,2,3,"ng-template",8),e.YNc(11,Ee,2,3,"ng-template",8),e.qZA()(),e.TgZ(12,"div",9)(13,"div",3),e._UZ(14,"app-w-collections",10),e.qZA()(),e.TgZ(15,"div",11)(16,"div",3),e._UZ(17,"app-w-supported-api",12),e.qZA()(),e.TgZ(18,"div",13)(19,"div",3),e._UZ(20,"app-w-schema-fields"),e.qZA()(),e.TgZ(21,"div",14)(22,"div",3),e._UZ(23,"app-w-supported-tp-api",15),e.qZA()(),e.TgZ(24,"div",16)(25,"div",3),e._UZ(26,"app-custom-api-grid",17),e.qZA()(),e.TgZ(27,"div",18)(28,"div",3),e._UZ(29,"app-system-api-w",17),e.qZA()(),e.TgZ(30,"div",19)(31,"div",3),e._UZ(32,"app-web-socket-events-grid",20),e.qZA()()()(),e._UZ(33,"app-create-schema-form")),2&s&&(e.xp6(5),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length?"block":"none"),e.xp6(2),e.Q6J("typeIsGroup","GROUP"),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.INSTANCES?"block":"none"),e.xp6(1),e.Q6J("panelSizes",e.DdM(41,Oe)),e.xp6(3),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.INSTANCES?"block":"none"),e.xp6(2),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.INSTANCES?"block":"none"),e.xp6(2),e.Q6J("isLPM",!1)("isDependentOnGroup",!0)("treeViewId","treeViewFromGroupLayout"),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.INSTANCES?"block":"none"),e.xp6(3),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.THIRD_PARTY_APIS?"block":"none"),e.xp6(2),e.Q6J("IsDependentOnGroup",!0)("isLPM",!1),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.CUSTOM_APIS?"block":"none"),e.xp6(2),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0)("isLPM",!1),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.SYSTEM_APIS?"block":"none"),e.xp6(2),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0)("isLPM",!1),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.WEB_SOCKET_EVENT?"block":"none"),e.xp6(2),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0)("showCheckbox",!0)("isLPM",!1))},dependencies:[w.jx,H.q,V.f,j.O,z.n,X.c,ee.G,te.X,ne.T,se.d,ae.A,oe.x,Y,Q],styles:[".vertical-height-instances[_ngcontent-%COMP%]{height:248px}.vertical-height-db[_ngcontent-%COMP%]{height:calc(100vh - 320px)}.vertical-height-max[_ngcontent-%COMP%]{height:calc(100vh - 66px)}.v-div[_ngcontent-%COMP%]{display:inline-block;height:calc(100vh - 62px);float:left}.w-groups[_ngcontent-%COMP%]{width:20rem}.w-categories[_ngcontent-%COMP%]{width:17rem}.w-ins-db[_ngcontent-%COMP%]{width:25rem}.w-collection[_ngcontent-%COMP%]{width:28rem}.w-ins-apis[_ngcontent-%COMP%], .w-schema-fields[_ngcontent-%COMP%]{width:35rem}.w-custom-apis[_ngcontent-%COMP%], .w-system-apis[_ngcontent-%COMP%], .w-third-party[_ngcontent-%COMP%], .w-web-sockets[_ngcontent-%COMP%]{width:calc(100vw - 37.5rem)}"]})}return o})();i(3965);var Ye=i(1678),Qe=i(5765),We=i(4211),qe=i(4186),Be=i(2777),Ke=i(7705),Le=i(1434);const He=[{path:"group-layout",component:W,canActivate:[K.P]}];let Ve=(()=>{class o{static \u0275fac=function(s){return new(s||o)};static \u0275mod=e.oAB({type:o});static \u0275inj=e.cJS({imports:[q.Bz.forChild(He),B.u,Ye.DashboardM,We.DbCellM,Qe.FunctionManM,qe.SystemApiM,Le.B,Be.u,Ke.L,L.WebSocketEventsM]})}return o})()}}]);
1
+ "use strict";(self.webpackChunkapi_maker_fe=self.webpackChunkapi_maker_fe||[]).push([[6401],{6401:($e,F,i)=>{i.r(F),i.d(F,{GroupM:()=>Ve});var q=i(7664),B=i(7359),K=i(3726),L=i(1025),Z=i(5085),e=i(4946),I=i(2915),w=i(5219),H=i(5043),V=i(3885),j=i(559),z=i(6937),X=i(740),ee=i(7595),te=i(9329),ne=i(356),se=i(3824),ae=i(8651),oe=i(2726),d=i(5861),C=i(3157),y=i(328),g=i(6212),c=i(6990),m=i(1162),R=i(8883),D=i(3429),ie=i(7629),re=i(2559),le=i(262),A=i(7240),E=i(9961),O=i(2189),N=i(5852),P=i(7414),pe=i(3065),M=i(6814),U=i(5431),T=i(7680),J=i(3259),h=i(95),ce=i(2660);function de(o,l){1&o&&(e.TgZ(0,"span"),e._UZ(1,"i",19),e._uU(2," Add Group"),e.qZA())}function ue(o,l){1&o&&(e.TgZ(0,"span"),e._UZ(1,"i",20),e._uU(2," View Group"),e.qZA())}function ge(o,l){1&o&&(e.TgZ(0,"span"),e._UZ(1,"i",21),e._uU(2," Edit Group"),e.qZA())}function me(o,l){1&o&&(e.TgZ(0,"span"),e._uU(1,"Save Group"),e.qZA())}function he(o,l){1&o&&(e.TgZ(0,"span"),e._uU(1,"Update Group"),e.qZA())}function fe(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"button",22),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.save())}),e._UZ(1,"i",23),e.YNc(2,me,2,0,"span",4),e.YNc(3,he,2,0,"span",4),e.qZA()}if(2&o){const t=e.oxw();e.Q6J("disabled",t.form.invalid),e.xp6(2),e.Q6J("ngIf",t.data.mode===t.EFormMode.ADD),e.xp6(1),e.Q6J("ngIf",t.data.mode===t.EFormMode.EDIT)}}function ve(o,l){1&o&&e._UZ(0,"p-progressSpinner",24)}let k=(()=>{class o{fb;ns;groupS;generalS;authCS;constantsS;data;loading={form:!1};EFormMode=y.D;form;subscriptions=[];constructor(t,s,n,a,r,u){this.fb=t,this.ns=s,this.groupS=n,this.generalS=a,this.authCS=r,this.constantsS=u}ngOnInit(){var t=this;this.createForm(),this.subscriptions.push(this.data.eventChannel.subscribe(function(){var s=(0,d.Z)(function*(n){if(n)if(t.form.enable(),n.action===C.F.OPEN_FORM_IN_EDIT_MODE){const a=yield t.groupS.getById(t.data.formData._id).toPromise();t.form.reset(),t.form.patchValue(a.data)}else if(n.action===C.F.OPEN_FORM_IN_VIEW_MODE){const a=yield t.groupS.getById(t.data.formData._id).toPromise();t.form.reset(),t.form.patchValue(a.data),t.form.disable()}else n.action===C.F.OPEN_FORM_IN_ADD_MODE&&t.form.reset()});return function(n){return s.apply(this,arguments)}}()))}createForm(){this.form=this.fb.group({name:[null,[h.kI.required]]})}showModal(){$("#idGroupsForm").modal("show")}hideModal(){$("#idGroupsForm").modal("hide")}save(){var t=this;return(0,d.Z)(function*(){const s=t.form.getRawValue();let n;n=t.data.formData&&t.data.formData._id?(yield t.groupS.getById(t.data.formData._id).toPromise()).data:{};const a=Object.assign({},n,s);a.user=t.authCS.getUserId();try{let r;t.loading.form=!0,t.data.mode===y.D.ADD?r=yield t.groupS.post(a).toPromise():t.data.mode===y.D.EDIT&&(r=yield t.groupS.put(t.data.formData._id,a,{select:m.iH._id}).toPromise()),t.ns.showSuccess(t.data.mode===y.D.ADD?t.constantsS.group.addSuccess:t.constantsS.group.editSuccess),t.data.eventChannel.emit({action:t.data.mode===y.D.ADD?C.F.SAVED:C.F.UPDATED}),t.loading.form=!1}catch(r){t.loading.form=!1,t.ns.showErrorFromResponse(r.error||r,"Unable to save group.")}})()}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(s){return new(s||o)(e.Y36(h.qu),e.Y36(E.W),e.Y36(R.e),e.Y36(A.b),e.Y36(N.D),e.Y36(P.L))};static \u0275cmp=e.Xpm({type:o,selectors:[["app-w-groups-form"]],inputs:{data:"data"},decls:23,vars:6,consts:[["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idGroupsForm","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog"],[1,"modal-content"],[1,"modal-header"],[4,"ngIf"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],[1,"container","pt-3",3,"formGroup"],[1,"form-group","row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["formControlName","name","name","name","spellcheck","false","type","text","placeholder","Please provide name",1,"form-control","form-control-sm"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["class","btn btn-primary btn-sm","sava-no-dbl-click","","type","button",3,"disabled","click",4,"ngIf"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],[1,"far","fa-eye","text-info","fa-fw","mr-1"],[1,"fas","fa-pencil-alt","text-light","fa-fw","mr-1"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"disabled","click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,n){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),e.YNc(4,de,3,0,"span",4),e.YNc(5,ue,3,0,"span",4),e.YNc(6,ge,3,0,"span",4),e.TgZ(7,"button",5)(8,"span",6),e._UZ(9,"i",7),e.qZA()()(),e.TgZ(10,"div",8)(11,"form",9)(12,"div",10)(13,"label",11),e._uU(14,"Name"),e.qZA(),e.TgZ(15,"div",12),e._UZ(16,"input",13),e.qZA()()()(),e.TgZ(17,"div",14)(18,"button",15),e._UZ(19,"i",16),e._uU(20," Close"),e.qZA(),e.YNc(21,fe,4,3,"button",17),e.qZA(),e.YNc(22,ve,1,0,"p-progressSpinner",18),e.qZA()()()),2&s&&(e.xp6(4),e.Q6J("ngIf",n.data.mode===n.EFormMode.ADD),e.xp6(1),e.Q6J("ngIf",n.data.mode===n.EFormMode.VIEW),e.xp6(1),e.Q6J("ngIf",n.data.mode===n.EFormMode.EDIT),e.xp6(5),e.Q6J("formGroup",n.form),e.xp6(10),e.Q6J("ngIf",n.data.mode!==n.EFormMode.VIEW),e.xp6(1),e.Q6J("ngIf",n.loading.form))},dependencies:[h._Y,h.Fj,h.JJ,h.JL,h.sg,h.u,M.O5,ce.y,T.G],encapsulation:2})}return o})();const Ce=["groupsFormC"];function Se(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"span",18),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.edit())}),e._UZ(1,"i",19),e.qZA()}}function ye(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"span",20),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.clone())}),e._UZ(1,"i",21),e.qZA()}}function _e(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"span",22),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.removePermanentDialog())}),e._UZ(1,"i",23),e.qZA()}}function be(o,l){1&o&&(e.TgZ(0,"tr")(1,"th"),e._uU(2,"Name"),e.qZA(),e._UZ(3,"th",24),e.qZA())}function Ie(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"i",27),e.NdJ("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw();return e.KtG(r.saveGroupPermissions(n,a))}),e.qZA()}}function we(o,l){if(1&o&&(e.TgZ(0,"tr",25)(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e.YNc(4,Ie,1,0,"i",26),e.qZA()()),2&o){const t=l.$implicit,s=e.oxw();e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Q6J("ngIf",s.selectedRows.indexOf(t)>-1)}}function Ae(o,l){1&o&&e._UZ(0,"p-progressSpinner",28)}let Y=(()=>{class o{groupS;instanceS;functionS;tpInstalledApisS;webSocketEventsS;generalS;notificationS;navigationCS;authCS;constantsS;apiS;eventCenterS;confirmationService;loading={grid:!1};subscriptions=[];data={mode:y.D.ADD,eventChannel:new e.vpe,formData:void 0};rows=[];rowsMap={};showAll=!1;selectedRows=[];gridKey=m.iH._id;groupsFormC;constructor(t,s,n,a,r,u,_,p,f,S,v,b,x){this.groupS=t,this.instanceS=s,this.functionS=n,this.tpInstalledApisS=a,this.webSocketEventsS=r,this.generalS=u,this.notificationS=_,this.navigationCS=p,this.authCS=f,this.constantsS=S,this.apiS=v,this.eventCenterS=b,this.confirmationService=x}ngOnInit(){this.eventCenterS.group.selectedGroups.next([]),this.loadGridData(),this.subscriptions.push(this.data.eventChannel.subscribe(t=>{(t.action===C.F.SAVED||t.action===C.F.UPDATED)&&(this.groupsFormC.hideModal(),this.loadGridData())})),this.generalS.setNewTitle("API Maker - Groups")}loadGridData(){var t=this;this.loading.grid=!0;const s={find:{user:this.authCS.getUserId(),active:!0},select:{name:1,active:1},sort:{name:1}};this.showAll&&delete s.find.active,this.subscriptions.push(this.groupS.query(s).subscribe(function(){var n=(0,d.Z)(function*(a){a.success&&(t.selectedRows=[],t.rows=a.data,t.rowsMap=c.keyBy(t.rows,m.iH._id));const r=t.navigationCS.getQueryParam(g.p.group);t.rowsMap[r]&&(t.selectedRows.length=0,t.selectedRows.push(t.rowsMap[r]),yield t.fillData()),t.generalS.setNewTitle("API Maker - Groups"),t.loading.grid=!1});return function(a){return n.apply(this,arguments)}}()))}add(){this.data.formData=void 0,this.data.mode=y.D.ADD,this.data.eventChannel.emit({action:C.F.OPEN_FORM_IN_ADD_MODE}),this.groupsFormC.showModal()}view(){this.data.formData=this.selectedRows[0],this.data.mode=y.D.VIEW,this.data.eventChannel.emit({action:C.F.OPEN_FORM_IN_VIEW_MODE}),this.groupsFormC.showModal()}edit(){this.data.formData=this.selectedRows[0],this.data.mode=y.D.EDIT,this.data.eventChannel.emit({action:C.F.OPEN_FORM_IN_EDIT_MODE}),this.groupsFormC.showModal()}clone(){var t=this;return(0,d.Z)(function*(){try{if(!t.selectedRows[0])return;const s=(yield t.groupS.getById(t.selectedRows[0]._id).toPromise()).data;delete s._id,delete s.queryParamsMap,s.name=`${s.name}-clone`,(yield t.groupS.post(s).toPromise()).success?(t.notificationS.showSuccess(t.constantsS.group.cloneSuccess),t.loadGridData()):t.notificationS.showSuccess(t.constantsS.group.cloneSuccess)}catch{t.notificationS.showError(t.constantsS.group.cloneError)}})()}removePermanentDialog(){var t=this;return(0,d.Z)(function*(){var s;t.confirmationService.confirm({message:t.constantsS.group.removePermanentConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(s=(0,d.Z)(function*(){yield t.removePermanent()}),function(){return s.apply(this,arguments)})})})()}removePermanent(){var t=this;return(0,d.Z)(function*(){t.loading.grid=!0;const s=yield t.groupS.permanentDelete(t.selectedRows[0]._id).toPromise();t.loading.grid=!1,s.success?(t.notificationS.showSuccess(t.constantsS.group.removePermanent),t.resetSelectedRows(),t.loadGridData()):t.notificationS.showErrorFromResponse(s,t.constantsS.group.removePermanentError)})()}resetSelectedRows(){this.selectedRows.length=0,this.eventCenterS.group.selectedGroups.next([])}resetDependents(){var t=this;return(0,d.Z)(function*(){t.eventCenterS.group.selectedGroups.next([]),yield t.generalS.resetUrlParams([g.p.group,g.p.api_category]),t.eventCenterS.apiCategory.selectedApiCategory.next([]),t.eventCenterS.group.instanceIds.next([]),t.eventCenterS.group.databaseNames.next([]),t.eventCenterS.group.collectionNames.next([]),t.eventCenterS.group.supportedApiIds.next([]),t.eventCenterS.group.fields.next([]),t.eventCenterS.group.customApiIds.next([]),t.eventCenterS.group.thirdPartyApiIds.next([]),t.eventCenterS.group.systemApiIds.next([]),t.eventCenterS.group.webSocketIds.next([]),t.eventCenterS.group.apisRegex={}})()}groupSelected(){var t=this;return(0,d.Z)(function*(){yield t.resetDependents(),yield t.fillData()})()}fillData(){var t=this;return(0,d.Z)(function*(){if(!t.selectedRows.length)return void(yield t.resetDependents());const s=(yield t.groupS.getById(t.selectedRows[0]._id).toPromise()).data;s&&s.queryParams&&(t.eventCenterS.group.instanceIds.next((yield t.apiS.getIdArrFromNames(s.queryParams.instanceNames,t.instanceS))||[]),t.eventCenterS.group.databaseNames.next(s.queryParams.databaseNames||[]),t.eventCenterS.group.collectionNames.next(s.queryParams.collectionNames||[]),t.eventCenterS.group.supportedApiIds.next(s.queryParams.supportedApiNames||[]),t.eventCenterS.group.fields.next(s.queryParams.fields||[]),t.eventCenterS.group.customApiIds.next((yield t.apiS.getIdArrFromNames(s.queryParams.customApiNames,t.functionS))||[]),t.eventCenterS.group.systemApiIds.next(s.queryParams.systemApiNames||[]),t.eventCenterS.group.thirdPartyApiIds.next((yield t.apiS.getIdArrFromNames(s.queryParams.thirdPartyApiNames,t.tpInstalledApisS,Z.R.THIRD_PARTY_APIS))||[]),t.eventCenterS.group.webSocketIds.next(yield t.apiS.getIdArrFromNamesWebSocketEvents(s.queryParams.webSocketEventNames))),s&&(t.eventCenterS.group.selectedGroups.next([s]),t.eventCenterS.group.apisRegex=s.apisRegex,yield t.navigationCS.setQueryParam(g.p.group,t.selectedRows[0]._id)),s?.queryParams||t.resetDependents()})()}saveGroupPermissions(t,s){var n=this;return(0,d.Z)(function*(){t.stopImmediatePropagation();const a=JSON.parse(JSON.stringify(s));a.fields=n.getPermissionMap(n.eventCenterS.group.schemaFields.value,["path","allowRead","allowWrite"]),a.apisRegex=n.eventCenterS.group.apisRegex,a.queryParams={},a.user=n.authCS.getUserId(),a.queryParams.instanceNames=yield n.apiS.getNameArrFromIds(n.eventCenterS.group.instanceIds.value,n.instanceS),a.queryParams.databaseNames=c.uniq(n.eventCenterS.group.databaseNames.value),a.queryParams.collectionNames=c.uniq(n.eventCenterS.group.collectionNames.value),a.queryParams.supportedApiNames=c.uniq(n.eventCenterS.group.supportedApiIds.value),a.queryParams.fields=c.uniq(n.eventCenterS.group.fields.value),a.queryParams.customApiNames=yield n.apiS.getNameArrFromIds(n.eventCenterS.group.customApiIds.value,n.functionS),a.queryParams.systemApiNames=c.uniq(n.eventCenterS.group.systemApiIds.value),a.queryParams.thirdPartyApiNames=yield n.apiS.getNameArrFromIds(n.eventCenterS.group.thirdPartyApiIds.value,n.tpInstalledApisS,Z.R.THIRD_PARTY_APIS),a.queryParams.webSocketEventNames=yield n.apiS.getNameArrFromIdsWebSocketEvents(n.eventCenterS.group.webSocketIds.value);const r=yield n.groupS.put(a._id,a,{select:m.iH._id}).toPromise();r&&r.success&&n.notificationS.showSuccess(n.constantsS.group.editSuccess)})()}getPermissionMap(t,s){const n=s.slice(1),a=c.groupBy(t,m.W$.instanceName);for(const r in a){const u=a[r]=c.groupBy(a[r],m.W$.databaseName);for(const _ in u){const p=u[_]=c.groupBy(u[_],m.W$.collectionName);for(const f in p)if(1===s.length){const S={};for(const v of p[f])S[v[s[0]]]=!0;p[f]=S}else{const S={};for(const v of p[f])S[v[s[0]]]=c.pick(v,n);p[f]=S}}}return a}getPermissionMapThirdPartyAPIs(t){const s=c.groupBy(t,m.W$.apiBundleName);for(const n in s){if("undefined"===n){delete s[n];continue}const a=s[n]=c.groupBy(s[n],m.W$.apiVersionName);for(const r in a){if("undefined"===r){delete a[r];continue}const u=a[r]=c.groupBy(a[r],m.W$.apiName);for(const _ in u)"undefined"!==_?u[_]=!0:delete u[_]}}return s}getPermissionMapFunctionsAndWSEventAndSysApis(t){const s={};for(const n of t||[])s[n._id]=!0;return s}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}dblClickGroups(){this.selectedRows.length&&this.edit()}static \u0275fac=function(s){return new(s||o)(e.Y36(R.e),e.Y36(D.E),e.Y36(ie.d),e.Y36(re.d),e.Y36(le.a),e.Y36(A.b),e.Y36(E.W),e.Y36(O.S),e.Y36(N.D),e.Y36(P.L),e.Y36(pe.k),e.Y36(I.u),e.Y36(w.YP))};static \u0275cmp=e.Xpm({type:o,selectors:[["app-w-groups"]],viewQuery:function(s,n){if(1&s&&e.Gf(Ce,5),2&s){let a;e.iGM(a=e.CRH())&&(n.groupsFormC=a.first)}},decls:20,vars:11,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],["src","/assets/images/icons/api-group.svg","alt","API Group Permissions",1,"fa-fw","mr-1"],[1,"float-right"],["href","https://docs.apimaker.dev/v1/docs/apis-security/api-group-permission.html","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"fa-fw","ml-3","mr-1","mt-n1",2,"font-size","25px"],["pTooltip","Add New",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],["class","float-right cursor-pointer ml-3","pTooltip","Edit",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Clone",3,"click",4,"ngIf"],["class","float-right cursor-pointer ml-3","pTooltip","Permanent Delete",3,"click",4,"ngIf"],[1,"card-body","p-0","h-100","overflow-hidden"],["styleClass","p-datatable-striped log-profile-grid-height","scrollHeight","flex",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange","dblclick"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[3,"data"],["groupsFormC",""],["pTooltip","Edit",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-pencil-alt","text-light","fa-fw"],["pTooltip","Clone",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"fas","fa-copy","text-warning","fa-fw"],["pTooltip","Permanent Delete",1,"float-right","cursor-pointer","ml-3",3,"click"],[1,"far","fa-trash-alt","fa-fw","text-danger"],[2,"width","40px"],[3,"pSelectableRow"],["class","fas fa-save text-success fa-fw cursor-pointer","pTooltip","Save group settings",3,"click",4,"ngIf"],["pTooltip","Save group settings",1,"fas","fa-save","text-success","fa-fw","cursor-pointer",3,"click"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,n){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"span"),e._UZ(3,"img",2),e._uU(4," Groups"),e.qZA(),e.TgZ(5,"div",3)(6,"a",4),e._UZ(7,"img",5),e.qZA()(),e.TgZ(8,"span",6),e.NdJ("click",function(){return n.add()}),e._UZ(9,"i",7),e.qZA(),e.YNc(10,Se,2,0,"span",8),e.YNc(11,ye,2,0,"span",9),e.YNc(12,_e,2,0,"span",10),e.qZA(),e.TgZ(13,"div",11)(14,"p-table",12),e.NdJ("selectionChange",function(r){return n.selectedRows=r})("selectionChange",function(){return n.groupSelected()})("dblclick",function(){return n.dblClickGroups()}),e.YNc(15,be,4,0,"ng-template",13),e.YNc(16,we,5,3,"ng-template",14),e.qZA(),e.YNc(17,Ae,1,0,"p-progressSpinner",15),e.qZA()(),e._UZ(18,"app-w-groups-form",16,17)),2&s&&(e.xp6(10),e.Q6J("ngIf",n.selectedRows.length),e.xp6(1),e.Q6J("ngIf",n.selectedRows.length),e.xp6(1),e.Q6J("ngIf",n.selectedRows.length),e.xp6(2),e.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",n.selectedRows)("dataKey",n.gridKey)("scrollable",!0)("value",n.rows),e.xp6(3),e.Q6J("ngIf",n.loading.grid),e.xp6(1),e.Q6J("data",n.data))},dependencies:[M.O5,U.iA,w.jx,U.Ei,T.G,J.u,k]})}return o})();var Me=i(3620),Te=i(1396),Ze=i(8057);function De(o,l){if(1&o&&(e.TgZ(0,"div")(1,"div",10),e._uU(2),e.qZA()()),2&o){const t=e.oxw();e.xp6(2),e.Oqu(t.constantsS.group.allFieldsPermitted)}}function Ne(o,l){if(1&o&&(e.TgZ(0,"span",18),e._uU(1),e.qZA()),2&o){const t=e.oxw().$implicit;e.xp6(1),e.AsE(" [",t.instanceName.substr(0,3).toUpperCase(),"] [",t.databaseName.substr(0,3).toUpperCase(),"] ")}}function Pe(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"span",19)(1,"label",20)(2,"p-checkbox",21),e.NdJ("ngModelChange",function(n){e.CHM(t);const a=e.oxw().$implicit;return e.KtG(a.allowRead=n)})("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw(2);return r.generalS.stopPropagation(n),e.KtG(r.removeDataItemFromSelectedRows(a))}),e.qZA()(),e.TgZ(3,"label",22)(4,"p-checkbox",23),e.NdJ("ngModelChange",function(n){e.CHM(t);const a=e.oxw().$implicit;return e.KtG(a.allowWrite=n)})("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw(2);return r.generalS.stopPropagation(n),e.KtG(r.removeDataItemFromSelectedRows(a))}),e.qZA()()()}if(2&o){const t=e.oxw().$implicit;e.xp6(2),e.Q6J("ngModel",t.allowRead)("binary",!0),e.xp6(2),e.Q6J("ngModel",t.allowWrite)("binary",!0)}}function xe(o,l){if(1&o&&(e.TgZ(0,"div",15),e._uU(1),e.YNc(2,Ne,2,2,"span",16),e.YNc(3,Pe,5,4,"span",17),e.qZA()),2&o){const t=l.$implicit,s=e.oxw(2);e.xp6(1),e.hij(" ",t.label||t.name," "),e.xp6(1),e.Q6J("ngIf",t.level1),e.xp6(1),e.Q6J("ngIf",!t.level1&&(!t.children||0===t.children.length)&&s.selectedRows.indexOf(t)>=0)}}function Ge(o,l){1&o&&e._UZ(0,"p-progressSpinner",24)}function Fe(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"div",11)(1,"p-tree",12),e.NdJ("selectionChange",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.selectedRows=n)})("selectionChange",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.checkedChange())})("onNodeSelect",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.nodeSelected(n))})("onNodeUnselect",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.nodeUnSelected(n))}),e.YNc(2,xe,4,3,"ng-template",13),e.qZA(),e.YNc(3,Ge,1,0,"p-progressSpinner",14),e.qZA()}if(2&o){const t=e.oxw();e.xp6(1),e.Q6J("value",t.propertiesListData)("selection",t.selectedRows)("metaKeySelection",!1),e.xp6(2),e.Q6J("ngIf",t.loading.grid)}}let Q=(()=>{class o{instanceS;eventCenterS;constantsS;generalS;loading={grid:!1};subscriptions=[];propertiesListData=[];allTreeItemsMap={};selectedRows=[];checkedKeysMap={};key="_id";constructor(t,s,n,a){this.instanceS=t,this.eventCenterS=s,this.constantsS=n,this.generalS=a}ngOnInit(){var t=this;this.subscriptions.push(this.eventCenterS.collection.selectedCollections.pipe((0,Me.b)(300)).subscribe(function(){var s=(0,d.Z)(function*(n){yield t.loadSchemas()});return function(n){return s.apply(this,arguments)}}()))}loadSchemas(){var t=this;return(0,d.Z)(function*(){const s=t.eventCenterS.collection.selectedCollections.value;if(!s.length)return void(yield t.resetGridAndUrl());t.loading.grid=!0;const n=t.eventCenterS.group.selectedGroups.value[0];yield t.resetGridAndUrl(),t.allTreeItemsMap={};const a=(yield t.instanceS.getSchemas(s).toPromise()).data,r=[],u=[];for(const p of a){const f=[];if(p.propertyItems){const b=[];for(const x of p.propertyItems){const G=t.generalS.convertKTreeItemToPrimeNGTreeItem(x);t.setReadWriteRecursively(n,G),b.push(G),f.push(G)}u.push(b)}const S=p.instanceName+":"+p.databaseName+":"+p.collectionName,v={label:`${p.collectionName}`,children:f,_id:S,level1:!0,instanceName:p.instanceName,databaseName:p.databaseName,collectionName:p.collectionName};r.push(v),t.allTreeItemsMap[S]=v;for(const b of v?.children||[])b.parent=v}t.propertiesListData=r;for(const p of u)t.generateIdMap(p,t.allTreeItemsMap);if(t.eventCenterS.group.fields.value.join(",")){const p=c.intersection(c.keys(t.allTreeItemsMap),t.eventCenterS.group.fields.value);t.selectedRows=[];for(const f of p)t.allTreeItemsMap[f]&&t.selectedRows.push(t.allTreeItemsMap[f]);t.generalS.setDataInSelectedRowsFromIdArr(p,t.selectedRows,t.allTreeItemsMap),t.setDataInEventCenter()}t.loading.grid=!1})()}setReadWriteRecursively(t,s){const n=t?.fields?.[s.instanceName]?.[s.databaseName]?.[s.collectionName];if(!n)return;const a=n[s.path];if(a?(s.allowRead=a.allowRead,s.allowWrite=a.allowWrite):s.allowRead=s.allowWrite=!1,s.children&&s.children.length)for(const r of s.children)this.setReadWriteRecursively(t,r)}resetGridAndUrl(){var t=this;return(0,d.Z)(function*(){t.propertiesListData=[],t.allTreeItemsMap={},t.selectedRows=[],t.checkedKeysMap={},t.eventCenterS.group.schemaFields.next([])})()}checkedChange(){this.setDataInEventCenter()}nodeSelected(t){t.node.allowRead=!0}nodeUnSelected(t){const s=t.node;s.allowRead=!1,s.allowWrite=!1}removeDataItemFromSelectedRows(t){if(!t.allowRead&&!t.allowWrite){const s=this.selectedRows.indexOf(t);s>=0&&this.selectedRows.splice(s,1)}}calculateCheckedKeysMap(){this.checkedKeysMap={};for(const t of this.selectedRows)this.checkedKeysMap[t._id]=t}setDataInEventCenter(){this.calculateCheckedKeysMap(),this.eventCenterS.group.fields.next(c.map(this.selectedRows,"_id"));const t=[];for(const s of this.selectedRows)this.allTreeItemsMap[s._id]&&t.push(s);this.eventCenterS.group.schemaFields.next(t)}generateIdMap(t,s){if(Array.isArray(t))for(const n of t)this.generateIdMap(n,s);else s[t._id]=t,t.children&&this.generateIdMap(t.children,s)}ngOnDestroy(){this.generalS.unsubscribe(this.subscriptions)}static \u0275fac=function(s){return new(s||o)(e.Y36(D.E),e.Y36(I.u),e.Y36(P.L),e.Y36(A.b))};static \u0275cmp=e.Xpm({type:o,selectors:[["app-w-schema-fields"]],decls:12,vars:4,consts:[[1,"card","shadow-sm","h-100"],[1,"card-header"],[1,"fas","fa-indent","text-success","fa-fw","mr-1"],["pTooltip","All Fields",1,"float-right","cursor-pointer"],[1,"mb-0","mt--2px"],[3,"ngModel","binary","ngModelChange"],[1,"card-body","p-0","h-100","overflow-hidden"],[1,"position-relative","border-top","h-100"],[4,"ngIf"],["class","h-100",4,"ngIf"],[1,"p-2","text-center","text-success"],[1,"h-100"],["scrollHeight","flex","selectionMode","checkbox",1,"w-full",3,"value","selection","metaKeySelection","selectionChange","onNodeSelect","onNodeUnselect"],["pTemplate","default"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"w-100","prevent-text-selection","cursor-pointer"],["class","text-monospace font-weight-bold font-italic float-right mr-1","style","font-size: xx-small;",4,"ngIf"],["class","float-right small mr-2",4,"ngIf"],[1,"text-monospace","font-weight-bold","font-italic","float-right","mr-1",2,"font-size","xx-small"],[1,"float-right","small","mr-2"],[1,"align-middle","mb-0","mr-2"],["label","R",3,"ngModel","binary","ngModelChange","click"],[1,"align-middle","mb-0"],["label","W",3,"ngModel","binary","ngModelChange","click"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,n){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"span"),e._UZ(3,"i",2),e._uU(4," Schema Fields"),e.qZA(),e.TgZ(5,"span",3)(6,"label",4)(7,"p-checkbox",5),e.NdJ("ngModelChange",function(r){return n.eventCenterS.group.apisRegex.allFields=r}),e.qZA()()()(),e.TgZ(8,"div",6)(9,"div",7),e.YNc(10,De,3,1,"div",8),e.YNc(11,Fe,4,4,"div",9),e.qZA()()()),2&s&&(e.xp6(7),e.Q6J("ngModel",n.eventCenterS.group.apisRegex.allFields)("binary",!0),e.xp6(3),e.Q6J("ngIf",n.eventCenterS.group.apisRegex.allInstances||n.eventCenterS.group.apisRegex.allDatabases||n.eventCenterS.group.apisRegex.allCollections||n.eventCenterS.group.apisRegex.allFields),e.xp6(1),e.Q6J("ngIf",!(n.eventCenterS.group.apisRegex.allInstances||n.eventCenterS.group.apisRegex.allDatabases||n.eventCenterS.group.apisRegex.allCollections||n.eventCenterS.group.apisRegex.allFields)))},dependencies:[h.JJ,h.On,M.O5,w.jx,Te.mp,T.G,J.u,Ze.XZ],encapsulation:2})}return o})();function Re(o,l){1&o&&(e.TgZ(0,"div",21),e._UZ(1,"app-w-instances",10),e.qZA()),2&o&&(e.xp6(1),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0))}function Ee(o,l){1&o&&(e.TgZ(0,"div",22),e._UZ(1,"app-w-databases",10),e.qZA()),2&o&&(e.xp6(1),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0))}const Oe=function(){return[50,50]};let W=(()=>{class o{eventCenterS;EAPICategory=Z.R;constructor(t){this.eventCenterS=t}ngOnInit(){}ngOnDestroy(){this.eventCenterS.group.apisRegex={}}static \u0275fac=function(s){return new(s||o)(e.Y36(I.u))};static \u0275cmp=e.Xpm({type:o,selectors:[["app-group-layout"]],decls:34,vars:42,consts:[[1,"pt-1","pl-1","pr-1","overflow-auto"],[2,"width","max-content"],[1,"v-div","w-groups"],[1,"vertical-height-max"],[1,"v-div","w-categories"],[3,"typeIsGroup"],[1,"v-div","w-ins-db"],["layout","vertical",3,"panelSizes"],["pTemplate",""],[1,"v-div","w-collection"],[3,"metaKeySelection","IsReadOnly","IsDependentOnGroup"],[1,"v-div","w-ins-apis"],[3,"isLPM","isDependentOnGroup","treeViewId"],[1,"v-div","w-schema-fields"],[1,"v-div","w-third-party"],[3,"IsDependentOnGroup","isLPM"],[1,"v-div","w-custom-apis"],[3,"metaKeySelection","IsReadOnly","IsDependentOnGroup","isLPM"],[1,"v-div","w-system-apis"],[1,"v-div","w-web-sockets"],[3,"metaKeySelection","IsReadOnly","IsDependentOnGroup","showCheckbox","isLPM"],[1,"vertical-height-instances","w-100"],[1,"vertical-height-db","w-100"]],template:function(s,n){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),e._UZ(4,"app-w-groups"),e.qZA()(),e.TgZ(5,"div",4)(6,"div",3),e._UZ(7,"app-w-api-categories",5),e.qZA()(),e.TgZ(8,"div",6)(9,"p-splitter",7),e.YNc(10,Re,2,3,"ng-template",8),e.YNc(11,Ee,2,3,"ng-template",8),e.qZA()(),e.TgZ(12,"div",9)(13,"div",3),e._UZ(14,"app-w-collections",10),e.qZA()(),e.TgZ(15,"div",11)(16,"div",3),e._UZ(17,"app-w-supported-api",12),e.qZA()(),e.TgZ(18,"div",13)(19,"div",3),e._UZ(20,"app-w-schema-fields"),e.qZA()(),e.TgZ(21,"div",14)(22,"div",3),e._UZ(23,"app-w-supported-tp-api",15),e.qZA()(),e.TgZ(24,"div",16)(25,"div",3),e._UZ(26,"app-custom-api-grid",17),e.qZA()(),e.TgZ(27,"div",18)(28,"div",3),e._UZ(29,"app-system-api-w",17),e.qZA()(),e.TgZ(30,"div",19)(31,"div",3),e._UZ(32,"app-web-socket-events-grid",20),e.qZA()()()(),e._UZ(33,"app-create-schema-form")),2&s&&(e.xp6(5),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length?"block":"none"),e.xp6(2),e.Q6J("typeIsGroup","GROUP"),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.INSTANCES?"block":"none"),e.xp6(1),e.Q6J("panelSizes",e.DdM(41,Oe)),e.xp6(3),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.INSTANCES?"block":"none"),e.xp6(2),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.INSTANCES?"block":"none"),e.xp6(2),e.Q6J("isLPM",!1)("isDependentOnGroup",!0)("treeViewId","treeViewFromGroupLayout"),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.INSTANCES?"block":"none"),e.xp6(3),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.THIRD_PARTY_APIS?"block":"none"),e.xp6(2),e.Q6J("IsDependentOnGroup",!0)("isLPM",!1),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.CUSTOM_APIS?"block":"none"),e.xp6(2),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0)("isLPM",!1),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.SYSTEM_APIS?"block":"none"),e.xp6(2),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0)("isLPM",!1),e.xp6(1),e.Udp("display",n.eventCenterS.group.selectedGroups.value.length&&(null==n.eventCenterS.apiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory||null==n.eventCenterS.apiCategory.selectedApiCategory.value||null==n.eventCenterS.apiCategory.selectedApiCategory.value[0]?null:n.eventCenterS.apiCategory.selectedApiCategory.value[0].id)===n.EAPICategory.WEB_SOCKET_EVENT?"block":"none"),e.xp6(2),e.Q6J("metaKeySelection",!1)("IsReadOnly",!0)("IsDependentOnGroup",!0)("showCheckbox",!0)("isLPM",!1))},dependencies:[w.jx,H.q,V.f,j.O,z.n,X.c,ee.G,te.X,ne.T,se.d,ae.A,oe.x,Y,Q],styles:[".vertical-height-instances[_ngcontent-%COMP%]{height:248px}.vertical-height-db[_ngcontent-%COMP%]{height:calc(100vh - 320px)}.vertical-height-max[_ngcontent-%COMP%]{height:calc(100vh - 66px)}.v-div[_ngcontent-%COMP%]{display:inline-block;height:calc(100vh - 62px);float:left}.w-groups[_ngcontent-%COMP%]{width:20rem}.w-categories[_ngcontent-%COMP%]{width:17rem}.w-ins-db[_ngcontent-%COMP%]{width:25rem}.w-collection[_ngcontent-%COMP%]{width:28rem}.w-ins-apis[_ngcontent-%COMP%], .w-schema-fields[_ngcontent-%COMP%]{width:35rem}.w-custom-apis[_ngcontent-%COMP%], .w-system-apis[_ngcontent-%COMP%], .w-third-party[_ngcontent-%COMP%], .w-web-sockets[_ngcontent-%COMP%]{width:calc(100vw - 37.5rem)}"]})}return o})();i(3965);var Ye=i(1678),Qe=i(5765),We=i(4211),qe=i(4186),Be=i(2777),Ke=i(7705),Le=i(1434);const He=[{path:"group-layout",component:W,canActivate:[K.P]}];let Ve=(()=>{class o{static \u0275fac=function(s){return new(s||o)};static \u0275mod=e.oAB({type:o});static \u0275inj=e.cJS({imports:[q.Bz.forChild(He),B.u,Ye.DashboardM,We.DbCellM,Qe.FunctionManM,qe.SystemApiM,Le.B,Be.u,Ke.L,L.WebSocketEventsM]})}return o})()}}]);
package/dist/7368.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkapi_maker_fe=self.webpackChunkapi_maker_fe||[]).push([[7368],{7368:(xe,S,s)=>{s.r(S),s.d(S,{SandboxSettingsM:()=>fe});var O=s(7664),D=s(3726),y=s(8176),M=s(5249),d=s(5861),e=s(4946),_=s(6990),v=s(3157),c=s(328),k=s(1162),h=s(553),U=s(4371),x=s(5852),b=s(3835),w=s(5405),Z=s(9961),p=s(5219),T=s(7414),I=s(2304),N=s(4977),P=s(3429),E=s(1344),J=s(7240),g=s(95),u=s(6814),G=s(8147),R=s(1861),K=s(756),f=s(5431),Y=s(7680),C=s(4844),A=s(3259),q=s(2660);function F(o,l){1&o&&(e.TgZ(0,"tr")(1,"th"),e._uU(2,"Name"),e.qZA(),e.TgZ(3,"th",28),e._uU(4,"Action"),e.qZA()())}function H(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"div",31)(1,"button",32),e.NdJ("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw();return e.KtG(r.editAllowedOrigin(n,a))}),e._UZ(2,"i",33),e.qZA(),e.TgZ(3,"button",34),e.NdJ("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw();return e.KtG(r.removeAllowedOrigin(n,a))}),e._UZ(4,"i",35),e.qZA()()}}function L(o,l){if(1&o&&(e.TgZ(0,"tr",29)(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e.YNc(4,H,5,0,"div",30),e.qZA()()),2&o){const t=l.$implicit;e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Q6J("ngIf",!t.isReadOnly)}}function Q(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"button",36),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.save())}),e._UZ(1,"i",37),e.TgZ(2,"span"),e._uU(3,"Save"),e.qZA()()}}let V=(()=>{class o{authCS;userS;eventCenterCS;notificationS;cs;confirmationService;modalId="idAllowedOriginModal";subscriptions=[];allowedOriginsGridData=[];saveSettings=new e.vpe;gridKeyAllowedOrigins="name";allowedOriginModel={domainName:"",domainNameBak:""};exampleOrigin=location.origin;allowedOriginData={mode:c.D.ADD};EFormMode=c.D;selectedRowsUI=[];constructor(t,i,n,a,r,m){this.authCS=t,this.userS=i,this.eventCenterCS=n,this.notificationS=a,this.cs=r,this.confirmationService=m}ngOnInit(){}save(){var t=this;return(0,d.Z)(function*(){if(t.allowedOriginData.mode===c.D.ADD)t.allowedOriginsGridData.push({name:t.allowedOriginModel.domainName});else{const i=t.allowedOriginsGridData.findIndex(n=>n.name===t.allowedOriginModel.domainNameBak);t.allowedOriginsGridData[i].name=t.allowedOriginModel.domainName}t.allowedOriginsGridData=_.uniqBy(t.allowedOriginsGridData,"name"),t.saveSettings.emit(),t.hideAllowedOriginModal()})()}showAllowedOriginModal(){$("#idAllowedOriginModal").modal("show")}hideAllowedOriginModal(){$("#idAllowedOriginModal").modal("hide")}addAllowedOrigin(){var t=this;return(0,d.Z)(function*(){t.allowedOriginModel.domainNameBak=t.allowedOriginModel.domainName="",t.allowedOriginData.mode=c.D.ADD,t.showAllowedOriginModal()})()}editAllowedOrigin(t,i){var n=this;return(0,d.Z)(function*(){n.allowedOriginModel.domainNameBak=n.allowedOriginModel.domainName=i.name,n.allowedOriginData.mode=c.D.EDIT,n.showAllowedOriginModal()})()}doubleClick(){this.editAllowedOrigin(null,this.selectedRowsUI[0]).then()}removeAllowedOrigin(t,i){var n=this;return(0,d.Z)(function*(){var a;n.confirmationService.confirm({message:n.cs.amUserSandboxDepSetting.removePermanentAllowedOriginConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(a=(0,d.Z)(function*(){yield n.removeAO(t,i)}),function(){return a.apply(this,arguments)})})})()}removeAO(t,i){var n=this;return(0,d.Z)(function*(){const a=n.allowedOriginsGridData.findIndex(r=>r.name===i.name);n.allowedOriginsGridData.splice(a,1),n.saveSettings.emit()})()}ngOnDestroy(){for(const t of this.subscriptions)t.unsubscribe()}static \u0275fac=function(i){return new(i||o)(e.Y36(x.D),e.Y36(b.K),e.Y36(w.M),e.Y36(Z.W),e.Y36(T.L),e.Y36(p.YP))};static \u0275cmp=e.Xpm({type:o,selectors:[["allowed-origin-c"]],inputs:{allowedOriginsGridData:["allowedOrigins","allowedOriginsGridData"]},outputs:{saveSettings:"saveSettings"},decls:37,vars:10,consts:[[1,"card","shadow-sm","mt-2","mr-1","mb-5",2,"height","384px"],[1,"card-header"],[1,"fas","fa-link","text-yellow","fa-fw","mr-1"],["pTooltip","Add New",1,"float-right","cursor-pointer","mr-1",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],[1,"card-body","p-0","overflow-hidden"],["styleClass","p-datatable-striped","scrollHeight","350px",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange","dblclick"],["pTemplate","header"],["pTemplate","body"],["aria-hidden","true","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal",3,"id"],["role","document",1,"modal-dialog","modal-lg"],[1,"modal-content"],[1,"modal-header"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body"],[1,"form-group","row","mt-3","mb-0"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["name","name","spellcheck","false","type","text","placeholder","Please provide domain name",1,"form-control","form-control-sm",3,"ngModel","blur","ngModelChange"],[1,"form-group","row"],[1,"col-form-label","col-form-label-sm","text-info","font-monospaced"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["class","btn btn-primary btn-sm","sava-no-dbl-click","","type","button",3,"click",4,"ngIf"],[2,"width","100px"],[3,"pSelectableRow"],["class","text-center",4,"ngIf"],[1,"text-center"],["pTooltip","Edit","tooltipPosition","left",1,"btn","btn-xsm-custom","mr-1",3,"click"],[1,"fas","fa-pencil-alt","text-light","fa-fw","cursor-pointer"],["pTooltip","Permanent Delete","tooltipPosition","left",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"far","fa-trash-alt","fa-fw","cursor-pointer","text-danger"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"]],template:function(i,n){1&i&&(e.TgZ(0,"div",0)(1,"div",1)(2,"span"),e._UZ(3,"i",2),e._uU(4," Allowed Origins"),e.qZA(),e.TgZ(5,"span",3),e.NdJ("click",function(){return n.addAllowedOrigin()}),e._UZ(6,"i",4),e.qZA()(),e.TgZ(7,"div",5)(8,"p-table",6),e.NdJ("selectionChange",function(r){return n.selectedRowsUI=r})("dblclick",function(){return n.doubleClick()}),e.YNc(9,F,5,0,"ng-template",7),e.YNc(10,L,5,3,"ng-template",8),e.qZA()()(),e.TgZ(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",12)(15,"span"),e._UZ(16,"i",13),e._uU(17," Allowed Origins"),e.qZA(),e.TgZ(18,"button",14)(19,"span",15),e._UZ(20,"i",16),e.qZA()()(),e.TgZ(21,"div",17)(22,"div",18)(23,"label",19),e._uU(24,"Domain name"),e.qZA(),e.TgZ(25,"div",20)(26,"input",21),e.NdJ("blur",function(){return n.allowedOriginModel.domainName=n.allowedOriginModel.domainName.toLowerCase()})("ngModelChange",function(r){return n.allowedOriginModel.domainName=r}),e.qZA()()(),e.TgZ(27,"div",22),e._UZ(28,"label",19),e.TgZ(29,"div",20)(30,"label",23),e._uU(31),e.qZA()()()(),e.TgZ(32,"div",24)(33,"button",25),e._UZ(34,"i",26),e._uU(35," Close"),e.qZA(),e.YNc(36,Q,4,0,"button",27),e.qZA()()()()),2&i&&(e.xp6(8),e.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",n.selectedRowsUI)("dataKey",n.gridKeyAllowedOrigins)("scrollable",!0)("value",n.allowedOriginsGridData),e.xp6(3),e.s9C("id",n.modalId),e.xp6(15),e.Q6J("ngModel",n.allowedOriginModel.domainName),e.xp6(5),e.hij("(Ex: ",n.exampleOrigin,")"),e.xp6(5),e.Q6J("ngIf",n.allowedOriginData.mode!==n.EFormMode.VIEW))},dependencies:[g.Fj,g.JJ,g.On,u.O5,q.y,f.iA,p.jx,f.Ei,A.u],encapsulation:2})}return o})();const B=["addNpmLibC"],j=["allowedOriginC"],W=["SandboxSettingsPkgVersionsModalC"];function z(o,l){1&o&&(e.TgZ(0,"tr"),e._UZ(1,"th",46)(2,"th",47),e.TgZ(3,"th",48),e._uU(4,"Version"),e.qZA(),e.TgZ(5,"th"),e._uU(6,"Name"),e.qZA(),e.TgZ(7,"th",49),e._uU(8,"Sub Dependencies"),e.qZA(),e.TgZ(9,"th",50),e._uU(10,"Third Party API"),e.qZA(),e.TgZ(11,"th",51),e._uU(12,"Default"),e.qZA(),e.TgZ(13,"th",52),e._uU(14,"Action"),e.qZA()())}function X(o,l){1&o&&e._UZ(0,"i",61)}function ee(o,l){1&o&&e._UZ(0,"i",62)}function te(o,l){if(1&o&&(e.TgZ(0,"div",64),e._uU(1),e.qZA()),2&o){const t=l.$implicit;e.xp6(1),e.AsE("",t.name," @",t.version,"")}}function ne(o,l){if(1&o&&(e.TgZ(0,"div"),e.YNc(1,te,2,2,"div",63),e.qZA()),2&o){const t=l.$implicit;e.xp6(1),e.Q6J("ngForOf",t.dependencies)}}function ie(o,l){1&o&&e._UZ(0,"i",65)}function oe(o,l){1&o&&e._UZ(0,"i",65)}function ae(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"div",58)(1,"button",66),e.NdJ("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw(2);return e.KtG(r.editData(n,a))}),e._UZ(2,"i",67),e.qZA(),e.TgZ(3,"button",68),e.NdJ("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw(2);return e.KtG(r.removePermanentDialog(n,a))}),e._UZ(4,"i",69),e.qZA()()}}function se(o,l){if(1&o&&(e.TgZ(0,"tr",53)(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e.YNc(4,X,1,0,"i",54),e.YNc(5,ee,1,0,"i",55),e.qZA(),e.TgZ(6,"td"),e._uU(7),e.qZA(),e.TgZ(8,"td"),e._uU(9),e.qZA(),e.TgZ(10,"td")(11,"div",56),e.YNc(12,ne,2,1,"div",57),e.qZA()(),e.TgZ(13,"td",58),e.YNc(14,ie,1,0,"i",59),e.qZA(),e.TgZ(15,"td",58),e.YNc(16,oe,1,0,"i",59),e.qZA(),e.TgZ(17,"td"),e.YNc(18,ae,5,0,"div",60),e.qZA()()),2&o){const t=l.$implicit,i=l.rowIndex;e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(i+1),e.xp6(2),e.Q6J("ngIf",t.active),e.xp6(1),e.Q6J("ngIf",!t.active),e.xp6(2),e.Oqu(t.version),e.xp6(2),e.Oqu(t.name),e.xp6(3),e.Q6J("ngForOf",t.subDependencies),e.xp6(2),e.Q6J("ngIf",t.isThirdPartyApi),e.xp6(2),e.Q6J("ngIf",t.isDefault),e.xp6(2),e.Q6J("ngIf",!t.isReadOnly)}}function le(o,l){1&o&&(e.TgZ(0,"tr"),e._UZ(1,"th",46),e.TgZ(2,"th",48),e._uU(3,"Version"),e.qZA(),e.TgZ(4,"th"),e._uU(5,"Name"),e.qZA(),e.TgZ(6,"th",70),e._uU(7,"Third Party API"),e.qZA(),e.TgZ(8,"th",48),e._uU(9,"Default"),e.qZA()())}function re(o,l){1&o&&e._UZ(0,"i",65)}function de(o,l){1&o&&e._UZ(0,"i",65)}function ce(o,l){if(1&o&&(e.TgZ(0,"tr",53)(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e._uU(4),e.qZA(),e.TgZ(5,"td"),e._uU(6),e.qZA(),e.TgZ(7,"td"),e.YNc(8,re,1,0,"i",59),e.qZA(),e.TgZ(9,"td"),e.YNc(10,de,1,0,"i",59),e.qZA()()),2&o){const t=l.$implicit,i=l.rowIndex;e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(i+1),e.xp6(2),e.Oqu(t.version),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Q6J("ngIf",t.isThirdPartyApi),e.xp6(2),e.Q6J("ngIf",t.isDefault)}}function ge(o,l){1&o&&e._UZ(0,"p-progressSpinner",71)}function me(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"div",5)(1,"div",6)(2,"button",7),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.loadGridData())}),e._UZ(3,"i",8),e._uU(4," Refresh "),e.qZA(),e.TgZ(5,"button",9),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.saveSettings(n.EFormMode.EDIT))}),e._UZ(6,"i",10),e._uU(7," Save "),e.qZA()(),e.TgZ(8,"div",11)(9,"div",12)(10,"span"),e._UZ(11,"i",13),e._uU(12," Settings"),e.qZA()(),e.TgZ(13,"div",14)(14,"div",15)(15,"div",16)(16,"label",17),e._uU(17,"Sandbox Count"),e.qZA(),e.TgZ(18,"input",18),e.NdJ("ngModelChange",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.settings.sandbox.sandboxCountOverrideAdmin=n)}),e.qZA(),e.TgZ(19,"div",19)(20,"span",20)(21,"span"),e._uU(22,"1 CPU core will have one process and one process will have these many sandbox."),e.qZA(),e._UZ(23,"br"),e.TgZ(24,"span"),e._uU(25,"Ideally it should be 1-2."),e.qZA()()()()()()(),e.TgZ(26,"div",11)(27,"div",12)(28,"span"),e._UZ(29,"i",21),e._uU(30," Sandbox Dependencies"),e.qZA(),e.TgZ(31,"div",22)(32,"a",23),e._UZ(33,"img",24),e.qZA()(),e.TgZ(34,"span",25),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.showLibraryModel())}),e._UZ(35,"i",26),e.qZA()(),e.TgZ(36,"div",27)(37,"p-tabView",28)(38,"p-tabPanel",29)(39,"p-table",30),e.NdJ("selectionChange",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.selectedRowsUI=n)})("dblclick",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.summaryTableDoubleClick())}),e.YNc(40,z,15,0,"ng-template",31),e.YNc(41,se,19,10,"ng-template",32),e.qZA()(),e.TgZ(42,"p-tabPanel",33)(43,"p-table",34),e.NdJ("selectionChange",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.selectedRowsPackageJson=n)}),e.YNc(44,le,10,0,"ng-template",31),e.YNc(45,ce,11,6,"ng-template",32),e.qZA()()(),e.YNc(46,ge,1,0,"p-progressSpinner",35),e.qZA()(),e.TgZ(47,"div",11)(48,"div",12)(49,"span"),e._UZ(50,"i",36),e._uU(51," Docker File"),e.qZA(),e.TgZ(52,"span",37),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.resetDockerfileToDefault())}),e._UZ(53,"i",38),e.qZA(),e.TgZ(54,"span",39),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.showDockerImageBuildLogs())}),e._UZ(55,"i",40),e.qZA()(),e.TgZ(56,"div",41)(57,"app-monaco-editor",42),e.NdJ("editorGenerated",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.editorGenerated(n))}),e.qZA()()(),e.TgZ(58,"allowed-origin-c",43,44),e.NdJ("saveSettings",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.saveSettings(n.EFormMode.EDIT))}),e.qZA(),e.TgZ(60,"div",45),e._uU(61,"\xa0"),e.qZA()()}if(2&o){const t=e.oxw();e.xp6(18),e.Q6J("ngModel",t.settings.sandbox.sandboxCountOverrideAdmin),e.xp6(21),e.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",t.selectedRowsUI)("dataKey",t.gridKey)("scrollable",!0)("value",t.packageSummary),e.xp6(4),e.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",t.selectedRowsPackageJson)("dataKey",t.gridKey)("scrollable",!0)("value",t.finalPackageJson),e.xp6(3),e.Q6J("ngIf",t.loading.form),e.xp6(11),e.Q6J("editorOptions",t.editorOptionsDocker),e.xp6(1),e.Q6J("allowedOrigins",t.settings.allowedOrigins)}}const pe=[{path:"main",component:(()=>{class o{authCS;userS;eventCenterCS;notificationS;confirmationService;cs;monacoS;tpStoreApiVersionS;instanceS;feStoreCS;generalCS;STORE_BE_HOST_PORT=h.N.STORE_BE_HOST_PORT;BE_HOST_PORT=h.N.BE_HOST_PORT;subscriptions=[];data={mode:c.D.ADD,eventChannel:new e.vpe,formData:void 0};packageSummary=[];selectedRowsUI=[];gridKey="rowId";counter;EFormMode=c.D;finalPackageJson=[];selectedRowsPackageJson=[];showAll=!1;loading={form:!1};settings;tpNpmPackageAndVersion={};tpApiVersionIdMap;tpApiBundleIdMap;editorDocker;editorOptionsDocker={readOnly:!1,language:"dockerfile",contextmenu:!0};addNpmLibC;allowedOriginC;SandboxSettingsPkgVersionsModalC;constructor(t,i,n,a,r,m,_e,ue,Se,ve,he){this.authCS=t,this.userS=i,this.eventCenterCS=n,this.notificationS=a,this.confirmationService=r,this.cs=m,this.monacoS=_e,this.tpStoreApiVersionS=ue,this.instanceS=Se,this.feStoreCS=ve,this.generalCS=he}ngOnInit(){var t=this;return(0,d.Z)(function*(){t.subscriptions.push(t.eventCenterCS.sandboxDep.subscribe(i=>{if(t.data.mode===c.D.ADD){for(const n of t.packageSummary)if(n.name===i.name&&n.isDefault)return void t.notificationS.showError("You can not override default package.");t.packageSummary.unshift(i),t.rowIdSet(),t.notificationS.showSuccess(t.cs.amUserSandboxDepSetting.addSuccess),t.addNpmLibC.hideModal()}})),yield t.loadGridData(),t.generalCS.setNewTitle("API Maker - Sandbox Settings")})()}loadGridData(){var t=this;return(0,d.Z)(function*(){const i=yield t.userS.getAdminSettings(t.authCS.getUserId()).toPromise();t.settings=i.data||{},t.packageSummary=t.settings.sandbox.dependenciesUI.nodeJS,t.finalPackageJson=t.settings.sandbox.dependencies.nodeJS;const n=t.settings.allowedOrigins||[];n.sort(),t.settings.allowedOrigins=_.map(n,a=>({name:a})),t.rowIdSet();for(const a of t.finalPackageJson)a.rowId=(t.counter++).toString();t.generalCS.setValueInEditor(t,"editorDocker",t.settings.dockerFile||"")})()}editorGenerated(t){var i=this;return(0,d.Z)(function*(){i.editorDocker=t,yield i.monacoS.loadSchemaEditorSettings(i.BE_HOST_PORT,i.authCS.getUserId(),null),i.monacoS.addSaveCodeKeyBinding(t,n=>{i.saveSettings()})})()}rowIdSet(){this.counter=1;for(const t of this.packageSummary)t.rowId=(this.counter++).toString()}showLibraryModel(){this.data.formData=void 0,this.data.mode=c.D.ADD,this.data.eventChannel.emit({action:v.F.OPEN_FORM_IN_ADD_MODE}),this.addNpmLibC.showModal()}saveSettings(t){var i=this;return(0,d.Z)(function*(){try{const n=i.authCS.getUserId();if(i?.settings?.sandbox?.sandboxCountOverrideAdmin>5)return void i.notificationS.showError("More than 5 sandbox are not allowed.");const a={settings:{sandbox:{sandboxCountOverrideAdmin:i.settings.sandbox.sandboxCountOverrideAdmin,dependencies:{nodeJS:i.packageSummary.filter(m=>!m.isReadOnly&&!m.isThirdPartyApi&&!m.isDefault)}},dockerFile:i.editorDocker.getValue(),allowedOrigins:_.map(i.allowedOriginC.allowedOriginsGridData,"name").sort()}};(yield i.userS.put(n,a,{select:k.iH._id}).toPromise())&&(t===c.D.EDIT?i.notificationS.showSuccess(i.cs.amUserSandboxDepSetting.editSuccess):"DELETE"===t?i.notificationS.showSuccess(i.cs.amUserSandboxDepSetting.removePermanent):t||i.notificationS.showSuccess("Success")),i.loadGridData().then()}catch(n){i.loading.form=!1,i.notificationS.showErrorFromResponse(n.error||n,"Unable to save settings.")}})()}removePermanentDialog(t,i){var n=this;return(0,d.Z)(function*(){var a;t.stopPropagation(),t.preventDefault(),n.confirmationService.confirm({message:n.cs.amUserSandboxDepSetting.removePermanentConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(a=(0,d.Z)(function*(){yield n.removePermanent(i)}),function(){return a.apply(this,arguments)})})})()}removePermanent(t){var i=this;return(0,d.Z)(function*(){i.packageSummary.splice(i.packageSummary.indexOf(t),1),i.saveSettings("DELETE").then()})()}loadDependenciesAndSchemas(){var t=this;return(0,d.Z)(function*(){const{tpNpmPackageAndVersion:i,tpApiBundleIdMap:n,tpApiVersionIdMap:a}=(yield t.instanceS.getInstalledPackagesAndSchemas().toPromise()).data;t.tpNpmPackageAndVersion=i,t.tpApiBundleIdMap=n,t.tpApiVersionIdMap=a})()}commonPackageAddRemoveTasks(){var t=this;return(0,d.Z)(function*(){yield t.loadDependenciesAndSchemas()})()}editData(t,i){var n=this;return(0,d.Z)(function*(){t?.stopPropagation(),t?.preventDefault(),n.data.formData=i,n.data.mode=c.D.EDIT,n.data.eventChannel.emit({action:v.F.OPEN_FORM_IN_EDIT_MODE}),yield n.SandboxSettingsPkgVersionsModalC.showPkgVersions(i.name)})()}hideNpmLibModel(){this.addNpmLibC.hideModal()}resetDockerfileToDefault(){var t=this;return(0,d.Z)(function*(){try{const i=yield t.feStoreCS.geDefaultDockerfile(t.BE_HOST_PORT);t.editorDocker.setValue(i.data)}catch(i){t.notificationS.showErrorFromResponse(i.error||i,"Unable to reset docker file.")}})()}showDockerImageBuildLogs(){var t=this;return(0,d.Z)(function*(){const i=t.eventCenterCS.headerC,n=i.systemLogsModelC.systemLogsListC.filterOptions.find(a=>a.value===U.g.DOCKER_IMAGE_BUILD_LOGS);i.showSystemLogsModal(n)})()}summaryTableDoubleClick(){var t=this;setTimeout((0,d.Z)(function*(){if(t.selectedRowsUI[0]){let i;for(const n of t.packageSummary)n[t.gridKey]===t.selectedRowsUI[0].rowId&&(i=n);i&&!i.isReadOnly&&(yield t.editData(null,i))}}),100)}ngOnDestroy(){for(const t of this.subscriptions)t.unsubscribe()}static \u0275fac=function(i){return new(i||o)(e.Y36(x.D),e.Y36(b.K),e.Y36(w.M),e.Y36(Z.W),e.Y36(p.YP),e.Y36(T.L),e.Y36(I.b),e.Y36(N.f),e.Y36(P.E),e.Y36(E.e),e.Y36(J.b))};static \u0275cmp=e.Xpm({type:o,selectors:[["app-sandbox-settings-c"]],viewQuery:function(i,n){if(1&i&&(e.Gf(B,5),e.Gf(j,5),e.Gf(W,5)),2&i){let a;e.iGM(a=e.CRH())&&(n.addNpmLibC=a.first),e.iGM(a=e.CRH())&&(n.allowedOriginC=a.first),e.iGM(a=e.CRH())&&(n.SandboxSettingsPkgVersionsModalC=a.first)}},decls:6,vars:9,consts:[["class","pt-1 pl-5 pr-5 full-body overflow-auto",4,"ngIf"],[3,"data","pkgVersionModal","modalId","hostAndPort"],["addNpmLibC",""],[3,"modalId","hostAndPort","data","dependencies","saveUpdateSandboxDep","hideLibraryModelEventEmitter","installed"],["pkgVersionsModalC","","SandboxSettingsPkgVersionsModalC",""],[1,"pt-1","pl-5","pr-5","full-body","overflow-auto"],[1,"cursor-pointer","text-right","mr-1"],[1,"btn","btn-primary","btn-sm","mt-1","mr-1",3,"click"],[1,"fas","fa-sync-alt","text-info","fa-fw","cursor-pointer"],[1,"btn","btn-success","btn-sm","mt-1",3,"click"],[1,"fas","fa-save","fa-fw","cursor-pointer"],[1,"card","shadow-sm","mt-2","mr-1"],[1,"card-header"],[1,"fas","fa-cog","text-danger","fa-fw","mr-1"],[1,"card-body","p-3","overflow-hidden"],[1,"container"],[1,"row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],["name","Setting","type","number","placeholder","Please provide value",1,"col-2","form-control","form-control-sm",3,"ngModel","ngModelChange"],[1,"col-6","pr-0"],[1,"small","text-info"],[1,"fas","fa-box","text-warning","fa-fw","mr-1"],[1,"float-right"],["href","https://docs.apimaker.dev/v1/docs/settings/sandboxSettings.html","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"fa-fw","ml-2","mr-1","mt-n1",2,"font-size","25px"],["tooltipPosition","left","pTooltip","Add New",1,"float-right","cursor-pointer","mr-1",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],[1,"card-body","p-2","overflow-hidden"],[1,"w-100"],["header","Summary"],["styleClass","p-datatable-striped","scrollHeight","400px",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange","dblclick"],["pTemplate","header"],["pTemplate","body"],["header","Final package.json"],["styleClass","p-datatable-striped","scrollHeight","400px",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"fab","fa-docker","fa-fw","mr-1","text-info"],["tooltipPosition","left","pTooltip","Reset dockerfile to default",1,"float-right","cursor-pointer","ml-2",3,"click"],[1,"fas","fa-undo","text-warning","fa-fw"],["tooltipPosition","left","pTooltip","View logs of docker image build",1,"float-right","cursor-pointer","ml-2",3,"click"],[1,"fas","fa-water","text-info","fa-fw"],[1,"card-body","p-1","overflow-hidden",2,"height","400px"],[3,"editorOptions","editorGenerated"],[3,"allowedOrigins","saveSettings"],["allowedOriginC",""],[1,"mb-5"],[2,"width","55px"],[2,"width","40px"],[2,"width","100px"],[2,"width","200px"],[1,"text-center",2,"width","150px"],[1,"text-center",2,"width","100px"],[1,"text-center",2,"width","130px"],[3,"pSelectableRow"],["class","fas fa-circle fa-fw text-success text-v-small",4,"ngIf"],["class","fas fa-circle fa-fw text-muted text-v-small",4,"ngIf"],[1,"small"],[4,"ngFor","ngForOf"],[1,"text-center"],["class","fas fa-check fa-fw text-success pt-1",4,"ngIf"],["class","text-center",4,"ngIf"],[1,"fas","fa-circle","fa-fw","text-success","text-v-small"],[1,"fas","fa-circle","fa-fw","text-muted","text-v-small"],["class","pl-3",4,"ngFor","ngForOf"],[1,"pl-3"],[1,"fas","fa-check","fa-fw","text-success","pt-1"],["pTooltip","Edit","tooltipPosition","left",1,"btn","btn-xsm-custom","mr-1",3,"click"],[1,"fas","fa-pencil-alt","text-light","fa-fw","cursor-pointer"],["pTooltip","Permanent Delete","tooltipPosition","left",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"far","fa-trash-alt","fa-fw","cursor-pointer","text-danger"],[2,"width","150px"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(i,n){if(1&i&&(e.YNc(0,me,62,16,"div",0),e._UZ(1,"find-npm-package",1,2),e.TgZ(3,"app-sandbox-settings-pkg-versions-modal",3,4),e.NdJ("saveUpdateSandboxDep",function(r){return n.saveSettings(r)})("hideLibraryModelEventEmitter",function(){return n.hideNpmLibModel()})("installed",function(){return n.commonPackageAddRemoveTasks()}),e.qZA()),2&i){const a=e.MAs(4);e.Q6J("ngIf",n.settings),e.xp6(1),e.Q6J("data",n.data)("pkgVersionModal",a)("modalId","idAddNpmSandboxSettings")("hostAndPort",n.STORE_BE_HOST_PORT),e.xp6(2),e.Q6J("modalId","idAddNpmSandboxSettingsEdit")("hostAndPort",n.STORE_BE_HOST_PORT)("data",n.data)("dependencies",n.tpNpmPackageAndVersion)}},dependencies:[g.Fj,g.wV,g.JJ,g.On,u.sg,u.O5,G.K,R.S,K.O,f.iA,p.jx,f.Ei,Y.G,C.xf,C.x4,A.u,V],encapsulation:2})}return o})(),canActivate:[D.P]}];let fe=(()=>{class o{static \u0275fac=function(i){return new(i||o)};static \u0275mod=e.oAB({type:o});static \u0275inj=e.cJS({imports:[O.Bz.forChild(pe),y.u,M.ApiTestingM]})}return o})()}}]);
1
+ "use strict";(self.webpackChunkapi_maker_fe=self.webpackChunkapi_maker_fe||[]).push([[7368],{7368:(xe,S,s)=>{s.r(S),s.d(S,{SandboxSettingsM:()=>fe});var O=s(7664),D=s(3726),y=s(7359),M=s(5249),d=s(5861),e=s(4946),_=s(6990),v=s(3157),c=s(328),k=s(1162),h=s(553),U=s(4371),x=s(5852),b=s(3835),w=s(5405),Z=s(9961),p=s(5219),T=s(7414),I=s(2304),N=s(4977),P=s(3429),E=s(1344),J=s(7240),g=s(95),u=s(6814),G=s(8147),R=s(1861),K=s(756),f=s(5431),Y=s(7680),C=s(4844),A=s(3259),q=s(2660);function F(o,l){1&o&&(e.TgZ(0,"tr")(1,"th"),e._uU(2,"Name"),e.qZA(),e.TgZ(3,"th",28),e._uU(4,"Action"),e.qZA()())}function H(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"div",31)(1,"button",32),e.NdJ("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw();return e.KtG(r.editAllowedOrigin(n,a))}),e._UZ(2,"i",33),e.qZA(),e.TgZ(3,"button",34),e.NdJ("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw();return e.KtG(r.removeAllowedOrigin(n,a))}),e._UZ(4,"i",35),e.qZA()()}}function L(o,l){if(1&o&&(e.TgZ(0,"tr",29)(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e.YNc(4,H,5,0,"div",30),e.qZA()()),2&o){const t=l.$implicit;e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Q6J("ngIf",!t.isReadOnly)}}function Q(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"button",36),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.save())}),e._UZ(1,"i",37),e.TgZ(2,"span"),e._uU(3,"Save"),e.qZA()()}}let V=(()=>{class o{authCS;userS;eventCenterCS;notificationS;cs;confirmationService;modalId="idAllowedOriginModal";subscriptions=[];allowedOriginsGridData=[];saveSettings=new e.vpe;gridKeyAllowedOrigins="name";allowedOriginModel={domainName:"",domainNameBak:""};exampleOrigin=location.origin;allowedOriginData={mode:c.D.ADD};EFormMode=c.D;selectedRowsUI=[];constructor(t,i,n,a,r,m){this.authCS=t,this.userS=i,this.eventCenterCS=n,this.notificationS=a,this.cs=r,this.confirmationService=m}ngOnInit(){}save(){var t=this;return(0,d.Z)(function*(){if(t.allowedOriginData.mode===c.D.ADD)t.allowedOriginsGridData.push({name:t.allowedOriginModel.domainName});else{const i=t.allowedOriginsGridData.findIndex(n=>n.name===t.allowedOriginModel.domainNameBak);t.allowedOriginsGridData[i].name=t.allowedOriginModel.domainName}t.allowedOriginsGridData=_.uniqBy(t.allowedOriginsGridData,"name"),t.saveSettings.emit(),t.hideAllowedOriginModal()})()}showAllowedOriginModal(){$("#idAllowedOriginModal").modal("show")}hideAllowedOriginModal(){$("#idAllowedOriginModal").modal("hide")}addAllowedOrigin(){var t=this;return(0,d.Z)(function*(){t.allowedOriginModel.domainNameBak=t.allowedOriginModel.domainName="",t.allowedOriginData.mode=c.D.ADD,t.showAllowedOriginModal()})()}editAllowedOrigin(t,i){var n=this;return(0,d.Z)(function*(){n.allowedOriginModel.domainNameBak=n.allowedOriginModel.domainName=i.name,n.allowedOriginData.mode=c.D.EDIT,n.showAllowedOriginModal()})()}doubleClick(){this.editAllowedOrigin(null,this.selectedRowsUI[0]).then()}removeAllowedOrigin(t,i){var n=this;return(0,d.Z)(function*(){var a;n.confirmationService.confirm({message:n.cs.amUserSandboxDepSetting.removePermanentAllowedOriginConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(a=(0,d.Z)(function*(){yield n.removeAO(t,i)}),function(){return a.apply(this,arguments)})})})()}removeAO(t,i){var n=this;return(0,d.Z)(function*(){const a=n.allowedOriginsGridData.findIndex(r=>r.name===i.name);n.allowedOriginsGridData.splice(a,1),n.saveSettings.emit()})()}ngOnDestroy(){for(const t of this.subscriptions)t.unsubscribe()}static \u0275fac=function(i){return new(i||o)(e.Y36(x.D),e.Y36(b.K),e.Y36(w.M),e.Y36(Z.W),e.Y36(T.L),e.Y36(p.YP))};static \u0275cmp=e.Xpm({type:o,selectors:[["allowed-origin-c"]],inputs:{allowedOriginsGridData:["allowedOrigins","allowedOriginsGridData"]},outputs:{saveSettings:"saveSettings"},decls:37,vars:10,consts:[[1,"card","shadow-sm","mt-2","mr-1","mb-5",2,"height","384px"],[1,"card-header"],[1,"fas","fa-link","text-yellow","fa-fw","mr-1"],["pTooltip","Add New",1,"float-right","cursor-pointer","mr-1",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],[1,"card-body","p-0","overflow-hidden"],["styleClass","p-datatable-striped","scrollHeight","350px",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange","dblclick"],["pTemplate","header"],["pTemplate","body"],["aria-hidden","true","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal",3,"id"],["role","document",1,"modal-dialog","modal-lg"],[1,"modal-content"],[1,"modal-header"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body"],[1,"form-group","row","mt-3","mb-0"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["name","name","spellcheck","false","type","text","placeholder","Please provide domain name",1,"form-control","form-control-sm",3,"ngModel","blur","ngModelChange"],[1,"form-group","row"],[1,"col-form-label","col-form-label-sm","text-info","font-monospaced"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["class","btn btn-primary btn-sm","sava-no-dbl-click","","type","button",3,"click",4,"ngIf"],[2,"width","100px"],[3,"pSelectableRow"],["class","text-center",4,"ngIf"],[1,"text-center"],["pTooltip","Edit","tooltipPosition","left",1,"btn","btn-xsm-custom","mr-1",3,"click"],[1,"fas","fa-pencil-alt","text-light","fa-fw","cursor-pointer"],["pTooltip","Permanent Delete","tooltipPosition","left",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"far","fa-trash-alt","fa-fw","cursor-pointer","text-danger"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"]],template:function(i,n){1&i&&(e.TgZ(0,"div",0)(1,"div",1)(2,"span"),e._UZ(3,"i",2),e._uU(4," Allowed Origins"),e.qZA(),e.TgZ(5,"span",3),e.NdJ("click",function(){return n.addAllowedOrigin()}),e._UZ(6,"i",4),e.qZA()(),e.TgZ(7,"div",5)(8,"p-table",6),e.NdJ("selectionChange",function(r){return n.selectedRowsUI=r})("dblclick",function(){return n.doubleClick()}),e.YNc(9,F,5,0,"ng-template",7),e.YNc(10,L,5,3,"ng-template",8),e.qZA()()(),e.TgZ(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",12)(15,"span"),e._UZ(16,"i",13),e._uU(17," Allowed Origins"),e.qZA(),e.TgZ(18,"button",14)(19,"span",15),e._UZ(20,"i",16),e.qZA()()(),e.TgZ(21,"div",17)(22,"div",18)(23,"label",19),e._uU(24,"Domain name"),e.qZA(),e.TgZ(25,"div",20)(26,"input",21),e.NdJ("blur",function(){return n.allowedOriginModel.domainName=n.allowedOriginModel.domainName.toLowerCase()})("ngModelChange",function(r){return n.allowedOriginModel.domainName=r}),e.qZA()()(),e.TgZ(27,"div",22),e._UZ(28,"label",19),e.TgZ(29,"div",20)(30,"label",23),e._uU(31),e.qZA()()()(),e.TgZ(32,"div",24)(33,"button",25),e._UZ(34,"i",26),e._uU(35," Close"),e.qZA(),e.YNc(36,Q,4,0,"button",27),e.qZA()()()()),2&i&&(e.xp6(8),e.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",n.selectedRowsUI)("dataKey",n.gridKeyAllowedOrigins)("scrollable",!0)("value",n.allowedOriginsGridData),e.xp6(3),e.s9C("id",n.modalId),e.xp6(15),e.Q6J("ngModel",n.allowedOriginModel.domainName),e.xp6(5),e.hij("(Ex: ",n.exampleOrigin,")"),e.xp6(5),e.Q6J("ngIf",n.allowedOriginData.mode!==n.EFormMode.VIEW))},dependencies:[g.Fj,g.JJ,g.On,u.O5,q.y,f.iA,p.jx,f.Ei,A.u],encapsulation:2})}return o})();const B=["addNpmLibC"],j=["allowedOriginC"],W=["SandboxSettingsPkgVersionsModalC"];function z(o,l){1&o&&(e.TgZ(0,"tr"),e._UZ(1,"th",46)(2,"th",47),e.TgZ(3,"th",48),e._uU(4,"Version"),e.qZA(),e.TgZ(5,"th"),e._uU(6,"Name"),e.qZA(),e.TgZ(7,"th",49),e._uU(8,"Sub Dependencies"),e.qZA(),e.TgZ(9,"th",50),e._uU(10,"Third Party API"),e.qZA(),e.TgZ(11,"th",51),e._uU(12,"Default"),e.qZA(),e.TgZ(13,"th",52),e._uU(14,"Action"),e.qZA()())}function X(o,l){1&o&&e._UZ(0,"i",61)}function ee(o,l){1&o&&e._UZ(0,"i",62)}function te(o,l){if(1&o&&(e.TgZ(0,"div",64),e._uU(1),e.qZA()),2&o){const t=l.$implicit;e.xp6(1),e.AsE("",t.name," @",t.version,"")}}function ne(o,l){if(1&o&&(e.TgZ(0,"div"),e.YNc(1,te,2,2,"div",63),e.qZA()),2&o){const t=l.$implicit;e.xp6(1),e.Q6J("ngForOf",t.dependencies)}}function ie(o,l){1&o&&e._UZ(0,"i",65)}function oe(o,l){1&o&&e._UZ(0,"i",65)}function ae(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"div",58)(1,"button",66),e.NdJ("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw(2);return e.KtG(r.editData(n,a))}),e._UZ(2,"i",67),e.qZA(),e.TgZ(3,"button",68),e.NdJ("click",function(n){e.CHM(t);const a=e.oxw().$implicit,r=e.oxw(2);return e.KtG(r.removePermanentDialog(n,a))}),e._UZ(4,"i",69),e.qZA()()}}function se(o,l){if(1&o&&(e.TgZ(0,"tr",53)(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e.YNc(4,X,1,0,"i",54),e.YNc(5,ee,1,0,"i",55),e.qZA(),e.TgZ(6,"td"),e._uU(7),e.qZA(),e.TgZ(8,"td"),e._uU(9),e.qZA(),e.TgZ(10,"td")(11,"div",56),e.YNc(12,ne,2,1,"div",57),e.qZA()(),e.TgZ(13,"td",58),e.YNc(14,ie,1,0,"i",59),e.qZA(),e.TgZ(15,"td",58),e.YNc(16,oe,1,0,"i",59),e.qZA(),e.TgZ(17,"td"),e.YNc(18,ae,5,0,"div",60),e.qZA()()),2&o){const t=l.$implicit,i=l.rowIndex;e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(i+1),e.xp6(2),e.Q6J("ngIf",t.active),e.xp6(1),e.Q6J("ngIf",!t.active),e.xp6(2),e.Oqu(t.version),e.xp6(2),e.Oqu(t.name),e.xp6(3),e.Q6J("ngForOf",t.subDependencies),e.xp6(2),e.Q6J("ngIf",t.isThirdPartyApi),e.xp6(2),e.Q6J("ngIf",t.isDefault),e.xp6(2),e.Q6J("ngIf",!t.isReadOnly)}}function le(o,l){1&o&&(e.TgZ(0,"tr"),e._UZ(1,"th",46),e.TgZ(2,"th",48),e._uU(3,"Version"),e.qZA(),e.TgZ(4,"th"),e._uU(5,"Name"),e.qZA(),e.TgZ(6,"th",70),e._uU(7,"Third Party API"),e.qZA(),e.TgZ(8,"th",48),e._uU(9,"Default"),e.qZA()())}function re(o,l){1&o&&e._UZ(0,"i",65)}function de(o,l){1&o&&e._UZ(0,"i",65)}function ce(o,l){if(1&o&&(e.TgZ(0,"tr",53)(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e._uU(4),e.qZA(),e.TgZ(5,"td"),e._uU(6),e.qZA(),e.TgZ(7,"td"),e.YNc(8,re,1,0,"i",59),e.qZA(),e.TgZ(9,"td"),e.YNc(10,de,1,0,"i",59),e.qZA()()),2&o){const t=l.$implicit,i=l.rowIndex;e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(i+1),e.xp6(2),e.Oqu(t.version),e.xp6(2),e.Oqu(t.name),e.xp6(2),e.Q6J("ngIf",t.isThirdPartyApi),e.xp6(2),e.Q6J("ngIf",t.isDefault)}}function ge(o,l){1&o&&e._UZ(0,"p-progressSpinner",71)}function me(o,l){if(1&o){const t=e.EpF();e.TgZ(0,"div",5)(1,"div",6)(2,"button",7),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.loadGridData())}),e._UZ(3,"i",8),e._uU(4," Refresh "),e.qZA(),e.TgZ(5,"button",9),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.saveSettings(n.EFormMode.EDIT))}),e._UZ(6,"i",10),e._uU(7," Save "),e.qZA()(),e.TgZ(8,"div",11)(9,"div",12)(10,"span"),e._UZ(11,"i",13),e._uU(12," Settings"),e.qZA()(),e.TgZ(13,"div",14)(14,"div",15)(15,"div",16)(16,"label",17),e._uU(17,"Sandbox Count"),e.qZA(),e.TgZ(18,"input",18),e.NdJ("ngModelChange",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.settings.sandbox.sandboxCountOverrideAdmin=n)}),e.qZA(),e.TgZ(19,"div",19)(20,"span",20)(21,"span"),e._uU(22,"1 CPU core will have one process and one process will have these many sandbox."),e.qZA(),e._UZ(23,"br"),e.TgZ(24,"span"),e._uU(25,"Ideally it should be 1-2."),e.qZA()()()()()()(),e.TgZ(26,"div",11)(27,"div",12)(28,"span"),e._UZ(29,"i",21),e._uU(30," Sandbox Dependencies"),e.qZA(),e.TgZ(31,"div",22)(32,"a",23),e._UZ(33,"img",24),e.qZA()(),e.TgZ(34,"span",25),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.showLibraryModel())}),e._UZ(35,"i",26),e.qZA()(),e.TgZ(36,"div",27)(37,"p-tabView",28)(38,"p-tabPanel",29)(39,"p-table",30),e.NdJ("selectionChange",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.selectedRowsUI=n)})("dblclick",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.summaryTableDoubleClick())}),e.YNc(40,z,15,0,"ng-template",31),e.YNc(41,se,19,10,"ng-template",32),e.qZA()(),e.TgZ(42,"p-tabPanel",33)(43,"p-table",34),e.NdJ("selectionChange",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.selectedRowsPackageJson=n)}),e.YNc(44,le,10,0,"ng-template",31),e.YNc(45,ce,11,6,"ng-template",32),e.qZA()()(),e.YNc(46,ge,1,0,"p-progressSpinner",35),e.qZA()(),e.TgZ(47,"div",11)(48,"div",12)(49,"span"),e._UZ(50,"i",36),e._uU(51," Docker File"),e.qZA(),e.TgZ(52,"span",37),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.resetDockerfileToDefault())}),e._UZ(53,"i",38),e.qZA(),e.TgZ(54,"span",39),e.NdJ("click",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.showDockerImageBuildLogs())}),e._UZ(55,"i",40),e.qZA()(),e.TgZ(56,"div",41)(57,"app-monaco-editor",42),e.NdJ("editorGenerated",function(n){e.CHM(t);const a=e.oxw();return e.KtG(a.editorGenerated(n))}),e.qZA()()(),e.TgZ(58,"allowed-origin-c",43,44),e.NdJ("saveSettings",function(){e.CHM(t);const n=e.oxw();return e.KtG(n.saveSettings(n.EFormMode.EDIT))}),e.qZA(),e.TgZ(60,"div",45),e._uU(61,"\xa0"),e.qZA()()}if(2&o){const t=e.oxw();e.xp6(18),e.Q6J("ngModel",t.settings.sandbox.sandboxCountOverrideAdmin),e.xp6(21),e.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",t.selectedRowsUI)("dataKey",t.gridKey)("scrollable",!0)("value",t.packageSummary),e.xp6(4),e.Q6J("selectionMode","multiple")("metaKeySelection",!0)("selection",t.selectedRowsPackageJson)("dataKey",t.gridKey)("scrollable",!0)("value",t.finalPackageJson),e.xp6(3),e.Q6J("ngIf",t.loading.form),e.xp6(11),e.Q6J("editorOptions",t.editorOptionsDocker),e.xp6(1),e.Q6J("allowedOrigins",t.settings.allowedOrigins)}}const pe=[{path:"main",component:(()=>{class o{authCS;userS;eventCenterCS;notificationS;confirmationService;cs;monacoS;tpStoreApiVersionS;instanceS;feStoreCS;generalCS;STORE_BE_HOST_PORT=h.N.STORE_BE_HOST_PORT;BE_HOST_PORT=h.N.BE_HOST_PORT;subscriptions=[];data={mode:c.D.ADD,eventChannel:new e.vpe,formData:void 0};packageSummary=[];selectedRowsUI=[];gridKey="rowId";counter;EFormMode=c.D;finalPackageJson=[];selectedRowsPackageJson=[];showAll=!1;loading={form:!1};settings;tpNpmPackageAndVersion={};tpApiVersionIdMap;tpApiBundleIdMap;editorDocker;editorOptionsDocker={readOnly:!1,language:"dockerfile",contextmenu:!0};addNpmLibC;allowedOriginC;SandboxSettingsPkgVersionsModalC;constructor(t,i,n,a,r,m,_e,ue,Se,ve,he){this.authCS=t,this.userS=i,this.eventCenterCS=n,this.notificationS=a,this.confirmationService=r,this.cs=m,this.monacoS=_e,this.tpStoreApiVersionS=ue,this.instanceS=Se,this.feStoreCS=ve,this.generalCS=he}ngOnInit(){var t=this;return(0,d.Z)(function*(){t.subscriptions.push(t.eventCenterCS.sandboxDep.subscribe(i=>{if(t.data.mode===c.D.ADD){for(const n of t.packageSummary)if(n.name===i.name&&n.isDefault)return void t.notificationS.showError("You can not override default package.");t.packageSummary.unshift(i),t.rowIdSet(),t.notificationS.showSuccess(t.cs.amUserSandboxDepSetting.addSuccess),t.addNpmLibC.hideModal()}})),yield t.loadGridData(),t.generalCS.setNewTitle("API Maker - Sandbox Settings")})()}loadGridData(){var t=this;return(0,d.Z)(function*(){const i=yield t.userS.getAdminSettings(t.authCS.getUserId()).toPromise();t.settings=i.data||{},t.packageSummary=t.settings.sandbox.dependenciesUI.nodeJS,t.finalPackageJson=t.settings.sandbox.dependencies.nodeJS;const n=t.settings.allowedOrigins||[];n.sort(),t.settings.allowedOrigins=_.map(n,a=>({name:a})),t.rowIdSet();for(const a of t.finalPackageJson)a.rowId=(t.counter++).toString();t.generalCS.setValueInEditor(t,"editorDocker",t.settings.dockerFile||"")})()}editorGenerated(t){var i=this;return(0,d.Z)(function*(){i.editorDocker=t,yield i.monacoS.loadSchemaEditorSettings(i.BE_HOST_PORT,i.authCS.getUserId(),null),i.monacoS.addSaveCodeKeyBinding(t,n=>{i.saveSettings()})})()}rowIdSet(){this.counter=1;for(const t of this.packageSummary)t.rowId=(this.counter++).toString()}showLibraryModel(){this.data.formData=void 0,this.data.mode=c.D.ADD,this.data.eventChannel.emit({action:v.F.OPEN_FORM_IN_ADD_MODE}),this.addNpmLibC.showModal()}saveSettings(t){var i=this;return(0,d.Z)(function*(){try{const n=i.authCS.getUserId();if(i?.settings?.sandbox?.sandboxCountOverrideAdmin>5)return void i.notificationS.showError("More than 5 sandbox are not allowed.");const a={settings:{sandbox:{sandboxCountOverrideAdmin:i.settings.sandbox.sandboxCountOverrideAdmin,dependencies:{nodeJS:i.packageSummary.filter(m=>!m.isReadOnly&&!m.isThirdPartyApi&&!m.isDefault)}},dockerFile:i.editorDocker.getValue(),allowedOrigins:_.map(i.allowedOriginC.allowedOriginsGridData,"name").sort()}};(yield i.userS.put(n,a,{select:k.iH._id}).toPromise())&&(t===c.D.EDIT?i.notificationS.showSuccess(i.cs.amUserSandboxDepSetting.editSuccess):"DELETE"===t?i.notificationS.showSuccess(i.cs.amUserSandboxDepSetting.removePermanent):t||i.notificationS.showSuccess("Success")),i.loadGridData().then()}catch(n){i.loading.form=!1,i.notificationS.showErrorFromResponse(n.error||n,"Unable to save settings.")}})()}removePermanentDialog(t,i){var n=this;return(0,d.Z)(function*(){var a;t.stopPropagation(),t.preventDefault(),n.confirmationService.confirm({message:n.cs.amUserSandboxDepSetting.removePermanentConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(a=(0,d.Z)(function*(){yield n.removePermanent(i)}),function(){return a.apply(this,arguments)})})})()}removePermanent(t){var i=this;return(0,d.Z)(function*(){i.packageSummary.splice(i.packageSummary.indexOf(t),1),i.saveSettings("DELETE").then()})()}loadDependenciesAndSchemas(){var t=this;return(0,d.Z)(function*(){const{tpNpmPackageAndVersion:i,tpApiBundleIdMap:n,tpApiVersionIdMap:a}=(yield t.instanceS.getInstalledPackagesAndSchemas().toPromise()).data;t.tpNpmPackageAndVersion=i,t.tpApiBundleIdMap=n,t.tpApiVersionIdMap=a})()}commonPackageAddRemoveTasks(){var t=this;return(0,d.Z)(function*(){yield t.loadDependenciesAndSchemas()})()}editData(t,i){var n=this;return(0,d.Z)(function*(){t?.stopPropagation(),t?.preventDefault(),n.data.formData=i,n.data.mode=c.D.EDIT,n.data.eventChannel.emit({action:v.F.OPEN_FORM_IN_EDIT_MODE}),yield n.SandboxSettingsPkgVersionsModalC.showPkgVersions(i.name)})()}hideNpmLibModel(){this.addNpmLibC.hideModal()}resetDockerfileToDefault(){var t=this;return(0,d.Z)(function*(){try{const i=yield t.feStoreCS.geDefaultDockerfile(t.BE_HOST_PORT);t.editorDocker.setValue(i.data)}catch(i){t.notificationS.showErrorFromResponse(i.error||i,"Unable to reset docker file.")}})()}showDockerImageBuildLogs(){var t=this;return(0,d.Z)(function*(){const i=t.eventCenterCS.headerC,n=i.systemLogsModelC.systemLogsListC.filterOptions.find(a=>a.value===U.g.DOCKER_IMAGE_BUILD_LOGS);i.showSystemLogsModal(n)})()}summaryTableDoubleClick(){var t=this;setTimeout((0,d.Z)(function*(){if(t.selectedRowsUI[0]){let i;for(const n of t.packageSummary)n[t.gridKey]===t.selectedRowsUI[0].rowId&&(i=n);i&&!i.isReadOnly&&(yield t.editData(null,i))}}),100)}ngOnDestroy(){for(const t of this.subscriptions)t.unsubscribe()}static \u0275fac=function(i){return new(i||o)(e.Y36(x.D),e.Y36(b.K),e.Y36(w.M),e.Y36(Z.W),e.Y36(p.YP),e.Y36(T.L),e.Y36(I.b),e.Y36(N.f),e.Y36(P.E),e.Y36(E.e),e.Y36(J.b))};static \u0275cmp=e.Xpm({type:o,selectors:[["app-sandbox-settings-c"]],viewQuery:function(i,n){if(1&i&&(e.Gf(B,5),e.Gf(j,5),e.Gf(W,5)),2&i){let a;e.iGM(a=e.CRH())&&(n.addNpmLibC=a.first),e.iGM(a=e.CRH())&&(n.allowedOriginC=a.first),e.iGM(a=e.CRH())&&(n.SandboxSettingsPkgVersionsModalC=a.first)}},decls:6,vars:9,consts:[["class","pt-1 pl-5 pr-5 full-body overflow-auto",4,"ngIf"],[3,"data","pkgVersionModal","modalId","hostAndPort"],["addNpmLibC",""],[3,"modalId","hostAndPort","data","dependencies","saveUpdateSandboxDep","hideLibraryModelEventEmitter","installed"],["pkgVersionsModalC","","SandboxSettingsPkgVersionsModalC",""],[1,"pt-1","pl-5","pr-5","full-body","overflow-auto"],[1,"cursor-pointer","text-right","mr-1"],[1,"btn","btn-primary","btn-sm","mt-1","mr-1",3,"click"],[1,"fas","fa-sync-alt","text-info","fa-fw","cursor-pointer"],[1,"btn","btn-success","btn-sm","mt-1",3,"click"],[1,"fas","fa-save","fa-fw","cursor-pointer"],[1,"card","shadow-sm","mt-2","mr-1"],[1,"card-header"],[1,"fas","fa-cog","text-danger","fa-fw","mr-1"],[1,"card-body","p-3","overflow-hidden"],[1,"container"],[1,"row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],["name","Setting","type","number","placeholder","Please provide value",1,"col-2","form-control","form-control-sm",3,"ngModel","ngModelChange"],[1,"col-6","pr-0"],[1,"small","text-info"],[1,"fas","fa-box","text-warning","fa-fw","mr-1"],[1,"float-right"],["href","https://docs.apimaker.dev/v1/docs/settings/sandboxSettings.html","target","_blank"],["src","/assets/images/logo/logo_docs.svg",1,"fa-fw","ml-2","mr-1","mt-n1",2,"font-size","25px"],["tooltipPosition","left","pTooltip","Add New",1,"float-right","cursor-pointer","mr-1",3,"click"],[1,"fas","fa-plus","text-success","fa-fw"],[1,"card-body","p-2","overflow-hidden"],[1,"w-100"],["header","Summary"],["styleClass","p-datatable-striped","scrollHeight","400px",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange","dblclick"],["pTemplate","header"],["pTemplate","body"],["header","Final package.json"],["styleClass","p-datatable-striped","scrollHeight","400px",3,"selectionMode","metaKeySelection","selection","dataKey","scrollable","value","selectionChange"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],[1,"fab","fa-docker","fa-fw","mr-1","text-info"],["tooltipPosition","left","pTooltip","Reset dockerfile to default",1,"float-right","cursor-pointer","ml-2",3,"click"],[1,"fas","fa-undo","text-warning","fa-fw"],["tooltipPosition","left","pTooltip","View logs of docker image build",1,"float-right","cursor-pointer","ml-2",3,"click"],[1,"fas","fa-water","text-info","fa-fw"],[1,"card-body","p-1","overflow-hidden",2,"height","400px"],[3,"editorOptions","editorGenerated"],[3,"allowedOrigins","saveSettings"],["allowedOriginC",""],[1,"mb-5"],[2,"width","55px"],[2,"width","40px"],[2,"width","100px"],[2,"width","200px"],[1,"text-center",2,"width","150px"],[1,"text-center",2,"width","100px"],[1,"text-center",2,"width","130px"],[3,"pSelectableRow"],["class","fas fa-circle fa-fw text-success text-v-small",4,"ngIf"],["class","fas fa-circle fa-fw text-muted text-v-small",4,"ngIf"],[1,"small"],[4,"ngFor","ngForOf"],[1,"text-center"],["class","fas fa-check fa-fw text-success pt-1",4,"ngIf"],["class","text-center",4,"ngIf"],[1,"fas","fa-circle","fa-fw","text-success","text-v-small"],[1,"fas","fa-circle","fa-fw","text-muted","text-v-small"],["class","pl-3",4,"ngFor","ngForOf"],[1,"pl-3"],[1,"fas","fa-check","fa-fw","text-success","pt-1"],["pTooltip","Edit","tooltipPosition","left",1,"btn","btn-xsm-custom","mr-1",3,"click"],[1,"fas","fa-pencil-alt","text-light","fa-fw","cursor-pointer"],["pTooltip","Permanent Delete","tooltipPosition","left",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"far","fa-trash-alt","fa-fw","cursor-pointer","text-danger"],[2,"width","150px"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(i,n){if(1&i&&(e.YNc(0,me,62,16,"div",0),e._UZ(1,"find-npm-package",1,2),e.TgZ(3,"app-sandbox-settings-pkg-versions-modal",3,4),e.NdJ("saveUpdateSandboxDep",function(r){return n.saveSettings(r)})("hideLibraryModelEventEmitter",function(){return n.hideNpmLibModel()})("installed",function(){return n.commonPackageAddRemoveTasks()}),e.qZA()),2&i){const a=e.MAs(4);e.Q6J("ngIf",n.settings),e.xp6(1),e.Q6J("data",n.data)("pkgVersionModal",a)("modalId","idAddNpmSandboxSettings")("hostAndPort",n.STORE_BE_HOST_PORT),e.xp6(2),e.Q6J("modalId","idAddNpmSandboxSettingsEdit")("hostAndPort",n.STORE_BE_HOST_PORT)("data",n.data)("dependencies",n.tpNpmPackageAndVersion)}},dependencies:[g.Fj,g.wV,g.JJ,g.On,u.sg,u.O5,G.K,R.S,K.O,f.iA,p.jx,f.Ei,Y.G,C.xf,C.x4,A.u,V],encapsulation:2})}return o})(),canActivate:[D.P]}];let fe=(()=>{class o{static \u0275fac=function(i){return new(i||o)};static \u0275mod=e.oAB({type:o});static \u0275inj=e.cJS({imports:[O.Bz.forChild(pe),y.u,M.ApiTestingM]})}return o})()}}]);
package/dist/7436.js CHANGED
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkapi_maker_fe=self.webpackChunkapi_maker_fe||[]).push([[7436],{7436:(ne,f,o)=>{o.r(f),o.d(f,{ExtLicensesM:()=>z});var v=o(7664),C=o(7213),Z=o(8176),y=o(3726),r=o(5861),p=o(921),u=o(1162),U=o(5085),e=o(4946),E=o(5852),S=o(4795),I=o(7240),A=o(3429),T=o(9961),L=o(5561),m=o(5219),P=o(7414),w=o(2915),l=o(95),g=o(6814),b=o(2660),h=o(5431),K=o(7680),N=o(3259);function M(i,c){1&i&&(e.TgZ(0,"span",5),e._UZ(1,"i",31),e.qZA())}function k(i,c){1&i&&(e.TgZ(0,"tr")(1,"th",32),e._uU(2,"#"),e.qZA(),e.TgZ(3,"th",32),e._uU(4,"\xa0"),e.qZA(),e.TgZ(5,"th",33),e._uU(6,"License Key"),e.qZA(),e.TgZ(7,"th",34),e._uU(8,"Server Info"),e.qZA(),e.TgZ(9,"th",35),e._uU(10,"Action Required"),e.qZA(),e.TgZ(11,"th",36),e._uU(12,"Actions"),e.qZA()())}function D(i,c){1&i&&(e.TgZ(0,"span"),e._UZ(1,"i",47),e.qZA())}function F(i,c){1&i&&(e.TgZ(0,"span"),e._UZ(1,"i",48),e.qZA())}function q(i,c){1&i&&(e.TgZ(0,"span"),e._UZ(1,"i",49),e.qZA())}function J(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"div")(1,"span"),e._uU(2),e.qZA(),e.TgZ(3,"a",50),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.hideLicenseKey(n))}),e._UZ(4,"i",51),e.qZA()()}if(2&i){const t=e.oxw().$implicit;e.xp6(2),e.Oqu(t.licenseKey)}}function Y(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"div")(1,"span"),e._uU(2,"\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7"),e.qZA(),e.TgZ(3,"a",50),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.showLicenseKey(n))}),e._UZ(4,"i",52),e.qZA()()}}function O(i,c){1&i&&(e.TgZ(0,"span"),e._UZ(1,"i",53),e._uU(2," All good"),e.qZA())}function R(i,c){if(1&i&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.qZA()()),2&i){const t=c.$implicit;e.xp6(2),e.hij("\u274c ",t.message,"")}}function G(i,c){if(1&i&&(e.TgZ(0,"div"),e.YNc(1,R,3,1,"div",54),e.qZA()),2&i){const t=e.oxw().$implicit;e.xp6(1),e.Q6J("ngForOf",t.licenseError)}}function B(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"a",55),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.resetMacAddress(n))}),e._UZ(1,"i",56),e.qZA()}}function Q(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"a",57),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.showDialogToGetNewLicenseKey(n))}),e._UZ(1,"i",58),e.qZA()}}function H(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"a",59),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.reduceUsage__click(n,"REDUCE_CPU_USAGE"))}),e._UZ(1,"i",60),e.qZA()}}function V(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"a",61),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.reduceUsage__click(n,"REDUCE_UI_PAGES_USAGE"))}),e._UZ(1,"i",62),e.qZA()}}function j(i,c){if(1&i&&(e.TgZ(0,"tr",37)(1,"td",38),e._uU(2),e.qZA(),e.TgZ(3,"td",38),e.YNc(4,D,2,0,"span",39),e.YNc(5,F,2,0,"span",39),e.YNc(6,q,2,0,"span",39),e.qZA(),e.TgZ(7,"td",40),e.YNc(8,J,5,1,"div",39),e.YNc(9,Y,5,0,"div",39),e.qZA(),e.TgZ(10,"td")(11,"span"),e._uU(12),e.qZA(),e._UZ(13,"br"),e.TgZ(14,"a",41),e._uU(15),e.qZA()(),e.TgZ(16,"td",42),e.YNc(17,O,3,0,"span",39),e.YNc(18,G,2,1,"div",39),e.qZA(),e.TgZ(19,"td",38),e.YNc(20,B,2,0,"a",43),e.YNc(21,Q,2,0,"a",44),e.YNc(22,H,2,0,"a",45),e.YNc(23,V,2,0,"a",46),e.qZA()()),2&i){const t=c.$implicit,s=c.rowIndex;e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(s+1),e.xp6(2),e.Q6J("ngIf","PENDING"===t.licenseCheckStatus),e.xp6(1),e.Q6J("ngIf","VALID"===t.licenseCheckStatus),e.xp6(1),e.Q6J("ngIf","INVALID"===t.licenseCheckStatus),e.xp6(2),e.Q6J("ngIf",t.showLicenseKey),e.xp6(1),e.Q6J("ngIf",!t.showLicenseKey),e.xp6(3),e.Oqu(t.hostName),e.xp6(2),e.s9C("href",t.beHostPort,e.LSH),e.xp6(1),e.Oqu(t.beHostPort),e.xp6(2),e.Q6J("ngIf","VALID"===t.licenseCheckStatus&&0===t.licenseError.length),e.xp6(1),e.Q6J("ngIf",t.licenseError.length),e.xp6(2),e.Q6J("ngIf",t.licenseActions.indexOf("RESET_MAC")>=0),e.xp6(1),e.Q6J("ngIf",t.licenseActions.indexOf("LICENSE_NOT_FOUND")>=0||t.licenseActions.indexOf("EXPIRED")>=0),e.xp6(1),e.Q6J("ngIf",t.licenseActions.indexOf("REDUCE_CPU_USAGE")>=0),e.xp6(1),e.Q6J("ngIf",t.licenseActions.indexOf("REDUCE_UI_PAGES_USAGE")>=0)}}function W(i,c){1&i&&e._UZ(0,"p-progressSpinner",63)}const X=[{path:"",component:(()=>{class i{authCS;authS;generalCS;instanceS;ns;navigationS;confirmationService;constantsS;eventCenterS;EUserType=p.dN;EAPICategory=U.R;gridKey=u.iH._id;loading={grid:!1};serverList=[];newLicenseKey="";setLicenseKeyForObj;showValidationInProgress;constructor(t,s,n,a,d,x,ee,te,se){this.authCS=t,this.authS=s,this.generalCS=n,this.instanceS=a,this.ns=d,this.navigationS=x,this.confirmationService=ee,this.constantsS=te,this.eventCenterS=se}ngOnInit(){return this.authS.backendSettings.extensions?this.authCS.gUser?.userType!==p.dN.ADMIN?this.navigationS.gotoDashboard():(this.generalCS.setNewTitle("AM - Extensions Licenses"),void this.loadData().then()):this.navigationS.gotoDashboard()}loadData(){var t=this;return(0,r.Z)(function*(){t.loading.grid=!0;try{t.serverList=[];const s=(yield t.instanceS.getFullSystemInfo().toPromise()).data,n=_.groupBy(s,u.GR.hostName);for(const a in n)t.serverList.push(n[a][0])}catch(s){console.log(s),t.ns.showErrorFromResponse(s.error||s,"Unable to load server information.")}t.loading.grid=!1})()}resetMacAddress(t){var s=this;return(0,r.Z)(function*(){var n;s.confirmationService.confirm({message:s.constantsS.license.resetMacAddressConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(n=(0,r.Z)(function*(){try{yield s.instanceS.resetMacAddressOfLicense({key:t.licenseKey}).toPromise(),s.ns.showSuccess("MAC address reset successfully."),s.setUIAfterFix(1e4)}catch(a){console.log(a),s.ns.showErrorFromResponse(a.error||a,"Unable to reset MAC address of license.")}}),function(){return n.apply(this,arguments)})})})()}showLicenseKey(t){t.showLicenseKey=!0}hideLicenseKey(t){t.showLicenseKey=!1}showModalSetLicenseKey(){$("#idSetLicenseKeyModal").modal("show")}hideModalSetLicenseKey(){$("#idSetLicenseKeyModal").modal("hide")}showDialogToGetNewLicenseKey(t){this.setLicenseKeyForObj=t,this.newLicenseKey=t.licenseKey,this.showModalSetLicenseKey()}setLicenseKeyAPICall(t){var s=this;return(0,r.Z)(function*(){try{yield s.instanceS.setLicenseKeyOnServer({updateMode:"LICENSE_KEY",uniqueServerId:t.uniqueServerId,uniqueProcessId:t.uniqueProcessId,workerId:t.workerId,licenseKey:s.newLicenseKey,serverName:t.hostName}).toPromise(),s.hideModalSetLicenseKey(),s.ns.showSuccess("License key set successfully."),s.setUIAfterFix(6e3)}catch(n){console.log(n),s.ns.showErrorFromResponse(n.error||n,"Unable to reset MAC address of license.")}})()}reduceUsage__click(t,s){var n=this;let a="";var d;"REDUCE_CPU_USAGE"===s?a=this.constantsS.license.setCPUCoreConfirm:"REDUCE_UI_PAGES_USAGE"===s&&(a=this.constantsS.license.setUIPageCountConfirm),this.confirmationService.confirm({message:a,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(d=(0,r.Z)(function*(){"REDUCE_CPU_USAGE"===s?yield n.hitReduceAPICallForCPU(t):"REDUCE_UI_PAGES_USAGE"===s&&(yield n.hitReduceAPICallForDBMasters(t))}),function(){return d.apply(this,arguments)})})}hitReduceAPICallForCPU(t){var s=this;return(0,r.Z)(function*(){try{const n=(t.licenseError||[]).find(a=>a.licensePermitsCPU)?.licensePermitsCPU;if(!n)return void s.ns.showError("Unable to find CPU core issue in license error.");yield s.instanceS.setLicenseKeyOnServer({updateMode:"CPU_CORE",uniqueServerId:t.uniqueServerId,uniqueProcessId:t.uniqueProcessId,workerId:t.workerId,serverName:t.hostName,cpuCore:n}).toPromise(),s.hideModalSetLicenseKey(),s.ns.showSuccess("CPU core set successfully."),s.setUIAfterFix(1e4)}catch(n){console.log(n),s.ns.showErrorFromResponse(n.error||n,"Unable to set CPU core of license.")}})()}hitReduceAPICallForDBMasters(t){var s=this;return(0,r.Z)(function*(){try{const n=(t.licenseError||[]).find(a=>a.licensePermitsDBMasterCount)?.licensePermitsDBMasterCount;if(!n)return void s.ns.showError("Unable to find UI Pages count issue in license error.");yield s.instanceS.setLicenseKeyOnServer({updateMode:"UI_PAGES_COUNT",uniqueServerId:t.uniqueServerId,uniqueProcessId:t.uniqueProcessId,workerId:t.workerId,serverName:t.hostName,dbMasterCount:n}).toPromise(),s.hideModalSetLicenseKey(),s.ns.showSuccess("UI Pages count set successfully."),s.setUIAfterFix(1e4)}catch(n){console.log(n),s.ns.showErrorFromResponse(n.error||n,"Unable to set UI Pages count of license.")}})()}setUIAfterFix(t){var s=this;this.loadData().then(),this.showValidationInProgress=!0,setTimeout((0,r.Z)(function*(){yield s.loadData(),s.showValidationInProgress=!1,yield s.eventCenterS.headerC.setLicenseHasIssues(s.serverList)}),t)}static \u0275fac=function(s){return new(s||i)(e.Y36(E.D),e.Y36(S.e),e.Y36(I.b),e.Y36(A.E),e.Y36(T.W),e.Y36(L.X),e.Y36(m.YP),e.Y36(P.L),e.Y36(w.u))};static \u0275cmp=e.Xpm({type:i,selectors:[["app-ext-licenses"]],decls:39,vars:7,consts:[[1,"pt-1","pl-1","pr-1"],[1,"full-body","overflow-hidden"],[1,"card"],[1,"card-header"],["src","/assets/images/icons/license.svg","alt","Extension license icon",1,"fa-fw","mr-1",2,"vertical-align","text-top"],[1,"float-right"],["class","float-right",4,"ngIf"],[1,"card-body","p-0","overflow-auto","text-center",2,"height","calc(100vh - 88px)"],["styleClass","p-datatable-striped custom-api-grid-height","scrollHeight","flex",3,"selectionMode","dataKey","scrollable","value"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idSetLicenseKeyModal","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog","modal-lg"],[1,"modal-content"],[1,"modal-header"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],[1,"container","pt-3"],[1,"form-group","row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["name","licenseKey","spellcheck","false","type","text","autocomplete","off",1,"form-control","form-control-sm","font-monospaced",3,"ngModel","ngModelChange"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["tooltipPosition","left","pTooltip","Validation in progress.",1,"fas","fa-sync-alt","text-success","fa-fw","fa-spin"],[1,"text-center","bg-table-header",2,"width","30px"],[1,"bg-table-header",2,"width","300px"],[1,"bg-table-header",2,"width","240px"],[1,"bg-table-header"],[1,"text-center","bg-table-header",2,"width","125px"],[3,"pSelectableRow"],[1,"text-center"],[4,"ngIf"],[1,"small","font-monospaced"],["target","_blank",1,"ml-2","small","text-muted",3,"href"],[1,""],["class","btn btn-xsm-custom ml-1","pTooltip","Reset registered mac address.","tooltipPosition","left","href","javascript:",3,"click",4,"ngIf"],["class","btn btn-xsm-custom ml-1","pTooltip","Set license key","tooltipPosition","left","href","javascript:",3,"click",4,"ngIf"],["class","btn btn-xsm-custom ml-1","pTooltip","Set CPU core usage from license","tooltipPosition","left","href","javascript:",3,"click",4,"ngIf"],["class","btn btn-xsm-custom ml-1","pTooltip","Set UI Pages usage from license","tooltipPosition","left","href","javascript:",3,"click",4,"ngIf"],["pTooltip","License validation will happen in future.",1,"fas","fa-circle","text-warning"],["pTooltip","Valid license",1,"fas","fa-circle","text-success"],["pTooltip","Invalid license",1,"fas","fa-circle","text-danger"],["href","javascript:",1,"btn","btn-xsm-custom","ml-2",3,"click"],[1,"fas","fa-eye-slash","fa-fw","pt-1"],[1,"fas","fa-eye","fa-fw","pt-1"],[1,"fas","fa-check","fa-fw","text-success"],[4,"ngFor","ngForOf"],["pTooltip","Reset registered mac address.","tooltipPosition","left","href","javascript:",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"fas","fa-history","text-info","fa-fw","pt-1"],["pTooltip","Set license key","tooltipPosition","left","href","javascript:",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"fas","fa-wrench","text-success","fa-fw","pt-1"],["pTooltip","Set CPU core usage from license","tooltipPosition","left","href","javascript:",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"fas","fa-microchip","text-success","fa-fw","pt-1"],["pTooltip","Set UI Pages usage from license","tooltipPosition","left","href","javascript:",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"fab","fa-html5","text-success","fa-fw","pt-1"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,n){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"span"),e._UZ(5,"img",4),e._uU(6," Server List "),e.qZA(),e.TgZ(7,"div",5),e.YNc(8,M,2,0,"span",6),e.qZA()(),e.TgZ(9,"div",7)(10,"p-table",8),e.YNc(11,k,13,0,"ng-template",9),e.YNc(12,j,24,16,"ng-template",10),e.qZA(),e.YNc(13,W,1,0,"p-progressSpinner",11),e.qZA()()()(),e.TgZ(14,"div",12)(15,"div",13)(16,"div",14)(17,"div",15)(18,"span"),e._UZ(19,"i",16),e._uU(20," Set License Key"),e.qZA(),e.TgZ(21,"button",17)(22,"span",18),e._UZ(23,"i",19),e.qZA()()(),e.TgZ(24,"div",20)(25,"form",21)(26,"div",22)(27,"label",23),e._uU(28,"Name"),e.qZA(),e.TgZ(29,"div",24)(30,"input",25),e.NdJ("ngModelChange",function(d){return n.newLicenseKey=d}),e.qZA()()()()(),e.TgZ(31,"div",26)(32,"button",27),e._UZ(33,"i",28),e._uU(34," Close "),e.qZA(),e.TgZ(35,"button",29),e.NdJ("click",function(){return n.setLicenseKeyAPICall(n.setLicenseKeyForObj)}),e._UZ(36,"i",30),e.TgZ(37,"span"),e._uU(38,"Set Key"),e.qZA()()()()()()),2&s&&(e.xp6(8),e.Q6J("ngIf",n.showValidationInProgress),e.xp6(2),e.Q6J("selectionMode","multiple")("dataKey",n.gridKey)("scrollable",!0)("value",n.serverList),e.xp6(3),e.Q6J("ngIf",n.loading.grid),e.xp6(17),e.Q6J("ngModel",n.newLicenseKey))},dependencies:[l._Y,l.Fj,l.JJ,l.JL,l.On,l.F,g.sg,g.O5,b.y,h.iA,m.jx,h.Ei,K.G,N.u],styles:[".bg-table-header[_ngcontent-%COMP%]{background-color:#272727}"]})}return i})(),canActivate:[y.P]}];let z=(()=>{class i{static \u0275fac=function(s){return new(s||i)};static \u0275mod=e.oAB({type:i});static \u0275inj=e.cJS({imports:[v.Bz.forChild(X),Z.u,C.S]})}return i})()}}]);
1
+ "use strict";(self.webpackChunkapi_maker_fe=self.webpackChunkapi_maker_fe||[]).push([[7436],{7436:(ne,f,o)=>{o.r(f),o.d(f,{ExtLicensesM:()=>z});var v=o(7664),C=o(7213),Z=o(7359),y=o(3726),r=o(5861),p=o(921),u=o(1162),U=o(5085),e=o(4946),E=o(5852),S=o(4795),I=o(7240),A=o(3429),T=o(9961),L=o(5561),m=o(5219),P=o(7414),w=o(2915),l=o(95),g=o(6814),b=o(2660),h=o(5431),K=o(7680),N=o(3259);function M(i,c){1&i&&(e.TgZ(0,"span",5),e._UZ(1,"i",31),e.qZA())}function k(i,c){1&i&&(e.TgZ(0,"tr")(1,"th",32),e._uU(2,"#"),e.qZA(),e.TgZ(3,"th",32),e._uU(4,"\xa0"),e.qZA(),e.TgZ(5,"th",33),e._uU(6,"License Key"),e.qZA(),e.TgZ(7,"th",34),e._uU(8,"Server Info"),e.qZA(),e.TgZ(9,"th",35),e._uU(10,"Action Required"),e.qZA(),e.TgZ(11,"th",36),e._uU(12,"Actions"),e.qZA()())}function D(i,c){1&i&&(e.TgZ(0,"span"),e._UZ(1,"i",47),e.qZA())}function F(i,c){1&i&&(e.TgZ(0,"span"),e._UZ(1,"i",48),e.qZA())}function q(i,c){1&i&&(e.TgZ(0,"span"),e._UZ(1,"i",49),e.qZA())}function J(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"div")(1,"span"),e._uU(2),e.qZA(),e.TgZ(3,"a",50),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.hideLicenseKey(n))}),e._UZ(4,"i",51),e.qZA()()}if(2&i){const t=e.oxw().$implicit;e.xp6(2),e.Oqu(t.licenseKey)}}function Y(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"div")(1,"span"),e._uU(2,"\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7\xb7"),e.qZA(),e.TgZ(3,"a",50),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.showLicenseKey(n))}),e._UZ(4,"i",52),e.qZA()()}}function O(i,c){1&i&&(e.TgZ(0,"span"),e._UZ(1,"i",53),e._uU(2," All good"),e.qZA())}function R(i,c){if(1&i&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.qZA()()),2&i){const t=c.$implicit;e.xp6(2),e.hij("\u274c ",t.message,"")}}function G(i,c){if(1&i&&(e.TgZ(0,"div"),e.YNc(1,R,3,1,"div",54),e.qZA()),2&i){const t=e.oxw().$implicit;e.xp6(1),e.Q6J("ngForOf",t.licenseError)}}function B(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"a",55),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.resetMacAddress(n))}),e._UZ(1,"i",56),e.qZA()}}function Q(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"a",57),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.showDialogToGetNewLicenseKey(n))}),e._UZ(1,"i",58),e.qZA()}}function H(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"a",59),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.reduceUsage__click(n,"REDUCE_CPU_USAGE"))}),e._UZ(1,"i",60),e.qZA()}}function V(i,c){if(1&i){const t=e.EpF();e.TgZ(0,"a",61),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit,a=e.oxw();return e.KtG(a.reduceUsage__click(n,"REDUCE_UI_PAGES_USAGE"))}),e._UZ(1,"i",62),e.qZA()}}function j(i,c){if(1&i&&(e.TgZ(0,"tr",37)(1,"td",38),e._uU(2),e.qZA(),e.TgZ(3,"td",38),e.YNc(4,D,2,0,"span",39),e.YNc(5,F,2,0,"span",39),e.YNc(6,q,2,0,"span",39),e.qZA(),e.TgZ(7,"td",40),e.YNc(8,J,5,1,"div",39),e.YNc(9,Y,5,0,"div",39),e.qZA(),e.TgZ(10,"td")(11,"span"),e._uU(12),e.qZA(),e._UZ(13,"br"),e.TgZ(14,"a",41),e._uU(15),e.qZA()(),e.TgZ(16,"td",42),e.YNc(17,O,3,0,"span",39),e.YNc(18,G,2,1,"div",39),e.qZA(),e.TgZ(19,"td",38),e.YNc(20,B,2,0,"a",43),e.YNc(21,Q,2,0,"a",44),e.YNc(22,H,2,0,"a",45),e.YNc(23,V,2,0,"a",46),e.qZA()()),2&i){const t=c.$implicit,s=c.rowIndex;e.Q6J("pSelectableRow",t),e.xp6(2),e.Oqu(s+1),e.xp6(2),e.Q6J("ngIf","PENDING"===t.licenseCheckStatus),e.xp6(1),e.Q6J("ngIf","VALID"===t.licenseCheckStatus),e.xp6(1),e.Q6J("ngIf","INVALID"===t.licenseCheckStatus),e.xp6(2),e.Q6J("ngIf",t.showLicenseKey),e.xp6(1),e.Q6J("ngIf",!t.showLicenseKey),e.xp6(3),e.Oqu(t.hostName),e.xp6(2),e.s9C("href",t.beHostPort,e.LSH),e.xp6(1),e.Oqu(t.beHostPort),e.xp6(2),e.Q6J("ngIf","VALID"===t.licenseCheckStatus&&0===t.licenseError.length),e.xp6(1),e.Q6J("ngIf",t.licenseError.length),e.xp6(2),e.Q6J("ngIf",t.licenseActions.indexOf("RESET_MAC")>=0),e.xp6(1),e.Q6J("ngIf",t.licenseActions.indexOf("LICENSE_NOT_FOUND")>=0||t.licenseActions.indexOf("EXPIRED")>=0),e.xp6(1),e.Q6J("ngIf",t.licenseActions.indexOf("REDUCE_CPU_USAGE")>=0),e.xp6(1),e.Q6J("ngIf",t.licenseActions.indexOf("REDUCE_UI_PAGES_USAGE")>=0)}}function W(i,c){1&i&&e._UZ(0,"p-progressSpinner",63)}const X=[{path:"",component:(()=>{class i{authCS;authS;generalCS;instanceS;ns;navigationS;confirmationService;constantsS;eventCenterS;EUserType=p.dN;EAPICategory=U.R;gridKey=u.iH._id;loading={grid:!1};serverList=[];newLicenseKey="";setLicenseKeyForObj;showValidationInProgress;constructor(t,s,n,a,d,x,ee,te,se){this.authCS=t,this.authS=s,this.generalCS=n,this.instanceS=a,this.ns=d,this.navigationS=x,this.confirmationService=ee,this.constantsS=te,this.eventCenterS=se}ngOnInit(){return this.authS.backendSettings.extensions?this.authCS.gUser?.userType!==p.dN.ADMIN?this.navigationS.gotoDashboard():(this.generalCS.setNewTitle("AM - Extensions Licenses"),void this.loadData().then()):this.navigationS.gotoDashboard()}loadData(){var t=this;return(0,r.Z)(function*(){t.loading.grid=!0;try{t.serverList=[];const s=(yield t.instanceS.getFullSystemInfo().toPromise()).data,n=_.groupBy(s,u.GR.hostName);for(const a in n)t.serverList.push(n[a][0])}catch(s){console.log(s),t.ns.showErrorFromResponse(s.error||s,"Unable to load server information.")}t.loading.grid=!1})()}resetMacAddress(t){var s=this;return(0,r.Z)(function*(){var n;s.confirmationService.confirm({message:s.constantsS.license.resetMacAddressConfirm,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(n=(0,r.Z)(function*(){try{yield s.instanceS.resetMacAddressOfLicense({key:t.licenseKey}).toPromise(),s.ns.showSuccess("MAC address reset successfully."),s.setUIAfterFix(1e4)}catch(a){console.log(a),s.ns.showErrorFromResponse(a.error||a,"Unable to reset MAC address of license.")}}),function(){return n.apply(this,arguments)})})})()}showLicenseKey(t){t.showLicenseKey=!0}hideLicenseKey(t){t.showLicenseKey=!1}showModalSetLicenseKey(){$("#idSetLicenseKeyModal").modal("show")}hideModalSetLicenseKey(){$("#idSetLicenseKeyModal").modal("hide")}showDialogToGetNewLicenseKey(t){this.setLicenseKeyForObj=t,this.newLicenseKey=t.licenseKey,this.showModalSetLicenseKey()}setLicenseKeyAPICall(t){var s=this;return(0,r.Z)(function*(){try{yield s.instanceS.setLicenseKeyOnServer({updateMode:"LICENSE_KEY",uniqueServerId:t.uniqueServerId,uniqueProcessId:t.uniqueProcessId,workerId:t.workerId,licenseKey:s.newLicenseKey,serverName:t.hostName}).toPromise(),s.hideModalSetLicenseKey(),s.ns.showSuccess("License key set successfully."),s.setUIAfterFix(6e3)}catch(n){console.log(n),s.ns.showErrorFromResponse(n.error||n,"Unable to reset MAC address of license.")}})()}reduceUsage__click(t,s){var n=this;let a="";var d;"REDUCE_CPU_USAGE"===s?a=this.constantsS.license.setCPUCoreConfirm:"REDUCE_UI_PAGES_USAGE"===s&&(a=this.constantsS.license.setUIPageCountConfirm),this.confirmationService.confirm({message:a,header:"Confirmation",icon:"pi pi-exclamation-triangle",accept:(d=(0,r.Z)(function*(){"REDUCE_CPU_USAGE"===s?yield n.hitReduceAPICallForCPU(t):"REDUCE_UI_PAGES_USAGE"===s&&(yield n.hitReduceAPICallForDBMasters(t))}),function(){return d.apply(this,arguments)})})}hitReduceAPICallForCPU(t){var s=this;return(0,r.Z)(function*(){try{const n=(t.licenseError||[]).find(a=>a.licensePermitsCPU)?.licensePermitsCPU;if(!n)return void s.ns.showError("Unable to find CPU core issue in license error.");yield s.instanceS.setLicenseKeyOnServer({updateMode:"CPU_CORE",uniqueServerId:t.uniqueServerId,uniqueProcessId:t.uniqueProcessId,workerId:t.workerId,serverName:t.hostName,cpuCore:n}).toPromise(),s.hideModalSetLicenseKey(),s.ns.showSuccess("CPU core set successfully."),s.setUIAfterFix(1e4)}catch(n){console.log(n),s.ns.showErrorFromResponse(n.error||n,"Unable to set CPU core of license.")}})()}hitReduceAPICallForDBMasters(t){var s=this;return(0,r.Z)(function*(){try{const n=(t.licenseError||[]).find(a=>a.licensePermitsDBMasterCount)?.licensePermitsDBMasterCount;if(!n)return void s.ns.showError("Unable to find UI Pages count issue in license error.");yield s.instanceS.setLicenseKeyOnServer({updateMode:"UI_PAGES_COUNT",uniqueServerId:t.uniqueServerId,uniqueProcessId:t.uniqueProcessId,workerId:t.workerId,serverName:t.hostName,dbMasterCount:n}).toPromise(),s.hideModalSetLicenseKey(),s.ns.showSuccess("UI Pages count set successfully."),s.setUIAfterFix(1e4)}catch(n){console.log(n),s.ns.showErrorFromResponse(n.error||n,"Unable to set UI Pages count of license.")}})()}setUIAfterFix(t){var s=this;this.loadData().then(),this.showValidationInProgress=!0,setTimeout((0,r.Z)(function*(){yield s.loadData(),s.showValidationInProgress=!1,yield s.eventCenterS.headerC.setLicenseHasIssues(s.serverList)}),t)}static \u0275fac=function(s){return new(s||i)(e.Y36(E.D),e.Y36(S.e),e.Y36(I.b),e.Y36(A.E),e.Y36(T.W),e.Y36(L.X),e.Y36(m.YP),e.Y36(P.L),e.Y36(w.u))};static \u0275cmp=e.Xpm({type:i,selectors:[["app-ext-licenses"]],decls:39,vars:7,consts:[[1,"pt-1","pl-1","pr-1"],[1,"full-body","overflow-hidden"],[1,"card"],[1,"card-header"],["src","/assets/images/icons/license.svg","alt","Extension license icon",1,"fa-fw","mr-1",2,"vertical-align","text-top"],[1,"float-right"],["class","float-right",4,"ngIf"],[1,"card-body","p-0","overflow-auto","text-center",2,"height","calc(100vh - 88px)"],["styleClass","p-datatable-striped custom-api-grid-height","scrollHeight","flex",3,"selectionMode","dataKey","scrollable","value"],["pTemplate","header"],["pTemplate","body"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s",4,"ngIf"],["aria-hidden","true","aria-labelledby","exampleModalLabel","id","idSetLicenseKeyModal","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal"],["role","document",1,"modal-dialog","modal-lg"],[1,"modal-content"],[1,"modal-header"],[1,"fas","fa-plus","text-success","fa-fw","mr-1"],["aria-label","Close","data-dismiss","modal","type","button",1,"close"],["aria-hidden","true"],[1,"fas","fa-window-close"],[1,"modal-body","overflow-auto"],[1,"container","pt-3"],[1,"form-group","row"],[1,"col-4","col-form-label","col-form-label-sm","text-right"],[1,"col-6"],["name","licenseKey","spellcheck","false","type","text","autocomplete","off",1,"form-control","form-control-sm","font-monospaced",3,"ngModel","ngModelChange"],[1,"modal-footer"],["data-dismiss","modal","type","button",1,"btn","btn-sm","btn-secondary"],[1,"fas","fa-times","text-danger","fa-fw"],["sava-no-dbl-click","","type","button",1,"btn","btn-primary","btn-sm",3,"click"],[1,"fas","fa-save","text-success","fa-fw","mr-1"],["tooltipPosition","left","pTooltip","Validation in progress.",1,"fas","fa-sync-alt","text-success","fa-fw","fa-spin"],[1,"text-center","bg-table-header",2,"width","30px"],[1,"bg-table-header",2,"width","300px"],[1,"bg-table-header",2,"width","240px"],[1,"bg-table-header"],[1,"text-center","bg-table-header",2,"width","125px"],[3,"pSelectableRow"],[1,"text-center"],[4,"ngIf"],[1,"small","font-monospaced"],["target","_blank",1,"ml-2","small","text-muted",3,"href"],[1,""],["class","btn btn-xsm-custom ml-1","pTooltip","Reset registered mac address.","tooltipPosition","left","href","javascript:",3,"click",4,"ngIf"],["class","btn btn-xsm-custom ml-1","pTooltip","Set license key","tooltipPosition","left","href","javascript:",3,"click",4,"ngIf"],["class","btn btn-xsm-custom ml-1","pTooltip","Set CPU core usage from license","tooltipPosition","left","href","javascript:",3,"click",4,"ngIf"],["class","btn btn-xsm-custom ml-1","pTooltip","Set UI Pages usage from license","tooltipPosition","left","href","javascript:",3,"click",4,"ngIf"],["pTooltip","License validation will happen in future.",1,"fas","fa-circle","text-warning"],["pTooltip","Valid license",1,"fas","fa-circle","text-success"],["pTooltip","Invalid license",1,"fas","fa-circle","text-danger"],["href","javascript:",1,"btn","btn-xsm-custom","ml-2",3,"click"],[1,"fas","fa-eye-slash","fa-fw","pt-1"],[1,"fas","fa-eye","fa-fw","pt-1"],[1,"fas","fa-check","fa-fw","text-success"],[4,"ngFor","ngForOf"],["pTooltip","Reset registered mac address.","tooltipPosition","left","href","javascript:",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"fas","fa-history","text-info","fa-fw","pt-1"],["pTooltip","Set license key","tooltipPosition","left","href","javascript:",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"fas","fa-wrench","text-success","fa-fw","pt-1"],["pTooltip","Set CPU core usage from license","tooltipPosition","left","href","javascript:",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"fas","fa-microchip","text-success","fa-fw","pt-1"],["pTooltip","Set UI Pages usage from license","tooltipPosition","left","href","javascript:",1,"btn","btn-xsm-custom","ml-1",3,"click"],[1,"fab","fa-html5","text-success","fa-fw","pt-1"],["styleClass","w-4rem h-4rem","strokeWidth","4","animationDuration",".5s"]],template:function(s,n){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"span"),e._UZ(5,"img",4),e._uU(6," Server List "),e.qZA(),e.TgZ(7,"div",5),e.YNc(8,M,2,0,"span",6),e.qZA()(),e.TgZ(9,"div",7)(10,"p-table",8),e.YNc(11,k,13,0,"ng-template",9),e.YNc(12,j,24,16,"ng-template",10),e.qZA(),e.YNc(13,W,1,0,"p-progressSpinner",11),e.qZA()()()(),e.TgZ(14,"div",12)(15,"div",13)(16,"div",14)(17,"div",15)(18,"span"),e._UZ(19,"i",16),e._uU(20," Set License Key"),e.qZA(),e.TgZ(21,"button",17)(22,"span",18),e._UZ(23,"i",19),e.qZA()()(),e.TgZ(24,"div",20)(25,"form",21)(26,"div",22)(27,"label",23),e._uU(28,"Name"),e.qZA(),e.TgZ(29,"div",24)(30,"input",25),e.NdJ("ngModelChange",function(d){return n.newLicenseKey=d}),e.qZA()()()()(),e.TgZ(31,"div",26)(32,"button",27),e._UZ(33,"i",28),e._uU(34," Close "),e.qZA(),e.TgZ(35,"button",29),e.NdJ("click",function(){return n.setLicenseKeyAPICall(n.setLicenseKeyForObj)}),e._UZ(36,"i",30),e.TgZ(37,"span"),e._uU(38,"Set Key"),e.qZA()()()()()()),2&s&&(e.xp6(8),e.Q6J("ngIf",n.showValidationInProgress),e.xp6(2),e.Q6J("selectionMode","multiple")("dataKey",n.gridKey)("scrollable",!0)("value",n.serverList),e.xp6(3),e.Q6J("ngIf",n.loading.grid),e.xp6(17),e.Q6J("ngModel",n.newLicenseKey))},dependencies:[l._Y,l.Fj,l.JJ,l.JL,l.On,l.F,g.sg,g.O5,b.y,h.iA,m.jx,h.Ei,K.G,N.u],styles:[".bg-table-header[_ngcontent-%COMP%]{background-color:#272727}"]})}return i})(),canActivate:[y.P]}];let z=(()=>{class i{static \u0275fac=function(s){return new(s||i)};static \u0275mod=e.oAB({type:i});static \u0275inj=e.cJS({imports:[v.Bz.forChild(X),Z.u,C.S]})}return i})()}}]);