@platform-mesh/portal-ui-lib 0.71.8 → 0.71.10
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.
|
@@ -1675,7 +1675,7 @@ design guidelines, please use the \`ui5-button\` component.
|
|
|
1675
1675
|
}
|
|
1676
1676
|
`;$pe=(()=>{class e{constructor(){this.resourceService=V(T3)}list(i){return this.resourceService.list("v1_namespaces",q8([{property:"metadata.name"}]),{portalContext:{crdGatewayApiUrl:i.portalContext.crdGatewayApiUrl},resourceDefinition:{version:"v1",entityCollection:"Namespaces",entity:"Namespace",scope:"Cluster"},kcpPath:i.kcpPath,token:i.token}).pipe(y1(r=>r.items.map(a=>a.metadata.name)))}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=Ot({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})(),Ac=(()=>{class e{constructor(){this.luigiCoreService=V(An)}handleError(i,r){let a=i?.message||i?.errors?.map(o=>o.message).join(`
|
|
1677
1677
|
`);this.luigiCoreService.showAlert({text:[r,a].filter(Boolean).join(`
|
|
1678
|
-
`)||"An unknown error occurred",type:"error"}),console.error(i)}errorCode(i){return this.isUnauthorizedAccess(i)?403:[i?.statusCode,i?.status,i?.networkError?.statusCode,i?.networkError?.status,i?.response?.status].find(Boolean)??500}isUnauthorizedAccess(i){return!!i?.message?.toLowerCase().includes("forbidden")||!!i?.message?.toLowerCase()?.includes("access denied")}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=Ot({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})(),Wpe=["dialog"],tP=(()=>{class e{constructor(){this.context=B.required(),this.fields=B([]),this.resource=Ae(),this.updateResource=Ae(),this.dialogOpen=Ee(!1),this.isNamespacedResource=K(()=>uo(this.context())),this.resourceService=V(T3),this.errorHandlerService=V(Ac),this.destroyRef=V(K0),this.dialog=Mr("dialog"),this.originalResource=Ee(null),this.validation=new wO((i,r)=>jO({name:i,value:r,fields:this.calculateFields(),editMode:this.isEditMode()})),this.fieldErrors=this.validation.errors,this.formFields=Ee([]),this.initialValues=Ee({}),this.pending=Ee(!1),this.formPending=K(()=>this.pending()||this.validation.hasDeferredErrors()),this.dependencies=new Km((i,r)=>this.resolveDynamicValuesResult(i,r),i=>this.applyDependentUpdate(i)),this.dialogTitle=K(()=>this.isEditMode()?"Edit":"Create"),this.confirmLabel=K(()=>this.isEditMode()?"Save":"Create"),this.dataTestidPrefix=K(()=>this.isEditMode()?"edit-resource-dialog":"create-resource-dialog"),this.destroyRef.onDestroy(()=>this.dependencies.end())}async open(i){this.dependencies.end(),this.dialogOpen.set(!1),this.pending.set(!1),this.validation.reset();let r=this.calculateFields();this.originalResource.set(i??null);let a=PO(r,i),o;try{o=this.dependencies.begin(r,a);let s=await UO(r,a,{editMode:this.isEditMode(),resolveResult:(c,_)=>this.resolveDynamicValuesResult(c,_)});if(!this.dependencies.isCurrent(o))return;this.formFields.set(s),this.initialValues.set(a),this.dialogOpen.set(!0)}catch(s){if(o!==void 0&&!this.dependencies.isCurrent(o))return;this.close(),this.errorHandlerService.handleError(s)}}close(){this.dependencies.end(),this.dialogOpen.set(!1),this.pending.set(!1),this.validation.reset(),this.originalResource.set(null)}isEditMode(){return!!this.originalResource()}onFieldChange(i){this.validation.handleChange(i),this.dependencies.handleChange(i)}applyDependentUpdate(i){i.clear&&(this.dialog()?.patchForm({[i.name]:""},{emitEvent:!1}),this.validation.resetField(i.name,"")),this.formFields.update(r=>r.map(a=>a.name===i.name?te(Z({},a),{values:i.values}):a)),this.pending.set(i.pending)}onFormSubmit(i){if(this.isEditMode()){let r=AO(i,this.calculateFields());this.updateResource.emit(r);return}this.resource.emit(i)}resolveDynamicValuesResult(i,r){return OO(i,this.context(),this.isNamespacedResource(),r,{list:(a,o,s,c)=>this.resourceService.list(a,o,s,c),getNamespace:a=>this.resourceService.getNamespace(a),handleError:a=>this.errorHandlerService.handleError(a)})}calculateFields(){let i=this.fields().slice();return this.shouldAddNamespaceControl()&&i.unshift({property:go.MetadataNamespace,required:!0,label:"Namespace",dynamicValuesDefinition:{operation:"v1.Namespaces.items",gqlQuery:"query { v1 { Namespaces { items { metadata { name } } } } }",value:"metadata.name",key:"metadata.name"}}),i}shouldAddNamespaceControl(){return this.isNamespacedResource()&&!this.resourceService.getNamespace(this.context())&&!this.fields().some(i=>i.property===go.MetadataNamespace)}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=Qe({type:e,selectors:[["pm-resource-form-modal"]],viewQuery:function(i,r){i&1&&m2(r.dialog,Wpe,5),i&2&&wn()},inputs:{context:[1,"context"],fields:[1,"fields"]},outputs:{resource:"resource",updateResource:"updateResource"},decls:2,vars:9,consts:[["dialog",""],[3,"fieldChange","submitted","cancelled","open","fields","initialValues","pending","fieldErrors","defaultTitle","defaultConfirmLabel","defaultCancelLabel","dataTestidPrefix"]],template:function(i,r){i&1&&(q(0,"mfp-resource-form-dialog",1,0),Se("fieldChange",function(a){return r.onFieldChange(a)})("submitted",function(a){return r.onFormSubmit(a)})("cancelled",function(){return r.close()}),X()),i&2&&ue("open",r.dialogOpen())("fields",r.formFields())("initialValues",r.initialValues())("pending",r.formPending())("fieldErrors",r.fieldErrors())("defaultTitle",r.dialogTitle())("defaultConfirmLabel",r.confirmLabel())("defaultCancelLabel","Cancel")("dataTestidPrefix",r.dataTestidPrefix())},dependencies:[rV],encapsulation:3})}}return e})();iP=(()=>{class e{constructor(){this.resourceDefinition=B.required()}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=Qe({type:e,selectors:[["pm-resource-logo"]],inputs:{resourceDefinition:[1,"resourceDefinition"]},decls:1,vars:1,consts:[["data-testid","generic-detail-view-logo","alt","Logo",1,"resource-logo",3,"src"]],template:function(i,r){i&1&&Fe(0,qpe,1,2,"img",0),i&2&&ze(r.resourceDefinition()?.ui?.logoUrl?0:-1)},styles:[".resource-logo[_ngcontent-%COMP%]{width:5rem;padding-bottom:1rem}"]})}}return e})();ep.registerAngularComponents([ade,rde,ode,nde,lh]);Gpe=[{id:"ras",title:"Recently accessed services",editable:!0,w:12}],Kpe=[{serviceType:"SAP HANA Cloud",serviceName:"olc-hana-db",serviceIcon:"database",serviceDescription:"My Subaccount 1/Space dev",path:"/hana/olc-hana-db"},{serviceType:"Cloud Identity Service",serviceName:"Cloud Identity",serviceIcon:"customer",serviceDescription:"My Subaccount 1/Space dev",path:"/identity/cloud-identity"},{serviceType:"SAP HANA Cloud",serviceName:"olc-hana-db-test",serviceIcon:"database",serviceDescription:"My Subaccount 1/Space dev",path:"/hana/olc-hana-db-test"},{serviceType:"Application Autoscaler",serviceName:"applicationtest",serviceIcon:"accelerated",serviceDescription:"My Subaccount 2/Space prod",path:"/autoscaler/applicationtest"},{serviceType:"Cloud Identity Service",serviceName:"Cloud Identity 2",serviceIcon:"customer",serviceDescription:"Long text Subaccount 1/Space",path:"/identity/cloud-identity-2"},{serviceType:"Audit Log Service",serviceName:"auditlog-name",serviceIcon:"log",serviceDescription:"My Subaccount 4/Space dev",path:"/auditlog/auditlog-name"}],rP=[{id:"whats-new",label:"What's New",type:"angular",w:6,h:57,component:"mfp-whats-new"},{id:"favorites",label:"Favorites",type:"angular",w:6,h:21,minW:3,maxW:6,minH:10,maxH:40,component:"mfp-favorites"},{id:"service-status",label:"Service Status",type:"angular",w:6,h:30,component:"mfp-service-status-card"}],Xpe=[...Kpe.map((e,t)=>({id:`ras-card-${t}`,w:4,h:10,sectionId:"ras",type:"angular",component:"mfp-visited-service-card",componentInputs:Z({},e)})),...rP],Ype=(()=>{class e{read(i){return bY(i)}write(i,r){fY(i,r)}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=Ot({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})(),Qpe=["email"],Jpe=e=>{let t=e.oidcScopes?.length?e.oidcScopes:Qpe;return[`--oidc-issuer-url=${e.oidcIssuerUrl}`,`--oidc-client-id=${e.oidcKubectlClientId}`,...t.map(i=>`--oidc-extra-scope=${i}`),...e.oidcCA?[`--certificate-authority-data=${btoa(e.oidcCA)}`]:[]]},e_e=e=>`
|
|
1678
|
+
`)||"An unknown error occurred",type:"error"}),console.error(i)}errorCode(i){return this.isUnauthorizedAccess(i)?403:[i?.statusCode,i?.status,i?.networkError?.statusCode,i?.networkError?.status,i?.response?.status].find(Boolean)??500}isUnauthorizedAccess(i){return!!i?.message?.toLowerCase().includes("forbidden")||!!i?.message?.toLowerCase()?.includes("access denied")}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=Ot({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})(),Wpe=["dialog"],tP=(()=>{class e{constructor(){this.context=B.required(),this.fields=B([]),this.resource=Ae(),this.updateResource=Ae(),this.dialogOpen=Ee(!1),this.isNamespacedResource=K(()=>uo(this.context())),this.resourceService=V(T3),this.errorHandlerService=V(Ac),this.destroyRef=V(K0),this.dialog=Mr("dialog"),this.originalResource=Ee(null),this.validation=new wO((i,r)=>jO({name:i,value:r,fields:this.calculateFields(),editMode:this.isEditMode()})),this.fieldErrors=this.validation.errors,this.formFields=Ee([]),this.initialValues=Ee({}),this.pending=Ee(!1),this.formPending=K(()=>this.pending()||this.validation.hasDeferredErrors()),this.dependencies=new Km((i,r)=>this.resolveDynamicValuesResult(i,r),i=>this.applyDependentUpdate(i)),this.dialogTitle=K(()=>this.isEditMode()?"Edit":"Create"),this.confirmLabel=K(()=>this.isEditMode()?"Save":"Create"),this.dataTestidPrefix=K(()=>this.isEditMode()?"edit-resource-dialog":"create-resource-dialog"),this.destroyRef.onDestroy(()=>this.dependencies.end())}async open(i){this.dependencies.end(),this.dialogOpen.set(!1),this.pending.set(!1),this.validation.reset();let r=this.calculateFields();this.originalResource.set(i??null);let a=PO(r,i),o;try{o=this.dependencies.begin(r,a);let s=await UO(r,a,{editMode:this.isEditMode(),resolveResult:(c,_)=>this.resolveDynamicValuesResult(c,_)});if(!this.dependencies.isCurrent(o))return;this.formFields.set(s),this.initialValues.set(a),this.dialogOpen.set(!0)}catch(s){if(o!==void 0&&!this.dependencies.isCurrent(o))return;this.close(),this.errorHandlerService.handleError(s)}}close(){this.dependencies.end(),this.dialogOpen.set(!1),this.pending.set(!1),this.validation.reset(),this.originalResource.set(null)}isEditMode(){return!!this.originalResource()}onFieldChange(i){this.validation.handleChange(i),this.dependencies.handleChange(i)}applyDependentUpdate(i){i.clear&&(this.dialog()?.patchForm({[i.name]:""},{emitEvent:!1}),this.validation.resetField(i.name,"")),this.formFields.update(r=>r.map(a=>a.name===i.name?te(Z({},a),{values:i.values}):a)),this.pending.set(i.pending)}onFormSubmit(i){if(this.isEditMode()){let r=AO(i,this.calculateFields());this.updateResource.emit(r);return}this.resource.emit(i)}resolveDynamicValuesResult(i,r){return OO(i,this.context(),this.isNamespacedResource(),r,{list:(a,o,s,c)=>this.resourceService.list(a,o,s,c),getNamespace:a=>this.resourceService.getNamespace(a),handleError:a=>this.errorHandlerService.handleError(a)})}calculateFields(){let i=this.fields().slice();return this.shouldAddNamespaceControl()&&i.unshift({property:go.MetadataNamespace,required:!0,label:"Namespace",dynamicValuesDefinition:{operation:"v1.Namespaces.items",gqlQuery:"query { v1 { Namespaces { items { metadata { name } } } } }",value:"metadata.name",key:"metadata.name"}}),i}shouldAddNamespaceControl(){return this.isNamespacedResource()&&!this.resourceService.getNamespace(this.context())&&!this.fields().some(i=>i.property===go.MetadataNamespace)}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=Qe({type:e,selectors:[["pm-resource-form-modal"]],viewQuery:function(i,r){i&1&&m2(r.dialog,Wpe,5),i&2&&wn()},inputs:{context:[1,"context"],fields:[1,"fields"]},outputs:{resource:"resource",updateResource:"updateResource"},decls:2,vars:9,consts:[["dialog",""],[3,"fieldChange","submitted","cancelled","open","fields","initialValues","pending","fieldErrors","defaultTitle","defaultConfirmLabel","defaultCancelLabel","dataTestidPrefix"]],template:function(i,r){i&1&&(q(0,"mfp-resource-form-dialog",1,0),Se("fieldChange",function(a){return r.onFieldChange(a)})("submitted",function(a){return r.onFormSubmit(a)})("cancelled",function(){return r.close()}),X()),i&2&&ue("open",r.dialogOpen())("fields",r.formFields())("initialValues",r.initialValues())("pending",r.formPending())("fieldErrors",r.fieldErrors())("defaultTitle",r.dialogTitle())("defaultConfirmLabel",r.confirmLabel())("defaultCancelLabel","Cancel")("dataTestidPrefix",r.dataTestidPrefix())},dependencies:[rV],encapsulation:3})}}return e})();iP=(()=>{class e{constructor(){this.resourceDefinition=B.required()}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=Qe({type:e,selectors:[["pm-resource-logo"]],inputs:{resourceDefinition:[1,"resourceDefinition"]},decls:1,vars:1,consts:[["data-testid","generic-detail-view-logo","alt","Logo",1,"resource-logo",3,"src"]],template:function(i,r){i&1&&Fe(0,qpe,1,2,"img",0),i&2&&ze(r.resourceDefinition()?.ui?.logoUrl?0:-1)},styles:[".resource-logo[_ngcontent-%COMP%]{width:5rem;padding-bottom:1rem}"]})}}return e})();ep.registerAngularComponents([ade,rde,ode,nde,lh]);Gpe=[{id:"ras",title:"Recently accessed services",editable:!0,w:12}],Kpe=[{serviceType:"SAP HANA Cloud",serviceName:"olc-hana-db",serviceIcon:"database",serviceDescription:"My Subaccount 1/Space dev",path:"/hana/olc-hana-db"},{serviceType:"Cloud Identity Service",serviceName:"Cloud Identity",serviceIcon:"customer",serviceDescription:"My Subaccount 1/Space dev",path:"/identity/cloud-identity"},{serviceType:"SAP HANA Cloud",serviceName:"olc-hana-db-test",serviceIcon:"database",serviceDescription:"My Subaccount 1/Space dev",path:"/hana/olc-hana-db-test"},{serviceType:"Application Autoscaler",serviceName:"applicationtest",serviceIcon:"accelerated",serviceDescription:"My Subaccount 2/Space prod",path:"/autoscaler/applicationtest"},{serviceType:"Cloud Identity Service",serviceName:"Cloud Identity 2",serviceIcon:"customer",serviceDescription:"Long text Subaccount 1/Space",path:"/identity/cloud-identity-2"},{serviceType:"Audit Log Service",serviceName:"auditlog-name",serviceIcon:"log",serviceDescription:"My Subaccount 4/Space dev",path:"/auditlog/auditlog-name"}],rP=[{id:"whats-new",label:"What's New",type:"angular",w:6,h:57,component:"mfp-whats-new"},{id:"favorites",label:"Favorites",type:"angular",w:6,h:21,minW:3,maxW:6,minH:10,maxH:40,component:"mfp-favorites"},{id:"service-status",label:"Service Status",type:"angular",w:6,h:30,component:"mfp-service-status-card"}],Xpe=[...Kpe.map((e,t)=>({id:`ras-card-${t}`,w:4,h:10,sectionId:"ras",type:"angular",component:"mfp-visited-service-card",componentInputs:Z({},e)})),...rP],Ype=(()=>{class e{read(i){return bY(i)}write(i,r){fY(i,r)}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=Ot({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})(),Qpe=["email"],Jpe=e=>{let t=e.oidcScopes?.length?e.oidcScopes:Qpe;return[`--oidc-issuer-url=${e.oidcIssuerUrl}`,`--oidc-client-id=${e.oidcKubectlClientId}`,...e.oidcKubectlClientSecret?[`--oidc-client-secret=${e.oidcKubectlClientSecret}`]:[],...t.map(i=>`--oidc-extra-scope=${i}`),...e.oidcCA?[`--certificate-authority-data=${btoa(e.oidcCA)}`]:[]]},e_e=e=>`
|
|
1679
1679
|
apiVersion: v1
|
|
1680
1680
|
kind: Config
|
|
1681
1681
|
clusters:
|
|
@@ -1704,7 +1704,7 @@ ${Jpe(e).map(t=>` - ${t}`).join(`
|
|
|
1704
1704
|
interactiveMode: IfAvailable
|
|
1705
1705
|
`,t_e=["createModal"],i_e=(e,t)=>t.property,r_e=(e,t)=>t.label;f_e=401,DM=404,OM=422,b_e=(()=>{class e{onActionButtonClick({event:i,action:r}){if(this.viewState()!=="ready"||!this.resource())return;let a=this.resource();switch(r.action){case hB:this.downloadKubeconfigFromSecretRef(r);break;case"download-kubeconfig":this.downloadKubeConfig();break;case"edit":a&&this.openEditResourceModal(i);break;case"delete":a&&this.openDeleteResourceModal(i);break;default:this.executeConfiguredAction(r,a)}}constructor(){this.resourceService=V(T3),this.accountInfoService=V(jpe),this.gatewayService=V(kw),this.kubeconfigSecretService=V(zpe),this.errorHandlerService=V(Ac),this.dashboardConfigService=V(Ype),this.luigiCoreService=V(An),this.namespaceService=V($pe),this.destroyRef=V(K0),this.resourceReadGeneration=0,this.readContext=Ee(void 0),this.readState=Ee("loading"),this.readErrorCode=Ee(0),this.canRetryRead=K(()=>this.readErrorCode()!==OM),this.namespaceRequired=Ee(!1),this.showNamespaceSelection=K(()=>this.namespaceRequired()&&this.readErrorCode()!==f_e),this.selectedNamespace=Ee(void 0),this.namespaces=Yr(()=>this.context().namespaces??[]),this.cancelKubeconfigRead=new aa,this.getResourceValueByJsonPath=Fl,this.createModal=Mr("createModal"),this.deleteDialogOpen=Ee(!1),this.deleteConfig=K(()=>{let i=this.resourceId()?.toLowerCase()??"";return{title:`Delete ${i}`,message:`<p>Are you sure you want to delete ${this.resourceDefinition()?.entity} <b>${i}</b>?</p>
|
|
1706
1706
|
<p class="dialog__message--critical">This action <b>cannot</b> be undone.</p>
|
|
1707
|
-
<p>Please type <b>${i}</b> to confirm:</p>`,confirmationText:i,confirmationPlaceholder:"Type name",confirmLabel:"Delete",cancelLabel:"Cancel"}}),this.LuigiClient=B.required(),this.context=B.required(),this.resource=Ee(void 0),this.viewState=K(()=>this.effectiveContext()===this.readContext()?this.readState():"loading"),this.effectiveContext=K(()=>{let i=this.context();return xO(i,this.resourceService.getNamespace(i),this.LuigiClient().getPathParams?.())}),this.resourceDefinition=K(()=>this.context().resourceDefinition),this.defaultTitle=K(()=>this.resource()?.spec?.displayName||this.resourceId()||""),this.defaultDescription=K(()=>`The ${this.resourceDefinition()?.entity} for ${this.resource()?.spec?.displayName||this.resourceId()}`),this.resourceTitleDefinition=K(()=>this.resourceDefinition()?.ui?.detailView?.resourceTitle?.label??this.defaultTitle()),this.resourceDescriptionDefinition=K(()=>this.resourceDefinition()?.ui?.detailView?.resourceDescription?.label??this.defaultDescription()),this.resourceDetailFields=K(()=>this.resourceDefinition()?.ui?.detailView?.fields??[]),this.resourceCreateEditFields=K(()=>this.resourceDefinition()?.ui?.createView?.fields??[]),this.resourceId=K(()=>this.context().resourceId),this.workspacePath=K(()=>this.gatewayService.resolveKcpPath(this.context())),this.viewFields=K(()=>fae(this.resourceDetailFields())),this.showDownloadKubeconfig=K(()=>this.resourceDefinition()?.ui?.detailView?.showDownloadKubeconfig??!1),this.configuredActions=K(()=>{let i=this.resourceDefinition()?.ui?.detailView?.actions;return Array.isArray(i)?i.filter(r=>!!r?.uiSettings?.buttonSettings&&(!r.requirePermission||this.canDoAction(r.requirePermission))):[]}),this.isDownloadingKubeConfig=Ee(!1),this.isDemoEnabled=K(()=>this.LuigiClient().getActiveFeatureToggles().includes("neoNephosDemo")),this.isNamespaced=K(()=>uo(this.context())),this.instancePermissions=K(()=>this.permissionsFor(this.resourceId(),this.resourceService.getNamespace(this.context()))),this.customActions=K(()=>{if(this.viewState()!=="ready"||!this.resource())return[];let i=[];return this.showDownloadKubeconfig()&&i.push({action:"download-kubeconfig",text:"Download kubeconfig",icon:"download-from-cloud",design:"Default",tooltip:"Download kubeconfig"}),this.resource()&&(this.canDoAction("update")&&i.push({action:"edit",text:"Edit",icon:"edit",design:"Default"}),this.canDoAction("delete")&&i.push({action:"delete",text:"Delete",icon:"delete",design:"Negative"})),i.push(...this.configuredActions().filter(r=>{let a=r.uiSettings?.buttonSettings;return!K6(a)||this.kubeconfigSecretService.isSecretReferenceAvailable(a,this.resource(),this.effectiveContext())}).flatMap(r=>r.uiSettings?.buttonSettings??[])),i}),this.i18n=K(()=>te(Z({},I8),{title:this.resourceTitleDefinition(),description:this.resourceDescriptionDefinition()})),this.dashboardConfig=K(()=>{let i=this.isDemoEnabled()?"":this.resourceDefinition()?.ui?.detailView?.backgroundImageUrl;return{title:this.resourceTitleDefinition(),description:this.resourceDescriptionDefinition(),editable:this.isDemoEnabled(),backgroundImageUrl:i}}),this.sections=K(()=>this.dashboardConfigService.read({workspacePath:this.workspacePath(),entity:this.resourceDefinition()?.entity,resourceId:this.resourceId(),userId:this.context().userId,seed:this.isDemoEnabled()?"demo":""})?.sections??(this.isDemoEnabled()?Gpe:[])),this.cards=K(()=>this.dashboardConfigService.read({workspacePath:this.workspacePath(),entity:this.resourceDefinition()?.entity,resourceId:this.resourceId(),userId:this.context().userId,seed:this.isDemoEnabled()?"demo":""})?.cards??(this.isDemoEnabled()?Xpe:[])),this.availableCards=K(()=>this.isDemoEnabled()?rP:[]),_t(i=>{this.readResource(),i(()=>this.resourceReadSubscription?.unsubscribe())}),this.destroyRef.onDestroy(()=>{this.resourceReadGeneration+=1,this.cancelKubeconfigRead.next(),this.cancelKubeconfigRead.complete(),this.setLuigiPageDirty(!1)})}setLuigiPageDirty(i){window.postMessage({msg:"luigi.set-page-dirty",dirty:i},"*")}readResource(){this.resourceReadSubscription?.unsubscribe(),this.resourceReadGeneration+=1;let i=this.resourceReadGeneration,r=this.effectiveContext(),a=()=>i===this.resourceReadGeneration&&r===this.effectiveContext();this.cancelKubeconfigRead.next(),this.resource.set(void 0),this.readContext.set(r),this.readState.set("loading"),this.namespaceRequired.set(this.isNamespaced()&&!this.resourceService.getNamespace(r)),this.selectedNamespace.set(void 0);let o=this.getResourceDefinition(),s=this.getDetailViewQueryFields(),c=o,_=this.resourceId();if(!_)throw this.LuigiClient().uxManager().showAlert({text:"Resource ID is not defined",type:"error"}),new Error("Resource ID is not defined");return this.resourceReadSubscription=this.resourceService.read(_,c,s,r,c.entity.toLowerCase()==="account").subscribe({next:m=>{if(a()){if(m?.metadata?.deletionTimestamp){this.showReadError(OM);return}this.resource.set(m??void 0),m?this.readState.set("ready"):this.showReadError(DM)}},error:m=>{a()&&this.showReadError(this.errorHandlerService.errorCode(m))},complete:()=>{a()&&nt(this.readState)==="loading"&&this.showReadError(DM)}}),this.resourceReadSubscription}showReadError(i){this.readErrorCode.set(i),this.readState.set("error")}retryRead(){if(nt(this.viewState)==="error"){if(!nt(this.namespaceRequired)){this.readResource();return}nt(this.selectedNamespace)&&this.luigiCoreService.configChanged()}}refreshNamespaces(){this.namespaceService.list(this.effectiveContext()).subscribe({next:i=>this.namespaces.set(i),error:i=>this.errorHandlerService.handleError(i,"Failed to read namespaces.")})}selectNamespace(i){let r=i.detail.selectedOption.value||void 0;this.selectedNamespace.set(r),this.LuigiClient().addCoreSearchParams({namespace:r},!1,!0)}navigateToParent(){let i=this.context().parentNavigationContexts?.at(0);if(!i)throw this.LuigiClient().uxManager().showAlert({text:"Parent navigation context is not defined",type:"error"}),new Error("Parent navigation context is not defined");this.LuigiClient().linkManager().fromContext(i).navigate("/")}openDeleteResourceModal(i){i.stopPropagation?.(),this.deleteDialogOpen.set(!0)}openEditResourceModal(i){i.stopPropagation?.();let r=this.getResourceDefinition(),a=GS(this.resourceCreateEditFields());this.resourceService.read(this.getResourceId(),r,a,this.effectiveContext(),r.entity.toLowerCase()==="account").pipe(sJ(1)).subscribe({next:o=>{this.createModal()?.open(o)},error:o=>this.errorHandlerService.handleError(o)})}delete(i){let r=this.getResourceDefinition(),a=this.getResourceId(),o=te(Z({},i),{metadata:{name:a}});this.resourceService.delete(o,r,this.effectiveContext(),r.entity.toLowerCase()==="account").subscribe({next:async s=>{this.deleteDialogOpen.set(!1),console.debug("Resource deleted."),this.navigateToParent()},error:s=>this.errorHandlerService.handleError(s,`Failure! Could not delete resource: ${i.metadata.name}.`)})}update(i){let r=this.getResourceDefinition(),a=this.getResourceId(),o=GS(this.resourceCreateEditFields()),s=te(Z({},i),{metadata:{name:a}});this.resourceService.update(s,r,this.effectiveContext(),r.entity.toLowerCase()==="account",o).subscribe({next:c=>{this.resource.set(c),this.createModal()?.close(),console.debug("Resource updated",c)},error:c=>this.errorHandlerService.handleError(c,`Failure! Could not update resource: ${i.metadata.name}.`)})}async downloadKubeConfig(){if(!this.isDownloadingKubeConfig())try{this.isDownloadingKubeConfig.set(!0);let{accountId:i,portalContext:r,accountPath:a,kcpCA:o}=this.context(),s=(await eg(this.accountInfoService.read(this.context())))?.spec.oidc;WS(e_e({clusterName:i??"",serverUrl:`${r.kcpWorkspaceUrl}:${a}`,kcpCA:o??"",oidcIssuerUrl:s?.issuerUrl??"",oidcKubectlClientId:s?.clients.kubectl?.clientId??"",oidcScopes:s?.scopes??[],oidcCA:s?.ca??""}),"kubeconfig.yaml","application/yaml")}catch(i){this.LuigiClient().uxManager().showAlert({text:`Failed to download kubeconfig: ${this.getErrorMessage(i)}`,type:"error"})}finally{this.isDownloadingKubeConfig.set(!1)}}async downloadKubeconfigFromSecretRef(i){if(this.isDownloadingKubeConfig()||this.viewState()!=="ready")return;let r=this.resource(),a=this.effectiveContext(),o=this.resourceReadGeneration;try{this.isDownloadingKubeConfig.set(!0);let s=await eg(this.kubeconfigSecretService.readKubeconfig(i,r,a).pipe(XB(this.cancelKubeconfigRead)));if(o!==this.resourceReadGeneration||a!==this.effectiveContext()||r!==this.resource())return;WS(s.contents,s.filename,"application/yaml")}catch(s){if(o!==this.resourceReadGeneration||a!==this.effectiveContext()||r!==this.resource())return;this.LuigiClient().uxManager().showAlert({text:`Failed to download kubeconfig: ${this.getErrorMessage(s)}`,type:"error"})}finally{this.isDownloadingKubeConfig.set(!1)}}getResourceDefinition(){let i=this.resourceDefinition();if(!i)throw this.LuigiClient().uxManager().showAlert({text:"Resource definition is not defined",type:"error"}),new Error("Resource definition is not defined");return i}getDetailViewQueryFields(){let i=this.getResourceDefinition(),r=[{property:"metadata.deletionTimestamp"}];return i.ui?.detailView?.resourceDescription&&r.push(i.ui.detailView.resourceDescription),this.isNamespaced()&&r.push({property:"metadata.namespace"}),i.ui?.detailView?.resourceTitle&&r.push(i.ui.detailView.resourceTitle),this.configuredActions().forEach(a=>{K6(a.uiSettings?.buttonSettings)&&r.push(...this.kubeconfigSecretService.secretReferenceQueryFields(a.uiSettings?.buttonSettings))}),q8(this.resourceDetailFields().concat(r))}getResourceId(){let i=this.resourceId();if(!i)throw this.LuigiClient().uxManager().showAlert({text:"Resource ID is not defined",type:"error"}),new Error("Resource ID is not defined");return i}canDoAction(i){return this.instancePermissions()?.includes(i)??!0}permissionsFor(i,r){return this.context().portalPermissions?.[Sl({resource:this.getResourceDefinition()?.permissionsDefinition?.resource,name:i,namespace:r})]}configuredActionFor(i){return this.configuredActions().find(r=>r.uiSettings?.buttonSettings===i)}executeConfiguredAction(i,r){let a=this.configuredActionFor(i);if(!a){this.showConfiguredActionError();return}try{yC(this.LuigiClient(),a,r,this.context())}catch{this.showConfiguredActionError()}}showConfiguredActionError(){this.LuigiClient().uxManager().showAlert({text:"Configured action could not be executed",type:"error"})}getErrorMessage(i){return i instanceof Error?i.message:String(i)}dashboardConfigurationChanged(i){this.dashboardConfigService.write({workspacePath:this.workspacePath(),entity:this.resourceDefinition()?.entity,resourceId:this.resourceId(),userId:this.context().userId,seed:this.isDemoEnabled()?"demo":""},i)}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=Qe({type:e,selectors:[["pm-detail-view"]],viewQuery:function(i,r){i&1&&m2(r.createModal,t_e,5),i&2&&wn()},inputs:{LuigiClient:[1,"LuigiClient"],context:[1,"context"]},decls:7,vars:5,consts:[["subheader",""],["createModal",""],["data-testid","generic-detail-view-error-state",3,"code","subtitle","retryable","retryDisabled"],[3,"loading","loadingDelay","config","customActions","i18n","sections","cards","availableCards"],[3,"updateResource","fields","context"],[3,"confirmed","cancelled","open","config"],["data-testid","generic-detail-view-error-state",3,"retry","code","subtitle","retryable","retryDisabled"],[1,"namespace-selection"],["data-testid","generic-detail-view-namespace-select","accessibleName","Namespace",3,"ui5Change"],["value","",3,"selected"],[3,"value","selected"],["data-testid","generic-detail-view-namespace-refresh","icon","refresh","tooltip","Refresh namespaces","accessibleName","Refresh namespaces",3,"click"],[3,"actionButtonClick","saved","unsavedChangesChange","loading","loadingDelay","config","customActions","i18n","sections","cards","availableCards"],["slot","dashboard-subheader",2,"width","100%"],[1,"sh"],[4,"ngTemplateOutlet"],[1,"logo"],[1,"resource-info"],[3,"resourceDefinition"],[1,"resource-info-cell"],["data-testid","generic-detail-view-workspace-path"],[3,"fieldDefinition","resource"]],template:function(i,r){i&1&&(Fe(0,n_e,2,5,"pm-error-state",2)(1,c_e,5,10,"mfp-dashboard",3),gu(2,g_e,8,3,"ng-template",null,0,Vy),q(4,"pm-resource-form-modal",4,1),Se("updateResource",function(a){return r.update(a)}),X(),q(6,"mfp-delete-confirmation-dialog",5),Se("confirmed",function(){return r.delete(r.resource())})("cancelled",function(){return r.deleteDialogOpen.set(!1)}),X()),i&2&&(ze(r.viewState()==="error"?0:1),U(4),ue("fields",r.resourceCreateEditFields())("context",r.effectiveContext()),U(2),ue("open",r.deleteDialogOpen())("config",r.deleteConfig()))},dependencies:[Cne,xu,F5,cw,Ru,Vu,tp,tP,tV,iP,ep],styles:["mfp-dashboard[_ngcontent-%COMP%]{background-position:center 12%}.resource-title[_ngcontent-%COMP%]{display:flex;align-items:center;padding:1rem 0}.resource-title-subheading[_ngcontent-%COMP%]{display:block;padding-bottom:1rem}.resource-title-actions[_ngcontent-%COMP%]{height:auto}.sh[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%}.resource-info[_ngcontent-%COMP%]{padding-top:1rem;display:flex;flex-wrap:wrap;gap:2rem}.resource-info-cell[_ngcontent-%COMP%]{display:flex;gap:5px;flex-direction:column;max-width:300px}.multiline[_ngcontent-%COMP%]{display:block}.logo[_ngcontent-%COMP%]{width:200px;height:80px;background-image:url(http://localhost:4300/assets/nn-logo.png);background-size:contain;background-repeat:no-repeat;background-position:center;margin:0 50px}.resource-title-snapped-container[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;padding-bottom:1rem}.resource-title-snapped-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px;padding-bottom:0}.resource-title-snapped-container[_ngcontent-%COMP%] ui5-title[_ngcontent-%COMP%]{font-size:1.5rem}.namespace-selection[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}"]})}}return e})(),Md=(()=>{class e{constructor(){this.instancePermissionsService=V(Tpe),this.destroyRef=V(K0),this.map=Ee({}),this.permissions=K(()=>this.map())}sync(i,r,a){let o=this.missing(r.resource,a);o.length&&this.instancePermissionsService.checkInstances(i,r,o).pipe(Ms(this.destroyRef)).subscribe(s=>this.merge(s))}missing(i,r){return r.filter(a=>!(Sl(Z({resource:i},a))in this.map()))}merge(i){for(let r of i)this.map.update(a=>te(Z({},a),{[Sl({resource:r.resource,namespace:r.namespace,name:r.name})]:r.actions}))}actionsFor(i,r,a){return this.map()[Sl({resource:i,namespace:r,name:a})]??[]}reset(){this.map.set({})}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=Ot({token:e,factory:e.\u0275fac})}}return e})(),C_e=(()=>{class e{constructor(){this.resourceService=V(T3),this.errorHandlerService=V(Ac),this.instancePermissionsStore=V(Md),this.destroyRef=V(K0),this.LuigiClient=B.required(),this.context=B.required(),this.readFailureChange=B(),this.tableCard=Mr.required(lh),this.resources=Ee([]),this.tableResources=K(()=>this.resources().map(i=>te(Z({},i),{id:this.generateResourceId(i)}))),this.resourceDefinition=K(()=>this.context().resourceDefinition),this.hasUiCreateViewFields=K(()=>!!this.resourceDefinition()?.ui?.createView?.fields?.length),this.columns=K(()=>{let i=this.resourceDefinition()?.ui?.listView?.fields??[],r=this.resourceDefinition()?.readyCondition;return r&&(i=[te(Z({},r),{columnSettings:te(Z({},r.columnSettings),{width:"30px"}),uiSettings:te(Z({},r.uiSettings),{displayAs:"alert"})}),...i]),i}),this.totalItemsCount=K(()=>this.resources().length+this.remainingItemCount()),this.paginationLimit=Ee(5),this.remainingItemCount=Ee(0),this.hasMore=Ee(!1),this.resourceVersion=Ee(void 0),this.loading=Ee(!1),this.listError=Ee(null),this.watchError=Ee(null),this.createValidation=this.createValidationController(!1),this.createFieldErrors=this.createValidation.errors,this.createPending=Ee(!1),this.createFormState=K(()=>({fieldErrors:this.createFieldErrors(),pending:this.createPending()||this.createValidation.hasDeferredErrors()})),this.editValidation=this.createValidationController(!0),this.editFieldErrors=this.editValidation.errors,this.editPending=Ee(!1),this.editFormState=K(()=>({fieldErrors:this.editFieldErrors(),pending:this.editPending()||this.editValidation.hasDeferredErrors()})),this.createDependencies=new Km((i,r)=>this.resolveDynamicValuesResult(i,r),i=>this.applyDependentUpdate(i,!1)),this.editDependencies=new Km((i,r)=>this.resolveDynamicValuesResult(i,r),i=>this.applyDependentUpdate(i,!0)),this.createFormFields=K(()=>{let i=this.resourceDefinition()?.ui?.createView?.fields||[];return this.hasUiCreateViewFields()&&this.isNamespaced()&&!this.resourceService.getNamespace(this.createContext())&&!i.some(r=>r.property===go.MetadataNamespace)&&(i=[{property:go.MetadataNamespace,required:!0,label:"Namespace",values:this.context().namespaces},...i]),i}),this.config=K(()=>te(Z(Z({header:this.resourceDefinition()?.entityCollection,tableConfig:{fields:this.columns(),overflowMode:this.resourceDefinition()?.ui?.listView?.overflowMode??"Scroll",totalItemsCount:this.totalItemsCount(),paginationLimit:this.paginationLimit(),hasMore:this.hasMore()}},this.hasUiCreateViewFields()&&this.canDo("create")&&{createResourceFormConfig:{fields:()=>this.buildFormFields(!1)}}),this.hasUiCreateViewFields()&&this.canDo("update")&&{editResourceFormConfig:i=>({fields:()=>this.buildFormFields(!0,i)})}),{deleteResourceConfirmationConfig:i=>this.getDeleteConfig(i)})),this.isNamespaced=K(()=>uo(this.context())),this.createContext=K(()=>{let i=this.context();return xO(i,this.resourceService.getNamespace(i),this.LuigiClient().getPathParams?.())}),this.currentContinueToken=void 0,this.lastListWasInitialLoad=!0,this.destroyRef.onDestroy(()=>{this.createDependencies.end(),this.editDependencies.end()}),_t(i=>{this.currentContinueToken=void 0,this.resources.set([]),this.resourceVersion.set(void 0),this.remainingItemCount.set(0),this.hasMore.set(!1),this.listError.set(null),this.watchError.set(null),this.list(!0),i(()=>this.listSubscription?.unsubscribe())}),_t(()=>{let i=this.listError()||this.watchError();this.readFailureChange()?.(i?{code:i.status,retry:()=>this.retryList()}:null)}),_t(i=>{let r=this.resourceVersion();if(!r||nt(this.watchError)||!this.canDo("watch"))return;let a=this.subscribeToResourceChange(r);i(()=>a.unsubscribe())}),_t(()=>{let i=this.resources(),r=this.resourceDefinition();if(!r?.permissionsDefinition?.entityActions.length||!i.length)return;let a=this.isNamespaced(),o=i.map(s=>({name:s.metadata.name,namespace:a?s.metadata.namespace:void 0}));this.instancePermissionsStore.sync(this.context(),r.permissionsDefinition,o)})}createValidationController(i){return new wO((r,a)=>jO({name:r,value:a,fields:this.createFormFields(),editMode:i}))}async buildFormFields(i,r){this.resetFormState(i);let a=i?this.editDependencies:this.createDependencies,o=this.createFormFields(),s=PO(o,r),c;try{c=a.begin(o,s);let _=await UO(o,s,{editMode:i,resolveResult:(m,f)=>this.resolveDynamicValuesResult(m,f)});return a.isCurrent(c)?_:[]}catch(_){return c!==void 0&&!a.isCurrent(c)?[]:(this.resetFormState(i),i?this.tableCard().closeEditDialog():this.tableCard().closeCreateDialog(),this.errorHandlerService.handleError(_),[])}}resolveDynamicValuesResult(i,r){return OO(i,this.createContext(),this.isNamespaced(),r,{list:(a,o,s,c)=>this.resourceService.list(a,o,s,c),getNamespace:a=>this.resourceService.getNamespace(a),handleError:a=>this.errorHandlerService.handleError(a)})}applyDependentUpdate(i,r){let a=r?this.editValidation:this.createValidation,o=r?this.editPending:this.createPending,s=te(Z({},i.clear&&{values:{[i.name]:""}}),{fieldUpdates:{[i.name]:{values:i.values}}});r?this.tableCard().applyEditFormPatch(s):this.tableCard().applyCreateFormPatch(s),i.clear&&a.resetField(i.name,""),o.set(i.pending)}onCreateDialogClosed(){this.resetFormState(!1)}onEditDialogClosed(){this.resetFormState(!0)}resetFormState(i){let r=i?this.editDependencies:this.createDependencies,a=i?this.editValidation:this.createValidation,o=i?this.editPending:this.createPending;r.end(),a.reset(),o.set(!1)}onEditFieldChange({formChangeEvent:i}){this.editValidation.handleChange(i),this.editDependencies.handleChange(i)}onEditSubmit({value:i}){let r=this.getResourceDefinition(),a=pL(AO(i,this.createFormFields()),this.createFormFields());this.resourceService.update(a,r,this.context()).subscribe({next:o=>{this.editValidation.reset(),this.tableCard().closeEditDialog(),console.debug("Resource updated",o)},error:o=>this.errorHandlerService.handleError(o)})}subscribeToResourceChange(i){let r=this.getListQueryFields(),a=this.context(),o=a.resourceDefinition,s=ul({apiGroup:o.apiGroup,version:o.version,entity:o.entityCollection});return this.resourceService.resourceChangeSubscription(s,r,a,i,!1).subscribe({next:c=>{!c||a!==this.context()||this.mergeResourcesWithSubscriptionResult(c)},error:c=>{a===this.context()&&this.watchError.set(this.mapError(c))}})}resetPagination(){this.currentContinueToken=void 0,this.resources.update(i=>i.slice(0,this.paginationLimit())),this.hasMore.set(this.resources().length<this.totalItemsCount())}onLimitChange(i){this.paginationLimit.set(i),this.resetPagination()}loadMore(){this.hasMore()&&this.list()}list(i=!1){if(!this.canDo("list")||nt(this.loading))return;this.lastListWasInitialLoad=i,this.listError.set(null),this.loading.set(!0);let r=this.getListQueryFields(),a=this.getResourceDefinition(),o=this.context(),s=ul({apiGroup:a.apiGroup,version:a.version,entity:a.entityCollection});this.listSubscription=this.resourceService.list(s,r,o,{pagination:{limit:this.paginationLimit(),continue:this.currentContinueToken}}).pipe(Gd(()=>{this.loading.set(!1)}),Ms(this.destroyRef)).subscribe({next:c=>{o===this.context()&&(i?this.resources.set(c.items??[]):this.resources.update(_=>{let m=new Map(_.map(f=>[f.id,f]));return(c.items??[]).forEach(f=>m.set(f.id,f)),[...m.values()]}),this.resourceVersion.set(c.resourceVersion),this.hasMore.set(!!c.continue),this.currentContinueToken=c.continue,this.remainingItemCount.set(c.remainingItemCount||0))},error:c=>{o===this.context()&&this.listError.set(this.mapError(c))}})}retryList(){if(!nt(this.loading)){if(nt(this.watchError)){this.currentContinueToken=void 0,this.resourceVersion.set(void 0),this.hasMore.set(!1),this.remainingItemCount.set(0),this.watchError.set(null),this.list(!0);return}nt(this.listError)&&this.list(this.lastListWasInitialLoad)}}mergeResourcesWithSubscriptionResult(i){this.resources.set(dB(this.resources(),i,{getItemKey:r=>r.id,mapSubscriptionObjectToItem:r=>r}))}mapError(i){return{status:this.errorHandlerService.errorCode(i),message:i.message,withRetryButton:!0}}navigateToResource(i){let r=this.context().resourceDefinition,a=r?.ui?.listView?.resourceURL;if(!(!a&&!r?.ui?.detailView)){if(!i.metadata.name)throw this.LuigiClient().uxManager().showAlert({text:"Resource name is not defined",type:"error"}),new Error("Resource name is not defined");if(this.isNamespaced()&&!i.metadata.namespace)throw this.LuigiClient().uxManager().showAlert({text:"Resource namespace is not known",type:"error"}),new Error("Resource namespace is not defined");this.LuigiClient().addCoreSearchParams({namespace:this.isNamespaced()?i.metadata.namespace:void 0},!1,!0),this.LuigiClient().linkManager().navigate(a?lB(a,i,this.context()):i.metadata.name)}}executeAction(i){yC(this.LuigiClient(),i.field,i.resource,this.context())}onCreateFieldChange(i){this.createValidation.handleChange(i),this.createDependencies.handleChange(i)}onCreateSubmit(i){let r=this.getResourceDefinition(),a=pL(i,this.createFormFields());this.resourceService.create(a,r,this.createContext()).subscribe({next:o=>{this.createValidation.reset(),this.tableCard().closeCreateDialog(),console.debug("Resource created",o)},error:o=>this.errorHandlerService.handleError(o)})}delete(i){this.resourceService.delete(i,this.getResourceDefinition(),this.context()).pipe(Ms(this.destroyRef)).subscribe({next:()=>{this.tableCard().closeDeleteDialog()},error:r=>this.errorHandlerService.handleError(r)})}getListQueryFields(){let i=[{property:"metadata.deletionTimestamp"}];return this.isNamespaced()&&i.push({property:"metadata.namespace"}),q8(this.columns().concat(i))}getResourceDefinition(){let i=this.resourceDefinition();if(!i)throw this.LuigiClient().uxManager().showAlert({text:"Resource definition is not defined",type:"error"}),new Error("Resource definition is not defined");return i}generateResourceId(i){return Sl({resource:this.getResourceDefinition().permissionsDefinition?.resource,name:i.metadata.name,namespace:i.metadata.namespace})}canDo(i){return uB(this.context().portalPermissions,this.resourceDefinition()?.permissionsDefinition?.resource,i)}getDeleteConfig(i){let r=this.getResourceDefinition(),a=i.metadata?.name?.toLowerCase()??"";return{title:`Delete ${a}`,message:`<p>Are you sure you want to delete ${r?.entity} <b>${a}</b>?</p>
|
|
1707
|
+
<p>Please type <b>${i}</b> to confirm:</p>`,confirmationText:i,confirmationPlaceholder:"Type name",confirmLabel:"Delete",cancelLabel:"Cancel"}}),this.LuigiClient=B.required(),this.context=B.required(),this.resource=Ee(void 0),this.viewState=K(()=>this.effectiveContext()===this.readContext()?this.readState():"loading"),this.effectiveContext=K(()=>{let i=this.context();return xO(i,this.resourceService.getNamespace(i),this.LuigiClient().getPathParams?.())}),this.resourceDefinition=K(()=>this.context().resourceDefinition),this.defaultTitle=K(()=>this.resource()?.spec?.displayName||this.resourceId()||""),this.defaultDescription=K(()=>`The ${this.resourceDefinition()?.entity} for ${this.resource()?.spec?.displayName||this.resourceId()}`),this.resourceTitleDefinition=K(()=>this.resourceDefinition()?.ui?.detailView?.resourceTitle?.label??this.defaultTitle()),this.resourceDescriptionDefinition=K(()=>this.resourceDefinition()?.ui?.detailView?.resourceDescription?.label??this.defaultDescription()),this.resourceDetailFields=K(()=>this.resourceDefinition()?.ui?.detailView?.fields??[]),this.resourceCreateEditFields=K(()=>this.resourceDefinition()?.ui?.createView?.fields??[]),this.resourceId=K(()=>this.context().resourceId),this.workspacePath=K(()=>this.gatewayService.resolveKcpPath(this.context())),this.viewFields=K(()=>fae(this.resourceDetailFields())),this.showDownloadKubeconfig=K(()=>this.resourceDefinition()?.ui?.detailView?.showDownloadKubeconfig??!1),this.configuredActions=K(()=>{let i=this.resourceDefinition()?.ui?.detailView?.actions;return Array.isArray(i)?i.filter(r=>!!r?.uiSettings?.buttonSettings&&(!r.requirePermission||this.canDoAction(r.requirePermission))):[]}),this.isDownloadingKubeConfig=Ee(!1),this.isDemoEnabled=K(()=>this.LuigiClient().getActiveFeatureToggles().includes("neoNephosDemo")),this.isNamespaced=K(()=>uo(this.context())),this.instancePermissions=K(()=>this.permissionsFor(this.resourceId(),this.resourceService.getNamespace(this.context()))),this.customActions=K(()=>{if(this.viewState()!=="ready"||!this.resource())return[];let i=[];return this.showDownloadKubeconfig()&&i.push({action:"download-kubeconfig",text:"Download kubeconfig",icon:"download-from-cloud",design:"Default",tooltip:"Download kubeconfig"}),this.resource()&&(this.canDoAction("update")&&i.push({action:"edit",text:"Edit",icon:"edit",design:"Default"}),this.canDoAction("delete")&&i.push({action:"delete",text:"Delete",icon:"delete",design:"Negative"})),i.push(...this.configuredActions().filter(r=>{let a=r.uiSettings?.buttonSettings;return!K6(a)||this.kubeconfigSecretService.isSecretReferenceAvailable(a,this.resource(),this.effectiveContext())}).flatMap(r=>r.uiSettings?.buttonSettings??[])),i}),this.i18n=K(()=>te(Z({},I8),{title:this.resourceTitleDefinition(),description:this.resourceDescriptionDefinition()})),this.dashboardConfig=K(()=>{let i=this.isDemoEnabled()?"":this.resourceDefinition()?.ui?.detailView?.backgroundImageUrl;return{title:this.resourceTitleDefinition(),description:this.resourceDescriptionDefinition(),editable:this.isDemoEnabled(),backgroundImageUrl:i}}),this.sections=K(()=>this.dashboardConfigService.read({workspacePath:this.workspacePath(),entity:this.resourceDefinition()?.entity,resourceId:this.resourceId(),userId:this.context().userId,seed:this.isDemoEnabled()?"demo":""})?.sections??(this.isDemoEnabled()?Gpe:[])),this.cards=K(()=>this.dashboardConfigService.read({workspacePath:this.workspacePath(),entity:this.resourceDefinition()?.entity,resourceId:this.resourceId(),userId:this.context().userId,seed:this.isDemoEnabled()?"demo":""})?.cards??(this.isDemoEnabled()?Xpe:[])),this.availableCards=K(()=>this.isDemoEnabled()?rP:[]),_t(i=>{this.readResource(),i(()=>this.resourceReadSubscription?.unsubscribe())}),this.destroyRef.onDestroy(()=>{this.resourceReadGeneration+=1,this.cancelKubeconfigRead.next(),this.cancelKubeconfigRead.complete(),this.setLuigiPageDirty(!1)})}setLuigiPageDirty(i){window.postMessage({msg:"luigi.set-page-dirty",dirty:i},"*")}readResource(){this.resourceReadSubscription?.unsubscribe(),this.resourceReadGeneration+=1;let i=this.resourceReadGeneration,r=this.effectiveContext(),a=()=>i===this.resourceReadGeneration&&r===this.effectiveContext();this.cancelKubeconfigRead.next(),this.resource.set(void 0),this.readContext.set(r),this.readState.set("loading"),this.namespaceRequired.set(this.isNamespaced()&&!this.resourceService.getNamespace(r)),this.selectedNamespace.set(void 0);let o=this.getResourceDefinition(),s=this.getDetailViewQueryFields(),c=o,_=this.resourceId();if(!_)throw this.LuigiClient().uxManager().showAlert({text:"Resource ID is not defined",type:"error"}),new Error("Resource ID is not defined");return this.resourceReadSubscription=this.resourceService.read(_,c,s,r,c.entity.toLowerCase()==="account").subscribe({next:m=>{if(a()){if(m?.metadata?.deletionTimestamp){this.showReadError(OM);return}this.resource.set(m??void 0),m?this.readState.set("ready"):this.showReadError(DM)}},error:m=>{a()&&this.showReadError(this.errorHandlerService.errorCode(m))},complete:()=>{a()&&nt(this.readState)==="loading"&&this.showReadError(DM)}}),this.resourceReadSubscription}showReadError(i){this.readErrorCode.set(i),this.readState.set("error")}retryRead(){if(nt(this.viewState)==="error"){if(!nt(this.namespaceRequired)){this.readResource();return}nt(this.selectedNamespace)&&this.luigiCoreService.configChanged()}}refreshNamespaces(){this.namespaceService.list(this.effectiveContext()).subscribe({next:i=>this.namespaces.set(i),error:i=>this.errorHandlerService.handleError(i,"Failed to read namespaces.")})}selectNamespace(i){let r=i.detail.selectedOption.value||void 0;this.selectedNamespace.set(r),this.LuigiClient().addCoreSearchParams({namespace:r},!1,!0)}navigateToParent(){let i=this.context().parentNavigationContexts?.at(0);if(!i)throw this.LuigiClient().uxManager().showAlert({text:"Parent navigation context is not defined",type:"error"}),new Error("Parent navigation context is not defined");this.LuigiClient().linkManager().fromContext(i).navigate("/")}openDeleteResourceModal(i){i.stopPropagation?.(),this.deleteDialogOpen.set(!0)}openEditResourceModal(i){i.stopPropagation?.();let r=this.getResourceDefinition(),a=GS(this.resourceCreateEditFields());this.resourceService.read(this.getResourceId(),r,a,this.effectiveContext(),r.entity.toLowerCase()==="account").pipe(sJ(1)).subscribe({next:o=>{this.createModal()?.open(o)},error:o=>this.errorHandlerService.handleError(o)})}delete(i){let r=this.getResourceDefinition(),a=this.getResourceId(),o=te(Z({},i),{metadata:{name:a}});this.resourceService.delete(o,r,this.effectiveContext(),r.entity.toLowerCase()==="account").subscribe({next:async s=>{this.deleteDialogOpen.set(!1),console.debug("Resource deleted."),this.navigateToParent()},error:s=>this.errorHandlerService.handleError(s,`Failure! Could not delete resource: ${i.metadata.name}.`)})}update(i){let r=this.getResourceDefinition(),a=this.getResourceId(),o=GS(this.resourceCreateEditFields()),s=te(Z({},i),{metadata:{name:a}});this.resourceService.update(s,r,this.effectiveContext(),r.entity.toLowerCase()==="account",o).subscribe({next:c=>{this.resource.set(c),this.createModal()?.close(),console.debug("Resource updated",c)},error:c=>this.errorHandlerService.handleError(c,`Failure! Could not update resource: ${i.metadata.name}.`)})}async downloadKubeConfig(){if(!this.isDownloadingKubeConfig())try{this.isDownloadingKubeConfig.set(!0);let{accountId:i,portalContext:r,accountPath:a,kcpCA:o}=this.context(),s=(await eg(this.accountInfoService.read(this.context())))?.spec.oidc;WS(e_e({clusterName:i??"",serverUrl:`${r.kcpWorkspaceUrl}:${a}`,kcpCA:o??"",oidcIssuerUrl:s?.issuerUrl??"",oidcKubectlClientId:s?.clients.kubectl?.clientId??"",oidcKubectlClientSecret:s?.clients.kubectl?.clientSecret??"",oidcScopes:s?.scopes??[],oidcCA:s?.ca??""}),"kubeconfig.yaml","application/yaml")}catch(i){this.LuigiClient().uxManager().showAlert({text:`Failed to download kubeconfig: ${this.getErrorMessage(i)}`,type:"error"})}finally{this.isDownloadingKubeConfig.set(!1)}}async downloadKubeconfigFromSecretRef(i){if(this.isDownloadingKubeConfig()||this.viewState()!=="ready")return;let r=this.resource(),a=this.effectiveContext(),o=this.resourceReadGeneration;try{this.isDownloadingKubeConfig.set(!0);let s=await eg(this.kubeconfigSecretService.readKubeconfig(i,r,a).pipe(XB(this.cancelKubeconfigRead)));if(o!==this.resourceReadGeneration||a!==this.effectiveContext()||r!==this.resource())return;WS(s.contents,s.filename,"application/yaml")}catch(s){if(o!==this.resourceReadGeneration||a!==this.effectiveContext()||r!==this.resource())return;this.LuigiClient().uxManager().showAlert({text:`Failed to download kubeconfig: ${this.getErrorMessage(s)}`,type:"error"})}finally{this.isDownloadingKubeConfig.set(!1)}}getResourceDefinition(){let i=this.resourceDefinition();if(!i)throw this.LuigiClient().uxManager().showAlert({text:"Resource definition is not defined",type:"error"}),new Error("Resource definition is not defined");return i}getDetailViewQueryFields(){let i=this.getResourceDefinition(),r=[{property:"metadata.deletionTimestamp"}];return i.ui?.detailView?.resourceDescription&&r.push(i.ui.detailView.resourceDescription),this.isNamespaced()&&r.push({property:"metadata.namespace"}),i.ui?.detailView?.resourceTitle&&r.push(i.ui.detailView.resourceTitle),this.configuredActions().forEach(a=>{K6(a.uiSettings?.buttonSettings)&&r.push(...this.kubeconfigSecretService.secretReferenceQueryFields(a.uiSettings?.buttonSettings))}),q8(this.resourceDetailFields().concat(r))}getResourceId(){let i=this.resourceId();if(!i)throw this.LuigiClient().uxManager().showAlert({text:"Resource ID is not defined",type:"error"}),new Error("Resource ID is not defined");return i}canDoAction(i){return this.instancePermissions()?.includes(i)??!0}permissionsFor(i,r){return this.context().portalPermissions?.[Sl({resource:this.getResourceDefinition()?.permissionsDefinition?.resource,name:i,namespace:r})]}configuredActionFor(i){return this.configuredActions().find(r=>r.uiSettings?.buttonSettings===i)}executeConfiguredAction(i,r){let a=this.configuredActionFor(i);if(!a){this.showConfiguredActionError();return}try{yC(this.LuigiClient(),a,r,this.context())}catch{this.showConfiguredActionError()}}showConfiguredActionError(){this.LuigiClient().uxManager().showAlert({text:"Configured action could not be executed",type:"error"})}getErrorMessage(i){return i instanceof Error?i.message:String(i)}dashboardConfigurationChanged(i){this.dashboardConfigService.write({workspacePath:this.workspacePath(),entity:this.resourceDefinition()?.entity,resourceId:this.resourceId(),userId:this.context().userId,seed:this.isDemoEnabled()?"demo":""},i)}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=Qe({type:e,selectors:[["pm-detail-view"]],viewQuery:function(i,r){i&1&&m2(r.createModal,t_e,5),i&2&&wn()},inputs:{LuigiClient:[1,"LuigiClient"],context:[1,"context"]},decls:7,vars:5,consts:[["subheader",""],["createModal",""],["data-testid","generic-detail-view-error-state",3,"code","subtitle","retryable","retryDisabled"],[3,"loading","loadingDelay","config","customActions","i18n","sections","cards","availableCards"],[3,"updateResource","fields","context"],[3,"confirmed","cancelled","open","config"],["data-testid","generic-detail-view-error-state",3,"retry","code","subtitle","retryable","retryDisabled"],[1,"namespace-selection"],["data-testid","generic-detail-view-namespace-select","accessibleName","Namespace",3,"ui5Change"],["value","",3,"selected"],[3,"value","selected"],["data-testid","generic-detail-view-namespace-refresh","icon","refresh","tooltip","Refresh namespaces","accessibleName","Refresh namespaces",3,"click"],[3,"actionButtonClick","saved","unsavedChangesChange","loading","loadingDelay","config","customActions","i18n","sections","cards","availableCards"],["slot","dashboard-subheader",2,"width","100%"],[1,"sh"],[4,"ngTemplateOutlet"],[1,"logo"],[1,"resource-info"],[3,"resourceDefinition"],[1,"resource-info-cell"],["data-testid","generic-detail-view-workspace-path"],[3,"fieldDefinition","resource"]],template:function(i,r){i&1&&(Fe(0,n_e,2,5,"pm-error-state",2)(1,c_e,5,10,"mfp-dashboard",3),gu(2,g_e,8,3,"ng-template",null,0,Vy),q(4,"pm-resource-form-modal",4,1),Se("updateResource",function(a){return r.update(a)}),X(),q(6,"mfp-delete-confirmation-dialog",5),Se("confirmed",function(){return r.delete(r.resource())})("cancelled",function(){return r.deleteDialogOpen.set(!1)}),X()),i&2&&(ze(r.viewState()==="error"?0:1),U(4),ue("fields",r.resourceCreateEditFields())("context",r.effectiveContext()),U(2),ue("open",r.deleteDialogOpen())("config",r.deleteConfig()))},dependencies:[Cne,xu,F5,cw,Ru,Vu,tp,tP,tV,iP,ep],styles:["mfp-dashboard[_ngcontent-%COMP%]{background-position:center 12%}.resource-title[_ngcontent-%COMP%]{display:flex;align-items:center;padding:1rem 0}.resource-title-subheading[_ngcontent-%COMP%]{display:block;padding-bottom:1rem}.resource-title-actions[_ngcontent-%COMP%]{height:auto}.sh[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%}.resource-info[_ngcontent-%COMP%]{padding-top:1rem;display:flex;flex-wrap:wrap;gap:2rem}.resource-info-cell[_ngcontent-%COMP%]{display:flex;gap:5px;flex-direction:column;max-width:300px}.multiline[_ngcontent-%COMP%]{display:block}.logo[_ngcontent-%COMP%]{width:200px;height:80px;background-image:url(http://localhost:4300/assets/nn-logo.png);background-size:contain;background-repeat:no-repeat;background-position:center;margin:0 50px}.resource-title-snapped-container[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;padding-bottom:1rem}.resource-title-snapped-container[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px;padding-bottom:0}.resource-title-snapped-container[_ngcontent-%COMP%] ui5-title[_ngcontent-%COMP%]{font-size:1.5rem}.namespace-selection[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}"]})}}return e})(),Md=(()=>{class e{constructor(){this.instancePermissionsService=V(Tpe),this.destroyRef=V(K0),this.map=Ee({}),this.permissions=K(()=>this.map())}sync(i,r,a){let o=this.missing(r.resource,a);o.length&&this.instancePermissionsService.checkInstances(i,r,o).pipe(Ms(this.destroyRef)).subscribe(s=>this.merge(s))}missing(i,r){return r.filter(a=>!(Sl(Z({resource:i},a))in this.map()))}merge(i){for(let r of i)this.map.update(a=>te(Z({},a),{[Sl({resource:r.resource,namespace:r.namespace,name:r.name})]:r.actions}))}actionsFor(i,r,a){return this.map()[Sl({resource:i,namespace:r,name:a})]??[]}reset(){this.map.set({})}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=Ot({token:e,factory:e.\u0275fac})}}return e})(),C_e=(()=>{class e{constructor(){this.resourceService=V(T3),this.errorHandlerService=V(Ac),this.instancePermissionsStore=V(Md),this.destroyRef=V(K0),this.LuigiClient=B.required(),this.context=B.required(),this.readFailureChange=B(),this.tableCard=Mr.required(lh),this.resources=Ee([]),this.tableResources=K(()=>this.resources().map(i=>te(Z({},i),{id:this.generateResourceId(i)}))),this.resourceDefinition=K(()=>this.context().resourceDefinition),this.hasUiCreateViewFields=K(()=>!!this.resourceDefinition()?.ui?.createView?.fields?.length),this.columns=K(()=>{let i=this.resourceDefinition()?.ui?.listView?.fields??[],r=this.resourceDefinition()?.readyCondition;return r&&(i=[te(Z({},r),{columnSettings:te(Z({},r.columnSettings),{width:"30px"}),uiSettings:te(Z({},r.uiSettings),{displayAs:"alert"})}),...i]),i}),this.totalItemsCount=K(()=>this.resources().length+this.remainingItemCount()),this.paginationLimit=Ee(5),this.remainingItemCount=Ee(0),this.hasMore=Ee(!1),this.resourceVersion=Ee(void 0),this.loading=Ee(!1),this.listError=Ee(null),this.watchError=Ee(null),this.createValidation=this.createValidationController(!1),this.createFieldErrors=this.createValidation.errors,this.createPending=Ee(!1),this.createFormState=K(()=>({fieldErrors:this.createFieldErrors(),pending:this.createPending()||this.createValidation.hasDeferredErrors()})),this.editValidation=this.createValidationController(!0),this.editFieldErrors=this.editValidation.errors,this.editPending=Ee(!1),this.editFormState=K(()=>({fieldErrors:this.editFieldErrors(),pending:this.editPending()||this.editValidation.hasDeferredErrors()})),this.createDependencies=new Km((i,r)=>this.resolveDynamicValuesResult(i,r),i=>this.applyDependentUpdate(i,!1)),this.editDependencies=new Km((i,r)=>this.resolveDynamicValuesResult(i,r),i=>this.applyDependentUpdate(i,!0)),this.createFormFields=K(()=>{let i=this.resourceDefinition()?.ui?.createView?.fields||[];return this.hasUiCreateViewFields()&&this.isNamespaced()&&!this.resourceService.getNamespace(this.createContext())&&!i.some(r=>r.property===go.MetadataNamespace)&&(i=[{property:go.MetadataNamespace,required:!0,label:"Namespace",values:this.context().namespaces},...i]),i}),this.config=K(()=>te(Z(Z({header:this.resourceDefinition()?.entityCollection,tableConfig:{fields:this.columns(),overflowMode:this.resourceDefinition()?.ui?.listView?.overflowMode??"Scroll",totalItemsCount:this.totalItemsCount(),paginationLimit:this.paginationLimit(),hasMore:this.hasMore()}},this.hasUiCreateViewFields()&&this.canDo("create")&&{createResourceFormConfig:{fields:()=>this.buildFormFields(!1)}}),this.hasUiCreateViewFields()&&this.canDo("update")&&{editResourceFormConfig:i=>({fields:()=>this.buildFormFields(!0,i)})}),{deleteResourceConfirmationConfig:i=>this.getDeleteConfig(i)})),this.isNamespaced=K(()=>uo(this.context())),this.createContext=K(()=>{let i=this.context();return xO(i,this.resourceService.getNamespace(i),this.LuigiClient().getPathParams?.())}),this.currentContinueToken=void 0,this.lastListWasInitialLoad=!0,this.destroyRef.onDestroy(()=>{this.createDependencies.end(),this.editDependencies.end()}),_t(i=>{this.currentContinueToken=void 0,this.resources.set([]),this.resourceVersion.set(void 0),this.remainingItemCount.set(0),this.hasMore.set(!1),this.listError.set(null),this.watchError.set(null),this.list(!0),i(()=>this.listSubscription?.unsubscribe())}),_t(()=>{let i=this.listError()||this.watchError();this.readFailureChange()?.(i?{code:i.status,retry:()=>this.retryList()}:null)}),_t(i=>{let r=this.resourceVersion();if(!r||nt(this.watchError)||!this.canDo("watch"))return;let a=this.subscribeToResourceChange(r);i(()=>a.unsubscribe())}),_t(()=>{let i=this.resources(),r=this.resourceDefinition();if(!r?.permissionsDefinition?.entityActions.length||!i.length)return;let a=this.isNamespaced(),o=i.map(s=>({name:s.metadata.name,namespace:a?s.metadata.namespace:void 0}));this.instancePermissionsStore.sync(this.context(),r.permissionsDefinition,o)})}createValidationController(i){return new wO((r,a)=>jO({name:r,value:a,fields:this.createFormFields(),editMode:i}))}async buildFormFields(i,r){this.resetFormState(i);let a=i?this.editDependencies:this.createDependencies,o=this.createFormFields(),s=PO(o,r),c;try{c=a.begin(o,s);let _=await UO(o,s,{editMode:i,resolveResult:(m,f)=>this.resolveDynamicValuesResult(m,f)});return a.isCurrent(c)?_:[]}catch(_){return c!==void 0&&!a.isCurrent(c)?[]:(this.resetFormState(i),i?this.tableCard().closeEditDialog():this.tableCard().closeCreateDialog(),this.errorHandlerService.handleError(_),[])}}resolveDynamicValuesResult(i,r){return OO(i,this.createContext(),this.isNamespaced(),r,{list:(a,o,s,c)=>this.resourceService.list(a,o,s,c),getNamespace:a=>this.resourceService.getNamespace(a),handleError:a=>this.errorHandlerService.handleError(a)})}applyDependentUpdate(i,r){let a=r?this.editValidation:this.createValidation,o=r?this.editPending:this.createPending,s=te(Z({},i.clear&&{values:{[i.name]:""}}),{fieldUpdates:{[i.name]:{values:i.values}}});r?this.tableCard().applyEditFormPatch(s):this.tableCard().applyCreateFormPatch(s),i.clear&&a.resetField(i.name,""),o.set(i.pending)}onCreateDialogClosed(){this.resetFormState(!1)}onEditDialogClosed(){this.resetFormState(!0)}resetFormState(i){let r=i?this.editDependencies:this.createDependencies,a=i?this.editValidation:this.createValidation,o=i?this.editPending:this.createPending;r.end(),a.reset(),o.set(!1)}onEditFieldChange({formChangeEvent:i}){this.editValidation.handleChange(i),this.editDependencies.handleChange(i)}onEditSubmit({value:i}){let r=this.getResourceDefinition(),a=pL(AO(i,this.createFormFields()),this.createFormFields());this.resourceService.update(a,r,this.context()).subscribe({next:o=>{this.editValidation.reset(),this.tableCard().closeEditDialog(),console.debug("Resource updated",o)},error:o=>this.errorHandlerService.handleError(o)})}subscribeToResourceChange(i){let r=this.getListQueryFields(),a=this.context(),o=a.resourceDefinition,s=ul({apiGroup:o.apiGroup,version:o.version,entity:o.entityCollection});return this.resourceService.resourceChangeSubscription(s,r,a,i,!1).subscribe({next:c=>{!c||a!==this.context()||this.mergeResourcesWithSubscriptionResult(c)},error:c=>{a===this.context()&&this.watchError.set(this.mapError(c))}})}resetPagination(){this.currentContinueToken=void 0,this.resources.update(i=>i.slice(0,this.paginationLimit())),this.hasMore.set(this.resources().length<this.totalItemsCount())}onLimitChange(i){this.paginationLimit.set(i),this.resetPagination()}loadMore(){this.hasMore()&&this.list()}list(i=!1){if(!this.canDo("list")||nt(this.loading))return;this.lastListWasInitialLoad=i,this.listError.set(null),this.loading.set(!0);let r=this.getListQueryFields(),a=this.getResourceDefinition(),o=this.context(),s=ul({apiGroup:a.apiGroup,version:a.version,entity:a.entityCollection});this.listSubscription=this.resourceService.list(s,r,o,{pagination:{limit:this.paginationLimit(),continue:this.currentContinueToken}}).pipe(Gd(()=>{this.loading.set(!1)}),Ms(this.destroyRef)).subscribe({next:c=>{o===this.context()&&(i?this.resources.set(c.items??[]):this.resources.update(_=>{let m=new Map(_.map(f=>[f.id,f]));return(c.items??[]).forEach(f=>m.set(f.id,f)),[...m.values()]}),this.resourceVersion.set(c.resourceVersion),this.hasMore.set(!!c.continue),this.currentContinueToken=c.continue,this.remainingItemCount.set(c.remainingItemCount||0))},error:c=>{o===this.context()&&this.listError.set(this.mapError(c))}})}retryList(){if(!nt(this.loading)){if(nt(this.watchError)){this.currentContinueToken=void 0,this.resourceVersion.set(void 0),this.hasMore.set(!1),this.remainingItemCount.set(0),this.watchError.set(null),this.list(!0);return}nt(this.listError)&&this.list(this.lastListWasInitialLoad)}}mergeResourcesWithSubscriptionResult(i){this.resources.set(dB(this.resources(),i,{getItemKey:r=>r.id,mapSubscriptionObjectToItem:r=>r}))}mapError(i){return{status:this.errorHandlerService.errorCode(i),message:i.message,withRetryButton:!0}}navigateToResource(i){let r=this.context().resourceDefinition,a=r?.ui?.listView?.resourceURL;if(!(!a&&!r?.ui?.detailView)){if(!i.metadata.name)throw this.LuigiClient().uxManager().showAlert({text:"Resource name is not defined",type:"error"}),new Error("Resource name is not defined");if(this.isNamespaced()&&!i.metadata.namespace)throw this.LuigiClient().uxManager().showAlert({text:"Resource namespace is not known",type:"error"}),new Error("Resource namespace is not defined");this.LuigiClient().addCoreSearchParams({namespace:this.isNamespaced()?i.metadata.namespace:void 0},!1,!0),this.LuigiClient().linkManager().navigate(a?lB(a,i,this.context()):i.metadata.name)}}executeAction(i){yC(this.LuigiClient(),i.field,i.resource,this.context())}onCreateFieldChange(i){this.createValidation.handleChange(i),this.createDependencies.handleChange(i)}onCreateSubmit(i){let r=this.getResourceDefinition(),a=pL(i,this.createFormFields());this.resourceService.create(a,r,this.createContext()).subscribe({next:o=>{this.createValidation.reset(),this.tableCard().closeCreateDialog(),console.debug("Resource created",o)},error:o=>this.errorHandlerService.handleError(o)})}delete(i){this.resourceService.delete(i,this.getResourceDefinition(),this.context()).pipe(Ms(this.destroyRef)).subscribe({next:()=>{this.tableCard().closeDeleteDialog()},error:r=>this.errorHandlerService.handleError(r)})}getListQueryFields(){let i=[{property:"metadata.deletionTimestamp"}];return this.isNamespaced()&&i.push({property:"metadata.namespace"}),q8(this.columns().concat(i))}getResourceDefinition(){let i=this.resourceDefinition();if(!i)throw this.LuigiClient().uxManager().showAlert({text:"Resource definition is not defined",type:"error"}),new Error("Resource definition is not defined");return i}generateResourceId(i){return Sl({resource:this.getResourceDefinition().permissionsDefinition?.resource,name:i.metadata.name,namespace:i.metadata.namespace})}canDo(i){return uB(this.context().portalPermissions,this.resourceDefinition()?.permissionsDefinition?.resource,i)}getDeleteConfig(i){let r=this.getResourceDefinition(),a=i.metadata?.name?.toLowerCase()??"";return{title:`Delete ${a}`,message:`<p>Are you sure you want to delete ${r?.entity} <b>${a}</b>?</p>
|
|
1708
1708
|
<p class="dialog__message--critical">This action <b>cannot</b> be undone.</p>
|
|
1709
1709
|
<p>Please type <b>${a}</b> to confirm:</p>`,confirmationText:a,confirmationPlaceholder:"Type name",confirmLabel:"Delete",cancelLabel:"Cancel"}}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=Qe({type:e,selectors:[["pm-resource-table-card"]],viewQuery:function(i,r){i&1&&m2(r.tableCard,lh,5),i&2&&wn()},inputs:{LuigiClient:[1,"LuigiClient"],context:[1,"context"],readFailureChange:[1,"readFailureChange"]},features:[Nt([Md])],decls:1,vars:6,consts:[["data-testid","generic-list-view-table",3,"tableRowClicked","loadMoreResources","paginationLimitChanged","actionButtonClick","createFieldChange","createDialogClosed","createSubmit","editFieldChange","editDialogClosed","editSubmit","deleteSubmit","resources","config","loading","permissions","createFormState","editFormState"]],template:function(i,r){i&1&&(q(0,"mfp-declarative-table-card",0),Se("tableRowClicked",function(a){return r.navigateToResource(a)})("loadMoreResources",function(){return r.loadMore()})("paginationLimitChanged",function(a){return r.onLimitChange(a)})("actionButtonClick",function(a){return r.executeAction(a)})("createFieldChange",function(a){return r.onCreateFieldChange(a)})("createDialogClosed",function(){return r.onCreateDialogClosed()})("createSubmit",function(a){return r.onCreateSubmit(a)})("editFieldChange",function(a){return r.onEditFieldChange(a)})("editDialogClosed",function(){return r.onEditDialogClosed()})("editSubmit",function(a){return r.onEditSubmit(a)})("deleteSubmit",function(a){return r.delete(a)}),X()),i&2&&ue("resources",r.tableResources())("config",r.config())("loading",r.loading())("permissions",r.instancePermissionsStore.permissions())("createFormState",r.createFormState())("editFormState",r.editFormState())},dependencies:[lh],styles:["mfp-declarative-table-card[_ngcontent-%COMP%]{opacity:80%;padding-bottom:5rem}"]})}}return e})();ep.registerAngularComponents([C_e]);A_e=(()=>{class e{constructor(){this.LuigiClient=B.required(),this.context=B.required(),this.readFailure=Ee(null),this.onReadFailureChange=i=>this.readFailure.set(i),this.resourceDefinition=K(()=>this.context().resourceDefinition),this.resourceTitleDefinition=K(()=>this.resourceDefinition()?.ui?.listView?.resourceTitle?.label??this.resourceDefinition()?.entityCollection??""),this.resourceDescriptionDefinition=K(()=>this.resourceDefinition()?.ui?.listView?.resourceDescription?.label??`This page displays the created ${this.resourceDefinition()?.entityCollection} in your environment`),this.isDemoEnabled=K(()=>this.LuigiClient().getActiveFeatureToggles().includes("neoNephosDemo")),this.sections=[{id:"accounts",editable:!1}],this.cards=K(()=>[{id:"pm-resource-table-card",component:"pm-resource-table-card",type:sh.ANGULAR,w:12,h:50,sectionId:"accounts",componentInputs:{LuigiClient:this.LuigiClient(),context:this.context(),readFailureChange:this.onReadFailureChange}}]),this.availableCards=[],this.customActions=[],this.i18n=K(()=>te(Z({},I8),{title:this.resourceTitleDefinition(),description:this.resourceDescriptionDefinition()})),this.dashboardConfig=K(()=>({backgroundImageUrl:this.isDemoEnabled()?"":this.resourceDefinition()?.ui?.listView?.backgroundImageUrl,editable:!1}))}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=Qe({type:e,selectors:[["pm-list-view"]],inputs:{LuigiClient:[1,"LuigiClient"],context:[1,"context"]},decls:4,vars:11,consts:[["data-testid","generic-list-view-error-state",3,"code"],["data-testid","generic-list-view",3,"config","customActions","i18n","sections","cards","availableCards"],["slot","dashboard-subheader",2,"width","100%"],["data-testid","generic-list-view-error-state",3,"retry","code"],[1,"demo-logo"]],template:function(i,r){if(i&1&&(Ry(0),Fe(1,y_e,1,1,"pm-error-state",0),q(2,"mfp-dashboard",1),Fe(3,w_e,2,0,"div",2),X()),i&2){let a=dO(r.readFailure());U(),ze(a?1:-1),U(),Ea("display",a?"none":null),ue("config",r.dashboardConfig())("customActions",r.customActions)("i18n",r.i18n())("sections",r.sections)("cards",r.cards())("availableCards",r.availableCards),U(),ze(r.isDemoEnabled()?3:-1)}},dependencies:[ep,xu],styles:[".demo-logo[_ngcontent-%COMP%]{width:200px;height:80px;margin-left:auto;background-image:url(http://localhost:4300/assets/nn-logo.png);background-size:contain;background-repeat:no-repeat;background-position:center;margin-right:50px}.title-logo[_ngcontent-%COMP%]{display:flex;align-items:center;padding:1rem 0}.logo[_ngcontent-%COMP%]{width:2rem;padding:0 1rem}.title-subheading[_ngcontent-%COMP%]{display:block;padding-bottom:1rem}.title-actions[_ngcontent-%COMP%]{height:auto}.multiline[_ngcontent-%COMP%]{display:block}.actions-column[_ngcontent-%COMP%]{width:fit-content!important;min-width:fit-content!important;white-space:nowrap;padding-left:.5rem;padding-right:.5rem}.actions-column[_ngcontent-%COMP%] ui5-icon[_ngcontent-%COMP%]{min-width:1rem;cursor:pointer}.edit-item[_ngcontent-%COMP%], .delete-item[_ngcontent-%COMP%]{padding:0 .5rem}.disabled[_ngcontent-%COMP%]{filter:brightness(.92);pointer-events:none}.disabled[_ngcontent-%COMP%] ui5-table-cell[_ngcontent-%COMP%]:not(:first-child){color:var(--%NS%sapContent_DisabledTextColor, #6a6d70)}.disabled[_ngcontent-%COMP%] ui5-table-cell[_ngcontent-%COMP%]:not(:first-child) ui5-icon[_ngcontent-%COMP%]{color:var(--%NS%sapContent_DisabledTextColor, #6a6d70)}.image-cell[_ngcontent-%COMP%]{width:62px;height:62px;margin:2px 0}.not-ready-indicator[_ngcontent-%COMP%]{pointer-events:auto}.group-value[_ngcontent-%COMP%]{display:flex;align-items:center}"]})}}return e})(),x_e=(()=>{class e{constructor(){this.httpClient=V(Z4),this.listResources=(i,r)=>{let a=i.portalContext.openSearchApiUrl;return a?this.httpClient.get(a,{headers:{Authorization:`Bearer ${i.token}`},params:this.buildParams(r)}).pipe(y1(o=>te(Z({},o),{results:o.results.map(s=>Z(Z({},s),this.expandDotNotation(Z(Z(Z(Z({},s.source.default_fields),s.source.filterable_fields),s.source.semantic_fields),s.source.custom_fields))))}))):ps(()=>new Error("OPENMFP_PORTAL_CONTEXT_OPEN_SEARCH_API_URL env variable is missing!"))}}buildParams(i){let r=new Z7().set("q",i.q);i.limit!==void 0&&(r=r.set("limit",i.limit.toString())),i.cursor!==void 0&&(r=r.set("cursor",i.cursor)),i.page!==void 0&&(r=r.set("page",i.page.toString())),i.resource!==void 0&&(r=r.set("resource",i.resource));for(let[a,o]of Object.entries(i.filters??{}))r=r.set(`filter.${a}`,o);return r}asReadResources(){return{list:(i,r,a)=>{let o={q:a.q||"*",resource:a.resource??i.resourceDefinition?.entityCollection,limit:r.limit,cursor:r.cursor,page:r.page,filters:this.parseFilter(a.filter)};return this.listResources(i,o).pipe(y1(s=>({items:s?.results??[],nextCursor:s?.nextCursor})))},subscribe:()=>Is}}parseFilter(i){if(!i)return{};let r=i.indexOf("=");return r<=0||r===i.length-1?{}:{[i.slice(0,r)]:i.slice(r+1)}}expandDotNotation(i){let r={};for(let[a,o]of Object.entries(i)){let s=a.split("."),c=r;for(let m=0;m<s.length-1;m++)(c[s[m]]===void 0||typeof c[s[m]]!="object")&&(c[s[m]]={}),c=c[s[m]];let _=s[s.length-1];c[_]=o!==null&&typeof o=="object"&&!Array.isArray(o)?Z(Z({},c[_]),o):o}return r}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=Ot({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})(),S_e=Symbol("FIELD_TREE"),Db=0;D7=Symbol(),up=Symbol(),qw=class{predicates;fns=[];constructor(e){this.predicates=e}push(e){this.fns.push(VM(this.predicates,e))}mergeIn(e){let t=this.predicates?e.fns.map(i=>VM(this.predicates,i)):e.fns;this.fns.push(...t)}hasRules(){return this.fns.length>0}},RM=class extends qw{get defaultValue(){return!1}compute(e){return this.fns.some(t=>{let i=t(e);return i&&i!==up})}},_h=class aP extends qw{ignore;static ignoreNull(t){return new aP(t,i=>i===null)}constructor(t,i){super(t),this.ignore=i}get defaultValue(){return[]}compute(t){return this.fns.reduce((i,r)=>{let a=r(t);return a===void 0||a===up?i:l3(a)?[...i,...this.ignore?a.filter(o=>!this.ignore(o)):a]:this.ignore&&this.ignore(a)?i:[...i,a]},[])}},T_e=class extends _h{constructor(e){super(e,void 0)}},M_e=class extends qw{key;get defaultValue(){return this.key.reducer.getInitial()}constructor(e,t){super(e),this.key=t}compute(e){if(this.fns.length===0)return this.key.reducer.getInitial();let t=this.key.reducer.getInitial();for(let i=0;i<this.fns.length;i++){let r=this.fns[i](e);r!==up&&(t=this.key.reducer.reduce(t,r))}return t}};pp=class{predicates;hidden;disabledReasons;readonly;syncErrors;syncTreeErrors;asyncErrors;metadata=new Map;constructor(e){this.predicates=e,this.hidden=new RM(e),this.disabledReasons=new T_e(e),this.readonly=new RM(e),this.syncErrors=_h.ignoreNull(e),this.syncTreeErrors=_h.ignoreNull(e),this.asyncErrors=_h.ignoreNull(e)}hasAnyLogic(){return this.hidden.hasRules()||this.disabledReasons.hasRules()||this.readonly.hasRules()||this.syncErrors.hasRules()||this.syncTreeErrors.hasRules()||this.asyncErrors.hasRules()||this.metadata.size>0}hasMetadata(e){return this.metadata.has(e)}hasMetadataKeys(){return this.metadata.size>0}getMetadataKeys(){return this.metadata.keys()}getMetadata(e){return this.metadata.has(e)||this.metadata.set(e,new M_e(this.predicates,e)),this.metadata.get(e)}mergeIn(e){this.hidden.mergeIn(e.hidden),this.disabledReasons.mergeIn(e.disabledReasons),this.readonly.mergeIn(e.readonly),this.syncErrors.mergeIn(e.syncErrors),this.syncTreeErrors.mergeIn(e.syncTreeErrors),this.asyncErrors.mergeIn(e.asyncErrors);for(let t of e.getMetadataKeys()){let i=e.metadata.get(t);this.getMetadata(t).mergeIn(i)}}},oP=class{depth;constructor(e){this.depth=e}build(){return new sP(this,[],0)}},_p=class nP extends oP{constructor(t){super(t)}current;all=[];addHiddenRule(t){this.getCurrent().addHiddenRule(t)}addDisabledReasonRule(t){this.getCurrent().addDisabledReasonRule(t)}addReadonlyRule(t){this.getCurrent().addReadonlyRule(t)}addSyncErrorRule(t){this.getCurrent().addSyncErrorRule(t)}addSyncTreeErrorRule(t){this.getCurrent().addSyncTreeErrorRule(t)}addAsyncErrorRule(t){this.getCurrent().addAsyncErrorRule(t)}addMetadataRule(t,i){this.getCurrent().addMetadataRule(t,i)}getChild(t){if(t===D7){let i=this.getCurrent().children;i.size>(i.has(D7)?1:0)&&(this.current=void 0)}return this.getCurrent().getChild(t)}hasLogic(t){return this===t?!0:this.all.some(({builder:i})=>i.hasLogic(t))}hasRules(){return this.all.length>0}anyChildHasLogic(){return this.all.some(({builder:t})=>t.anyChildHasLogic())}mergeIn(t,i){i?this.all.push({builder:t,predicate:{fn:is(i.fn,this.depth),path:i.path}}):this.all.push({builder:t}),this.current=void 0}getCurrent(){return this.current===void 0&&(this.current=new Gw(this.depth),this.all.push({builder:this.current})),this.current}static newRoot(){return new nP(0)}},Gw=class extends oP{logic=new pp([]);children=new Map;constructor(e){super(e)}addHiddenRule(e){this.logic.hidden.push(is(e,this.depth))}addDisabledReasonRule(e){this.logic.disabledReasons.push(is(e,this.depth))}addReadonlyRule(e){this.logic.readonly.push(is(e,this.depth))}addSyncErrorRule(e){this.logic.syncErrors.push(is(e,this.depth))}addSyncTreeErrorRule(e){this.logic.syncTreeErrors.push(is(e,this.depth))}addAsyncErrorRule(e){this.logic.asyncErrors.push(is(e,this.depth))}addMetadataRule(e,t){this.logic.getMetadata(e).push(is(t,this.depth))}getChild(e){return this.children.has(e)||this.children.set(e,new _p(this.depth+1)),this.children.get(e)}hasLogic(e){return this===e}hasRules(){return this.logic.hasAnyLogic()||this.children.size>0}anyChildHasLogic(){for(let e of this.children.values())if(e.hasRules())return!0;return!1}},sP=class vh{builder;predicates;depth;logic;constructor(t,i,r){this.builder=t,this.predicates=i,this.depth=r,this.logic=t?E_e(t,i,r):new pp([])}getChild(t){let i=this.builder?cP(this.builder,t):[];if(i.length===0)return new vh(void 0,[],this.depth+1);if(i.length===1){let{builder:r,predicates:a}=i[0];return new vh(r,[...this.predicates,...a.map(o=>Ob(o,this.depth))],this.depth+1)}else return new k_e(i.map(({builder:r,predicates:a})=>new vh(r,[...this.predicates,...a.map(o=>Ob(o,this.depth))],this.depth+1)))}hasLogic(t){return this.builder?this.builder.hasLogic(t):!1}hasRules(){return this.builder?this.builder.hasRules():!1}anyChildHasLogic(){return this.builder?this.builder.anyChildHasLogic():!1}},k_e=class lP{all;logic;constructor(t){this.all=t,this.logic=new pp([]);for(let i of t)this.logic.mergeIn(i.logic)}getChild(t){return new lP(this.all.flatMap(i=>i.getChild(t)))}hasLogic(t){return this.all.some(i=>i.hasLogic(t))}hasRules(){return this.all.some(t=>t.hasRules())}anyChildHasLogic(){return this.all.some(t=>t.anyChildHasLogic())}};hP=Symbol("PATH"),Nb=class Rb{keys;parent;keyInParent;root;children=new Map;fieldPathProxy=new Proxy(this,B_e);logicBuilder;constructor(t,i,r,a){this.keys=t,this.parent=r,this.keyInParent=a,this.root=i??this,r||(this.logicBuilder=_p.newRoot())}get builder(){return this.logicBuilder?this.logicBuilder:this.parent.builder.getChild(this.keyInParent)}getChild(t){return this.children.has(t)||this.children.set(t,new Rb([...this.keys,t],this.root,this,t)),this.children.get(t)}mergeIn(t,i){let r=t.compile();this.builder.mergeIn(r.builder,i)}static unwrapFieldPath(t){return t[hP]}static newRoot(){return new Rb([],void 0,void 0,void 0)}},B_e={get(e,t){return t===hP?e:e.getChild(t).fieldPathProxy}},m6=new Map,dP=class R6{schemaFn;constructor(t){this.schemaFn=t}compile(){if(m6.has(this))return m6.get(this);let t=Nb.newRoot();m6.set(this,t);let i=Fv;try{Fv=t,this.schemaFn(t.fieldPathProxy)}finally{Fv=i}return t}static create(t){return t instanceof R6?t:new R6(t)}static rootCompile(t){try{return m6.clear(),t===void 0?Nb.newRoot():t instanceof R6?t.compile():new R6(t).compile()}finally{m6.clear()}}};xc={list(){return{reduce:(e,t)=>t===void 0?e:[...e,t],getInitial:()=>[]}},min(){return{reduce:(e,t)=>e===void 0||t===void 0?e??t:t<e?t:e,getInitial:()=>{}}},max(){return{reduce:(e,t)=>e===void 0||t===void 0?e??t:t>e?t:e,getInitial:()=>{}}},or(){return{reduce:(e,t)=>e||t,getInitial:()=>!1}},and(){return{reduce:(e,t)=>e&&t,getInitial:()=>!0}},override:H_e};uP=Symbol("IS_ASYNC_VALIDATION_RESOURCE"),D_e=class{reducer;create;brand;[uP];constructor(e,t){this.reducer=e,this.create=t}};O_e=j4(xc.or()),N_e=pP(),R_e=pP(),V_e=j4(xc.max()),P_e=j4(xc.min()),F_e=j4(xc.list());U_e=class{node;constructor(e){this.node=e}rawSyncTreeErrors=K(()=>this.shouldSkipValidation()?[]:[...this.node.logicNode.logic.syncTreeErrors.compute(this.node.context),...this.node.structure.parent?.validationState.rawSyncTreeErrors()??[]],{equal:wa});syncErrors=K(()=>this.shouldSkipValidation()?[]:[...this.node.logicNode.logic.syncErrors.compute(this.node.context),...this.syncTreeErrors(),...j_e(this.node.submitState.submissionErrors())],{equal:wa});syncValid=K(()=>this.shouldSkipValidation()?!0:this.node.structure.reduceChildren(this.syncErrors().length===0,(e,t)=>t&&e.validationState.syncValid(),L_e));syncTreeErrors=K(()=>this.rawSyncTreeErrors().filter(e=>e.fieldTree===this.node.fieldTree),{equal:wa});rawAsyncErrors=K(()=>this.shouldSkipValidation()?[]:[...this.node.logicNode.logic.asyncErrors.compute(this.node.context),...this.node.structure.parent?.validationState.rawAsyncErrors()??[]],{equal:wa});asyncErrors=K(()=>this.shouldSkipValidation()?[]:this.rawAsyncErrors().filter(e=>e==="pending"||e.fieldTree===this.node.fieldTree),{equal:wa});parseErrors=K(()=>this.node.formFieldBindings().flatMap(e=>e.parseErrors()),{equal:wa});errors=K(()=>[...this.parseErrors(),...this.syncErrors(),...this.asyncErrors().filter(e=>e!=="pending")],{equal:wa});errorSummary=K(()=>{let e=this.node.structure.reduceChildren(this.errors(),(t,i)=>[...i,...t.errorSummary()]);return nt(()=>e.sort($_e)),e},{equal:wa});pending=K(()=>this.node.structure.reduceChildren(this.asyncErrors().includes("pending"),(e,t)=>t||e.validationState.pending()));status=K(()=>{if(this.shouldSkipValidation())return"valid";let e=z_e(this);return this.node.structure.reduceChildren(e,(t,i)=>i==="invalid"||t.validationState.status()==="invalid"?"invalid":i==="unknown"||t.validationState.status()==="unknown"?"unknown":"valid",t=>t==="invalid")});valid=K(()=>this.status()==="valid");invalid=K(()=>this.status()==="invalid");shouldSkipValidation=K(()=>this.node.hidden()||this.node.disabled()||this.node.readonly()||this.node.structure.isOrphaned())};FM=j4(),W_e=class{node;cache=new WeakMap;constructor(e){this.node=e,this.fieldTreeOf=this.fieldTreeOf.bind(this),this.stateOf=this.stateOf.bind(this)}resolve(e){if(!this.cache.has(e)){let t=K(()=>{let i=Nb.unwrapFieldPath(e),r=this.node,a=I_e();for(;a>0||!r.structure.logic.hasLogic(i.root.builder);)if(a--,r=r.structure.parent,r===void 0)throw new ot(1900,!1);for(let o of i.keys)if(r=r.structure.getChild(o),r===void 0)throw new ot(1901,!1);return r.fieldTree});this.cache.set(e,t)}return this.cache.get(e)()}get fieldTree(){return this.node.fieldProxy}get state(){return this.node}get value(){return this.node.structure.value}get key(){return this.node.structure.keyInParent}get pathKeys(){return this.node.structure.pathKeys}index=K(()=>{let e=this.key();if(!l3(nt(this.node.structure.parent.value)))throw new ot(1906,!1);return Number(e)});fieldTreeOf(e){return this.resolve(e)}stateOf(e){return this.resolve(e)()}valueOf=e=>{let t=this.resolve(e)().value();if(t instanceof hc)throw new ot(1907,!1);return t}},q_e=class{node;metadata=new Map;constructor(e){this.node=e}runMetadataCreateLifecycle(){if(!this.node.logicNode.logic.hasMetadataKeys())return;let e=fO();e&&od(!1);try{nt(()=>jt(this.node.structure.injector,()=>{for(let t of this.node.logicNode.logic.getMetadataKeys())if(t.create){let i=this.node.logicNode.logic.getMetadata(t),r=t.create(this.node,K(()=>i.compute(this.node.context)));this.metadata.set(t,r)}}))}finally{e&&od(!0)}}get(e){if(this.has(e)&&!this.metadata.has(e)){if(e.create)throw new ot(1912,!1);let t=this.node.logicNode.logic.getMetadata(e);this.metadata.set(e,K(()=>t.compute(this.node.context)))}return this.metadata.get(e)}has(e){return this.node.logicNode.logic.hasMetadata(e)}},G_e={get(e,t,i){if(t===S_e)return!0;let r=e(),a=r.structure.getChild(t);if(a!==void 0)return a.fieldTree;let o=nt(r.value);if(l3(o)){if(t==="length")return r.value().length;if(t===Symbol.iterator)return()=>(r.value(),Array.prototype[Symbol.iterator].apply(r.fieldTree))}if(kd(o)&&t===Symbol.iterator)return function*(){for(let s in i)yield[s,i[s]]}},getOwnPropertyDescriptor(e,t){let i=nt(e().value),r=Reflect.getOwnPropertyDescriptor(i,t);return r&&!r.configurable&&(r.configurable=!0),r},ownKeys(e){let t=nt(e().value);return typeof t=="object"&&t!==null?Reflect.ownKeys(t):[]}};el=Symbol(""),_P=K(()=>!1),vP=class{logic;node;createChildNode;identitySymbol=Symbol();_injector=void 0;_anyChildHasLogic;get injector(){return this._injector??=mt.create({providers:[],parent:this.fieldManager.injector}),this._injector}constructor(e,t,i){this.logic=e,this.node=t,this.createChildNode=i}children(){this.ensureChildrenMap();let e=this.childrenMap();return e===void 0?[]:Array.from(e.byPropertyKey.values()).map(t=>nt(t.reader))}materializedChildren(){let e=this.childrenMap();return e===void 0?[]:Array.from(e.byPropertyKey.values()).map(t=>t.node)}_areChildrenMaterialized(){return nt(this.childrenMap)!==void 0}ensureChildrenMap(){this._areChildrenMaterialized()||nt(()=>{this.childrenMap.update(e=>this.computeChildrenMap(this.value(),e,!0))})}getChild(e){this.ensureChildrenMap();let t=e.toString(),i=nt(this.childrenMap)?.byPropertyKey.get(t)?.reader;return i||(i=this.createReader(t)),i()}reduceChildren(e,t,i){let r=this.childrenMap();if(!r)return e;let a=e;for(let o of r.byPropertyKey.values()){if(i?.(a))break;a=t(nt(o.reader),a)}return a}destroy(){this.injector.destroy()}createKeyOrOrphanSignals(e,t,i){if(e==="root")return{keyInParent:mP,isOrphaned:_P};let r=this.parent,a=i,o=K(()=>{if(r.structure.isOrphaned())return el;let c=r.structure.childrenMap();if(!c)return el;let _=c.byPropertyKey.get(a);if(_&&_.node===this.node)return a;if(t===void 0)return el;for(let[m,f]of c.byPropertyKey)if(f.node===this.node)return a=m;return el}),s=K(()=>o()===el);return{keyInParent:K(()=>{let c=o();if(c===el)throw t===void 0?new ot(-1902,!1):new ot(1904,!1);return c}),isOrphaned:s}}createChildrenMap(){return Yr({source:this.value,computation:(e,t)=>this.computeChildrenMap(e,t?.value,!1)})}computeChildrenMap(e,t,i){if(!kd(e)||!i&&t===void 0&&!(this._anyChildHasLogic??=this.logic.anyChildHasLogic()))return;t??={byPropertyKey:new Map};let r,a=l3(e);t!==void 0&&(a?r=eve(t,e,this.identitySymbol):r=tve(t,e));for(let o of Object.keys(e)){let s,c=e[o];if(c===void 0){t.byPropertyKey.has(o)&&(r??=Z({},t),r.byPropertyKey.delete(o));continue}a&&kd(c)&&!l3(c)&&(s=c[this.identitySymbol]??=Symbol(""));let _;s&&(t.byTrackingKey?.has(s)||(r??=Z({},t),r.byTrackingKey??=new Map,r.byTrackingKey.set(s,this.createChildNode(o,s,a))),_=(r??t).byTrackingKey.get(s));let m=t.byPropertyKey.get(o);m===void 0?(r??=Z({},t),r.byPropertyKey.set(o,{reader:this.createReader(o),node:_??this.createChildNode(o,s,a)})):_&&_!==m.node&&(r??=Z({},t),m.node=_)}return r??t}createReader(e){return K(()=>this.childrenMap()?.byPropertyKey.get(e)?.node)}},Y_e=class extends vP{fieldManager;value;get parent(){}get root(){return this.node}get pathKeys(){return J_e}get keyInParent(){return mP}isOrphaned=_P;childrenMap;constructor(e,t,i,r,a){super(t,e,a),this.fieldManager=i,this.value=r,this.childrenMap=this.createChildrenMap()}},Q_e=class extends vP{logic;parent;root;pathKeys;keyInParent;value;childrenMap;isOrphaned;get fieldManager(){return this.root.structure.fieldManager}constructor(e,t,i,r,a,o){super(t,e,o),this.logic=t,this.parent=i,this.root=this.parent.structure.root;let s=this.createKeyOrOrphanSignals("child",r,a);this.isOrphaned=s.isOrphaned,this.keyInParent=s.keyInParent,this.pathKeys=K(()=>[...i.structure.pathKeys(),this.keyInParent()]),this.value=K_e(this.parent.structure.value,this.keyInParent),this.childrenMap=this.createChildrenMap(),this.fieldManager.structures.add(this)}},J_e=K(()=>[]),mP=K(()=>{throw new ot(1905,!1)});ive=class{node;selfSubmitting=Ee(!1);submissionErrors;constructor(e){this.node=e,this.submissionErrors=Yr({source:this.node.structure.value,computation:()=>[]})}submitting=K(()=>this.selfSubmitting()||(this.node.structure.parent?.submitting()??!1))},Vb=class{structure;validationState;metadataState;nodeState;submitState;fieldAdapter;controlValue;_context=void 0;get context(){return this._context??=new W_e(this)}fieldProxy=new Proxy(()=>this,G_e);pathNode;constructor(e){this.pathNode=e.pathNode,this.fieldAdapter=e.fieldAdapter,this.structure=this.fieldAdapter.createStructure(this,e),this.validationState=this.fieldAdapter.createValidationState(this,e),this.nodeState=this.fieldAdapter.createNodeState(this,e),this.metadataState=new q_e(this),this.submitState=new ive(this),this.controlValue=this.controlValueSignal(),this.metadataState.runMetadataCreateLifecycle()}focusBoundControl(e){this.getBindingForFocus()?.focus(e)}getBindingForFocus(){return this.formFieldBindings().filter(e=>e.focus!==void 0).reduce(zM,void 0)||this.structure.children().map(e=>e.getBindingForFocus()).reduce(zM,void 0)}pendingSync=Yr({source:()=>this.value(),computation:(e,t)=>{t?.value?.abort()}});get fieldTree(){return this.fieldProxy}get logicNode(){return this.structure.logic}get value(){return this.structure.value}get keyInParent(){return this.structure.keyInParent}get errors(){return this.validationState.errors}get parseErrors(){return this.validationState.parseErrors}get errorSummary(){return this.validationState.errorSummary}get pending(){return this.validationState.pending}get valid(){return this.validationState.valid}get invalid(){return this.validationState.invalid}get dirty(){return this.nodeState.dirty}get touched(){return this.nodeState.touched}get disabled(){return this.nodeState.disabled}get disabledReasons(){return this.nodeState.disabledReasons}get hidden(){return this.nodeState.hidden}get readonly(){return this.nodeState.readonly}get formFieldBindings(){return this.nodeState.formFieldBindings}get submitting(){return this.submitState.submitting}get name(){return this.nodeState.name}get max(){let e=this.metadata(R_e)?.();return e?this.metadata(e):void 0}get maxLength(){return this.metadata(P_e)}get min(){let e=this.metadata(N_e)?.();return e?this.metadata(e):void 0}get minLength(){return this.metadata(V_e)}get pattern(){return this.metadata(F_e)??rve}get required(){return this.metadata(O_e)??ave}metadata(e){return this.metadataState.get(e)}getError(e){return this.errors().find(t=>t.kind===e)}hasMetadata(e){return this.metadataState.has(e)}markAsTouched(e){this.structure.isOrphaned()||nt(()=>{this.markAsTouchedInternal(e),this.flushSync()})}markAsTouchedInternal(e){if(!this.structure.isOrphaned()&&!this.validationState.shouldSkipValidation()&&(this.nodeState.markAsTouched(),!e?.skipDescendants))for(let t of this.structure.children())t.markAsTouchedInternal()}markAsDirty(){this.nodeState.markAsDirty()}markAsPristine(){this.nodeState.markAsPristine()}markAsUntouched(){this.nodeState.markAsUntouched()}reset(e){nt(()=>this._reset(e))}_reset(e){this.pendingSync()?.abort(),e!==void 0&&this.value.set(e),this.controlValue.rawSet(this.value()),this.nodeState.markAsUntouched(),this.nodeState.markAsPristine();for(let t of this.formFieldBindings())t.reset();for(let t of this.structure.materializedChildren())t._reset()}reloadValidation(){nt(()=>this._reloadValidation())}_reloadValidation(){let e=this.logicNode.logic.getMetadataKeys();for(let t of e)t[uP]&&this.metadata(t).reload?.();for(let t of this.structure.children())t._reloadValidation()}controlValueSignal(){let e=Yr(this.value);e.rawSet=e.set,e.set=i=>{e.rawSet(i),this.markAsDirty(),this.debounceSync()};let t=e.update;return e.update=i=>{t(i),this.markAsDirty(),this.debounceSync()},e}sync(){this.value.set(this.controlValue())}flushSync(){let e=this.pendingSync();e&&!e.signal.aborted&&(e.abort(),this.sync())}async debounceSync(){let e=nt(()=>(this.pendingSync()?.abort(),this.nodeState.debouncer()));if(e){let t=new AbortController,i=e(t.signal);if(i&&(this.pendingSync.set(t),await i,t.signal.aborted))return}this.structure.isOrphaned()||this.sync()}static newRoot(e,t,i,r){return r.newRoot(e,t,i,r)}createStructure(e){return e.kind==="root"?new Y_e(this,e.logic,e.fieldManager,e.value,this.newChild.bind(this)):new Q_e(this,e.logic,e.parent,e.identityInParent,e.initialKeyInParent,this.newChild.bind(this))}newChild(e,t,i){let r,a;return i?(r=this.pathNode.getChild(D7),a=this.structure.logic.getChild(D7)):(r=this.pathNode.getChild(e),a=this.structure.logic.getChild(e)),this.fieldAdapter.newChild({kind:"child",parent:this,pathNode:r,logic:a,initialKeyInParent:e,identityInParent:t,fieldAdapter:this.fieldAdapter})}},rve=K(()=>[]),ave=K(()=>!1);ove=class{node;selfTouched=Ee(!1);selfDirty=Ee(!1);markAsTouched(){this.selfTouched.set(!0)}markAsDirty(){this.selfDirty.set(!0)}markAsPristine(){this.selfDirty.set(!1)}markAsUntouched(){this.selfTouched.set(!1)}formFieldBindings=Ee([]);constructor(e){this.node=e}dirty=K(()=>{let e=this.selfDirty()&&!this.isNonInteractive();return this.node.structure.reduceChildren(e,(t,i)=>i||t.nodeState.dirty(),NM)});touched=K(()=>{let e=this.selfTouched()&&!this.isNonInteractive();return this.node.structure.reduceChildren(e,(t,i)=>i||t.nodeState.touched(),NM)});disabledReasons=K(()=>[...this.node.structure.parent?.nodeState.disabledReasons()??[],...this.node.logicNode.logic.disabledReasons.compute(this.node.context)],{equal:wa});disabled=K(()=>!!this.disabledReasons().length);readonly=K(()=>(this.node.structure.parent?.nodeState.readonly()||this.node.logicNode.logic.readonly.compute(this.node.context))??!1);hidden=K(()=>(this.node.structure.parent?.nodeState.hidden()||this.node.logicNode.logic.hidden.compute(this.node.context))??!1);name=K(()=>{let e=this.node.structure.parent;return e?`${e.name()}.${this.node.structure.keyInParent()}`:this.node.structure.fieldManager.rootName});debouncer=K(()=>{if(this.node.logicNode.logic.hasMetadata(FM)){let e=this.node.logicNode.logic.getMetadata(FM).compute(this.node.context);if(e)return t=>e(this.node.context,t)}return this.node.structure.parent?.nodeState.debouncer?.()});isNonInteractive=K(()=>this.hidden()||this.disabled()||this.readonly())},nve=class{newRoot(e,t,i,r){return new Vb({kind:"root",fieldManager:e,value:t,pathNode:i,logic:i.builder.build(),fieldAdapter:r})}newChild(e){return new Vb(e)}createNodeState(e){return new ove(e)}createValidationState(e){return new U_e(e)}createStructure(e,t){return e.createStructure(t)}},sve=class{injector;rootName;submitOptions;constructor(e,t,i){this.injector=e,this.rootName=t??`${this.injector.get(ru)}.form${lve++}`,this.submitOptions=i}structures=new Set;createFieldManagementEffect(e){_t(()=>{let t=new Set;this.markStructuresLive(e,t);for(let i of this.structures)t.has(i)||(this.structures.delete(i),nt(()=>i.destroy()))},{injector:this.injector})}markStructuresLive(e,t){t.add(e);for(let i of e.children())this.markStructuresLive(i.structure,t)}},lve=0,cve=new kt("");gP=class{kind="compat";control;fieldTree;context;message;constructor({context:e,kind:t,control:i}){this.context=e,this.kind=t,this.control=i}};_ve=new kt("");vve=class{__brand=void 0;kind="";fieldTree;message;constructor(e){e&&Object.assign(this,e)}},jM=class extends vve{kind="parse"};gve=class{field;constructor(e){this.field=e}control=this;get value(){return this.field().controlValue()}get valid(){return this.field().valid()}get invalid(){return this.field().invalid()}get pending(){return this.field().pending()}get disabled(){return this.field().disabled()}get enabled(){return!this.field().disabled()}get errors(){return uve(this.field().errors())}get pristine(){return!this.field().dirty()}get dirty(){return this.field().dirty()}get touched(){return this.field().touched()}get untouched(){return!this.field().touched()}get status(){if(this.field().disabled())return"DISABLED";if(this.field().valid())return"VALID";if(this.field().invalid())return"INVALID";if(this.field().pending())return"PENDING";throw new ot(1910,!1)}valueAccessor=null;hasValidator(e){return e===Lu.required?this.field().required():!1}updateValueAndValidity(){}},Pb={disabled:"disabled",disabledReasons:"disabledReasons",dirty:"dirty",errors:"errors",hidden:"hidden",invalid:"invalid",max:"max",maxLength:"maxLength",min:"min",minLength:"minLength",name:"name",pattern:"pattern",pending:"pending",readonly:"readonly",required:"required",touched:"touched"},fve=(()=>{let e={};for(let t of Object.keys(Pb))e[Pb[t]]=t;return e})();Xw=Object.values(Pb);CP=(()=>{class e{static \u0275fac=function(i){return new(i||e)};static \u0275prov=Ot({token:e,factory:i=>Mve.\u0275fac(i),providedIn:"root"})}return e})(),Mve=(()=>{class e extends CP{document=V(Xa);cspNonce=V(sy,{optional:!0});injectedStyles=new WeakMap;watchValidity(i,r,a){let o=r.getRootNode();this.injectedStyles.has(o)||this.injectedStyles.set(o,this.createTransitionStyle(o));let s=c=>{let _=c;(_.animationName==="ng-valid"||_.animationName==="ng-invalid")&&a()};r.addEventListener("animationstart",s),i.onDestroy(()=>{r.removeEventListener("animationstart",s)})}isBadInput(i){return i.validity?.badInput??!1}createTransitionStyle(i){let r=this.document.createElement("style");return this.cspNonce&&(r.nonce=this.cspNonce),r.textContent=`
|
|
1710
1710
|
@keyframes ng-valid {}
|
package/package.json
CHANGED
|
@@ -24,6 +24,8 @@ interface AccountInfo {
|
|
|
24
24
|
clients: {
|
|
25
25
|
kubectl?: {
|
|
26
26
|
clientId: string;
|
|
27
|
+
/** Secret of a client that is not public; absent for a public client. */
|
|
28
|
+
clientSecret?: string | null;
|
|
27
29
|
};
|
|
28
30
|
};
|
|
29
31
|
/** Scopes to request besides openid; empty leaves the choice to the client. */
|