]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/dist/en-US/25.9d84971ea743706b.js
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / dist / en-US / 25.9d84971ea743706b.js
1 "use strict";(self.webpackChunkceph_dashboard=self.webpackChunkceph_dashboard||[]).push([[25],{39025:(mt,Ae,p)=>{p.r(Ae),p.d(Ae,{BlockModule:()=>yt,RoutedBlockModule:()=>Or});var c=p(88692),r=p(20092),m=p(54247),ne=p(62946),F=p(51389),Ne=p(37496),L=p(79512),j=p(4222),re=p(54462),Pe=p(44466),le=p(23815),C=p.n(le),ce=p(35758),D=p(64762),ie=p(35732),V=p(93523),e=p(64537);let X=class{constructor(s){this.http=s}listTargets(){return this.http.get("api/iscsi/target")}getTarget(s){return this.http.get(`api/iscsi/target/${s}`)}updateTarget(s,t){return this.http.put(`api/iscsi/target/${s}`,t,{observe:"response"})}status(){return this.http.get("ui-api/iscsi/status")}settings(){return this.http.get("ui-api/iscsi/settings")}version(){return this.http.get("ui-api/iscsi/version")}portals(){return this.http.get("ui-api/iscsi/portals")}createTarget(s){return this.http.post("api/iscsi/target",s,{observe:"response"})}deleteTarget(s){return this.http.delete(`api/iscsi/target/${s}`,{observe:"response"})}getDiscovery(){return this.http.get("api/iscsi/discoveryauth")}updateDiscovery(s){return this.http.put("api/iscsi/discoveryauth",s)}overview(){return this.http.get("ui-api/iscsi/overview")}};X.\u0275fac=function(s){return new(s||X)(e.LFG(ie.eN))},X.\u0275prov=e.Yz7({token:X,factory:X.\u0275fac,providedIn:"root"}),X=(0,D.gn)([V.o,(0,D.w6)("design:paramtypes",[ie.eN])],X);var Fe=p(88002),De=p(76189),v=p(19358),be=p(34089);let H=class extends De.S{constructor(s,t){super(),this.http=s,this.rbdConfigurationService=t}isRBDPool(s){return-1!==C().indexOf(s.application_metadata,"rbd")&&!s.pool_name.includes("/")}create(s){return this.http.post("api/block/image",s,{observe:"response"})}delete(s){return this.http.delete(`api/block/image/${s.toStringEncoded()}`,{observe:"response"})}update(s,t){return this.http.put(`api/block/image/${s.toStringEncoded()}`,t,{observe:"response"})}get(s){return this.http.get(`api/block/image/${s.toStringEncoded()}`)}list(s){return this.http.get("api/block/image",{params:s,headers:{Accept:this.getVersionHeaderValue(2,0)},observe:"response"}).pipe((0,Fe.U)(t=>t.body.map(o=>(o.value.map(i=>(i.configuration&&i.configuration.map(_=>Object.assign(_,this.rbdConfigurationService.getOptionByName(_.name))),i)),o.headers=t.headers,o))))}copy(s,t){return this.http.post(`api/block/image/${s.toStringEncoded()}/copy`,t,{observe:"response"})}flatten(s){return this.http.post(`api/block/image/${s.toStringEncoded()}/flatten`,null,{observe:"response"})}defaultFeatures(){return this.http.get("api/block/image/default_features")}cloneFormatVersion(){return this.http.get("api/block/image/clone_format_version")}createSnapshot(s,t,o){const i={snapshot_name:t,mirrorImageSnapshot:o};return this.http.post(`api/block/image/${s.toStringEncoded()}/snap`,i,{observe:"response"})}renameSnapshot(s,t,o){const i={new_snap_name:o};return this.http.put(`api/block/image/${s.toStringEncoded()}/snap/${t}`,i,{observe:"response"})}protectSnapshot(s,t,o){const i={is_protected:o};return this.http.put(`api/block/image/${s.toStringEncoded()}/snap/${t}`,i,{observe:"response"})}rollbackSnapshot(s,t){return this.http.post(`api/block/image/${s.toStringEncoded()}/snap/${t}/rollback`,null,{observe:"response"})}cloneSnapshot(s,t,o){return this.http.post(`api/block/image/${s.toStringEncoded()}/snap/${t}/clone`,o,{observe:"response"})}deleteSnapshot(s,t){return this.http.delete(`api/block/image/${s.toStringEncoded()}/snap/${t}`,{observe:"response"})}listTrash(){return this.http.get("api/block/image/trash/")}createNamespace(s,t){return this.http.post(`api/block/pool/${s}/namespace`,{namespace:t},{observe:"response"})}listNamespaces(s){return this.http.get(`api/block/pool/${s}/namespace/`)}deleteNamespace(s,t){return this.http.delete(`api/block/pool/${s}/namespace/${t}`,{observe:"response"})}moveTrash(s,t){return this.http.post(`api/block/image/${s.toStringEncoded()}/move_trash`,{delay:t},{observe:"response"})}purgeTrash(s){return this.http.post(`api/block/image/trash/purge/?pool_name=${s}`,null,{observe:"response"})}restoreTrash(s,t){return this.http.post(`api/block/image/trash/${s.toStringEncoded()}/restore`,{new_image_name:t},{observe:"response"})}removeTrash(s,t=!1){return this.http.delete(`api/block/image/trash/${s.toStringEncoded()}/?force=${t}`,{observe:"response"})}};H.\u0275fac=function(s){return new(s||H)(e.LFG(ie.eN),e.LFG(be.n))},H.\u0275prov=e.Yz7({token:H,factory:H.\u0275fac,providedIn:"root"}),(0,D.gn)([(0,D.fM)(1,V.G),(0,D.w6)("design:type",Function),(0,D.w6)("design:paramtypes",[v.N,String,Boolean]),(0,D.w6)("design:returntype",void 0)],H.prototype,"createSnapshot",null),(0,D.gn)([(0,D.fM)(2,V.G),(0,D.w6)("design:type",Function),(0,D.w6)("design:paramtypes",[v.N,String,String]),(0,D.w6)("design:returntype",void 0)],H.prototype,"renameSnapshot",null),(0,D.gn)([(0,D.fM)(2,V.G),(0,D.w6)("design:type",Function),(0,D.w6)("design:paramtypes",[v.N,String,Boolean]),(0,D.w6)("design:returntype",void 0)],H.prototype,"protectSnapshot",null),(0,D.gn)([(0,D.fM)(1,V.G),(0,D.w6)("design:type",Function),(0,D.w6)("design:paramtypes",[v.N,String]),(0,D.w6)("design:returntype",void 0)],H.prototype,"restoreTrash",null),H=(0,D.gn)([V.o,(0,D.w6)("design:paramtypes",[ie.eN,be.n])],H);var N=p(7022),x=p(14745),T=p(65862),k=p(93614),Z=p(95463),z=p(90070),h=p(48168),E=p(76111),u=p(32337),f=p(60312),A=p(30839),M=p(87925),B=p(94276),K=p(56310),J=p(41582);function no(n,s){if(1&n&&(e.TgZ(0,"option",6),e._uU(1),e.qZA()),2&n){const t=s.$implicit;e.Q6J("ngValue",t),e.xp6(1),e.Oqu(t)}}function io(n,s){if(1&n&&(e.TgZ(0,"select",5),e._UZ(1,"option",6),e.YNc(2,no,2,2,"option",7),e.qZA()),2&n){const t=e.oxw();e.s9C("id",t.setting),e.s9C("name",t.setting),e.Q6J("formControlName",t.setting),e.xp6(1),e.Q6J("ngValue",null),e.xp6(1),e.Q6J("ngForOf",t.limits.values)}}function so(n,s){if(1&n&&e._UZ(0,"input",10),2&n){const t=e.oxw(2);e.Q6J("formControlName",t.setting)}}function _o(n,s){if(1&n&&e._UZ(0,"input",11),2&n){const t=e.oxw(2);e.Q6J("formControlName",t.setting)}}function ao(n,s){if(1&n&&(e.ynx(0),e._UZ(1,"br"),e.TgZ(2,"div",12),e._UZ(3,"input",13),e.TgZ(4,"label",14),e._uU(5,"Yes"),e.qZA()(),e.TgZ(6,"div",12),e._UZ(7,"input",13),e.TgZ(8,"label",14),e._uU(9,"No"),e.qZA()(),e.BQk()),2&n){const t=e.oxw(2);e.xp6(3),e.Q6J("id",t.setting+"True")("value",!0)("formControlName",t.setting),e.xp6(1),e.Q6J("for",t.setting+"True"),e.xp6(3),e.Q6J("id",t.setting+"False")("value",!1)("formControlName",t.setting),e.xp6(1),e.Q6J("for",t.setting+"False")}}function ro(n,s){if(1&n&&(e.TgZ(0,"span"),e.YNc(1,so,1,1,"input",8),e.YNc(2,_o,1,1,"input",9),e.YNc(3,ao,10,8,"ng-container",3),e.qZA()),2&n){const t=e.oxw();e.xp6(1),e.Q6J("ngIf","int"===t.limits.type),e.xp6(1),e.Q6J("ngIf","str"===t.limits.type),e.xp6(1),e.Q6J("ngIf","bool"===t.limits.type)}}function lo(n,s){if(1&n&&(e.TgZ(0,"span",15),e.ynx(1),e.SDv(2,16),e.BQk(),e.qZA()),2&n){const t=e.oxw();e.xp6(2),e.pQV(t.limits.min),e.QtT(2)}}function co(n,s){if(1&n&&(e.TgZ(0,"span",15),e.ynx(1),e.SDv(2,17),e.BQk(),e.qZA()),2&n){const t=e.oxw();e.xp6(2),e.pQV(t.limits.max),e.QtT(2)}}let gt=(()=>{class n{ngOnInit(){const t=[];"min"in this.limits&&t.push(r.kI.min(Number(this.limits.min))),"max"in this.limits&&t.push(r.kI.max(Number(this.limits.max))),this.settingsForm.get(this.setting).setValidators(t)}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi-setting"]],inputs:{settingsForm:"settingsForm",formDir:"formDir",setting:"setting",limits:"limits"},decls:7,vars:7,consts:function(){let s,t;return s="Must be greater than or equal to " + "\ufffd0\ufffd" + ".",t="Must be less than or equal to " + "\ufffd0\ufffd" + ".",[[1,"form-group",3,"formGroup"],[1,"col-form-label",3,"for"],["class","form-control",3,"id","name","formControlName",4,"ngIf"],[4,"ngIf"],["class","invalid-feedback",4,"ngIf"],[1,"form-control",3,"id","name","formControlName"],[3,"ngValue"],[3,"ngValue",4,"ngFor","ngForOf"],["type","number","class","form-control",3,"formControlName",4,"ngIf"],["type","text","class","form-control",3,"formControlName",4,"ngIf"],["type","number",1,"form-control",3,"formControlName"],["type","text",1,"form-control",3,"formControlName"],[1,"custom-control","custom-radio","custom-control-inline"],["type","radio",1,"custom-control-input",3,"id","value","formControlName"],[1,"custom-control-label",3,"for"],[1,"invalid-feedback"],s,t]},template:function(t,o){1&t&&(e.TgZ(0,"div",0)(1,"label",1),e._uU(2),e.qZA(),e.YNc(3,io,3,5,"select",2),e.YNc(4,ro,4,3,"span",3),e.YNc(5,lo,3,1,"span",4),e.YNc(6,co,3,1,"span",4),e.qZA()),2&t&&(e.Q6J("formGroup",o.settingsForm),e.xp6(1),e.s9C("for",o.setting),e.xp6(1),e.Oqu(o.setting),e.xp6(1),e.Q6J("ngIf","enum"===o.limits.type),e.xp6(1),e.Q6J("ngIf","enum"!==o.limits.type),e.xp6(1),e.Q6J("ngIf",o.settingsForm.showError(o.setting,o.formDir,"min")),e.xp6(1),e.Q6J("ngIf",o.settingsForm.showError(o.setting,o.formDir,"max")))},dependencies:[c.sg,c.O5,r.YN,r.Kr,r.Fj,r.wV,r.EJ,r._,r.JJ,r.JL,r.sg,r.u,M.o,B.b,K.P,J.V]}),n})();var Je=p(88820);function po(n,s){1&n&&(e.TgZ(0,"span",29),e.SDv(1,30),e.qZA())}function uo(n,s){if(1&n&&(e.TgZ(0,"span")(1,"legend",10),e.SDv(2,21),e.qZA(),e.TgZ(3,"div",12)(4,"div",13)(5,"label",22),e.SDv(6,23),e.qZA(),e._UZ(7,"input",24),e.YNc(8,po,2,0,"span",25),e.qZA()(),e.TgZ(9,"div",12)(10,"div",13)(11,"label",26),e.SDv(12,27),e.qZA(),e._UZ(13,"input",28),e.qZA()()()),2&n){const t=e.oxw(),o=e.MAs(9);e.xp6(8),e.Q6J("ngIf",t.settingsForm.showError("lun",o,"required"))}}function mo(n,s){if(1&n&&(e.TgZ(0,"option",31),e._uU(1),e.ALo(2,"iscsiBackstore"),e.qZA()),2&n){const t=s.$implicit;e.Q6J("value",t),e.xp6(1),e.Oqu(e.lcZ(2,2,t))}}function go(n,s){if(1&n&&(e.TgZ(0,"div",12)(1,"div",13),e._UZ(2,"cd-iscsi-setting",33),e.qZA()()),2&n){const t=s.$implicit,o=e.oxw(2).$implicit,i=e.oxw(),_=e.MAs(9);e.xp6(2),e.Q6J("settingsForm",i.settingsForm)("formDir",_)("setting",t.key)("limits",i.getDiskControlLimits(o,t.key))}}function To(n,s){if(1&n&&(e.ynx(0),e.YNc(1,go,3,4,"div",32),e.ALo(2,"keyvalue"),e.BQk()),2&n){const t=e.oxw().$implicit,o=e.oxw();e.xp6(1),e.Q6J("ngForOf",e.lcZ(2,1,o.disk_default_controls[t]))}}function fo(n,s){if(1&n&&(e.ynx(0),e.YNc(1,To,3,3,"ng-container",9),e.BQk()),2&n){const t=s.$implicit,o=e.oxw();e.xp6(1),e.Q6J("ngIf",o.settingsForm.value.backstore===t)}}let Co=(()=>{class n{constructor(t,o,i){this.activeModal=t,this.iscsiService=o,this.actionLabels=i}ngOnInit(){const t={backstore:new r.p4(this.imagesSettings[this.image].backstore),lun:new r.p4(this.imagesSettings[this.image].lun),wwn:new r.p4(this.imagesSettings[this.image].wwn)};C().forEach(this.backstores,o=>{const i=this.imagesSettings[this.image][o]||{};C().forIn(this.disk_default_controls[o],(_,a)=>{t[a]=new r.p4(i[a])})}),this.settingsForm=new Z.d(t)}getDiskControlLimits(t,o){return this.disk_controls_limits?this.disk_controls_limits[t][o]:{type:"int"}}save(){const t=this.settingsForm.controls.backstore.value,o=this.settingsForm.controls.lun.value,i=this.settingsForm.controls.wwn.value,_={};C().forIn(this.settingsForm.controls,(a,l)=>{""!==a.value&&null!==a.value&&l in this.disk_default_controls[this.settingsForm.value.backstore]&&(_[l]=a.value,C().forEach(this.backstores,d=>{d!==t&&l in(this.imagesSettings[this.image][d]||{})&&(this.imagesSettings[this.image][d][l]=a.value)}))}),this.imagesSettings[this.image].backstore=t,this.imagesSettings[this.image].lun=o,this.imagesSettings[this.image].wwn=i,this.imagesSettings[this.image][t]=_,this.imagesSettings={...this.imagesSettings},this.control.updateValueAndValidity({emitEvent:!1}),this.activeModal.close()}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(F.Kz),e.Y36(X),e.Y36(L.p4))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi-target-image-settings-modal"]],decls:25,vars:8,consts:function(){let s,t,o,i,_,a,l,d;return s="Configure",t="Changing these parameters from their default values is usually not necessary.",o="Settings",i="Backstore",_="Identifier",a="lun",l="wwn",d="This field is required.",[[3,"modalRef"],[1,"modal-title"],s,[1,"modal-content"],["name","settingsForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"alert-warning"],t,[4,"ngIf"],[1,"cd-header"],o,[1,"form-group","row"],[1,"col-sm-12"],[1,"col-form-label"],i,["id","backstore","name","backstore","formControlName","backstore",1,"form-select"],[3,"value",4,"ngFor","ngForOf"],[4,"ngFor","ngForOf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],_,["for","lun",1,"col-form-label","required"],a,["type","number","id","lun","name","lun","formControlName","lun",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["for","wwn",1,"col-form-label"],l,["type","text","id","wwn","name","wwn","formControlName","wwn",1,"form-control"],[1,"invalid-feedback"],d,[3,"value"],["class","form-group row",4,"ngFor","ngForOf"],[3,"settingsForm","formDir","setting","limits"]]},template:function(t,o){1&t&&(e.TgZ(0,"cd-modal",0),e.ynx(1,1)(2),e.SDv(3,2),e.BQk(),e._uU(4,"\xa0 "),e.TgZ(5,"small"),e._uU(6),e.qZA(),e.BQk(),e.ynx(7,3),e.TgZ(8,"form",4,5)(10,"div",6)(11,"p",7),e.SDv(12,8),e.qZA(),e.YNc(13,uo,14,1,"span",9),e.TgZ(14,"legend",10),e.SDv(15,11),e.qZA(),e.TgZ(16,"div",12)(17,"div",13)(18,"label",14),e.SDv(19,15),e.qZA(),e.TgZ(20,"select",16),e.YNc(21,mo,3,4,"option",17),e.qZA()()(),e.YNc(22,fo,2,1,"ng-container",18),e.qZA(),e.TgZ(23,"div",19)(24,"cd-form-button-panel",20),e.NdJ("submitActionEvent",function(){return o.save()}),e.qZA()()(),e.BQk(),e.qZA()),2&t&&(e.Q6J("modalRef",o.activeModal),e.xp6(6),e.Oqu(o.image),e.xp6(2),e.Q6J("formGroup",o.settingsForm),e.xp6(5),e.Q6J("ngIf",o.api_version>=1),e.xp6(8),e.Q6J("ngForOf",o.backstores),e.xp6(1),e.Q6J("ngForOf",o.backstores),e.xp6(2),e.Q6J("form",o.settingsForm)("submitText",o.actionLabels.UPDATE))},dependencies:[c.sg,c.O5,r._Y,r.YN,r.Kr,r.Fj,r.wV,r.EJ,r.JJ,r.JL,r.sg,r.u,f.z,A.p,M.o,B.b,K.P,J.V,gt,c.Nd,Je.V]}),n})();function So(n,s){if(1&n&&(e.TgZ(0,"div",12)(1,"div",13),e._UZ(2,"cd-iscsi-setting",14),e.qZA()()),2&n){const t=s.$implicit,o=e.oxw(),i=e.MAs(5);e.xp6(2),e.Q6J("settingsForm",o.settingsForm)("formDir",i)("setting",t.key)("limits",o.getTargetControlLimits(t.key))}}let Ro=(()=>{class n{constructor(t,o,i){this.activeModal=t,this.iscsiService=o,this.actionLabels=i}ngOnInit(){const t={};C().forIn(this.target_default_controls,(o,i)=>{t[i]=new r.p4(this.target_controls.value[i])}),this.settingsForm=new Z.d(t)}save(){const t={};C().forIn(this.settingsForm.controls,(o,i)=>{""===o.value||null===o.value||(t[i]=o.value)}),this.target_controls.setValue(t),this.activeModal.close()}getTargetControlLimits(t){return this.target_controls_limits?this.target_controls_limits[t]:["Yes","No"].includes(this.target_default_controls[t])?{type:"bool"}:{type:"int"}}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(F.Kz),e.Y36(X),e.Y36(L.p4))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi-target-iqn-settings-modal"]],decls:13,vars:7,consts:function(){let s,t;return s="Advanced Settings",t="Changing these parameters from their default values is usually not necessary.",[[3,"modalRef"],[1,"modal-title"],s,[1,"modal-content"],["name","settingsForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"alert-warning"],t,["class","form-group row",4,"ngFor","ngForOf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"form-group","row"],[1,"col-sm-12"],[3,"settingsForm","formDir","setting","limits"]]},template:function(t,o){1&t&&(e.TgZ(0,"cd-modal",0),e.ynx(1,1),e.SDv(2,2),e.BQk(),e.ynx(3,3),e.TgZ(4,"form",4,5)(6,"div",6)(7,"p",7),e.SDv(8,8),e.qZA(),e.YNc(9,So,3,4,"div",9),e.ALo(10,"keyvalue"),e.qZA(),e.TgZ(11,"div",10)(12,"cd-form-button-panel",11),e.NdJ("submitActionEvent",function(){return o.save()}),e.qZA()()(),e.BQk(),e.qZA()),2&t&&(e.Q6J("modalRef",o.activeModal),e.xp6(4),e.Q6J("formGroup",o.settingsForm),e.xp6(5),e.Q6J("ngForOf",e.lcZ(10,5,o.settingsForm.controls)),e.xp6(3),e.Q6J("form",o.settingsForm)("submitText",o.actionLabels.UPDATE))},dependencies:[c.sg,r._Y,r.JL,r.sg,f.z,A.p,K.P,J.V,gt,c.Nd]}),n})();var pe=p(63285),Eo=p(39092),Ye=p(58039),Tt=p(4416);let Mo=(()=>{class n{constructor(t){this.ngControl=t}onInput(t){this.setValue(t)}setValue(t){t=C().isString(t)?t.trim():t,this.ngControl.control.setValue(t)}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(r.a5))},n.\u0275dir=e.lG2({type:n,selectors:[["","cdTrim",""]],hostBindings:function(t,o){1&t&&e.NdJ("input",function(_){return o.onInput(_.target.value)})}}),n})();var ft=p(63622),ot=p(10545);function Oo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,41),e.qZA())}function ho(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,42),e.qZA())}function Ao(n,s){1&n&&(e.TgZ(0,"span",40),e.ynx(1),e.SDv(2,43),e.BQk(),e._UZ(3,"br"),e.ynx(4),e.SDv(5,44),e.BQk(),e._UZ(6,"br"),e.TgZ(7,"a",45),e.SDv(8,46),e.qZA()())}function Po(n,s){1&n&&(e.TgZ(0,"span",47),e.SDv(1,48),e.qZA())}const U=function(n){return[n]};function bo(n,s){if(1&n){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",49),e._UZ(2,"input",50),e.TgZ(3,"button",51),e.NdJ("click",function(){const i=e.CHM(t),_=i.index,a=i.$implicit,l=e.oxw(2);return e.KtG(l.removePortal(_,a))}),e._UZ(4,"i",15),e.qZA()(),e.BQk()}if(2&n){const t=s.$implicit,o=e.oxw(2);e.xp6(2),e.Q6J("value",t),e.xp6(2),e.Q6J("ngClass",e.VKq(2,U,o.icons.destroy))}}function Io(n,s){if(1&n&&(e.TgZ(0,"span",40),e.SDv(1,52),e.qZA()),2&n){const t=e.oxw(2);e.xp6(1),e.pQV(t.minimum_gateways),e.QtT(1)}}function No(n,s){if(1&n&&(e.TgZ(0,"div",55),e._uU(1),e.qZA()),2&n){const t=e.oxw().$implicit,o=e.oxw(2);e.xp6(1),e.hij("lun: ",o.imagesSettings[t].lun,"")}}function Fo(n,s){if(1&n&&(e.ynx(0),e.SDv(1,56),e.ALo(2,"iscsiBackstore"),e.BQk()),2&n){const t=e.oxw().$implicit,o=e.oxw(2);e.xp6(2),e.pQV(e.lcZ(2,1,o.imagesSettings[t].backstore)),e.QtT(1)}}function Do(n,s){1&n&&(e.ynx(0),e.SDv(1,57),e.BQk())}function Lo(n,s){if(1&n){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",49),e._UZ(2,"input",50),e.YNc(3,No,2,1,"div",53),e.TgZ(4,"button",51),e.NdJ("click",function(){const _=e.CHM(t).$implicit,a=e.oxw(2);return e.KtG(a.imageSettingsModal(_))}),e._UZ(5,"i",15),e.qZA(),e.TgZ(6,"button",51),e.NdJ("click",function(){const i=e.CHM(t),_=i.index,a=i.$implicit,l=e.oxw(2);return e.KtG(l.removeImage(_,a))}),e._UZ(7,"i",15),e.qZA()(),e.TgZ(8,"span",47),e.YNc(9,Fo,3,3,"ng-container",54),e.YNc(10,Do,2,0,"ng-container",54),e.qZA(),e.BQk()}if(2&n){const t=s.$implicit,o=e.oxw(2);e.xp6(2),e.Q6J("value",t),e.xp6(1),e.Q6J("ngIf",o.api_version>=1),e.xp6(2),e.Q6J("ngClass",e.VKq(6,U,o.icons.deepCheck)),e.xp6(2),e.Q6J("ngClass",e.VKq(8,U,o.icons.destroy)),e.xp6(2),e.Q6J("ngIf",o.backstores.length>1),e.xp6(1),e.Q6J("ngIf",o.hasAdvancedSettings(o.imagesSettings[t][o.imagesSettings[t].backstore]))}}function vo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,58),e.qZA())}function $o(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,59),e.qZA())}function Bo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,77),e.qZA())}function Go(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,78),e.qZA())}function yo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,79),e.qZA())}function xo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,80),e.qZA())}function Zo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,81),e.qZA())}function wo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,82),e.qZA())}function Ho(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,83),e.qZA())}function ko(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,84),e.qZA())}function Ko(n,s){if(1&n&&(e.TgZ(0,"div",60)(1,"div",8)(2,"label",61),e.ynx(3),e.SDv(4,62),e.BQk(),e.qZA(),e.TgZ(5,"div",11),e._UZ(6,"input",63),e.YNc(7,Bo,2,0,"span",16),e.YNc(8,Go,2,0,"span",16),e.qZA()(),e.TgZ(9,"div",8)(10,"label",64),e.ynx(11),e.SDv(12,65),e.BQk(),e.qZA(),e.TgZ(13,"div",11)(14,"div",12),e._UZ(15,"input",66)(16,"button",67)(17,"cd-copy-2-clipboard-button",68),e.qZA(),e.YNc(18,yo,2,0,"span",16),e.YNc(19,xo,2,0,"span",16),e.qZA()(),e.TgZ(20,"div",8)(21,"label",69),e.ynx(22),e.SDv(23,70),e.BQk(),e.qZA(),e.TgZ(24,"div",11),e._UZ(25,"input",71),e.YNc(26,Zo,2,0,"span",16),e.YNc(27,wo,2,0,"span",16),e.qZA()(),e.TgZ(28,"div",8)(29,"label",72),e.ynx(30),e.SDv(31,73),e.BQk(),e.qZA(),e.TgZ(32,"div",11)(33,"div",12),e._UZ(34,"input",74)(35,"button",75)(36,"cd-copy-2-clipboard-button",76),e.qZA(),e.YNc(37,Ho,2,0,"span",16),e.YNc(38,ko,2,0,"span",16),e.qZA()()()),2&n){e.oxw();const t=e.MAs(2),o=e.oxw();e.xp6(7),e.Q6J("ngIf",o.targetForm.showError("user",t,"required")),e.xp6(1),e.Q6J("ngIf",o.targetForm.showError("user",t,"pattern")),e.xp6(10),e.Q6J("ngIf",o.targetForm.showError("password",t,"required")),e.xp6(1),e.Q6J("ngIf",o.targetForm.showError("password",t,"pattern")),e.xp6(7),e.Q6J("ngIf",o.targetForm.showError("mutual_user",t,"required")),e.xp6(1),e.Q6J("ngIf",o.targetForm.showError("mutual_user",t,"pattern")),e.xp6(10),e.Q6J("ngIf",o.targetForm.showError("mutual_password",t,"required")),e.xp6(1),e.Q6J("ngIf",o.targetForm.showError("mutual_password",t,"pattern"))}}function qo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,114),e.qZA())}function Xo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,115),e.qZA())}function Qo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,116),e.qZA())}function zo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,117),e.qZA())}function Jo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,118),e.qZA())}function Yo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,119),e.qZA())}function Vo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,120),e.qZA())}function Uo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,121),e.qZA())}function jo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,122),e.qZA())}function Wo(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,123),e.qZA())}function en(n,s){1&n&&(e.TgZ(0,"span",40),e.SDv(1,124),e.qZA())}function tn(n,s){if(1&n){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",49),e._UZ(2,"input",50),e.TgZ(3,"button",51),e.NdJ("click",function(){const i=e.CHM(t),_=i.index,a=i.$implicit,l=e.oxw(),d=l.$implicit,g=l.index,S=e.oxw(3);return e.KtG(S.removeInitiatorImage(d,_,g,a))}),e._UZ(4,"i",15),e.qZA()(),e.BQk()}if(2&n){const t=s.$implicit,o=e.oxw(4);e.xp6(2),e.Q6J("value",t),e.xp6(2),e.Q6J("ngClass",e.VKq(2,U,o.icons.destroy))}}function on(n,s){1&n&&(e.TgZ(0,"span"),e.SDv(1,125),e.qZA())}function nn(n,s){if(1&n&&(e.TgZ(0,"div",21)(1,"div",22)(2,"cd-select",126),e._UZ(3,"i",24),e.ynx(4),e.SDv(5,127),e.BQk(),e.qZA()()()),2&n){const t=e.oxw(),o=t.$implicit,i=t.index,_=e.oxw(3);e.xp6(2),e.Q6J("data",o.getValue("luns"))("options",_.imagesInitiatorSelections[i])("messages",_.messages.initiatorImage),e.xp6(1),e.Q6J("ngClass",e.VKq(4,U,_.icons.add))}}function sn(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",91)(1,"div",5),e.ynx(2),e.SDv(3,92),e.BQk(),e._uU(4),e.TgZ(5,"button",93),e.NdJ("click",function(){const _=e.CHM(t).index,a=e.oxw(3);return e.KtG(a.removeInitiator(_))}),e.qZA()(),e.TgZ(6,"div",7)(7,"div",8)(8,"label",94),e.SDv(9,95),e.qZA(),e.TgZ(10,"div",11)(11,"input",96),e.NdJ("blur",function(){e.CHM(t);const i=e.oxw(3);return e.KtG(i.updatedInitiatorSelector())}),e.qZA(),e.YNc(12,qo,2,0,"span",16),e.YNc(13,Xo,2,0,"span",16),e.YNc(14,Qo,2,0,"span",16),e.qZA()(),e.ynx(15,60),e.TgZ(16,"div",8)(17,"label",97),e.SDv(18,98),e.qZA(),e.TgZ(19,"div",11),e._UZ(20,"input",99),e.YNc(21,zo,2,0,"span",16),e.YNc(22,Jo,2,0,"span",16),e.qZA()(),e.TgZ(23,"div",8)(24,"label",100),e.SDv(25,101),e.qZA(),e.TgZ(26,"div",11)(27,"div",12),e._UZ(28,"input",102)(29,"button",103)(30,"cd-copy-2-clipboard-button",104),e.qZA(),e.YNc(31,Yo,2,0,"span",16),e.YNc(32,Vo,2,0,"span",16),e.qZA()(),e.TgZ(33,"div",8)(34,"label",105),e.ynx(35),e.SDv(36,106),e.BQk(),e.qZA(),e.TgZ(37,"div",11),e._UZ(38,"input",107),e.YNc(39,Uo,2,0,"span",16),e.YNc(40,jo,2,0,"span",16),e.qZA()(),e.TgZ(41,"div",8)(42,"label",108),e.SDv(43,109),e.qZA(),e.TgZ(44,"div",11)(45,"div",12),e._UZ(46,"input",110)(47,"button",103)(48,"cd-copy-2-clipboard-button",104),e.qZA(),e.YNc(49,Wo,2,0,"span",16),e.YNc(50,en,2,0,"span",16),e.qZA()(),e.BQk(),e.TgZ(51,"div",8)(52,"label",111),e.SDv(53,112),e.qZA(),e.TgZ(54,"div",11),e.YNc(55,tn,5,4,"ng-container",20),e.YNc(56,on,2,0,"span",54),e.YNc(57,nn,6,6,"div",113),e.qZA()()()()}if(2&n){const t=s.$implicit,o=s.index;e.oxw(2);const i=e.MAs(2);e.Q6J("formGroup",t),e.xp6(4),e.hij(": ",t.getValue("client_iqn")," "),e.xp6(8),e.Q6J("ngIf",t.showError("client_iqn",i,"notUnique")),e.xp6(1),e.Q6J("ngIf",t.showError("client_iqn",i,"required")),e.xp6(1),e.Q6J("ngIf",t.showError("client_iqn",i,"pattern")),e.xp6(6),e.Q6J("id","user"+o),e.xp6(1),e.Q6J("ngIf",t.showError("user",i,"required")),e.xp6(1),e.Q6J("ngIf",t.showError("user",i,"pattern")),e.xp6(6),e.Q6J("id","password"+o),e.xp6(1),e.Q6J("cdPasswordButton","password"+o),e.xp6(1),e.Q6J("source","password"+o),e.xp6(1),e.Q6J("ngIf",t.showError("password",i,"required")),e.xp6(1),e.Q6J("ngIf",t.showError("password",i,"pattern")),e.xp6(6),e.Q6J("id","mutual_user"+o),e.xp6(1),e.Q6J("ngIf",t.showError("mutual_user",i,"required")),e.xp6(1),e.Q6J("ngIf",t.showError("mutual_user",i,"pattern")),e.xp6(6),e.Q6J("id","mutual_password"+o),e.xp6(1),e.Q6J("cdPasswordButton","mutual_password"+o),e.xp6(1),e.Q6J("source","mutual_password"+o),e.xp6(1),e.Q6J("ngIf",t.showError("mutual_password",i,"required")),e.xp6(1),e.Q6J("ngIf",t.showError("mutual_password",i,"pattern")),e.xp6(5),e.Q6J("ngForOf",t.getValue("luns")),e.xp6(1),e.Q6J("ngIf",t.getValue("cdIsInGroup")),e.xp6(1),e.Q6J("ngIf",!t.getValue("cdIsInGroup"))}}function _n(n,s){1&n&&(e.TgZ(0,"span",47),e.SDv(1,128),e.qZA())}function an(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",8)(1,"label",85),e.SDv(2,86),e.qZA(),e.TgZ(3,"div",87),e.YNc(4,sn,58,24,"div",88),e.TgZ(5,"div",21)(6,"div",22),e.YNc(7,_n,2,0,"span",17),e.TgZ(8,"button",89),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).addInitiator(),e.KtG(!1)}),e._UZ(9,"i",24),e.ynx(10),e.SDv(11,90),e.BQk(),e.qZA()()(),e._UZ(12,"hr"),e.qZA()()}if(2&n){const t=e.oxw(2);e.xp6(4),e.Q6J("ngForOf",t.initiators.controls),e.xp6(3),e.Q6J("ngIf",0===t.initiators.controls.length),e.xp6(2),e.Q6J("ngClass",e.VKq(3,U,t.icons.add))}}function rn(n,s){if(1&n){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",49),e._UZ(2,"input",50),e.TgZ(3,"button",51),e.NdJ("click",function(){const _=e.CHM(t).index,a=e.oxw(),l=a.$implicit,d=a.index,g=e.oxw(3);return e.KtG(g.removeGroupInitiator(l,_,d))}),e._UZ(4,"i",15),e.qZA()(),e.BQk()}if(2&n){const t=s.$implicit,o=e.oxw(4);e.xp6(2),e.Q6J("value",t),e.xp6(2),e.Q6J("ngClass",e.VKq(2,U,o.icons.destroy))}}function ln(n,s){if(1&n){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",49),e._UZ(2,"input",50),e.TgZ(3,"button",51),e.NdJ("click",function(){const _=e.CHM(t).index,a=e.oxw(),l=a.$implicit,d=a.index,g=e.oxw(3);return e.KtG(g.removeGroupDisk(l,_,d))}),e._UZ(4,"i",15),e.qZA()(),e.BQk()}if(2&n){const t=s.$implicit,o=e.oxw(4);e.xp6(2),e.Q6J("value",t),e.xp6(2),e.Q6J("ngClass",e.VKq(2,U,o.icons.destroy))}}function cn(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",91)(1,"div",5),e.ynx(2),e.SDv(3,132),e.BQk(),e._uU(4),e.TgZ(5,"button",93),e.NdJ("click",function(){const _=e.CHM(t).index,a=e.oxw(3);return e.KtG(a.removeGroup(_))}),e.qZA()(),e.TgZ(6,"div",7)(7,"div",8)(8,"label",133),e.SDv(9,134),e.qZA(),e.TgZ(10,"div",11),e._UZ(11,"input",135),e.qZA()(),e.TgZ(12,"div",8)(13,"label",136),e.ynx(14),e.SDv(15,137),e.BQk(),e.qZA(),e.TgZ(16,"div",11),e.YNc(17,rn,5,4,"ng-container",20),e.TgZ(18,"div",21)(19,"div",22)(20,"cd-select",23),e.NdJ("selection",function(i){const a=e.CHM(t).index,l=e.oxw(3);return e.KtG(l.onGroupMemberSelection(i,a))}),e._UZ(21,"i",24),e.ynx(22),e.SDv(23,138),e.BQk(),e.qZA()()(),e._UZ(24,"hr"),e.qZA()(),e.TgZ(25,"div",8)(26,"label",27),e.ynx(27),e.SDv(28,139),e.BQk(),e.qZA(),e.TgZ(29,"div",11),e.YNc(30,ln,5,4,"ng-container",20),e.TgZ(31,"div",21)(32,"div",22)(33,"cd-select",126),e._UZ(34,"i",24),e.ynx(35),e.SDv(36,140),e.BQk(),e.qZA()()(),e._UZ(37,"hr"),e.qZA()()()()}if(2&n){const t=s.$implicit,o=s.index,i=e.oxw(3);e.Q6J("formGroup",t),e.xp6(4),e.hij(": ",t.getValue("group_id")," "),e.xp6(13),e.Q6J("ngForOf",t.getValue("members")),e.xp6(3),e.Q6J("data",t.getValue("members"))("options",i.groupMembersSelections[o])("messages",i.messages.groupInitiator),e.xp6(1),e.Q6J("ngClass",e.VKq(12,U,i.icons.add)),e.xp6(9),e.Q6J("ngForOf",t.getValue("disks")),e.xp6(3),e.Q6J("data",t.getValue("disks"))("options",i.groupDiskSelections[o])("messages",i.messages.initiatorImage),e.xp6(1),e.Q6J("ngClass",e.VKq(14,U,i.icons.add))}}function dn(n,s){1&n&&(e.TgZ(0,"span",47),e.SDv(1,141),e.qZA())}function pn(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",8)(1,"label",85),e.SDv(2,129),e.qZA(),e.TgZ(3,"div",130),e.YNc(4,cn,38,16,"div",88),e.TgZ(5,"div",21)(6,"div",22),e.YNc(7,dn,2,0,"span",17),e.TgZ(8,"button",89),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).addGroup(),e.KtG(!1)}),e._UZ(9,"i",24),e.ynx(10),e.SDv(11,131),e.BQk(),e.qZA()()()()()}if(2&n){const t=e.oxw(2);e.xp6(4),e.Q6J("ngForOf",t.groups.controls),e.xp6(3),e.Q6J("ngIf",0===t.groups.controls.length),e.xp6(2),e.Q6J("ngClass",e.VKq(3,U,t.icons.add))}}function un(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",1)(1,"form",2,3)(3,"div",4)(4,"div",5),e.SDv(5,6),e.ALo(6,"titlecase"),e.ALo(7,"upperFirst"),e.qZA(),e.TgZ(8,"div",7)(9,"div",8)(10,"label",9),e.SDv(11,10),e.qZA(),e.TgZ(12,"div",11)(13,"div",12),e._UZ(14,"input",13),e.TgZ(15,"button",14),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.targetSettingsModal())}),e._UZ(16,"i",15),e.qZA()(),e.YNc(17,Oo,2,0,"span",16),e.YNc(18,ho,2,0,"span",16),e.YNc(19,Ao,9,0,"span",16),e.YNc(20,Po,2,0,"span",17),e._UZ(21,"hr"),e.qZA()(),e.TgZ(22,"div",8)(23,"label",18),e.SDv(24,19),e.qZA(),e.TgZ(25,"div",11),e.YNc(26,bo,5,4,"ng-container",20),e.TgZ(27,"div",21)(28,"div",22)(29,"cd-select",23),e.NdJ("selection",function(i){e.CHM(t);const _=e.oxw();return e.KtG(_.onPortalSelection(i))}),e._UZ(30,"i",24),e.ynx(31),e.SDv(32,25),e.BQk(),e.qZA()()(),e._UZ(33,"input",26),e.YNc(34,Io,2,1,"span",16),e._UZ(35,"hr"),e.qZA()(),e.TgZ(36,"div",8)(37,"label",27),e.SDv(38,28),e.qZA(),e.TgZ(39,"div",11),e.YNc(40,Lo,11,10,"ng-container",20),e._UZ(41,"input",29),e.YNc(42,vo,2,0,"span",16),e.YNc(43,$o,2,0,"span",16),e.TgZ(44,"div",21)(45,"div",22)(46,"cd-select",23),e.NdJ("selection",function(i){e.CHM(t);const _=e.oxw();return e.KtG(_.onImageSelection(i))}),e._UZ(47,"i",24),e.ynx(48),e.SDv(49,30),e.BQk(),e.qZA()()(),e._UZ(50,"hr"),e.qZA()(),e.TgZ(51,"div",8)(52,"div",31)(53,"div",32),e._UZ(54,"input",33),e.TgZ(55,"label",34),e.SDv(56,35),e.qZA()(),e._UZ(57,"hr"),e.qZA()(),e.YNc(58,Ko,39,8,"div",36),e.YNc(59,an,13,5,"div",37),e.YNc(60,pn,12,5,"div",37),e.qZA(),e.TgZ(61,"div",38)(62,"cd-form-button-panel",39),e.NdJ("submitActionEvent",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.submit())}),e.ALo(63,"titlecase"),e.ALo(64,"upperFirst"),e.qZA()()()()()}if(2&n){const t=e.MAs(2),o=e.oxw();e.xp6(1),e.Q6J("formGroup",o.targetForm),e.xp6(6),e.pQV(e.lcZ(6,26,o.action))(e.lcZ(7,28,o.resource)),e.QtT(5),e.xp6(9),e.Q6J("ngClass",e.VKq(34,U,o.icons.deepCheck)),e.xp6(1),e.Q6J("ngIf",o.targetForm.showError("target_iqn",t,"required")),e.xp6(1),e.Q6J("ngIf",o.targetForm.showError("target_iqn",t,"pattern")),e.xp6(1),e.Q6J("ngIf",o.targetForm.showError("target_iqn",t,"iqn")),e.xp6(1),e.Q6J("ngIf",o.hasAdvancedSettings(o.targetForm.getValue("target_controls"))),e.xp6(6),e.Q6J("ngForOf",o.portals.value),e.xp6(3),e.Q6J("data",o.portals.value)("options",o.portalsSelections)("messages",o.messages.portals),e.xp6(1),e.Q6J("ngClass",e.VKq(36,U,o.icons.add)),e.xp6(4),e.Q6J("ngIf",o.targetForm.showError("portals",t,"minGateways")),e.xp6(6),e.Q6J("ngForOf",o.targetForm.getValue("disks")),e.xp6(2),e.Q6J("ngIf",o.targetForm.showError("disks",t,"dupLunId")),e.xp6(1),e.Q6J("ngIf",o.targetForm.showError("disks",t,"dupWwn")),e.xp6(3),e.Q6J("data",o.disks.value)("options",o.imagesSelections)("messages",o.messages.images),e.xp6(1),e.Q6J("ngClass",e.VKq(38,U,o.icons.add)),e.xp6(11),e.Q6J("ngIf",o.cephIscsiConfigVersion>10&&!o.targetForm.getValue("acl_enabled")),e.xp6(1),e.Q6J("ngIf",o.targetForm.getValue("acl_enabled")),e.xp6(1),e.Q6J("ngIf",o.targetForm.getValue("acl_enabled")),e.xp6(2),e.Q6J("form",o.targetForm)("submitText",e.lcZ(63,30,o.action)+" "+e.lcZ(64,32,o.resource))}}let Ct=(()=>{class n extends k.E{constructor(t,o,i,_,a,l,d){super(),this.iscsiService=t,this.modalService=o,this.rbdService=i,this.router=_,this.route=a,this.taskWrapper=l,this.actionLabels=d,this.api_version=0,this.minimum_gateways=1,this.icons=T.P,this.isEdit=!1,this.portalsSelections=[],this.imagesInitiatorSelections=[],this.groupDiskSelections=[],this.groupMembersSelections=[],this.imagesSettings={},this.messages={portals:new N.a({noOptions:"There are no portals available."}),images:new N.a({noOptions:"There are no images available."}),initiatorImage:new N.a({noOptions:"There are no images available. Please make sure you add an image to the target."}),groupInitiator:new N.a({noOptions:"There are no initiators available. Please make sure you add an initiator to the target."})},this.IQN_REGEX=/^iqn\.(19|20)\d\d-(0[1-9]|1[0-2])\.\D{2,3}(\.[A-Za-z0-9-]+)+(:[A-Za-z0-9-\.]+)*$/,this.USER_REGEX=/^[\w\.:@_-]{8,64}$/,this.PASSWORD_REGEX=/^[\w@\-_\/]{12,16}$/,this.resource="target"}ngOnInit(){const t=new h.E(()=>{});t.pageInfo.limit=-1;const o=[this.iscsiService.listTargets(),this.rbdService.list(t.toParams()),this.iscsiService.portals(),this.iscsiService.settings(),this.iscsiService.version()];this.router.url.startsWith("/block/iscsi/targets/edit")&&(this.isEdit=!0,this.route.params.subscribe(i=>{this.target_iqn=decodeURIComponent(i.target_iqn),o.push(this.iscsiService.getTarget(this.target_iqn))})),this.action=this.isEdit?this.actionLabels.EDIT:this.actionLabels.CREATE,(0,ce.D)(o).subscribe(i=>{const _=C()(i[0]).filter(l=>l.target_iqn!==this.target_iqn).flatMap(l=>l.disks).map(l=>`${l.pool}/${l.image}`).value();"api_version"in i[3]&&(this.api_version=i[3].api_version),this.minimum_gateways=i[3].config.minimum_gateways,this.target_default_controls=i[3].target_default_controls,this.target_controls_limits=i[3].target_controls_limits,this.disk_default_controls=i[3].disk_default_controls,this.disk_controls_limits=i[3].disk_controls_limits,this.backstores=i[3].backstores,this.default_backstore=i[3].default_backstore,this.unsupported_rbd_features=i[3].unsupported_rbd_features,this.required_rbd_features=i[3].required_rbd_features,this.imagesAll=C()(i[1]).flatMap(l=>l.value).filter(l=>!l.namespace&&!(-1!==_.indexOf(`${l.pool_name}/${l.name}`)||0===this.getValidBackstores(l).length)).value(),this.imagesSelections=this.imagesAll.map(l=>new x.$(!1,`${l.pool_name}/${l.name}`,""));const a=[];i[2].forEach(l=>{l.ip_addresses.forEach(d=>{a.push(new x.$(!1,l.name+":"+d,""))})}),this.portalsSelections=[...a],this.cephIscsiConfigVersion=i[4].ceph_iscsi_config_version,this.createForm(),i[5]&&this.resolveModel(i[5]),this.loadingReady()})}createForm(){if(this.targetForm=new Z.d({target_iqn:new r.p4("iqn.2001-07.com.ceph:"+Date.now(),{validators:[r.kI.required,r.kI.pattern(this.IQN_REGEX)]}),target_controls:new r.p4({}),portals:new r.p4([],{validators:[z.h.custom("minGateways",t=>C().uniq(t.map(i=>i.split(":")[0])).length<Math.max(1,this.minimum_gateways))]}),disks:new r.p4([],{validators:[z.h.custom("dupLunId",t=>{const o=this.getLunIds(t);return o.length!==C().uniq(o).length}),z.h.custom("dupWwn",t=>{const o=this.getWwns(t);return o.length!==C().uniq(o).length})]}),initiators:new r.vC([]),groups:new r.vC([]),acl_enabled:new r.p4(!1)}),this.cephIscsiConfigVersion>10){const t=new Z.d({user:new r.p4(""),password:new r.p4(""),mutual_user:new r.p4(""),mutual_password:new r.p4("")});this.setAuthValidator(t),this.targetForm.addControl("auth",t)}}resolveModel(t){this.targetForm.patchValue({target_iqn:t.target_iqn,target_controls:t.target_controls,acl_enabled:t.acl_enabled}),this.cephIscsiConfigVersion>10&&this.targetForm.patchValue({auth:t.auth});const o=[];C().forEach(t.portals,_=>{o.push(`${_.host}:${_.ip}`)}),this.targetForm.patchValue({portals:o});const i=[];C().forEach(t.disks,_=>{const a=`${_.pool}/${_.image}`;i.push(a),this.imagesSettings[a]={backstore:_.backstore},this.imagesSettings[a][_.backstore]=_.controls,"lun"in _&&(this.imagesSettings[a].lun=_.lun),"wwn"in _&&(this.imagesSettings[a].wwn=_.wwn),this.onImageSelection({option:{name:a,selected:!0}})}),this.targetForm.patchValue({disks:i}),C().forEach(t.clients,_=>{const a=this.addInitiator();_.luns=C().map(_.luns,l=>`${l.pool}/${l.image}`),a.patchValue(_)}),t.groups.forEach((_,a)=>{const l=this.addGroup();_.disks=C().map(_.disks,d=>`${d.pool}/${d.image}`),l.patchValue(_),C().forEach(_.members,d=>{this.onGroupMemberSelection({option:new x.$(!0,d,"")},a)})})}hasAdvancedSettings(t){return Object.values(t).length>0}get portals(){return this.targetForm.get("portals")}onPortalSelection(){this.portals.setValue(this.portals.value)}removePortal(t,o){return this.portalsSelections.forEach(i=>{i.name===o&&(i.selected=!1)}),this.portals.value.splice(t,1),this.portals.setValue(this.portals.value),!1}get disks(){return this.targetForm.get("disks")}removeImage(t,o){return this.imagesSelections.forEach(i=>{i.name===o&&(i.selected=!1)}),this.disks.value.splice(t,1),this.removeImageRefs(o),this.targetForm.get("disks").updateValueAndValidity({emitEvent:!1}),!1}removeImageRefs(t){this.initiators.controls.forEach(o=>{const i=o.value.luns.filter(_=>_!==t);o.get("luns").setValue(i)}),this.groups.controls.forEach(o=>{const i=o.value.disks.filter(_=>_!==t);o.get("disks").setValue(i)}),C().forEach(this.imagesInitiatorSelections,(o,i)=>{this.imagesInitiatorSelections[i]=o.filter(_=>_.name!==t)}),C().forEach(this.groupDiskSelections,(o,i)=>{this.groupDiskSelections[i]=o.filter(_=>_.name!==t)})}getDefaultBackstore(t){let o=this.default_backstore;const i=this.getImageById(t);return this.validFeatures(i,this.default_backstore)||this.backstores.forEach(_=>{_!==this.default_backstore&&this.validFeatures(i,_)&&(o=_)}),o}isLunIdInUse(t,o){const i=this.disks.value.filter(_=>_!==o);return this.getLunIds(i).includes(t)}getLunIds(t){return C().map(t,o=>this.imagesSettings[o].lun)}nextLunId(t){const o=this.disks.value.filter(a=>a!==t),i=this.getLunIds(o);let _=0;for(;i.includes(_);)_++;return _}getWwns(t){return C().map(t,i=>this.imagesSettings[i].wwn).filter(i=>C().isString(i)&&""!==i)}onImageSelection(t){const o=t.option;if(o.selected){if(this.imagesSettings[o.name])this.isLunIdInUse(this.imagesSettings[o.name].lun,o.name)&&(this.imagesSettings[o.name].lun=this.nextLunId(o.name));else{const i=this.getDefaultBackstore(o.name);this.imagesSettings[o.name]={backstore:i,lun:this.nextLunId(o.name)},this.imagesSettings[o.name][i]={}}C().forEach(this.imagesInitiatorSelections,(i,_)=>{i.push(new x.$(!1,o.name,"")),this.imagesInitiatorSelections[_]=[...i]}),C().forEach(this.groupDiskSelections,(i,_)=>{i.push(new x.$(!1,o.name,"")),this.groupDiskSelections[_]=[...i]})}else this.removeImageRefs(o.name);this.targetForm.get("disks").updateValueAndValidity({emitEvent:!1})}get initiators(){return this.targetForm.get("initiators")}addInitiator(){const t=new Z.d({client_iqn:new r.p4("",{validators:[r.kI.required,z.h.custom("notUnique",i=>{const _=this.initiators.controls.reduce(function(a,l){return a.concat(l.value.client_iqn)},[]);return _.indexOf(i)!==_.lastIndexOf(i)}),r.kI.pattern(this.IQN_REGEX)]}),auth:new Z.d({user:new r.p4(""),password:new r.p4(""),mutual_user:new r.p4(""),mutual_password:new r.p4("")}),luns:new r.p4([]),cdIsInGroup:new r.p4(!1)});this.setAuthValidator(t),this.initiators.push(t),C().forEach(this.groupMembersSelections,(i,_)=>{i.push(new x.$(!1,"","")),this.groupMembersSelections[_]=[...i]});const o=C().map(this.targetForm.getValue("disks"),i=>new x.$(!1,i,""));return this.imagesInitiatorSelections.push(o),t}setAuthValidator(t){z.h.validateIf(t.get("user"),()=>t.getValue("password")||t.getValue("mutual_user")||t.getValue("mutual_password"),[r.kI.required],[r.kI.pattern(this.USER_REGEX)],[t.get("password"),t.get("mutual_user"),t.get("mutual_password")]),z.h.validateIf(t.get("password"),()=>t.getValue("user")||t.getValue("mutual_user")||t.getValue("mutual_password"),[r.kI.required],[r.kI.pattern(this.PASSWORD_REGEX)],[t.get("user"),t.get("mutual_user"),t.get("mutual_password")]),z.h.validateIf(t.get("mutual_user"),()=>t.getValue("mutual_password"),[r.kI.required],[r.kI.pattern(this.USER_REGEX)],[t.get("user"),t.get("password"),t.get("mutual_password")]),z.h.validateIf(t.get("mutual_password"),()=>t.getValue("mutual_user"),[r.kI.required],[r.kI.pattern(this.PASSWORD_REGEX)],[t.get("user"),t.get("password"),t.get("mutual_user")])}removeInitiator(t){const o=this.initiators.value[t];this.initiators.removeAt(t),C().forEach(this.groupMembersSelections,(i,_)=>{i.splice(t,1),this.groupMembersSelections[_]=[...i]}),this.groups.controls.forEach(i=>{const _=i.value.members.filter(a=>a!==o.client_iqn);i.get("members").setValue(_)}),this.imagesInitiatorSelections.splice(t,1)}updatedInitiatorSelector(){this.initiators.controls.forEach(t=>{t.get("client_iqn").updateValueAndValidity({emitEvent:!1})}),C().forEach(this.groupMembersSelections,(t,o)=>{C().forEach(t,(i,_)=>{const a=i.name;i.name=this.initiators.controls[_].value.client_iqn,this.groups.controls.forEach(l=>{const d=l.value.members,g=d.indexOf(a);-1!==g&&(d[g]=i.name),l.get("members").setValue(d)})}),this.groupMembersSelections[o]=[...this.groupMembersSelections[o]]})}removeInitiatorImage(t,o,i,_){const a=t.getValue("luns");return a.splice(o,1),t.patchValue({luns:a}),this.imagesInitiatorSelections[i].forEach(l=>{l.name===_&&(l.selected=!1)}),!1}get groups(){return this.targetForm.get("groups")}addGroup(){const t=new Z.d({group_id:new r.p4("",{validators:[r.kI.required]}),members:new r.p4([]),disks:new r.p4([])});this.groups.push(t);const o=C().map(this.targetForm.getValue("disks"),_=>new x.$(!1,_,""));this.groupDiskSelections.push(o);const i=C().map(this.initiators.value,_=>new x.$(!1,_.client_iqn,"",!_.cdIsInGroup));return this.groupMembersSelections.push(i),t}removeGroup(t){this.groups.removeAt(t),this.groupMembersSelections[t].filter(i=>i.selected).forEach(i=>{i.selected=!1,this.onGroupMemberSelection({option:i},t)}),this.groupMembersSelections.splice(t,1),this.groupDiskSelections.splice(t,1)}onGroupMemberSelection(t,o){const i=t.option;let _=[];i.selected||(_=this.groupDiskSelections[o].filter(l=>l.selected).map(l=>l.name)),this.initiators.controls.forEach((a,l)=>{a.value.client_iqn===i.name&&(a.patchValue({luns:_}),a.get("cdIsInGroup").setValue(i.selected),C().forEach(this.groupMembersSelections,d=>{d[l].enabled=!i.selected}),this.imagesInitiatorSelections[l].forEach(d=>{d.selected=_.includes(d.name)}))})}removeGroupInitiator(t,o,i){const _=t.getValue("members")[o];t.getValue("members").splice(o,1),this.onGroupMemberSelection({option:new x.$(!1,_,"")},i)}removeGroupDisk(t,o,i){const _=t.getValue("disks")[o];t.getValue("disks").splice(o,1),this.groupDiskSelections[i].forEach(a=>{a.name===_&&(a.selected=!1)}),this.groupDiskSelections[i]=[...this.groupDiskSelections[i]]}submit(){const t=C().cloneDeep(this.targetForm.value),o={target_iqn:this.targetForm.getValue("target_iqn"),target_controls:this.targetForm.getValue("target_controls"),acl_enabled:this.targetForm.getValue("acl_enabled"),portals:[],disks:[],clients:[],groups:[]};if(this.cephIscsiConfigVersion>10){const _=this.targetForm.get("auth");_.getValue("user")||_.get("user").setValue(""),_.getValue("password")||_.get("password").setValue(""),_.getValue("mutual_user")||_.get("mutual_user").setValue(""),_.getValue("mutual_password")||_.get("mutual_password").setValue("");const a=this.targetForm.getValue("acl_enabled");o.auth={user:a?"":_.getValue("user"),password:a?"":_.getValue("password"),mutual_user:a?"":_.getValue("mutual_user"),mutual_password:a?"":_.getValue("mutual_password")}}let i;t.disks.forEach(_=>{const a=_.split("/"),l=this.imagesSettings[_].backstore;o.disks.push({pool:a[0],image:a[1],backstore:l,controls:this.imagesSettings[_][l],lun:this.imagesSettings[_].lun,wwn:this.imagesSettings[_].wwn})}),t.portals.forEach(_=>{const a=_.indexOf(":");o.portals.push({host:_.substring(0,a),ip:_.substring(a+1)})}),o.acl_enabled&&(t.initiators.forEach(_=>{_.auth.user||(_.auth.user=""),_.auth.password||(_.auth.password=""),_.auth.mutual_user||(_.auth.mutual_user=""),_.auth.mutual_password||(_.auth.mutual_password=""),delete _.cdIsInGroup;const a=[];_.luns.forEach(l=>{const d=l.split("/");a.push({pool:d[0],image:d[1]})}),_.luns=a}),o.clients=t.initiators),o.acl_enabled&&(t.groups.forEach(_=>{const a=[];_.disks.forEach(l=>{const d=l.split("/");a.push({pool:d[0],image:d[1]})}),_.disks=a}),o.groups=t.groups),this.isEdit?(o.new_target_iqn=o.target_iqn,o.target_iqn=this.target_iqn,i=this.taskWrapper.wrapTaskAroundCall({task:new E.R("iscsi/target/edit",{target_iqn:o.target_iqn}),call:this.iscsiService.updateTarget(this.target_iqn,o)})):i=this.taskWrapper.wrapTaskAroundCall({task:new E.R("iscsi/target/create",{target_iqn:o.target_iqn}),call:this.iscsiService.createTarget(o)}),i.subscribe({error:()=>{this.targetForm.setErrors({cdSubmitButton:!0})},complete:()=>this.router.navigate(["/block/iscsi/targets"])})}targetSettingsModal(){const t={target_controls:this.targetForm.get("target_controls"),target_default_controls:this.target_default_controls,target_controls_limits:this.target_controls_limits};this.modalRef=this.modalService.show(Ro,t)}imageSettingsModal(t){const o={imagesSettings:this.imagesSettings,image:t,api_version:this.api_version,disk_default_controls:this.disk_default_controls,disk_controls_limits:this.disk_controls_limits,backstores:this.getValidBackstores(this.getImageById(t)),control:this.targetForm.get("disks")};this.modalRef=this.modalService.show(Co,o)}validFeatures(t,o){const i=t.features,_=this.required_rbd_features[o];return(i&_)===_&&0==(i&this.unsupported_rbd_features[o])}getImageById(t){return this.imagesAll.find(o=>t===`${o.pool_name}/${o.name}`)}getValidBackstores(t){return this.backstores.filter(o=>this.validFeatures(t,o))}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(X),e.Y36(pe.Z),e.Y36(H),e.Y36(m.F0),e.Y36(m.gz),e.Y36(u.P),e.Y36(L.p4))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi-target-form"]],features:[e.qOj],decls:1,vars:1,consts:function(){let s,t,o,i,_,a,l,d,g,S,I,P,$,y,Q,Y,ee,te,w,_e,ae,O,me,ge,Te,fe,Ce,Se,Re,G,Ge,ye,xe,Ze,we,He,ke,Ke,qe,Xe,Qe,ze,b,xt,Zt,wt,Ht,kt,Kt,qt,Xt,Qt,zt,Jt,Yt,Vt,Ut,jt,Wt,eo,to,oo;return s="" + "\ufffd0\ufffd" + " " + "\ufffd1\ufffd" + "",t="Target IQN",o="Portals",i="Add portal",_="Images",a="Add image",l="ACL authentication",d="This field is required.",g="IQN has wrong pattern.",S="An IQN has the following notation 'iqn.$year-$month.$reversedAddress:$definedName'",I="For example: iqn.2016-06.org.dashboard:storage:disk.sn-a8675309",P="More information",$="This target has modified advanced settings.",y="At least " + "\ufffd0\ufffd" + " gateways are required.",Q="Backstore: " + "\ufffd0\ufffd" + ".\xA0",Y="This image has modified settings.",ee="Duplicated LUN numbers.",te="Duplicated WWN.",w="User",_e="Password",ae="Mutual User",O="Mutual Password",me="This field is required.",ge="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",Te="This field is required.",fe="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",Ce="This field is required.",Se="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",Re="This field is required.",G="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",Ge="Initiators",ye="Add initiator",xe="Initiator",Ze="Client IQN",we="User",He="Password",ke="Mutual User",Ke="Mutual Password",qe="Images",Xe="Initiator IQN needs to be unique.",Qe="This field is required.",ze="IQN has wrong pattern.",b="This field is required.",xt="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",Zt="This field is required.",wt="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",Ht="This field is required.",kt="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",Kt="This field is required.",qt="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",Xt="Initiator belongs to a group. Images will be configure in the group.",Qt="Add image",zt="No items added.",Jt="Groups",Yt="Add group",Vt="Group",Ut="Name",jt="Initiators",Wt="Add initiator",eo="Images",to="Add image",oo="No items added.",[["class","cd-col-form",4,"cdFormLoading"],[1,"cd-col-form"],["name","targetForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"card"],[1,"card-header"],s,[1,"card-body"],[1,"form-group","row"],["for","target_iqn",1,"cd-col-form-label","required"],t,[1,"cd-col-form-input"],[1,"input-group"],["type","text","id","target_iqn","name","target_iqn","formControlName","target_iqn","cdTrim","",1,"form-control"],["id","ecp-info-button","type","button",1,"btn","btn-light",3,"click"],["aria-hidden","true",3,"ngClass"],["class","invalid-feedback",4,"ngIf"],["class","form-text text-muted",4,"ngIf"],["for","portals",1,"cd-col-form-label","required"],o,[4,"ngFor","ngForOf"],[1,"row"],[1,"col-md-12"],["elemClass","btn btn-light float-end",3,"data","options","messages","selection"],[3,"ngClass"],i,["type","hidden","id","portals","name","portals","formControlName","portals",1,"form-control"],["for","disks",1,"cd-col-form-label"],_,["type","hidden","id","disks","name","disks","formControlName","disks",1,"form-control"],a,[1,"cd-col-form-offset"],[1,"custom-control","custom-checkbox"],["type","checkbox","formControlName","acl_enabled","name","acl_enabled","id","acl_enabled",1,"custom-control-input"],["for","acl_enabled",1,"custom-control-label"],l,["formGroupName","auth",4,"ngIf"],["class","form-group row",4,"ngIf"],[1,"card-footer"],["wrappingClass","text-right",3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],d,g,S,I,["target","_blank","href","https://en.wikipedia.org/wiki/ISCSI#Addressing"],P,[1,"form-text","text-muted"],$,[1,"input-group","cd-mb"],["type","text","disabled","",1,"cd-form-control",3,"value"],["type","button",1,"btn","btn-light",3,"click"],y,["class","input-group-text",4,"ngIf"],[4,"ngIf"],[1,"input-group-text"],Q,Y,ee,te,["formGroupName","auth"],["for","target_user",1,"cd-col-form-label"],w,["type","text","autocomplete","off","id","target_user","name","target_user","formControlName","user",1,"form-control"],["for","target_password",1,"cd-col-form-label"],_e,["type","password","autocomplete","new-password","id","target_password","name","target_password","formControlName","password",1,"form-control"],["type","button","cdPasswordButton","target_password",1,"btn","btn-light"],["source","target_password"],["for","target_mutual_user",1,"cd-col-form-label"],ae,["type","text","autocomplete","off","id","target_mutual_user","name","target_mutual_user","formControlName","mutual_user",1,"form-control"],["for","target_mutual_password",1,"cd-col-form-label"],O,["type","password","autocomplete","new-password","id","target_mutual_password","name","target_mutual_password","formControlName","mutual_password",1,"form-control"],["type","button","cdPasswordButton","target_mutual_password",1,"btn","btn-light"],["source","target_mutual_password"],me,ge,Te,fe,Ce,Se,Re,G,["for","initiators",1,"cd-col-form-label"],Ge,["formArrayName","initiators",1,"cd-col-form-input"],["class","card mb-2",3,"formGroup",4,"ngFor","ngForOf"],[1,"btn","btn-light","float-end",3,"click"],ye,[1,"card","mb-2",3,"formGroup"],xe,["type","button",1,"btn-close","float-end",3,"click"],["for","client_iqn",1,"cd-col-form-label","required"],Ze,["type","text","formControlName","client_iqn","cdTrim","",1,"form-control",3,"blur"],["for","user",1,"cd-col-form-label"],we,["formControlName","user","autocomplete","off","type","text",1,"form-control",3,"id"],["for","password",1,"cd-col-form-label"],He,["formControlName","password","autocomplete","new-password","type","password",1,"form-control",3,"id"],["type","button",1,"btn","btn-light",3,"cdPasswordButton"],[3,"source"],["for","mutual_user",1,"cd-col-form-label"],ke,["formControlName","mutual_user","autocomplete","off","type","text",1,"form-control",3,"id"],["for","mutual_password",1,"cd-col-form-label"],Ke,["formControlName","mutual_password","autocomplete","new-password","type","password",1,"form-control",3,"id"],["for","luns",1,"cd-col-form-label"],qe,["class","row",4,"ngIf"],Xe,Qe,ze,b,xt,Zt,wt,Ht,kt,Kt,qt,Xt,["elemClass","btn btn-light float-end",3,"data","options","messages"],Qt,zt,Jt,["formArrayName","groups",1,"cd-col-form-input"],Yt,Vt,["for","group_id",1,"cd-col-form-label","required"],Ut,["type","text","formControlName","group_id",1,"form-control"],["for","members",1,"cd-col-form-label"],jt,Wt,eo,to,oo]},template:function(t,o){1&t&&e.YNc(0,un,65,40,"div",0),2&t&&e.Q6J("cdFormLoading",o.loading)},dependencies:[c.mk,c.sg,c.O5,r._Y,r.Fj,r.Wl,r.JJ,r.JL,r.sg,r.u,r.x0,r.CE,Eo.H,Ye.s,A.p,Tt.C,Mo,ft.y,M.o,B.b,K.P,J.V,c.rS,Je.V,ot.m],styles:[".cd-mb[_ngcontent-%COMP%]{margin-bottom:10px}"]}),n})();var St=p(68136),ue=p(30982),W=p(59019),Le=p(99466),Ee=p(68774),Rt=p(55657),de=p(38047),nt=p(18001),ve=p(97161),oe=p(47640);function mn(n,s){1&n&&(e.TgZ(0,"span",29),e.SDv(1,30),e.qZA())}function gn(n,s){1&n&&(e.TgZ(0,"span",29),e.SDv(1,31),e.qZA())}function Tn(n,s){1&n&&(e.TgZ(0,"span",29),e.SDv(1,32),e.qZA())}function fn(n,s){1&n&&(e.TgZ(0,"span",29),e.SDv(1,33),e.qZA())}function Cn(n,s){1&n&&(e.TgZ(0,"span",29),e.SDv(1,34),e.qZA())}function Sn(n,s){1&n&&(e.TgZ(0,"span",29),e.SDv(1,35),e.qZA())}function Rn(n,s){1&n&&(e.TgZ(0,"span",29),e.SDv(1,36),e.qZA())}function En(n,s){1&n&&(e.TgZ(0,"span",29),e.SDv(1,37),e.qZA())}let Mn=(()=>{class n{constructor(t,o,i,_,a){this.authStorageService=t,this.activeModal=o,this.actionLabels=i,this.iscsiService=_,this.notificationService=a,this.USER_REGEX=/^[\w\.:@_-]{8,64}$/,this.PASSWORD_REGEX=/^[\w@\-_\/]{12,16}$/,this.permission=this.authStorageService.getPermissions().iscsi}ngOnInit(){this.hasPermission=this.permission.update,this.createForm(),this.iscsiService.getDiscovery().subscribe(t=>{this.discoveryForm.patchValue(t)})}createForm(){this.discoveryForm=new Z.d({user:new r.p4({value:"",disabled:!this.hasPermission}),password:new r.p4({value:"",disabled:!this.hasPermission}),mutual_user:new r.p4({value:"",disabled:!this.hasPermission}),mutual_password:new r.p4({value:"",disabled:!this.hasPermission})}),z.h.validateIf(this.discoveryForm.get("user"),()=>this.discoveryForm.getValue("password")||this.discoveryForm.getValue("mutual_user")||this.discoveryForm.getValue("mutual_password"),[r.kI.required],[r.kI.pattern(this.USER_REGEX)],[this.discoveryForm.get("password"),this.discoveryForm.get("mutual_user"),this.discoveryForm.get("mutual_password")]),z.h.validateIf(this.discoveryForm.get("password"),()=>this.discoveryForm.getValue("user")||this.discoveryForm.getValue("mutual_user")||this.discoveryForm.getValue("mutual_password"),[r.kI.required],[r.kI.pattern(this.PASSWORD_REGEX)],[this.discoveryForm.get("user"),this.discoveryForm.get("mutual_user"),this.discoveryForm.get("mutual_password")]),z.h.validateIf(this.discoveryForm.get("mutual_user"),()=>this.discoveryForm.getValue("mutual_password"),[r.kI.required],[r.kI.pattern(this.USER_REGEX)],[this.discoveryForm.get("user"),this.discoveryForm.get("password"),this.discoveryForm.get("mutual_password")]),z.h.validateIf(this.discoveryForm.get("mutual_password"),()=>this.discoveryForm.getValue("mutual_user"),[r.kI.required],[r.kI.pattern(this.PASSWORD_REGEX)],[this.discoveryForm.get("user"),this.discoveryForm.get("password"),this.discoveryForm.get("mutual_user")])}submitAction(){this.iscsiService.updateDiscovery(this.discoveryForm.value).subscribe(()=>{this.notificationService.show(nt.k.success,"Updated discovery authentication"),this.activeModal.close()},()=>{this.discoveryForm.setErrors({cdSubmitButton:!0})})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(F.Kz),e.Y36(L.p4),e.Y36(X),e.Y36(ve.g))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi-target-discovery-modal"]],decls:44,vars:13,consts:function(){let s,t,o,i,_,a,l,d,g,S,I,P,$;return s="Discovery Authentication",t="User",o="Password",i="Mutual User",_="Mutual Password",a="This field is required.",l="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",d="This field is required.",g="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",S="This field is required.",I="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",P="This field is required.",$="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",[[3,"modalRef"],[1,"modal-title"],s,[1,"modal-content"],["name","discoveryForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"form-group","row"],["for","user",1,"cd-col-form-label"],t,[1,"cd-col-form-input"],["id","user","formControlName","user","type","text","autocomplete","off",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["for","password",1,"cd-col-form-label"],o,[1,"input-group"],["id","password","formControlName","password","type","password","autocomplete","new-password",1,"form-control"],["type","button","cdPasswordButton","password",1,"btn","btn-light"],["source","password"],["for","mutual_user",1,"cd-col-form-label"],i,["id","mutual_user","formControlName","mutual_user","type","text","autocomplete","off",1,"form-control"],["for","mutual_password",1,"cd-col-form-label"],_,["id","mutual_password","formControlName","mutual_password","type","password","autocomplete","new-password",1,"form-control"],["type","button","cdPasswordButton","mutual_password",1,"btn","btn-light"],["source","mutual_password"],[1,"modal-footer"],[3,"form","showSubmit","submitText","submitActionEvent"],[1,"invalid-feedback"],a,l,d,g,S,I,P,$]},template:function(t,o){if(1&t&&(e.TgZ(0,"cd-modal",0),e.ynx(1,1),e.SDv(2,2),e.BQk(),e.ynx(3,3),e.TgZ(4,"form",4,5)(6,"div",6)(7,"div",7)(8,"label",8),e.SDv(9,9),e.qZA(),e.TgZ(10,"div",10),e._UZ(11,"input",11),e.YNc(12,mn,2,0,"span",12),e.YNc(13,gn,2,0,"span",12),e.qZA()(),e.TgZ(14,"div",7)(15,"label",13),e.SDv(16,14),e.qZA(),e.TgZ(17,"div",10)(18,"div",15),e._UZ(19,"input",16)(20,"button",17)(21,"cd-copy-2-clipboard-button",18),e.qZA(),e.YNc(22,Tn,2,0,"span",12),e.YNc(23,fn,2,0,"span",12),e.qZA()(),e.TgZ(24,"div",7)(25,"label",19),e.ynx(26),e.SDv(27,20),e.BQk(),e.qZA(),e.TgZ(28,"div",10),e._UZ(29,"input",21),e.YNc(30,Cn,2,0,"span",12),e.YNc(31,Sn,2,0,"span",12),e.qZA()(),e.TgZ(32,"div",7)(33,"label",22),e.SDv(34,23),e.qZA(),e.TgZ(35,"div",10)(36,"div",15),e._UZ(37,"input",24)(38,"button",25)(39,"cd-copy-2-clipboard-button",26),e.qZA(),e.YNc(40,Rn,2,0,"span",12),e.YNc(41,En,2,0,"span",12),e.qZA()()(),e.TgZ(42,"div",27)(43,"cd-form-button-panel",28),e.NdJ("submitActionEvent",function(){return o.submitAction()}),e.qZA()()(),e.BQk(),e.qZA()),2&t){const i=e.MAs(5);e.Q6J("modalRef",o.activeModal),e.xp6(4),e.Q6J("formGroup",o.discoveryForm),e.xp6(8),e.Q6J("ngIf",o.discoveryForm.showError("user",i,"required")),e.xp6(1),e.Q6J("ngIf",o.discoveryForm.showError("user",i,"pattern")),e.xp6(9),e.Q6J("ngIf",o.discoveryForm.showError("password",i,"required")),e.xp6(1),e.Q6J("ngIf",o.discoveryForm.showError("password",i,"pattern")),e.xp6(7),e.Q6J("ngIf",o.discoveryForm.showError("mutual_user",i,"required")),e.xp6(1),e.Q6J("ngIf",o.discoveryForm.showError("mutual_user",i,"pattern")),e.xp6(9),e.Q6J("ngIf",o.discoveryForm.showError("mutual_password",i,"required")),e.xp6(1),e.Q6J("ngIf",o.discoveryForm.showError("mutual_password",i,"pattern")),e.xp6(2),e.Q6J("form",o.discoveryForm)("showSubmit",o.hasPermission)("submitText",o.actionLabels.SUBMIT)}},dependencies:[c.O5,r._Y,r.Fj,r.JJ,r.JL,r.sg,r.u,f.z,Ye.s,A.p,Tt.C,M.o,B.b,K.P,J.V]}),n})();var On=p(86969),it=p(34501),hn=p(30490),Me=p(94928);let Et=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi-tabs"]],decls:7,vars:0,consts:function(){let s,t;return s="Overview",t="Targets",[[1,"nav","nav-tabs"],[1,"nav-item"],["routerLink","/block/iscsi/overview","routerLinkActive","active","ariaCurrentWhenActive","page",1,"nav-link"],s,["routerLink","/block/iscsi/targets","routerLinkActive","active","ariaCurrentWhenActive","page",1,"nav-link"],t]},template:function(t,o){1&t&&(e.TgZ(0,"ul",0)(1,"li",1)(2,"a",2),e.SDv(3,3),e.qZA()(),e.TgZ(4,"li",1)(5,"a",4),e.SDv(6,5),e.qZA()()())},dependencies:[m.rH,m.Od]}),n})();var An=p(68962);const Pn=["highlightTpl"],bn=["detailTable"],In=["tree"],Nn=function(){return["logged_in"]},Fn=function(){return["logged_out"]},Dn=function(n,s){return{"badge-success":n,"badge-danger":s}};function Ln(n,s){if(1&n&&(e._UZ(0,"i"),e.TgZ(1,"span"),e._uU(2),e.qZA(),e._uU(3," \xa0 "),e.TgZ(4,"span",8),e._uU(5),e.qZA()),2&n){const t=s.$implicit;e.Tol(t.data.cdIcon),e.xp6(2),e.Oqu(t.data.name),e.xp6(2),e.Q6J("ngClass",e.WLB(7,Dn,e.DdM(5,Nn).includes(t.data.status),e.DdM(6,Fn).includes(t.data.status))),e.xp6(1),e.hij(" ",t.data.status," ")}}function vn(n,s){if(1&n&&(e.TgZ(0,"div",9)(1,"legend"),e._uU(2),e.qZA(),e._UZ(3,"cd-table",10,11),e.qZA()),2&n){const t=e.oxw();e.xp6(2),e.Oqu(t.title),e.xp6(1),e.Q6J("data",t.data)("columns",t.columns)("limit",0)}}function $n(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.Oqu(t)}}function Bn(n,s){if(1&n&&(e.TgZ(0,"strong"),e._uU(1),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.Oqu(t)}}function Gn(n,s){if(1&n&&(e.YNc(0,$n,2,1,"span",12),e.YNc(1,Bn,2,1,"strong",12)),2&n){const t=s.row;e.Q6J("ngIf",void 0===t.default||t.default===t.current),e.xp6(1),e.Q6J("ngIf",void 0!==t.default&&t.default!==t.current)}}let yn=(()=>{class n{set content(t){this.detailTable=t,t&&t.updateColumns()}constructor(t,o){this.iscsiBackstorePipe=t,this.booleanTextPipe=o,this.icons=T.P,this.metadata={},this.nodes=[],this.treeOptions={useVirtualScroll:!0,actionMapping:{mouse:{click:this.onNodeSelected.bind(this)}}}}ngOnInit(){this.columns=[{prop:"displayName",name:"Name",flexGrow:1,cellTemplate:this.highlightTpl},{prop:"current",name:"Current",flexGrow:1,cellTemplate:this.highlightTpl},{prop:"default",name:"Default",flexGrow:1,cellTemplate:this.highlightTpl}]}ngOnChanges(){this.selection&&(this.selectedItem=this.selection,this.generateTree()),this.data=void 0}generateTree(){const t=C().cloneDeep(this.selectedItem.target_controls);this.cephIscsiConfigVersion>10&&C().extend(t,C().cloneDeep(this.selectedItem.auth)),this.metadata={root:t};const o={target:{expanded:C().join(this.selectedItem.cdExecuting?[T.P.large,T.P.spinner,T.P.spin]:[T.P.large,T.P.bullseye]," ")},initiators:{expanded:C().join([T.P.large,T.P.user]," "),leaf:C().join([T.P.user]," ")},groups:{expanded:C().join([T.P.large,T.P.users]," "),leaf:C().join([T.P.users]," ")},disks:{expanded:C().join([T.P.large,T.P.disk]," "),leaf:C().join([T.P.disk]," ")},portals:{expanded:C().join([T.P.large,T.P.server]," "),leaf:C().join([T.P.server]," ")}},i=[];C().forEach(this.selectedItem.disks,d=>{const g="disk_"+d.pool+"_"+d.image;this.metadata[g]={controls:d.controls,backstore:d.backstore},["wwn","lun"].forEach(S=>{S in d&&(this.metadata[g][S]=d[S])}),i.push({name:`${d.pool}/${d.image}`,cdId:g,cdIcon:o.disks.leaf})});const _=[];C().forEach(this.selectedItem.portals,d=>{_.push({name:`${d.host}:${d.ip}`,cdIcon:o.portals.leaf})});const a=[];C().forEach(this.selectedItem.clients,d=>{const g=C().cloneDeep(d.auth);d.info&&(C().extend(g,d.info),delete g.state,C().forEach(Object.keys(d.info.state),P=>{g[P.toLowerCase()]=d.info.state[P]})),this.metadata["client_"+d.client_iqn]=g;const S=[];d.luns.forEach(P=>{S.push({name:`${P.pool}/${P.image}`,cdId:"disk_"+P.pool+"_"+P.image,cdIcon:o.disks.leaf})});let I="";d.info&&(I=Object.keys(d.info.state).includes("LOGGED_IN")?"logged_in":"logged_out"),a.push({name:d.client_iqn,status:I,cdId:"client_"+d.client_iqn,children:S,cdIcon:o.initiators.leaf})});const l=[];C().forEach(this.selectedItem.groups,d=>{const g=[];d.disks.forEach(I=>{g.push({name:`${I.pool}/${I.image}`,cdId:"disk_"+I.pool+"_"+I.image,cdIcon:o.disks.leaf})});const S=[];d.members.forEach(I=>{S.push({name:I,cdId:"client_"+I})}),l.push({name:d.group_id,cdIcon:o.groups.leaf,children:[{name:"Disks",children:g,cdIcon:o.disks.expanded},{name:"Initiators",children:S,cdIcon:o.initiators.expanded}]})}),this.nodes=[{name:this.selectedItem.target_iqn,cdId:"root",isExpanded:!0,cdIcon:o.target.expanded,children:[{name:"Disks",isExpanded:!0,children:i,cdIcon:o.disks.expanded},{name:"Portals",isExpanded:!0,children:_,cdIcon:o.portals.expanded},{name:"Initiators",isExpanded:!0,children:a,cdIcon:o.initiators.expanded},{name:"Groups",isExpanded:!0,children:l,cdIcon:o.groups.expanded}]}]}format(t){return"boolean"==typeof t?this.booleanTextPipe.transform(t):t}onNodeSelected(t,o){if(ne.iM.ACTIVATE(t,o,!0),o.data.cdId){this.title=o.data.name;const i=this.metadata[o.data.cdId]||{};"root"===o.data.cdId?(this.detailTable?.toggleColumn({prop:"default",isHidden:!0}),this.data=C().map(this.settings.target_default_controls,(_,a)=>({displayName:a,default:_=this.format(_),current:C().isUndefined(i[a])?_:this.format(i[a])})),this.cephIscsiConfigVersion>10&&["user","password","mutual_user","mutual_password"].forEach(_=>{this.data.push({displayName:_,default:null,current:i[_]})})):o.data.cdId.toString().startsWith("disk_")?(this.detailTable?.toggleColumn({prop:"default",isHidden:!0}),this.data=C().map(this.settings.disk_default_controls[i.backstore],(_,a)=>({displayName:a,default:_=this.format(_),current:C().isUndefined(i.controls[a])?_:this.format(i.controls[a])})),this.data.push({displayName:"backstore",default:this.iscsiBackstorePipe.transform(this.settings.default_backstore),current:this.iscsiBackstorePipe.transform(i.backstore)}),["wwn","lun"].forEach(_=>{_ in i&&this.data.push({displayName:_,default:void 0,current:i[_]})})):(this.detailTable?.toggleColumn({prop:"default",isHidden:!1}),this.data=C().map(i,(_,a)=>({displayName:a,default:void 0,current:this.format(_)})))}else this.data=void 0;this.detailTable?.updateColumns()}onUpdateData(){this.tree.treeModel.expandAll()}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(Je.V),e.Y36(An.T))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi-target-details"]],viewQuery:function(t,o){if(1&t&&(e.Gf(Pn,7),e.Gf(bn,5),e.Gf(In,5)),2&t){let i;e.iGM(i=e.CRH())&&(o.highlightTpl=i.first),e.iGM(i=e.CRH())&&(o.content=i.first),e.iGM(i=e.CRH())&&(o.tree=i.first)}},inputs:{selection:"selection",settings:"settings",cephIscsiConfigVersion:"cephIscsiConfigVersion"},features:[e.TTD],decls:11,vars:3,consts:function(){let s;return s="iSCSI Topology",[[1,"row"],[1,"col-6"],s,[3,"nodes","options","updateData"],["tree",""],["treeNodeTemplate",""],["class","col-6 metadata",4,"ngIf"],["highlightTpl",""],[1,"badge",3,"ngClass"],[1,"col-6","metadata"],["columnMode","flex",3,"data","columns","limit"],["detailTable",""],[4,"ngIf"]]},template:function(t,o){1&t&&(e.TgZ(0,"div",0)(1,"div",1)(2,"legend"),e.SDv(3,2),e.qZA(),e.TgZ(4,"tree-root",3,4),e.NdJ("updateData",function(){return o.onUpdateData()}),e.YNc(6,Ln,6,10,"ng-template",null,5,e.W1O),e.qZA()(),e.YNc(8,vn,5,4,"div",6),e.qZA(),e.YNc(9,Gn,2,2,"ng-template",null,7,e.W1O)),2&t&&(e.xp6(4),e.Q6J("nodes",o.nodes)("options",o.treeOptions),e.xp6(4),e.Q6J("ngIf",o.data))},dependencies:[c.mk,c.O5,W.a,ne.qr]}),n})();function xn(n,s){if(1&n&&(e.ynx(0),e._UZ(1,"br"),e.TgZ(2,"span"),e.SDv(3,6),e.qZA(),e.TgZ(4,"pre"),e._uU(5),e.qZA(),e.BQk()),2&n){const t=e.oxw(2);e.xp6(5),e.Oqu(t.status)}}function Zn(n,s){if(1&n&&(e.TgZ(0,"cd-alert-panel",2),e.ynx(1),e.tHW(2,3),e._UZ(3,"cd-doc",4),e.N_p(),e.BQk(),e.YNc(4,xn,6,1,"ng-container",5),e.qZA()),2&n){const t=e.oxw();e.xp6(4),e.Q6J("ngIf",t.status)}}function wn(n,s){if(1&n&&e._UZ(0,"cd-iscsi-target-details",15),2&n){const t=e.oxw(2);e.Q6J("cephIscsiConfigVersion",t.cephIscsiConfigVersion)("selection",t.expandedRow)("settings",t.settings)}}const Hn=function(n){return[n]};function kn(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"cd-table",7,8),e.NdJ("fetchData",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.getTargets())})("setExpandedRow",function(i){e.CHM(t);const _=e.oxw();return e.KtG(_.setExpandedRow(i))})("updateSelection",function(i){e.CHM(t);const _=e.oxw();return e.KtG(_.updateSelection(i))}),e.TgZ(2,"div",9),e._UZ(3,"cd-table-actions",10),e.TgZ(4,"button",11),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.configureDiscoveryAuth())}),e._UZ(5,"i",12),e.ynx(6),e.SDv(7,13),e.BQk(),e.qZA()(),e.YNc(8,wn,1,3,"cd-iscsi-target-details",14),e.qZA()}if(2&n){const t=e.oxw();e.Q6J("data",t.targets)("columns",t.columns)("hasDetails",!0)("autoReload",!1)("status",t.tableStatus),e.xp6(3),e.Q6J("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions),e.xp6(2),e.Q6J("ngClass",e.VKq(10,Hn,t.icons.key)),e.xp6(3),e.Q6J("ngIf",t.expandedRow)}}let Kn=(()=>{class n extends St.o{constructor(t,o,i,_,a,l,d,g,S){super(S),this.authStorageService=t,this.iscsiService=o,this.joinPipe=i,this.taskListService=_,this.notAvailablePipe=a,this.modalService=l,this.taskWrapper=d,this.actionLabels=g,this.ngZone=S,this.available=void 0,this.selection=new Ee.r,this.targets=[],this.icons=T.P,this.builders={"iscsi/target/create":I=>({target_iqn:I.target_iqn})},this.permission=this.authStorageService.getPermissions().iscsi,this.tableActions=[{permission:"create",icon:T.P.add,routerLink:()=>"/block/iscsi/targets/create",name:this.actionLabels.CREATE},{permission:"update",icon:T.P.edit,routerLink:()=>`/block/iscsi/targets/edit/${this.selection.first().target_iqn}`,name:this.actionLabels.EDIT,disable:()=>this.getEditDisableDesc()},{permission:"delete",icon:T.P.destroy,click:()=>this.deleteIscsiTargetModal(),name:this.actionLabels.DELETE,disable:()=>this.getDeleteDisableDesc()}]}ngOnInit(){this.columns=[{name:"Target",prop:"target_iqn",flexGrow:2,cellTransformation:Le.e.executing},{name:"Portals",prop:"cdPortals",pipe:this.joinPipe,flexGrow:2},{name:"Images",prop:"cdImages",pipe:this.joinPipe,flexGrow:2},{name:"# Sessions",prop:"info.num_sessions",pipe:this.notAvailablePipe,flexGrow:1}],this.iscsiService.status().subscribe(t=>{this.available=t.available,t.available||(this.status=t.message)})}getTargets(){this.available&&(this.setTableRefreshTimeout(),this.iscsiService.version().subscribe(t=>{this.cephIscsiConfigVersion=t.ceph_iscsi_config_version}),this.taskListService.init(()=>this.iscsiService.listTargets(),t=>this.prepareResponse(t),t=>this.targets=t,()=>this.onFetchError(),this.taskFilter,this.itemFilter,this.builders),this.iscsiService.settings().subscribe(t=>{this.settings=t}))}ngOnDestroy(){this.summaryDataSubscription&&this.summaryDataSubscription.unsubscribe()}getEditDisableDesc(){const t=this.selection.first();return t&&t?.cdExecuting?t.cdExecuting:t&&C().isUndefined(t?.info)?"Unavailable gateway(s)":!t}getDeleteDisableDesc(){const t=this.selection.first();return t?.cdExecuting?t.cdExecuting:t&&C().isUndefined(t?.info)?"Unavailable gateway(s)":t&&t?.info?.num_sessions?"Target has active sessions":!t}prepareResponse(t){return t.forEach(o=>{o.cdPortals=o.portals.map(i=>`${i.host}:${i.ip}`),o.cdImages=o.disks.map(i=>`${i.pool}/${i.image}`)}),t}onFetchError(){this.table.reset()}itemFilter(t,o){return t.target_iqn===o.metadata.target_iqn}taskFilter(t){return["iscsi/target/create","iscsi/target/edit","iscsi/target/delete"].includes(t.name)}updateSelection(t){this.selection=t}deleteIscsiTargetModal(){const t=this.selection.first().target_iqn;this.modalRef=this.modalService.show(ue.M,{itemDescription:"iSCSI target",itemNames:[t],submitActionObservable:()=>this.taskWrapper.wrapTaskAroundCall({task:new E.R("iscsi/target/delete",{target_iqn:t}),call:this.iscsiService.deleteTarget(t)})})}configureDiscoveryAuth(){this.modalService.show(Mn)}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(X),e.Y36(On.A),e.Y36(de.j),e.Y36(Rt.g),e.Y36(pe.Z),e.Y36(u.P),e.Y36(L.p4),e.Y36(e.R0b))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi-target-list"]],viewQuery:function(t,o){if(1&t&&e.Gf(W.a,5),2&t){let i;e.iGM(i=e.CRH())&&(o.table=i.first)}},features:[e._Bn([de.j]),e.qOj],decls:3,vars:2,consts:function(){let s,t,o,i;return s="iSCSI Targets not available",t="Please consult the " + "\ufffd#3\ufffd" + "" + "\ufffd/#3\ufffd" + " on how to configure and enable the iSCSI Targets management functionality.",o="Available information:",i="Discovery authentication",[["type","info","title",s,4,"ngIf"],["columnMode","flex","identifier","target_iqn","forceIdentifier","true","selectionType","single",3,"data","columns","hasDetails","autoReload","status","fetchData","setExpandedRow","updateSelection",4,"ngIf"],["type","info","title",s],t,["section","iscsi"],[4,"ngIf"],o,["columnMode","flex","identifier","target_iqn","forceIdentifier","true","selectionType","single",3,"data","columns","hasDetails","autoReload","status","fetchData","setExpandedRow","updateSelection"],["table",""],[1,"table-actions","btn-toolbar"],[1,"btn-group",3,"permission","selection","tableActions"],["type","button",1,"btn","btn-light",3,"click"],["aria-hidden","true",3,"ngClass"],i,["cdTableDetail","",3,"cephIscsiConfigVersion","selection","settings",4,"ngIf"],["cdTableDetail","",3,"cephIscsiConfigVersion","selection","settings"]]},template:function(t,o){1&t&&(e._UZ(0,"cd-iscsi-tabs"),e.YNc(1,Zn,5,1,"cd-alert-panel",0),e.YNc(2,kn,9,12,"cd-table",1)),2&t&&(e.xp6(1),e.Q6J("ngIf",!1===o.available),e.xp6(1),e.Q6J("ngIf",!0===o.available))},dependencies:[c.mk,c.O5,it.G,hn.K,W.a,Me.K,M.o,Et,yn]}),n})();var st=p(66369),qn=p(76446),Xn=p(90068);const Qn=["iscsiSparklineTpl"],zn=["iscsiPerSecondTpl"],Jn=["iscsiRelativeDateTpl"];function Yn(n,s){if(1&n&&(e.TgZ(0,"span"),e._UZ(1,"cd-sparkline",9),e.qZA()),2&n){const t=e.oxw(),o=t.value,i=t.row;e.xp6(1),e.Q6J("data",o)("isBinary",i.cdIsBinary)}}function Vn(n,s){1&n&&(e.TgZ(0,"span",10),e._uU(1," n/a "),e.qZA())}function Un(n,s){if(1&n&&(e.YNc(0,Yn,2,2,"span",7),e.YNc(1,Vn,2,0,"span",8)),2&n){const t=s.row;e.Q6J("ngIf","user:rbd"===t.backstore),e.xp6(1),e.Q6J("ngIf","user:rbd"!==t.backstore)}}function jn(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.hij(" ",t," /s ")}}function Wn(n,s){1&n&&(e.TgZ(0,"span",10),e._uU(1," n/a "),e.qZA())}function ei(n,s){if(1&n&&(e.YNc(0,jn,2,1,"span",7),e.YNc(1,Wn,2,0,"span",8)),2&n){const t=s.row;e.Q6J("ngIf","user:rbd"===t.backstore),e.xp6(1),e.Q6J("ngIf","user:rbd"!==t.backstore)}}function ti(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"notAvailable"),e.ALo(3,"relativeDate"),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.hij(" ",e.lcZ(2,1,e.lcZ(3,3,t))," ")}}function oi(n,s){1&n&&(e.TgZ(0,"span",10),e._uU(1," n/a "),e.qZA())}function ni(n,s){if(1&n&&(e.YNc(0,ti,4,5,"span",7),e.YNc(1,oi,2,0,"span",8)),2&n){const t=s.row;e.Q6J("ngIf","user:rbd"===t.backstore),e.xp6(1),e.Q6J("ngIf","user:rbd"!==t.backstore)}}let ii=(()=>{class n{constructor(t,o,i){this.iscsiService=t,this.dimlessPipe=o,this.iscsiBackstorePipe=i,this.gateways=[],this.images=[]}ngOnInit(){this.gatewaysColumns=[{name:"Name",prop:"name"},{name:"State",prop:"state",flexGrow:1,cellTransformation:Le.e.badge,customTemplateConfig:{map:{up:{class:"badge-success"},down:{class:"badge-danger"}}}},{name:"# Targets",prop:"num_targets"},{name:"# Sessions",prop:"num_sessions"}],this.imagesColumns=[{name:"Pool",prop:"pool"},{name:"Image",prop:"image"},{name:"Backstore",prop:"backstore",pipe:this.iscsiBackstorePipe},{name:"Read Bytes",prop:"stats_history.rd_bytes",cellTemplate:this.iscsiSparklineTpl},{name:"Write Bytes",prop:"stats_history.wr_bytes",cellTemplate:this.iscsiSparklineTpl},{name:"Read Ops",prop:"stats.rd",pipe:this.dimlessPipe,cellTemplate:this.iscsiPerSecondTpl},{name:"Write Ops",prop:"stats.wr",pipe:this.dimlessPipe,cellTemplate:this.iscsiPerSecondTpl},{name:"A/O Since",prop:"optimized_since",cellTemplate:this.iscsiRelativeDateTpl}]}refresh(){this.iscsiService.overview().subscribe(t=>{this.gateways=t.gateways,this.images=t.images,this.images.map(o=>(o.stats_history&&(o.stats_history.rd_bytes=o.stats_history.rd_bytes.map(i=>i[1]),o.stats_history.wr_bytes=o.stats_history.wr_bytes.map(i=>i[1])),o.cdIsBinary=!0,o))})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(X),e.Y36(st.n),e.Y36(Je.V))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi"]],viewQuery:function(t,o){if(1&t&&(e.Gf(Qn,7),e.Gf(zn,7),e.Gf(Jn,7)),2&t){let i;e.iGM(i=e.CRH())&&(o.iscsiSparklineTpl=i.first),e.iGM(i=e.CRH())&&(o.iscsiPerSecondTpl=i.first),e.iGM(i=e.CRH())&&(o.iscsiRelativeDateTpl=i.first)}},decls:15,vars:4,consts:function(){let s,t;return s="Gateways",t="Images",[s,[3,"data","columns","fetchData"],t,[3,"data","columns"],["iscsiSparklineTpl",""],["iscsiPerSecondTpl",""],["iscsiRelativeDateTpl",""],[4,"ngIf"],["class","text-muted",4,"ngIf"],[3,"data","isBinary"],[1,"text-muted"]]},template:function(t,o){1&t&&(e._UZ(0,"cd-iscsi-tabs"),e.TgZ(1,"legend"),e.SDv(2,0),e.qZA(),e.TgZ(3,"div")(4,"cd-table",1),e.NdJ("fetchData",function(){return o.refresh()}),e.qZA()(),e.TgZ(5,"legend"),e.SDv(6,2),e.qZA(),e.TgZ(7,"div"),e._UZ(8,"cd-table",3),e.qZA(),e.YNc(9,Un,2,2,"ng-template",null,4,e.W1O),e.YNc(11,ei,2,2,"ng-template",null,5,e.W1O),e.YNc(13,ni,2,2,"ng-template",null,6,e.W1O)),2&t&&(e.xp6(4),e.Q6J("data",o.gateways)("columns",o.gatewaysColumns),e.xp6(4),e.Q6J("data",o.images)("columns",o.imagesColumns))},dependencies:[c.O5,qn.l,W.a,Et,Xn.h,Rt.g]}),n})(),si=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=e.oAB({type:n}),n.\u0275inj=e.cJS({imports:[c.ez,Pe.m,F.Oz,m.Bz,r.u5,r.UX,F.ZQ,F.HK]}),n})();var _i=p(13464),ai=p(26215),ri=p(45435),Mt=p(36848);let q=class{constructor(s,t){this.http=s,this.timerService=t,this.REFRESH_INTERVAL=3e4,this.summaryDataSource=new ai.X(null),this.summaryData$=this.summaryDataSource.asObservable()}startPolling(){return this.timerService.get(()=>this.retrieveSummaryObservable(),this.REFRESH_INTERVAL).subscribe(this.retrieveSummaryObserver())}refresh(){return this.retrieveSummaryObservable().subscribe(this.retrieveSummaryObserver())}retrieveSummaryObservable(){return this.http.get("api/block/mirroring/summary")}retrieveSummaryObserver(){return s=>{this.summaryDataSource.next(s)}}subscribeSummary(s,t){return this.summaryData$.pipe((0,ri.h)(o=>!!o)).subscribe(s,t)}getPool(s){return this.http.get(`api/block/mirroring/pool/${s}`)}updatePool(s,t){return this.http.put(`api/block/mirroring/pool/${s}`,t,{observe:"response"})}getSiteName(){return this.http.get("api/block/mirroring/site_name")}setSiteName(s){return this.http.put("api/block/mirroring/site_name",{site_name:s},{observe:"response"})}createBootstrapToken(s){return this.http.post(`api/block/mirroring/pool/${s}/bootstrap/token`,{})}importBootstrapToken(s,t,o){return this.http.post(`api/block/mirroring/pool/${s}/bootstrap/peer`,{direction:t,token:o},{observe:"response"})}getPeer(s,t){return this.http.get(`api/block/mirroring/pool/${s}/peer/${t}`)}getPeerForPool(s){return this.http.get(`api/block/mirroring/pool/${s}/peer`)}addPeer(s,t){return this.http.post(`api/block/mirroring/pool/${s}/peer`,t,{observe:"response"})}updatePeer(s,t,o){return this.http.put(`api/block/mirroring/pool/${s}/peer/${t}`,o,{observe:"response"})}deletePeer(s,t){return this.http.delete(`api/block/mirroring/pool/${s}/peer/${t}`,{observe:"response"})}};q.\u0275fac=function(s){return new(s||q)(e.LFG(ie.eN),e.LFG(Mt.f))},q.\u0275prov=e.Yz7({token:q,factory:q.\u0275fac,providedIn:"root"}),(0,D.gn)([(0,D.fM)(0,V.G),(0,D.w6)("design:type",Function),(0,D.w6)("design:paramtypes",[String]),(0,D.w6)("design:returntype",void 0)],q.prototype,"setSiteName",null),(0,D.gn)([(0,D.fM)(1,V.G),(0,D.fM)(2,V.G),(0,D.w6)("design:type",Function),(0,D.w6)("design:paramtypes",[String,String,String]),(0,D.w6)("design:returntype",void 0)],q.prototype,"importBootstrapToken",null),q=(0,D.gn)([V.o,(0,D.w6)("design:paramtypes",[ie.eN,Mt.f])],q);var _t=p(6481),li=p(68307),Ot=p(12627),ci=p(39749),di=p(13472),Oe=p(82945);function pi(n,s){1&n&&(e.TgZ(0,"span",25),e.SDv(1,26),e.qZA())}function ui(n,s){if(1&n&&(e.TgZ(0,"div",27),e._UZ(1,"input",28),e.TgZ(2,"label",29),e._uU(3),e.qZA()()),2&n){const t=s.$implicit;e.xp6(1),e.s9C("id",t.name),e.s9C("name",t.name),e.s9C("formControlName",t.name),e.xp6(1),e.s9C("for",t.name),e.xp6(1),e.Oqu(t.name)}}function mi(n,s){1&n&&(e.TgZ(0,"span",25),e.SDv(1,30),e.qZA())}let gi=(()=>{class n{constructor(t,o,i){this.activeModal=t,this.rbdMirroringService=o,this.taskWrapper=i,this.pools=[],this.createForm()}createForm(){this.createBootstrapForm=new Z.d({siteName:new r.p4("",{validators:[r.kI.required]}),pools:new r.nJ({},{validators:[this.validatePools()]}),token:new r.p4("",{})})}ngOnInit(){this.createBootstrapForm.get("siteName").setValue(this.siteName),this.rbdMirroringService.getSiteName().subscribe(t=>{this.createBootstrapForm.get("siteName").setValue(t.site_name)}),this.subs=this.rbdMirroringService.subscribeSummary(t=>{this.pools=t.content_data.pools.reduce((_,a)=>(_.push({name:a.name,mirror_mode:a.mirror_mode}),_),[]);const i=this.createBootstrapForm.get("pools");C().each(this.pools,_=>{const a=_.name,l="disabled"===_.mirror_mode,d=i.controls[a];d?l&&d.disabled?d.enable():!l&&d.enabled&&(d.disable(),d.setValue(!0)):i.addControl(a,new r.p4({value:!l,disabled:!l}))})})}ngOnDestroy(){this.subs&&this.subs.unsubscribe()}validatePools(){return t=>{let o=0;return C().each(t.controls,i=>{!0===i.value&&++o}),o>0?null:{requirePool:!0}}}generate(){this.createBootstrapForm.get("token").setValue("");let t="";const o=[],i=this.createBootstrapForm.get("pools");C().each(i.controls,(g,S)=>{!0===g.value&&(t=S,g.disabled||o.push(S))});const _={mirror_mode:"image"},a=(0,_t.z)(this.rbdMirroringService.setSiteName(this.createBootstrapForm.getValue("siteName")),(0,ce.D)(o.map(g=>this.rbdMirroringService.updatePool(g,_))),this.rbdMirroringService.createBootstrapToken(t).pipe((0,li.b)(g=>this.createBootstrapForm.get("token").setValue(g.token)))).pipe((0,Ot.Z)()),l=()=>{this.rbdMirroringService.refresh(),this.createBootstrapForm.setErrors({cdSubmitButton:!0})};this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/mirroring/bootstrap/create",{}),call:a}).subscribe({error:l,complete:l})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(F.Kz),e.Y36(q),e.Y36(u.P))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-bootstrap-create-modal"]],decls:32,vars:6,consts:function(){let s,t,o,i,_,a,l,d,g,S,I;return s="Create Bootstrap Token",t="To create a bootstrap token which can be imported by a peer site cluster, provide the local site's name, select which pools will have mirroring enabled, and click\xA0 " + "\ufffd#10\ufffd" + "Generate" + "\ufffd/#10\ufffd" + ".",o="Site Name",i="Name...",_="Pools",a="Generate",l="Token",d="Generated token...",g="Close",S="This field is required.",I="At least one pool is required.",[[3,"modalRef"],[1,"modal-title"],s,[1,"modal-content"],["name","createBootstrapForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t,[1,"form-group"],["for","siteName",1,"col-form-label","required"],o,["type","text","placeholder",i,"id","siteName","name","siteName","formControlName","siteName","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["formGroupName","pools",1,"form-group"],["for","pools",1,"col-form-label","required"],_,["class","custom-control custom-checkbox",4,"ngFor","ngForOf"],[1,"mb-4","float-end",3,"form","submitAction"],a,["for","token",1,"col-form-label"],l,["placeholder",d,"id","token","formControlName","token","readonly","",1,"form-control","resize-vertical"],["source","token",1,"float-end"],[1,"modal-footer"],["name",g,3,"backAction"],[1,"invalid-feedback"],S,[1,"custom-control","custom-checkbox"],["type","checkbox",1,"custom-control-input",3,"id","name","formControlName"],[1,"custom-control-label",3,"for"],I]},template:function(t,o){if(1&t&&(e.TgZ(0,"cd-modal",0),e.ynx(1,1),e.SDv(2,2),e.BQk(),e.ynx(3,3),e.TgZ(4,"form",4,5)(6,"div",6)(7,"p"),e.ynx(8),e.tHW(9,7),e._UZ(10,"kbd"),e.N_p(),e.BQk(),e.qZA(),e.TgZ(11,"div",8)(12,"label",9),e.SDv(13,10),e.qZA(),e._UZ(14,"input",11),e.YNc(15,pi,2,0,"span",12),e.qZA(),e.TgZ(16,"div",13)(17,"label",14),e.SDv(18,15),e.qZA(),e.YNc(19,ui,4,5,"div",16),e.YNc(20,mi,2,0,"span",12),e.qZA(),e.TgZ(21,"cd-submit-button",17),e.NdJ("submitAction",function(){return o.generate()}),e.SDv(22,18),e.qZA(),e.TgZ(23,"div",8)(24,"label",19)(25,"span"),e.SDv(26,20),e.qZA()(),e.TgZ(27,"textarea",21),e._uU(28," "),e.qZA()(),e._UZ(29,"cd-copy-2-clipboard-button",22),e.qZA(),e.TgZ(30,"div",23)(31,"cd-back-button",24),e.NdJ("backAction",function(){return o.activeModal.close()}),e.qZA()()(),e.BQk(),e.qZA()),2&t){const i=e.MAs(5);e.Q6J("modalRef",o.activeModal),e.xp6(4),e.Q6J("formGroup",o.createBootstrapForm),e.xp6(11),e.Q6J("ngIf",o.createBootstrapForm.showError("siteName",i,"required")),e.xp6(4),e.Q6J("ngForOf",o.pools),e.xp6(1),e.Q6J("ngIf",o.createBootstrapForm.showError("pools",i,"requirePool")),e.xp6(1),e.Q6J("form",o.createBootstrapForm)}},dependencies:[c.sg,c.O5,ci.w,di.W,f.z,Ye.s,Oe.U,M.o,B.b,K.P,J.V,r._Y,r.Fj,r.Wl,r.JJ,r.JL,r.sg,r.u,r.x0],styles:[".form-group.ng-invalid[_ngcontent-%COMP%] .invalid-feedback[_ngcontent-%COMP%]{display:block}"]}),n})();function Ti(n,s){1&n&&(e.TgZ(0,"span",26),e.SDv(1,27),e.qZA())}function fi(n,s){if(1&n&&(e.TgZ(0,"option",28),e._uU(1),e.qZA()),2&n){const t=s.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.desc)}}function Ci(n,s){if(1&n&&(e.TgZ(0,"div",29),e._UZ(1,"input",30),e.TgZ(2,"label",31),e._uU(3),e.qZA()()),2&n){const t=s.$implicit;e.xp6(1),e.s9C("id",t.name),e.s9C("name",t.name),e.s9C("formControlName",t.name),e.xp6(1),e.s9C("for",t.name),e.xp6(1),e.Oqu(t.name)}}function Si(n,s){1&n&&(e.TgZ(0,"span",26),e.SDv(1,32),e.qZA())}function Ri(n,s){1&n&&(e.TgZ(0,"span",26),e.SDv(1,33),e.qZA())}function Ei(n,s){1&n&&(e.TgZ(0,"span",26),e.SDv(1,34),e.qZA())}let Mi=(()=>{class n{constructor(t,o,i,_){this.activeModal=t,this.actionLabels=o,this.rbdMirroringService=i,this.taskWrapper=_,this.pools=[],this.directions=[{key:"rx-tx",desc:"Bidirectional"},{key:"rx",desc:"Unidirectional (receive-only)"}],this.createForm()}createForm(){this.importBootstrapForm=new Z.d({siteName:new r.p4("",{validators:[r.kI.required]}),direction:new r.p4("rx-tx",{}),pools:new r.nJ({},{validators:[this.validatePools()]}),token:new r.p4("",{validators:[r.kI.required,this.validateToken()]})})}ngOnInit(){this.rbdMirroringService.getSiteName().subscribe(t=>{this.importBootstrapForm.get("siteName").setValue(t.site_name)}),this.subs=this.rbdMirroringService.subscribeSummary(t=>{this.pools=t.content_data.pools.reduce((_,a)=>(_.push({name:a.name,mirror_mode:a.mirror_mode}),_),[]);const i=this.importBootstrapForm.get("pools");C().each(this.pools,_=>{const a=_.name,l="disabled"===_.mirror_mode,d=i.controls[a];d?l&&d.disabled?d.enable():!l&&d.enabled&&(d.disable(),d.setValue(!0)):i.addControl(a,new r.p4({value:!l,disabled:!l}))})})}ngOnDestroy(){this.subs&&this.subs.unsubscribe()}validatePools(){return t=>{let o=0;return C().each(t.controls,i=>{!0===i.value&&++o}),o>0?null:{requirePool:!0}}}validateToken(){return t=>{try{if(JSON.parse(atob(t.value)))return null}catch{}return{invalidToken:!0}}}import(){const t=[],o=[],i=this.importBootstrapForm.get("pools");C().each(i.controls,(g,S)=>{!0===g.value&&(t.push(S),g.disabled||o.push(S))});const _={mirror_mode:"image"};let a=(0,_t.z)(this.rbdMirroringService.setSiteName(this.importBootstrapForm.getValue("siteName")),(0,ce.D)(o.map(g=>this.rbdMirroringService.updatePool(g,_))));a=t.reduce((g,S)=>(0,_t.z)(g,this.rbdMirroringService.importBootstrapToken(S,this.importBootstrapForm.getValue("direction"),this.importBootstrapForm.getValue("token"))),a).pipe((0,Ot.Z)());const l=()=>{this.rbdMirroringService.refresh(),this.importBootstrapForm.setErrors({cdSubmitButton:!0})};this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/mirroring/bootstrap/import",{}),call:a}).subscribe({error:l,complete:()=>{l(),this.activeModal.close()}})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(F.Kz),e.Y36(L.p4),e.Y36(q),e.Y36(u.P))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-bootstrap-import-modal"]],decls:36,vars:10,consts:function(){let s,t,o,i,_,a,l,d,g,S,I,P;return s="Import Bootstrap Token",t="To import a bootstrap token which was created by a peer site cluster, provide the local site's name, select which pools will have mirroring enabled, provide the generated token, and click\xA0" + "\ufffd#10\ufffd" + "Import" + "\ufffd/#10\ufffd" + ".",o="Site Name",i="Name...",_="Direction",a="Pools",l="Token",d="Generated token...",g="This field is required.",S="At least one pool is required.",I="This field is required.",P="The token is invalid.",[[3,"modalRef"],[1,"modal-title"],s,[1,"modal-content"],["name","importBootstrapForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t,[1,"form-group"],["for","siteName",1,"col-form-label","required"],o,["type","text","placeholder",i,"id","siteName","name","siteName","formControlName","siteName","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["for","direction",1,"col-form-label"],_,["id","direction","name","direction","formControlName","direction",1,"form-control"],[3,"value",4,"ngFor","ngForOf"],["formGroupName","pools",1,"form-group"],["for","pools",1,"col-form-label","required"],a,["class","custom-control custom-checkbox",4,"ngFor","ngForOf"],["for","token",1,"col-form-label","required"],l,["placeholder",d,"id","token","formControlName","token",1,"form-control","resize-vertical"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],g,[3,"value"],[1,"custom-control","custom-checkbox"],["type","checkbox",1,"custom-control-input",3,"id","name","formControlName"],[1,"custom-control-label",3,"for"],S,I,P]},template:function(t,o){if(1&t&&(e.TgZ(0,"cd-modal",0),e.ynx(1,1),e.SDv(2,2),e.BQk(),e.ynx(3,3),e.TgZ(4,"form",4,5)(6,"div",6)(7,"p"),e.ynx(8),e.tHW(9,7),e._UZ(10,"kbd"),e.N_p(),e.BQk(),e.qZA(),e.TgZ(11,"div",8)(12,"label",9),e.SDv(13,10),e.qZA(),e._UZ(14,"input",11),e.YNc(15,Ti,2,0,"span",12),e.qZA(),e.TgZ(16,"div",8)(17,"label",13)(18,"span"),e.SDv(19,14),e.qZA()(),e.TgZ(20,"select",15),e.YNc(21,fi,2,2,"option",16),e.qZA()(),e.TgZ(22,"div",17)(23,"label",18),e.SDv(24,19),e.qZA(),e.YNc(25,Ci,4,5,"div",20),e.YNc(26,Si,2,0,"span",12),e.qZA(),e.TgZ(27,"div",8)(28,"label",21),e.SDv(29,22),e.qZA(),e.TgZ(30,"textarea",23),e._uU(31," "),e.qZA(),e.YNc(32,Ri,2,0,"span",12),e.YNc(33,Ei,2,0,"span",12),e.qZA()(),e.TgZ(34,"div",24)(35,"cd-form-button-panel",25),e.NdJ("submitActionEvent",function(){return o.import()}),e.qZA()()(),e.BQk(),e.qZA()),2&t){const i=e.MAs(5);e.Q6J("modalRef",o.activeModal),e.xp6(4),e.Q6J("formGroup",o.importBootstrapForm),e.xp6(11),e.Q6J("ngIf",o.importBootstrapForm.showError("siteName",i,"required")),e.xp6(6),e.Q6J("ngForOf",o.directions),e.xp6(4),e.Q6J("ngForOf",o.pools),e.xp6(1),e.Q6J("ngIf",o.importBootstrapForm.showError("pools",i,"requirePool")),e.xp6(6),e.Q6J("ngIf",o.importBootstrapForm.showError("token",i,"required")),e.xp6(1),e.Q6J("ngIf",o.importBootstrapForm.showError("token",i,"invalidToken")),e.xp6(2),e.Q6J("form",o.importBootstrapForm)("submitText",o.actionLabels.SUBMIT)}},dependencies:[c.sg,c.O5,f.z,A.p,Oe.U,M.o,B.b,K.P,J.V,r._Y,r.YN,r.Kr,r.Fj,r.Wl,r.EJ,r.JJ,r.JL,r.sg,r.u,r.x0]}),n})();var se=p(69158),Oi=p(58111);let at=(()=>{class n{transform(t){return"warning"===t?"badge badge-warning":"error"===t?"badge badge-danger":"success"===t?"badge badge-success":"badge badge-info"}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275pipe=e.Yjl({name:"mirrorHealthColor",type:n,pure:!0}),n})();const hi=["healthTmpl"];function Ai(n,s){if(1&n&&(e.TgZ(0,"span",2),e.ALo(1,"mirrorHealthColor"),e._uU(2),e.qZA()),2&n){const o=s.value;e.Q6J("ngClass",e.lcZ(1,2,s.row.health_color)),e.xp6(2),e.Oqu(o)}}let Pi=(()=>{class n{constructor(t,o){this.rbdMirroringService=t,this.cephShortVersionPipe=o,this.tableStatus=new se.E}ngOnInit(){this.columns=[{prop:"instance_id",name:"Instance",flexGrow:2},{prop:"id",name:"ID",flexGrow:2},{prop:"server_hostname",name:"Hostname",flexGrow:2},{prop:"version",name:"Version",pipe:this.cephShortVersionPipe,flexGrow:2},{prop:"health",name:"Health",cellTemplate:this.healthTmpl,flexGrow:1}],this.subs=this.rbdMirroringService.subscribeSummary(t=>{this.data=t.content_data.daemons,this.tableStatus=new se.E(t.status)})}ngOnDestroy(){this.subs.unsubscribe()}refresh(){this.rbdMirroringService.refresh()}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(q),e.Y36(Oi.F))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-mirroring-daemons"]],viewQuery:function(t,o){if(1&t&&e.Gf(hi,7),2&t){let i;e.iGM(i=e.CRH())&&(o.healthTmpl=i.first)}},decls:3,vars:4,consts:[["columnMode","flex",3,"data","columns","autoReload","status","fetchData"],["healthTmpl",""],[3,"ngClass"]],template:function(t,o){1&t&&(e.TgZ(0,"cd-table",0),e.NdJ("fetchData",function(){return o.refresh()}),e.qZA(),e.YNc(1,Ai,3,4,"ng-template",null,1,e.W1O)),2&t&&e.Q6J("data",o.data)("columns",o.columns)("autoReload",-1)("status",o.tableStatus)},dependencies:[c.mk,W.a,at]}),n})();var ht=p(59376);const bi=["stateTmpl"],Ii=["syncTmpl"],Ni=["progressTmpl"],Fi=["entriesBehindPrimaryTpl"];function Di(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"cd-table",14),e.NdJ("fetchData",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.refresh())}),e.qZA()}if(2&n){const t=e.oxw();e.Q6J("data",t.image_error.data)("columns",t.image_error.columns)("autoReload",-1)("status",t.tableStatus)}}function Li(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"cd-table",14),e.NdJ("fetchData",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.refresh())}),e.qZA()}if(2&n){const t=e.oxw();e.Q6J("data",t.image_syncing.data)("columns",t.image_syncing.columns)("autoReload",-1)("status",t.tableStatus)}}function vi(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"cd-table",14),e.NdJ("fetchData",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.refresh())}),e.qZA()}if(2&n){const t=e.oxw();e.Q6J("data",t.image_ready.data)("columns",t.image_ready.columns)("autoReload",-1)("status",t.tableStatus)}}function $i(n,s){if(1&n&&(e.TgZ(0,"span",15),e.ALo(1,"mirrorHealthColor"),e._uU(2),e.qZA()),2&n){const o=s.value;e.Q6J("ngClass",e.lcZ(1,2,s.row.state_color)),e.xp6(2),e.Oqu(o)}}function Bi(n,s){1&n&&e._UZ(0,"div")}function Gi(n,s){if(1&n&&e._UZ(0,"ngb-progressbar",19),2&n){const t=e.oxw().value;e.Q6J("value",t)("showValue",!0)}}function yi(n,s){if(1&n&&(e.YNc(0,Bi,1,0,"div",16),e.TgZ(1,"div",17),e.YNc(2,Gi,1,2,"ngb-progressbar",18),e.qZA()),2&n){const t=s.row;e.Q6J("ngIf","Replaying"===t.state),e.xp6(2),e.Q6J("ngIf","Replaying"===t.state)}}function xi(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.hij(" ",t," ")}}function Zi(n,s){1&n&&(e.TgZ(0,"span",21),e._uU(1,"-"),e.qZA())}function wi(n,s){if(1&n&&(e.YNc(0,xi,2,1,"span",16),e.YNc(1,Zi,2,0,"span",20)),2&n){const t=s.row;e.Q6J("ngIf","journal"===t.mirror_mode),e.xp6(1),e.Q6J("ngIf","snapshot"===t.mirror_mode)}}let Hi=(()=>{class n{constructor(t){this.rbdMirroringService=t,this.image_error={data:[],columns:{}},this.image_syncing={data:[],columns:{}},this.image_ready={data:[],columns:{}},this.tableStatus=new se.E}ngOnInit(){this.image_error.columns=[{prop:"pool_name",name:"Pool",flexGrow:2},{prop:"name",name:"Image",flexGrow:2},{prop:"state",name:"State",cellTemplate:this.stateTmpl,flexGrow:1},{prop:"description",name:"Issue",flexGrow:4}],this.image_syncing.columns=[{prop:"pool_name",name:"Pool",flexGrow:2},{prop:"name",name:"Image",flexGrow:2},{prop:"state",name:"State",cellTemplate:this.stateTmpl,flexGrow:1},{prop:"syncing_percent",name:"Progress",cellTemplate:this.progressTmpl,flexGrow:2},{prop:"bytes_per_second",name:"Bytes per second",flexGrow:2},{prop:"entries_behind_primary",name:"Entries behind primary",cellTemplate:this.entriesBehindPrimaryTpl,flexGrow:2}],this.image_ready.columns=[{prop:"pool_name",name:"Pool",flexGrow:2},{prop:"name",name:"Image",flexGrow:2},{prop:"state",name:"State",cellTemplate:this.stateTmpl,flexGrow:1},{prop:"description",name:"Description",flexGrow:4}],this.subs=this.rbdMirroringService.subscribeSummary(t=>{this.image_error.data=t.content_data.image_error,this.image_syncing.data=t.content_data.image_syncing,this.image_ready.data=t.content_data.image_ready,this.tableStatus=new se.E(t.status)})}ngOnDestroy(){this.subs.unsubscribe()}refresh(){this.rbdMirroringService.refresh()}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(q))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-mirroring-images"]],viewQuery:function(t,o){if(1&t&&(e.Gf(bi,7),e.Gf(Ii,7),e.Gf(Ni,7),e.Gf(Fi,7)),2&t){let i;e.iGM(i=e.CRH())&&(o.stateTmpl=i.first),e.iGM(i=e.CRH())&&(o.syncTmpl=i.first),e.iGM(i=e.CRH())&&(o.progressTmpl=i.first),e.iGM(i=e.CRH())&&(o.entriesBehindPrimaryTpl=i.first)}},decls:21,vars:4,consts:function(){let s,t,o;return s="Issues (" + "\ufffd0\ufffd" + ")",t="Syncing (" + "\ufffd0\ufffd" + ")",o="Ready (" + "\ufffd0\ufffd" + ")",[["ngbNav","","cdStatefulTab","image-list",1,"nav-tabs"],["nav","ngbNav"],["ngbNavItem","issues"],["ngbNavLink",""],s,["ngbNavContent",""],["ngbNavItem","syncing"],t,["ngbNavItem","ready"],o,[3,"ngbNavOutlet"],["stateTmpl",""],["progressTmpl",""],["entriesBehindPrimaryTpl",""],["columnMode","flex",3,"data","columns","autoReload","status","fetchData"],[3,"ngClass"],[4,"ngIf"],[1,"w-100","h-100","d-flex","justify-content-center","align-items-center"],["type","info","class","w-100",3,"value","showValue",4,"ngIf"],["type","info",1,"w-100",3,"value","showValue"],["ngbTooltip","Not available with mirroring snapshot mode",4,"ngIf"],["ngbTooltip","Not available with mirroring snapshot mode"]]},template:function(t,o){if(1&t&&(e.TgZ(0,"nav",0,1),e.ynx(2,2),e.TgZ(3,"a",3),e.SDv(4,4),e.qZA(),e.YNc(5,Di,1,4,"ng-template",5),e.BQk(),e.ynx(6,6),e.TgZ(7,"a",3),e.SDv(8,7),e.qZA(),e.YNc(9,Li,1,4,"ng-template",5),e.BQk(),e.ynx(10,8),e.TgZ(11,"a",3),e.SDv(12,9),e.qZA(),e.YNc(13,vi,1,4,"ng-template",5),e.BQk(),e.qZA(),e._UZ(14,"div",10),e.YNc(15,$i,3,4,"ng-template",null,11,e.W1O),e.YNc(17,yi,3,2,"ng-template",null,12,e.W1O),e.YNc(19,wi,2,2,"ng-template",null,13,e.W1O)),2&t){const i=e.MAs(1);e.xp6(4),e.pQV(o.image_error.data.length),e.QtT(4),e.xp6(4),e.pQV(o.image_syncing.data.length),e.QtT(8),e.xp6(4),e.pQV(o.image_ready.data.length),e.QtT(12),e.xp6(2),e.Q6J("ngbNavOutlet",i)}},dependencies:[c.mk,c.O5,W.a,ht.m,F.uN,F.Pz,F.nv,F.Vx,F.tO,F.Dy,F.Ly,F._L,at]}),n})();var At=p(70882);class ki{}function Ki(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,25),e.qZA())}function qi(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,26),e.qZA())}function Xi(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,27),e.qZA())}function Qi(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,28),e.qZA())}function zi(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,29),e.qZA())}function Ji(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,30),e.qZA())}let Yi=(()=>{class n{constructor(t,o,i,_){this.activeModal=t,this.actionLabels=o,this.rbdMirroringService=i,this.taskWrapper=_,this.bsConfig={containerClass:"theme-default"},this.createForm()}createForm(){this.editPeerForm=new Z.d({clusterName:new r.p4("",{validators:[r.kI.required,this.validateClusterName]}),clientID:new r.p4("",{validators:[r.kI.required,this.validateClientID]}),monAddr:new r.p4("",{validators:[this.validateMonAddr]}),key:new r.p4("",{validators:[this.validateKey]})})}ngOnInit(){this.pattern=`${this.poolName}/${this.peerUUID}`,"edit"===this.mode&&this.rbdMirroringService.getPeer(this.poolName,this.peerUUID).subscribe(t=>{this.setResponse(t)})}validateClusterName(t){if(!t.value.match(/^[\w\-_]*$/))return{invalidClusterName:{value:t.value}}}validateClientID(t){if(!t.value.match(/^(?!client\.)[\w\-_.]*$/))return{invalidClientID:{value:t.value}}}validateMonAddr(t){if(!t.value.match(/^[,; ]*([\w.\-_\[\]]+(:[\d]+)?[,; ]*)*$/))return{invalidMonAddr:{value:t.value}}}validateKey(t){try{if(""===t.value||atob(t.value))return null}catch{}return{invalidKey:{value:t.value}}}setResponse(t){this.response=t,this.editPeerForm.get("clusterName").setValue(t.cluster_name),this.editPeerForm.get("clientID").setValue(t.client_id),this.editPeerForm.get("monAddr").setValue(t.mon_host),this.editPeerForm.get("key").setValue(t.key)}update(){const t=new ki;let o;t.cluster_name=this.editPeerForm.getValue("clusterName"),t.client_id=this.editPeerForm.getValue("clientID"),t.mon_host=this.editPeerForm.getValue("monAddr"),t.key=this.editPeerForm.getValue("key"),o=this.taskWrapper.wrapTaskAroundCall("edit"===this.mode?{task:new E.R("rbd/mirroring/peer/edit",{pool_name:this.poolName}),call:this.rbdMirroringService.updatePeer(this.poolName,this.peerUUID,t)}:{task:new E.R("rbd/mirroring/peer/add",{pool_name:this.poolName}),call:this.rbdMirroringService.addPeer(this.poolName,t)}),o.subscribe({error:()=>this.editPeerForm.setErrors({cdSubmitButton:!0}),complete:()=>{this.rbdMirroringService.refresh(),this.activeModal.close()}})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(F.Kz),e.Y36(L.p4),e.Y36(q),e.Y36(u.P))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-pool-edit-peer-modal"]],decls:38,vars:13,consts:function(){let s,t,o,i,_,a,l,d,g,S,I,P,$,y,Q,Y,ee,te;return s="{VAR_SELECT, select, edit {Edit} other {Add}}",s=e.Zx4(s,{VAR_SELECT:"\ufffd0\ufffd"}),t="" + s + " pool mirror peer",o="{VAR_SELECT, select, edit {Edit} other {Add}}",o=e.Zx4(o,{VAR_SELECT:"\ufffd0\ufffd"}),i="" + o + " the pool mirror peer attributes for pool " + "[\ufffd#10\ufffd|\ufffd#11\ufffd]" + "" + "\ufffd1\ufffd" + "" + "[\ufffd/#10\ufffd|\ufffd/#11\ufffd]" + " and click " + "[\ufffd#10\ufffd|\ufffd#11\ufffd]" + "Submit" + "[\ufffd/#10\ufffd|\ufffd/#11\ufffd]" + ".",i=e.Zx4(i),_="Cluster Name",a="Name...",l="CephX ID",d="CephX ID...",g="Monitor Addresses",S="Comma-delimited addresses...",I="CephX Key",P="Base64-encoded key...",$="This field is required.",y="The cluster name is not valid.",Q="This field is required.",Y="The CephX ID is not valid.",ee="The monitory address is not valid.",te="CephX key must be base64 encoded.",[[3,"modalRef"],[1,"modal-title"],t,[1,"modal-content"],["name","editPeerForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],i,[1,"form-group"],["for","clusterName",1,"col-form-label","required"],_,["type","text","placeholder",a,"id","clusterName","name","clusterName","formControlName","clusterName","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["for","clientID",1,"col-form-label","required"],l,["type","text","placeholder",d,"id","clientID","name","clientID","formControlName","clientID",1,"form-control"],["for","monAddr",1,"col-form-label"],g,["type","text","placeholder",S,"id","monAddr","name","monAddr","formControlName","monAddr",1,"form-control"],["for","key",1,"col-form-label"],I,["type","text","placeholder",P,"id","key","name","key","formControlName","key",1,"form-control"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],$,y,Q,Y,ee,te]},template:function(t,o){if(1&t&&(e.TgZ(0,"cd-modal",0)(1,"span",1),e.SDv(2,2),e.qZA(),e.ynx(3,3),e.TgZ(4,"form",4,5)(6,"div",6)(7,"p")(8,"span"),e.tHW(9,7),e._UZ(10,"kbd")(11,"kbd"),e.N_p(),e.qZA()(),e.TgZ(12,"div",8)(13,"label",9),e.SDv(14,10),e.qZA(),e._UZ(15,"input",11),e.YNc(16,Ki,2,0,"span",12),e.YNc(17,qi,2,0,"span",12),e.qZA(),e.TgZ(18,"div",8)(19,"label",13),e.SDv(20,14),e.qZA(),e._UZ(21,"input",15),e.YNc(22,Xi,2,0,"span",12),e.YNc(23,Qi,2,0,"span",12),e.qZA(),e.TgZ(24,"div",8)(25,"label",16)(26,"span"),e.SDv(27,17),e.qZA()(),e._UZ(28,"input",18),e.YNc(29,zi,2,0,"span",12),e.qZA(),e.TgZ(30,"div",8)(31,"label",19)(32,"span"),e.SDv(33,20),e.qZA()(),e._UZ(34,"input",21),e.YNc(35,Ji,2,0,"span",12),e.qZA()(),e.TgZ(36,"div",22)(37,"cd-form-button-panel",23),e.NdJ("submitActionEvent",function(){return o.update()}),e.qZA()()(),e.BQk(),e.qZA()),2&t){const i=e.MAs(5);e.Q6J("modalRef",o.activeModal),e.xp6(2),e.pQV(o.mode),e.QtT(2),e.xp6(2),e.Q6J("formGroup",o.editPeerForm),e.xp6(7),e.pQV(o.mode)(o.poolName),e.QtT(9),e.xp6(5),e.Q6J("ngIf",o.editPeerForm.showError("clusterName",i,"required")),e.xp6(1),e.Q6J("ngIf",o.editPeerForm.showError("clusterName",i,"invalidClusterName")),e.xp6(5),e.Q6J("ngIf",o.editPeerForm.showError("clientID",i,"required")),e.xp6(1),e.Q6J("ngIf",o.editPeerForm.showError("clientID",i,"invalidClientID")),e.xp6(6),e.Q6J("ngIf",o.editPeerForm.showError("monAddr",i,"invalidMonAddr")),e.xp6(6),e.Q6J("ngIf",o.editPeerForm.showError("key",i,"invalidKey")),e.xp6(2),e.Q6J("form",o.editPeerForm)("submitText",o.actionLabels.SUBMIT)}},dependencies:[c.O5,f.z,A.p,Oe.U,M.o,B.b,K.P,J.V,r._Y,r.Fj,r.JJ,r.JL,r.sg,r.u]}),n})();const Vi=["healthTmpl"],Ui=["localTmpl"],ji=["remoteTmpl"];function Wi(n,s){if(1&n&&(e.TgZ(0,"span",6),e.ALo(1,"mirrorHealthColor"),e._uU(2),e.qZA()),2&n){const o=s.value;e.Q6J("ngClass",e.lcZ(1,2,s.row.health_color)),e.xp6(2),e.Oqu(o)}}function es(n,s){1&n&&(e.TgZ(0,"span",7),e.SDv(1,8),e.qZA())}function ts(n,s){1&n&&(e.TgZ(0,"span",9),e.SDv(1,10),e.qZA())}let ns=(()=>{class n{constructor(t,o,i,_,a){this.authStorageService=t,this.rbdMirroringService=o,this.modalService=i,this.taskWrapper=_,this.router=a,this.selection=new Ee.r,this.tableStatus=new se.E,this.data=[],this.permission=this.authStorageService.getPermissions().rbdMirroring;const l={permission:"update",icon:T.P.edit,click:()=>this.editModeModal(),name:"Edit Mode",canBePrimary:()=>!0},d={permission:"create",icon:T.P.add,name:"Add Peer",click:()=>this.editPeersModal("add"),disable:()=>!this.selection.first()||"disabled"===this.selection.first().mirror_mode,visible:()=>!this.getPeerUUID(),canBePrimary:()=>!1},g={permission:"update",icon:T.P.exchange,name:"Edit Peer",click:()=>this.editPeersModal("edit"),visible:()=>!!this.getPeerUUID()},S={permission:"delete",icon:T.P.destroy,name:"Delete Peer",click:()=>this.deletePeersModal(),visible:()=>!!this.getPeerUUID()};this.tableActions=[l,d,g,S]}ngOnInit(){this.columns=[{prop:"name",name:"Name",flexGrow:2},{prop:"mirror_mode",name:"Mode",flexGrow:2},{prop:"leader_id",name:"Leader",flexGrow:2},{prop:"image_local_count",name:"# Local",headerTemplate:this.localTmpl,flexGrow:2},{prop:"image_remote_count",name:"# Remote",headerTemplate:this.remoteTmpl,flexGrow:2},{prop:"health",name:"Health",cellTemplate:this.healthTmpl,flexGrow:1}],this.subs=this.rbdMirroringService.subscribeSummary(t=>{this.data=t.content_data.pools,this.tableStatus=new se.E(t.status)})}ngOnDestroy(){this.subs.unsubscribe()}refresh(){this.rbdMirroringService.refresh()}editModeModal(){this.router.navigate(["/block/mirroring",{outlets:{modal:[L.MQ.EDIT,this.selection.first().name]}}])}editPeersModal(t){const o={poolName:this.selection.first().name,mode:t};"edit"===t&&(o.peerUUID=this.getPeerUUID()),this.modalRef=this.modalService.show(Yi,o)}deletePeersModal(){const t=this.selection.first().name,o=this.getPeerUUID();this.modalRef=this.modalService.show(ue.M,{itemDescription:"mirror peer",itemNames:[`${t} (${o})`],submitActionObservable:()=>new At.y(i=>{this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/mirroring/peer/delete",{pool_name:t}),call:this.rbdMirroringService.deletePeer(t,o)}).subscribe({error:_=>i.error(_),complete:()=>{this.rbdMirroringService.refresh(),i.complete()}})})})}getPeerUUID(){const t=this.selection.first(),o=this.data.find(i=>t&&t.name===i.name);if(o&&o.peer_uuids)return o.peer_uuids[0]}updateSelection(t){this.selection=t}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(q),e.Y36(pe.Z),e.Y36(u.P),e.Y36(m.F0))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-mirroring-pools"]],viewQuery:function(t,o){if(1&t&&(e.Gf(Vi,7),e.Gf(Ui,7),e.Gf(ji,7)),2&t){let i;e.iGM(i=e.CRH())&&(o.healthTmpl=i.first),e.iGM(i=e.CRH())&&(o.localTmpl=i.first),e.iGM(i=e.CRH())&&(o.remoteTmpl=i.first)}},decls:9,vars:7,consts:function(){let s,t,o,i;return s="Local image count",t="# Local",o="Remote image count",i="# Remote",[["columnMode","flex","identifier","name","forceIdentifier","true","selectionType","single",3,"data","columns","autoReload","status","fetchData","updateSelection"],[1,"table-actions",3,"permission","selection","tableActions"],["healthTmpl",""],["localTmpl",""],["remoteTmpl",""],["name","modal"],[3,"ngClass"],["ngbTooltip",s],t,["ngbTooltip",o],i]},template:function(t,o){1&t&&(e.TgZ(0,"cd-table",0),e.NdJ("fetchData",function(){return o.refresh()})("updateSelection",function(_){return o.updateSelection(_)}),e._UZ(1,"cd-table-actions",1),e.qZA(),e.YNc(2,Wi,3,4,"ng-template",null,2,e.W1O),e.YNc(4,es,2,0,"ng-template",null,3,e.W1O),e.YNc(6,ts,2,0,"ng-template",null,4,e.W1O),e._UZ(8,"router-outlet",5)),2&t&&(e.Q6J("data",o.data)("columns",o.columns)("autoReload",-1)("status",o.tableStatus),e.xp6(1),e.Q6J("permission",o.permission)("selection",o.selection)("tableActions",o.tableActions))},dependencies:[c.mk,W.a,Me.K,m.lC,F._L,at]}),n})();function is(n,s){if(1&n&&e._UZ(0,"i",19),2&n){const t=e.oxw();e.Q6J("ngClass",t.icons.edit)}}function ss(n,s){if(1&n&&e._UZ(0,"i",19),2&n){const t=e.oxw();e.Q6J("ngClass",t.icons.check)}}let _s=(()=>{class n{constructor(t,o,i,_){this.authStorageService=t,this.rbdMirroringService=o,this.modalService=i,this.taskWrapper=_,this.selection=new Ee.r,this.peersExist=!0,this.subs=new _i.w,this.editing=!1,this.icons=T.P,this.permission=this.authStorageService.getPermissions().rbdMirroring;const a={permission:"update",icon:T.P.upload,click:()=>this.createBootstrapModal(),name:"Create Bootstrap Token",canBePrimary:()=>!0,disable:()=>!1},l={permission:"update",icon:T.P.download,click:()=>this.importBootstrapModal(),name:"Import Bootstrap Token",disable:()=>!1};this.tableActions=[a,l]}ngOnInit(){this.createForm(),this.subs.add(this.rbdMirroringService.startPolling()),this.subs.add(this.rbdMirroringService.subscribeSummary(t=>{this.status=t.content_data.status,this.peersExist=!!t.content_data.pools.find(o=>o.peer_uuids.length>0)})),this.rbdMirroringService.getSiteName().subscribe(t=>{this.siteName=t.site_name,this.rbdmirroringForm.get("siteName").setValue(this.siteName)})}createForm(){this.rbdmirroringForm=new Z.d({siteName:new r.p4({value:"",disabled:!0})})}ngOnDestroy(){this.subs.unsubscribe()}updateSiteName(){this.editing&&this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/mirroring/site_name/edit",{}),call:this.rbdMirroringService.setSiteName(this.rbdmirroringForm.getValue("siteName"))}).subscribe({complete:()=>{this.rbdMirroringService.refresh()}}),this.editing=!this.editing}createBootstrapModal(){this.modalRef=this.modalService.show(gi,{siteName:this.siteName})}importBootstrapModal(){this.modalRef=this.modalService.show(Mi,{siteName:this.siteName})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(q),e.Y36(pe.Z),e.Y36(u.P))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-mirroring"]],decls:31,vars:10,consts:function(){let s,t,o,i;return s="Site Name",t="Daemons",o="Pools",i="Images",[["name","rbdmirroringForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"row","mb-3"],[1,"col-md-auto"],["for","siteName",1,"col-form-label"],s,[1,"col-sm-4","d-flex"],["type","text","id","siteName","name","siteName","formControlName","siteName",1,"form-control"],["id","editSiteName",1,"btn","btn-light",3,"click"],[3,"ngClass",4,"ngIf"],[3,"source","byId"],[1,"col"],[1,"table-actions","float-end",3,"permission","selection","tableActions"],[1,"row"],[1,"col-sm-6"],t,o,[1,"col-md-12"],i,[3,"ngClass"]]},template:function(t,o){1&t&&(e.TgZ(0,"form",0,1)(2,"div",2)(3,"div",3)(4,"label",4),e.SDv(5,5),e.qZA()(),e.TgZ(6,"div",6),e._UZ(7,"input",7),e.TgZ(8,"button",8),e.NdJ("click",function(){return o.updateSiteName()}),e.YNc(9,is,1,1,"i",9),e.YNc(10,ss,1,1,"i",9),e.qZA(),e._UZ(11,"cd-copy-2-clipboard-button",10),e.qZA(),e.TgZ(12,"div",11),e._UZ(13,"cd-table-actions",12),e.qZA()()(),e.TgZ(14,"div",13)(15,"div",14)(16,"legend"),e.SDv(17,15),e.qZA(),e.TgZ(18,"div"),e._UZ(19,"cd-mirroring-daemons"),e.qZA()(),e.TgZ(20,"div",14)(21,"legend"),e.SDv(22,16),e.qZA(),e.TgZ(23,"div"),e._UZ(24,"cd-mirroring-pools"),e.qZA()()(),e.TgZ(25,"div",13)(26,"div",17)(27,"legend"),e.SDv(28,18),e.qZA(),e.TgZ(29,"div"),e._UZ(30,"cd-mirroring-images"),e.qZA()()()),2&t&&(e.Q6J("formGroup",o.rbdmirroringForm),e.xp6(7),e.uIk("disabled",!o.editing||null),e.xp6(1),e.uIk("title",o.editing?"Save":"Edit"),e.xp6(1),e.Q6J("ngIf",!o.editing),e.xp6(1),e.Q6J("ngIf",o.editing),e.xp6(1),e.Q6J("source",o.siteName)("byId",!1),e.xp6(2),e.Q6J("permission",o.permission)("selection",o.selection)("tableActions",o.tableActions))},dependencies:[c.mk,c.O5,Ye.s,Me.K,M.o,B.b,J.V,r._Y,r.Fj,r.JJ,r.JL,r.sg,r.u,Pi,Hi,ns]}),n})();class as{}function rs(n,s){if(1&n&&(e.TgZ(0,"option",16),e._uU(1),e.qZA()),2&n){const t=s.$implicit;e.Q6J("value",t.id),e.xp6(1),e.Oqu(t.name)}}function ls(n,s){1&n&&(e.TgZ(0,"span",17),e.SDv(1,18),e.qZA())}let cs=(()=>{class n{constructor(t,o,i,_,a,l){this.activeModal=t,this.actionLabels=o,this.rbdMirroringService=i,this.taskWrapper=_,this.route=a,this.location=l,this.bsConfig={containerClass:"theme-default"},this.peerExists=!1,this.mirrorModes=[{id:"disabled",name:"Disabled"},{id:"pool",name:"Pool"},{id:"image",name:"Image"}],this.createForm()}createForm(){this.editModeForm=new Z.d({mirrorMode:new r.p4("",{validators:[r.kI.required,this.validateMode.bind(this)]})})}ngOnInit(){this.route.params.subscribe(t=>{this.poolName=t.pool_name}),this.pattern=`${this.poolName}`,this.rbdMirroringService.getPool(this.poolName).subscribe(t=>{this.setResponse(t)}),this.subs=this.rbdMirroringService.subscribeSummary(t=>{this.peerExists=!1;const i=t.content_data.pools.find(_=>this.poolName===_.name);this.peerExists=i&&i.peer_uuids.length})}ngOnDestroy(){this.subs.unsubscribe()}validateMode(t){return"disabled"===t.value&&this.peerExists?{cannotDisable:{value:t.value}}:null}setResponse(t){this.editModeForm.get("mirrorMode").setValue(t.mirror_mode)}update(){const t=new as;t.mirror_mode=this.editModeForm.getValue("mirrorMode"),this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/mirroring/pool/edit",{pool_name:this.poolName}),call:this.rbdMirroringService.updatePool(this.poolName,t)}).subscribe({error:()=>this.editModeForm.setErrors({cdSubmitButton:!0}),complete:()=>{this.rbdMirroringService.refresh(),this.location.back()}})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(F.Kz),e.Y36(L.p4),e.Y36(q),e.Y36(u.P),e.Y36(m.gz),e.Y36(c.Ye))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-pool-edit-mode-modal"]],decls:21,vars:7,consts:function(){let s,t,o,i;return s="Edit pool mirror mode",t="To edit the mirror mode for pool\xA0 " + "[\ufffd#10\ufffd|\ufffd#11\ufffd]" + "" + "\ufffd0\ufffd" + "" + "[\ufffd/#10\ufffd|\ufffd/#11\ufffd]" + ", select a new mode from the list and click\xA0 " + "[\ufffd#10\ufffd|\ufffd#11\ufffd]" + "Update" + "[\ufffd/#10\ufffd|\ufffd/#11\ufffd]" + ".",t=e.Zx4(t),o="Mode",i="Peer clusters must be removed prior to disabling mirror.",[["pageURL","mirroring",3,"modalRef"],[1,"modal-title"],s,[1,"modal-content"],["name","editModeForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t,[1,"form-group"],["for","mirrorMode",1,"col-form-label"],o,["id","mirrorMode","name","mirrorMode","formControlName","mirrorMode",1,"form-select"],[3,"value",4,"ngFor","ngForOf"],["class","invalid-feedback",4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[3,"value"],[1,"invalid-feedback"],i]},template:function(t,o){if(1&t&&(e.TgZ(0,"cd-modal",0),e.ynx(1,1),e.SDv(2,2),e.BQk(),e.ynx(3,3),e.TgZ(4,"form",4,5)(6,"div",6)(7,"p"),e.ynx(8),e.tHW(9,7),e._UZ(10,"kbd")(11,"kbd"),e.N_p(),e.BQk(),e.qZA(),e.TgZ(12,"div",8)(13,"label",9)(14,"span"),e.SDv(15,10),e.qZA()(),e.TgZ(16,"select",11),e.YNc(17,rs,2,2,"option",12),e.qZA(),e.YNc(18,ls,2,0,"span",13),e.qZA()(),e.TgZ(19,"div",14)(20,"cd-form-button-panel",15),e.NdJ("submitActionEvent",function(){return o.update()}),e.qZA()()(),e.BQk(),e.qZA()),2&t){const i=e.MAs(5);e.Q6J("modalRef",o.activeModal),e.xp6(4),e.Q6J("formGroup",o.editModeForm),e.xp6(7),e.pQV(o.poolName),e.QtT(9),e.xp6(6),e.Q6J("ngForOf",o.mirrorModes),e.xp6(1),e.Q6J("ngIf",o.editModeForm.showError("mirrorMode",i,"cannotDisable")),e.xp6(2),e.Q6J("form",o.editModeForm)("submitText",o.actionLabels.UPDATE)}},dependencies:[c.sg,c.O5,f.z,A.p,M.o,K.P,J.V,r._Y,r.YN,r.Kr,r.EJ,r.JJ,r.JL,r.sg,r.u]}),n})();var Pt=p(7357),ds=p(28049),ps=p(43190),Ve=p(80842),rt=p(30633),Ue=p(47557),us=p(28211);class ms{}var Ie=(()=>{return(n=Ie||(Ie={}))[n.V1=1]="V1",n[n.V2=2]="V2",Ie;var n})();class gs{constructor(){this.features=[]}}class Ts{constructor(){this.features=[]}}class fs{}class Cs extends fs{constructor(){super(...arguments),this.features=[]}}class lt{constructor(){this.features=[],this.remove_scheduling=!1}}var je=(()=>{return(n=je||(je={})).editing="editing",n.cloning="cloning",n.copying="copying",je;var n})(),bt=p(18372),Ss=p(17932),Rs=p(60950);function Es(n,s){if(1&n&&(e.TgZ(0,"div",9)(1,"label",58),e.SDv(2,59),e.ALo(3,"titlecase"),e.qZA(),e.TgZ(4,"div",12),e._UZ(5,"input",60)(6,"hr"),e.qZA()()),2&n){const t=e.oxw(2);e.xp6(3),e.pQV(e.lcZ(3,1,t.action)),e.QtT(2)}}function Ms(n,s){1&n&&(e.TgZ(0,"span",61),e.ynx(1),e.SDv(2,62),e.BQk(),e.qZA())}function Os(n,s){1&n&&(e.TgZ(0,"span",61),e.ynx(1),e.SDv(2,63),e.BQk(),e.qZA())}function hs(n,s){1&n&&e._UZ(0,"input",64)}function As(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,67),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Ps(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,68),e.qZA()),2&n&&e.Q6J("ngValue",null)}function bs(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,69),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Is(n,s){if(1&n&&(e.TgZ(0,"option",70),e._uU(1),e.qZA()),2&n){const t=s.$implicit;e.Q6J("value",t.pool_name),e.xp6(1),e.Oqu(t.pool_name)}}function Ns(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"select",65),e.NdJ("change",function(){e.CHM(t);const i=e.oxw(2);return e.KtG(i.setPoolMirrorMode())}),e.YNc(1,As,2,1,"option",66),e.YNc(2,Ps,2,1,"option",66),e.YNc(3,bs,2,1,"option",66),e.YNc(4,Is,2,2,"option",46),e.qZA()}if(2&n){const t=e.oxw(2);e.xp6(1),e.Q6J("ngIf",null===t.pools),e.xp6(1),e.Q6J("ngIf",null!==t.pools&&0===t.pools.length),e.xp6(1),e.Q6J("ngIf",null!==t.pools&&t.pools.length>0),e.xp6(1),e.Q6J("ngForOf",t.pools)}}function Fs(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,71),e.qZA())}const Ds=function(n,s){return[n,s]};function Ls(n,s){if(1&n&&(e.TgZ(0,"div",9)(1,"div",20),e._UZ(2,"i",72),e.qZA()()),2&n){const t=e.oxw(2);e.xp6(2),e.Q6J("ngClass",e.WLB(1,Ds,t.icons.spinner,t.icons.spin))}}function vs(n,s){1&n&&e._UZ(0,"input",76)}function $s(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,78),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Bs(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,79),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Gs(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,80),e.qZA()),2&n&&e.Q6J("ngValue",null)}function ys(n,s){if(1&n&&(e.TgZ(0,"option",70),e._uU(1),e.qZA()),2&n){const t=s.$implicit;e.Q6J("value",t),e.xp6(1),e.Oqu(t)}}function xs(n,s){if(1&n&&(e.TgZ(0,"select",77),e.YNc(1,$s,2,1,"option",66),e.YNc(2,Bs,2,1,"option",66),e.YNc(3,Gs,2,1,"option",66),e.YNc(4,ys,2,2,"option",46),e.qZA()),2&n){const t=e.oxw(3);e.xp6(1),e.Q6J("ngIf",null===t.pools),e.xp6(1),e.Q6J("ngIf",null!==t.pools&&0===t.pools.length),e.xp6(1),e.Q6J("ngIf",null!==t.pools&&t.pools.length>0),e.xp6(1),e.Q6J("ngForOf",t.namespaces)}}function Zs(n,s){if(1&n&&(e.TgZ(0,"div",9)(1,"label",73),e._uU(2," Namespace "),e.qZA(),e.TgZ(3,"div",12),e.YNc(4,vs,1,0,"input",74),e.YNc(5,xs,5,4,"select",75),e.qZA()()),2&n){const t=e.oxw(2);e.xp6(4),e.Q6J("ngIf","editing"===t.mode||!t.poolPermission.read),e.xp6(1),e.Q6J("ngIf","editing"!==t.mode&&t.poolPermission.read)}}function ws(n,s){1&n&&(e.TgZ(0,"cd-helper")(1,"span"),e.SDv(2,81),e.qZA()())}function Hs(n,s){1&n&&e._UZ(0,"input",87)}function ks(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,89),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Ks(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,90),e.qZA()),2&n&&e.Q6J("ngValue",null)}function qs(n,s){1&n&&(e.TgZ(0,"option",50),e._uU(1,"-- Select a data pool -- "),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Xs(n,s){if(1&n&&(e.TgZ(0,"option",70),e._uU(1),e.qZA()),2&n){const t=s.$implicit;e.Q6J("value",t.pool_name),e.xp6(1),e.Oqu(t.pool_name)}}function Qs(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"select",88),e.NdJ("change",function(i){e.CHM(t);const _=e.oxw(3);return e.KtG(_.onDataPoolChange(i.target.value))}),e.YNc(1,ks,2,1,"option",66),e.YNc(2,Ks,2,1,"option",66),e.YNc(3,qs,2,1,"option",66),e.YNc(4,Xs,2,2,"option",46),e.qZA()}if(2&n){const t=e.oxw(3);e.xp6(1),e.Q6J("ngIf",null===t.dataPools),e.xp6(1),e.Q6J("ngIf",null!==t.dataPools&&0===t.dataPools.length),e.xp6(1),e.Q6J("ngIf",null!==t.dataPools&&t.dataPools.length>0),e.xp6(1),e.Q6J("ngForOf",t.dataPools)}}function zs(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,91),e.qZA())}const We=function(n){return{required:n}};function Js(n,s){if(1&n&&(e.TgZ(0,"div",9)(1,"label",82)(2,"span",72),e.SDv(3,83),e.qZA(),e._UZ(4,"cd-helper",84),e.qZA(),e.TgZ(5,"div",12),e.YNc(6,Hs,1,0,"input",85),e.YNc(7,Qs,5,4,"select",86),e.YNc(8,zs,2,0,"span",14),e.qZA()()),2&n){e.oxw();const t=e.MAs(2),o=e.oxw();e.xp6(2),e.Q6J("ngClass",e.VKq(4,We,"editing"!==o.mode)),e.xp6(4),e.Q6J("ngIf","editing"===o.mode||!o.poolPermission.read),e.xp6(1),e.Q6J("ngIf","editing"!==o.mode&&o.poolPermission.read),e.xp6(1),e.Q6J("ngIf",o.rbdForm.showError("dataPool",t,"required"))}}function Ys(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,92),e.qZA())}function Vs(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,93),e.qZA())}function Us(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,94),e.qZA())}function js(n,s){if(1&n&&e._UZ(0,"cd-helper",98),2&n){const t=e.oxw().$implicit;e.s9C("html",t.helperHtml)}}function Ws(n,s){if(1&n&&(e.TgZ(0,"div",21),e._UZ(1,"input",95),e.TgZ(2,"label",96),e._uU(3),e.qZA(),e.YNc(4,js,1,1,"cd-helper",97),e.qZA()),2&n){const t=s.$implicit;e.xp6(1),e.s9C("id",t.key),e.s9C("name",t.key),e.s9C("formControlName",t.key),e.xp6(1),e.s9C("for",t.key),e.xp6(1),e.Oqu(t.desc),e.xp6(1),e.Q6J("ngIf",t.helperHtml)}}const It=function(n){return["edit",n]},Nt=function(n){return{modal:n}},Ft=function(n){return{outlets:n}},Dt=function(n){return["/block/mirroring",n]};function e_(n,s){if(1&n&&(e.TgZ(0,"cd-helper")(1,"span"),e.tHW(2,99),e._UZ(3,"b")(4,"a",100),e.N_p(),e.qZA()()),2&n){const t=e.oxw(2);e.xp6(4),e.Q6J("routerLink",e.VKq(7,Dt,e.VKq(5,Ft,e.VKq(3,Nt,e.VKq(1,It,t.currentPoolName)))))}}function t_(n,s){if(1&n&&(e.TgZ(0,"cd-helper")(1,"span"),e.tHW(2,105),e._UZ(3,"b")(4,"a",100),e.N_p(),e.qZA()()),2&n){const t=e.oxw(4);e.xp6(4),e.Q6J("routerLink",e.VKq(7,Dt,e.VKq(5,Ft,e.VKq(3,Nt,e.VKq(1,It,t.currentPoolName)))))}}function o_(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",102)(1,"input",103),e.NdJ("change",function(){e.CHM(t);const i=e.oxw(3);return e.KtG(i.setExclusiveLock())}),e.qZA(),e.TgZ(2,"label",104),e._uU(3),e.ALo(4,"titlecase"),e.qZA(),e.YNc(5,t_,5,9,"cd-helper",25),e.qZA()}if(2&n){const t=s.$implicit,o=e.oxw(3);e.xp6(1),e.Q6J("id",t)("value",t),e.uIk("disabled","pool"===o.poolMirrorMode&&"snapshot"===t||null),e.xp6(1),e.Q6J("for",t),e.xp6(1),e.Oqu(e.lcZ(4,6,t)),e.xp6(2),e.Q6J("ngIf","pool"===o.poolMirrorMode&&"snapshot"===t)}}function n_(n,s){if(1&n&&(e.TgZ(0,"div"),e.YNc(1,o_,6,8,"div",101),e.qZA()),2&n){const t=e.oxw(2);e.xp6(1),e.Q6J("ngForOf",t.mirroringOptions)}}function i_(n,s){if(1&n&&(e.TgZ(0,"div",9)(1,"label",106),e.tHW(2,107),e._UZ(3,"cd-helper",108),e.N_p(),e.qZA(),e.TgZ(4,"div",12),e._UZ(5,"input",109),e.qZA()()),2&n){const t=e.oxw(2);e.xp6(5),e.uIk("disabled",!1===t.peerConfigured||null)}}function s_(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"a",110),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).advancedEnabled=!0,e.KtG(!1)}),e.SDv(1,111),e.qZA()}}function __(n,s){if(1&n&&(e.TgZ(0,"option",70),e._uU(1),e.qZA()),2&n){const t=s.$implicit;e.Q6J("value",t),e.xp6(1),e.Oqu(t)}}function a_(n,s){if(1&n&&(e.TgZ(0,"option",70),e._uU(1),e.qZA()),2&n){const t=s.$implicit;e.Q6J("value",t),e.xp6(1),e.Oqu(t)}}function r_(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,112),e.qZA())}function l_(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,113),e.qZA())}function c_(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,114),e.qZA())}function d_(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,115),e.qZA())}function p_(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",1)(1,"form",2,3)(3,"div",4)(4,"div",5),e.SDv(5,6),e.ALo(6,"titlecase"),e.ALo(7,"upperFirst"),e.qZA(),e.TgZ(8,"div",7),e.YNc(9,Es,7,3,"div",8),e.TgZ(10,"div",9)(11,"label",10),e.SDv(12,11),e.qZA(),e.TgZ(13,"div",12),e._UZ(14,"input",13),e.YNc(15,Ms,3,0,"span",14),e.YNc(16,Os,3,0,"span",14),e.qZA()(),e.TgZ(17,"div",15),e.NdJ("change",function(i){e.CHM(t);const _=e.oxw();return e.KtG(_.onPoolChange(i.target.value))}),e.TgZ(18,"label",16),e.SDv(19,17),e.qZA(),e.TgZ(20,"div",12),e.YNc(21,hs,1,0,"input",18),e.YNc(22,Ns,5,4,"select",19),e.YNc(23,Fs,2,0,"span",14),e.qZA()(),e.YNc(24,Ls,3,4,"div",8),e.YNc(25,Zs,6,2,"div",8),e.TgZ(26,"div",9)(27,"div",20)(28,"div",21)(29,"input",22),e.NdJ("change",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.onUseDataPoolChange())}),e.qZA(),e.TgZ(30,"label",23),e.SDv(31,24),e.qZA(),e.YNc(32,ws,3,0,"cd-helper",25),e.qZA()()(),e.YNc(33,Js,9,6,"div",8),e.TgZ(34,"div",9)(35,"label",26),e.SDv(36,27),e.qZA(),e.TgZ(37,"div",12),e._UZ(38,"input",28),e.YNc(39,Ys,2,0,"span",14),e.YNc(40,Vs,2,0,"span",14),e.YNc(41,Us,2,0,"span",14),e.qZA()(),e.TgZ(42,"div",29)(43,"label",30),e.SDv(44,31),e.qZA(),e.TgZ(45,"div",12),e.YNc(46,Ws,5,6,"div",32),e.qZA()(),e.TgZ(47,"div",9)(48,"div",20)(49,"div",21)(50,"input",33),e.NdJ("change",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.setMirrorMode())}),e.qZA(),e.TgZ(51,"label",34),e._uU(52,"Mirroring"),e.qZA(),e.YNc(53,e_,5,9,"cd-helper",25),e.qZA(),e.YNc(54,n_,2,1,"div",25),e.qZA()(),e.YNc(55,i_,6,1,"div",8),e.TgZ(56,"div",35)(57,"div",36),e.YNc(58,s_,2,0,"a",37),e.qZA()(),e.TgZ(59,"div",38)(60,"legend",39),e.SDv(61,40),e.qZA(),e.TgZ(62,"div",41)(63,"h4",39),e.SDv(64,42),e.qZA(),e.TgZ(65,"div",9)(66,"label",43),e.tHW(67,44),e._UZ(68,"cd-helper"),e.N_p(),e.qZA(),e.TgZ(69,"div",12)(70,"select",45),e.YNc(71,__,2,2,"option",46),e.qZA()()(),e.TgZ(72,"div",9)(73,"label",47),e.tHW(74,48),e._UZ(75,"cd-helper"),e.N_p(),e.qZA(),e.TgZ(76,"div",12)(77,"select",49)(78,"option",50),e.SDv(79,51),e.qZA(),e.YNc(80,a_,2,2,"option",46),e.qZA(),e.YNc(81,r_,2,0,"span",14),e.YNc(82,l_,2,0,"span",14),e.qZA()(),e.TgZ(83,"div",9)(84,"label",52),e.tHW(85,53),e._UZ(86,"cd-helper"),e.N_p(),e.qZA(),e.TgZ(87,"div",12),e._UZ(88,"input",54),e.YNc(89,c_,2,0,"span",14),e.YNc(90,d_,2,0,"span",14),e.qZA()()(),e.TgZ(91,"cd-rbd-configuration-form",55),e.NdJ("changes",function(i){e.CHM(t);const _=e.oxw();return e.KtG(_.getDirtyConfigurationValues=i)}),e.qZA()()(),e.TgZ(92,"div",56)(93,"cd-form-button-panel",57),e.NdJ("submitActionEvent",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.submit())}),e.ALo(94,"titlecase"),e.ALo(95,"upperFirst"),e.qZA()()()()()}if(2&n){const t=e.MAs(2),o=e.oxw();e.xp6(1),e.Q6J("formGroup",o.rbdForm),e.xp6(6),e.pQV(e.lcZ(6,36,o.action))(e.lcZ(7,38,o.resource)),e.QtT(5),e.xp6(2),e.Q6J("ngIf",o.rbdForm.getValue("parent")),e.xp6(6),e.Q6J("ngIf",o.rbdForm.showError("name",t,"required")),e.xp6(1),e.Q6J("ngIf",o.rbdForm.showError("name",t,"pattern")),e.xp6(2),e.Q6J("ngClass",e.VKq(44,We,"editing"!==o.mode)),e.xp6(3),e.Q6J("ngIf","editing"===o.mode||!o.poolPermission.read),e.xp6(1),e.Q6J("ngIf","editing"!==o.mode&&o.poolPermission.read),e.xp6(1),e.Q6J("ngIf",o.rbdForm.showError("pool",t,"required")),e.xp6(1),e.Q6J("ngIf","editing"!==o.mode&&o.rbdForm.getValue("pool")&&null===o.namespaces),e.xp6(1),e.Q6J("ngIf","editing"===o.mode&&o.rbdForm.getValue("namespace")||"editing"!==o.mode&&(o.namespaces&&o.namespaces.length>0||!o.poolPermission.read)),e.xp6(7),e.Q6J("ngIf",o.allDataPools.length<=1),e.xp6(1),e.Q6J("ngIf",o.rbdForm.getValue("useDataPool")),e.xp6(6),e.Q6J("ngIf",o.rbdForm.showError("size",t,"required")),e.xp6(1),e.Q6J("ngIf",o.rbdForm.showError("size",t,"invalidSizeObject")),e.xp6(1),e.Q6J("ngIf",o.rbdForm.showError("size",t,"pattern")),e.xp6(5),e.Q6J("ngForOf",o.featuresList),e.xp6(7),e.Q6J("ngIf",!1===o.mirroring&&o.currentPoolName),e.xp6(1),e.Q6J("ngIf",o.mirroring),e.xp6(1),e.Q6J("ngIf","snapshot"===o.rbdForm.getValue("mirroringMode")&&o.mirroring),e.xp6(3),e.Q6J("ngIf",!o.advancedEnabled),e.xp6(1),e.Q6J("hidden",!o.advancedEnabled),e.xp6(12),e.Q6J("ngForOf",o.objectSizes),e.xp6(2),e.Q6J("ngClass",e.VKq(46,We,o.rbdForm.getValue("stripingCount"))),e.xp6(5),e.Q6J("ngValue",null),e.xp6(2),e.Q6J("ngForOf",o.objectSizes),e.xp6(1),e.Q6J("ngIf",o.rbdForm.showError("stripingUnit",t,"required")),e.xp6(1),e.Q6J("ngIf",o.rbdForm.showError("stripingUnit",t,"invalidStripingUnit")),e.xp6(2),e.Q6J("ngClass",e.VKq(48,We,o.rbdForm.getValue("stripingUnit"))),e.xp6(5),e.Q6J("ngIf",o.rbdForm.showError("stripingCount",t,"required")),e.xp6(1),e.Q6J("ngIf",o.rbdForm.showError("stripingCount",t,"min")),e.xp6(1),e.Q6J("form",o.rbdForm)("initializeData",o.initializeConfigData),e.xp6(2),e.Q6J("form",t)("submitText",e.lcZ(94,40,o.action)+" "+e.lcZ(95,42,o.resource))}}let $e=(()=>{class n extends k.E{constructor(t,o,i,_,a,l,d,g,S,I){super(),this.authStorageService=t,this.route=o,this.poolService=i,this.rbdService=_,this.formatter=a,this.taskWrapper=l,this.dimlessBinaryPipe=d,this.actionLabels=g,this.router=S,this.rbdMirroringService=I,this.namespaces=[],this.namespacesByPoolCache={},this.pools=null,this.allPools=null,this.dataPools=null,this.allDataPools=[],this.featuresList=[],this.initializeConfigData=new Pt.t(1),this.peerConfigured=!1,this.advancedEnabled=!1,this.rbdFormMode=je,this.defaultObjectSize="4 MiB",this.mirroringOptions=["journal","snapshot"],this.mirroring=!1,this.currentPoolName="",this.objectSizes=["4 KiB","8 KiB","16 KiB","32 KiB","64 KiB","128 KiB","256 KiB","512 KiB","1 MiB","2 MiB","4 MiB","8 MiB","16 MiB","32 MiB"],this.defaultStripingUnit="4 MiB",this.defaultStripingCount=1,this.rbdImage=new Pt.t(1),this.icons=T.P,this.routerUrl=this.router.url,this.poolPermission=this.authStorageService.getPermissions().pool,this.resource="RBD",this.features={"deep-flatten":{desc:"Deep flatten",requires:null,allowEnable:!1,allowDisable:!0,helperHtml:"Feature can be disabled but can't be re-enabled later"},layering:{desc:"Layering",requires:null,allowEnable:!1,allowDisable:!1,helperHtml:"Feature flag can't be manipulated after the image is created. Disabling this option will also disable the Protect and Clone actions on Snapshot"},"exclusive-lock":{desc:"Exclusive lock",requires:null,allowEnable:!0,allowDisable:!0},"object-map":{desc:"Object map (requires exclusive-lock)",requires:"exclusive-lock",allowEnable:!0,allowDisable:!0,initDisabled:!0},"fast-diff":{desc:"Fast diff (interlocked with object-map)",requires:"object-map",allowEnable:!0,allowDisable:!0,interlockedWith:"object-map",initDisabled:!0}},this.featuresList=this.objToArray(this.features),this.createForm()}objToArray(t){return C().map(t,(o,i)=>Object.assign(o,{key:i}))}createForm(){this.rbdForm=new Z.d({parent:new r.p4(""),name:new r.p4("",{validators:[r.kI.required,r.kI.pattern(/^[^@/]+?$/)]}),pool:new r.p4(null,{validators:[r.kI.required]}),namespace:new r.p4(null),useDataPool:new r.p4(!1),dataPool:new r.p4(null),size:new r.p4(null,{updateOn:"blur"}),obj_size:new r.p4(this.defaultObjectSize),features:new Z.d(this.featuresList.reduce((t,o)=>(t[o.key]=new r.p4({value:!1,disabled:!!o.initDisabled}),t),{})),mirroring:new r.p4(""),schedule:new r.p4("",{validators:[r.kI.pattern(/^([0-9]+)d|([0-9]+)h|([0-9]+)m$/)]}),mirroringMode:new r.p4(""),stripingUnit:new r.p4(this.defaultStripingUnit),stripingCount:new r.p4(this.defaultStripingCount,{updateOn:"blur"})},this.validateRbdForm(this.formatter))}disableForEdit(){this.rbdForm.get("parent").disable(),this.rbdForm.get("pool").disable(),this.rbdForm.get("namespace").disable(),this.rbdForm.get("useDataPool").disable(),this.rbdForm.get("dataPool").disable(),this.rbdForm.get("obj_size").disable(),this.rbdForm.get("stripingUnit").disable(),this.rbdForm.get("stripingCount").disable(),this.rbdImage.subscribe(t=>{t.image_format===Ie.V1?(this.rbdForm.get("deep-flatten").disable(),this.rbdForm.get("layering").disable(),this.rbdForm.get("exclusive-lock").disable()):(this.rbdForm.get("deep-flatten").value||this.rbdForm.get("deep-flatten").disable(),this.rbdForm.get("layering").disable())})}disableForClone(){this.rbdForm.get("parent").disable(),this.rbdForm.get("size").disable()}disableForCopy(){this.rbdForm.get("parent").disable(),this.rbdForm.get("size").disable()}ngOnInit(){this.prepareFormForAction(),this.gatherNeededData().subscribe(this.handleExternalData.bind(this))}setExclusiveLock(){this.mirroring&&"journal"===this.rbdForm.get("mirroringMode").value?(this.rbdForm.get("exclusive-lock").setValue(!0),this.rbdForm.get("exclusive-lock").disable()):(this.rbdForm.get("exclusive-lock").enable(),"pool"===this.poolMirrorMode&&this.rbdForm.get("mirroringMode").setValue(this.mirroringOptions[0]))}setMirrorMode(){this.mirroring=!this.mirroring,this.setExclusiveLock(),this.checkPeersConfigured()}checkPeersConfigured(t){var o=t||this.rbdForm.get("pool").value;this.rbdMirroringService.getPeerForPool(o).subscribe(i=>{i.length>0&&(this.peerConfigured=!0)})}setPoolMirrorMode(){this.currentPoolName=this.mode===this.rbdFormMode.editing?this.response?.pool_name:this.rbdForm.getValue("pool"),this.currentPoolName&&(this.rbdMirroringService.refresh(),this.rbdMirroringService.subscribeSummary(t=>{const o=t.content_data.pools.find(i=>i.name===this.currentPoolName);this.poolMirrorMode=o.mirror_mode,"disabled"===o.mirror_mode&&(this.mirroring=!1,this.rbdForm.get("mirroring").setValue(this.mirroring),this.rbdForm.get("mirroring").disable())})),this.setExclusiveLock()}prepareFormForAction(){const t=this.routerUrl;t.startsWith("/block/rbd/edit")?(this.mode=this.rbdFormMode.editing,this.action=this.actionLabels.EDIT,this.disableForEdit()):t.startsWith("/block/rbd/clone")?(this.mode=this.rbdFormMode.cloning,this.disableForClone(),this.action=this.actionLabels.CLONE):t.startsWith("/block/rbd/copy")?(this.mode=this.rbdFormMode.copying,this.action=this.actionLabels.COPY,this.disableForCopy()):this.action=this.actionLabels.CREATE,C().each(this.features,o=>{this.rbdForm.get("features").get(o.key).valueChanges.subscribe(i=>this.featureFormUpdate(o.key,i))})}gatherNeededData(){const t={};return this.mode?this.route.params.subscribe(o=>{const i=v.N.fromString(decodeURIComponent(o.image_spec));o.snap&&(this.snapName=decodeURIComponent(o.snap)),t.rbd=this.rbdService.get(i),this.checkPeersConfigured(i.poolName)}):t.defaultFeatures=this.rbdService.defaultFeatures(),this.mode!==this.rbdFormMode.editing&&this.poolPermission.read&&(t.pools=this.poolService.list(["pool_name","type","flags_names","application_metadata"])),(0,ce.D)(t)}handleExternalData(t){if(this.handlePoolData(t.pools),this.setPoolMirrorMode(),t.defaultFeatures&&this.setFeatures(t.defaultFeatures),t.rbd){const o=t.rbd;this.setResponse(o,this.snapName),this.rbdImage.next(o)}this.loadingReady()}handlePoolData(t){if(!t)return;const o=[],i=[];for(const _ of t)this.rbdService.isRBDPool(_)&&("replicated"===_.type?(o.push(_),i.push(_)):"erasure"===_.type&&-1!==_.flags_names.indexOf("ec_overwrites")&&i.push(_));if(this.pools=o,this.allPools=o,this.dataPools=i,this.allDataPools=i,1===this.pools.length){const _=this.pools[0].pool_name;this.rbdForm.get("pool").setValue(_),this.onPoolChange(_)}this.allDataPools.length<=1&&this.rbdForm.get("useDataPool").disable()}onPoolChange(t){const o=this.rbdForm.get("dataPool");o.value===t&&o.setValue(null),this.dataPools=this.allDataPools?this.allDataPools.filter(i=>i.pool_name!==t):[],this.namespaces=null,t in this.namespacesByPoolCache?this.namespaces=this.namespacesByPoolCache[t]:this.rbdService.listNamespaces(t).subscribe(i=>{i=i.map(_=>_.namespace),this.namespacesByPoolCache[t]=i,this.namespaces=i}),this.rbdForm.get("namespace").setValue(null)}onUseDataPoolChange(){this.rbdForm.getValue("useDataPool")||(this.rbdForm.get("dataPool").setValue(null),this.onDataPoolChange(null))}onDataPoolChange(t){const o=this.allPools.filter(i=>i.pool_name!==t);this.rbdForm.getValue("pool")===t&&this.rbdForm.get("pool").setValue(null),this.pools=o}validateRbdForm(t){return o=>{const i=o.get("useDataPool"),_=o.get("dataPool");let a=null;i.value&&null==_.value&&(a={required:!0}),_.setErrors(a);const l=o.get("size"),d=o.get("obj_size"),g=t.toBytes(null!=d.value?d.value:this.defaultObjectSize),S=o.get("stripingCount"),I=null!=S.value?S.value:this.defaultStripingCount;let P=null;null===l.value?P={required:!0}:I*g>t.toBytes(l.value)&&(P={invalidSizeObject:!0}),l.setErrors(P);const $=o.get("stripingUnit");let y=null;null===$.value&&null!==S.value?y={required:!0}:null!==$.value&&t.toBytes($.value)>g&&(y={invalidStripingUnit:!0}),$.setErrors(y);let Q=null;return null===S.value&&null!==$.value?Q={required:!0}:I<1&&(Q={min:!0}),S.setErrors(Q),null}}deepBoxCheck(t,o){this.getDependentChildFeatures(t).forEach(_=>{const a=this.rbdForm.get(_.key);o?a.enable({emitEvent:!1}):(a.disable({emitEvent:!1}),a.setValue(!1,{emitEvent:!1}),this.deepBoxCheck(_.key,o));const l=this.rbdForm.get("features");this.mode===this.rbdFormMode.editing&&l.get(_.key).enabled&&(-1!==this.response.features_name.indexOf(_.key)&&!_.allowDisable||-1===this.response.features_name.indexOf(_.key)&&!_.allowEnable)&&l.get(_.key).disable()})}getDependentChildFeatures(t){return C().filter(this.features,o=>o.requires===t)||[]}interlockCheck(t,o){const i=this.featuresList.find(_=>_.key===t);if(this.response){const _=null!=i.interlockedWith,a=this.featuresList.find(d=>d.interlockedWith===i.key),l=!!this.response.features_name.find(d=>d===i.key);if(_){if(l!==!!this.response.features_name.find(g=>g===i.interlockedWith))return}else if(a&&!!this.response.features_name.find(g=>g===a.key)!==l)return}o?C().filter(this.features,_=>_.interlockedWith===t).forEach(_=>this.rbdForm.get(_.key).setValue(!0,{emitEvent:!1})):i.interlockedWith&&this.rbdForm.get("features").get(i.interlockedWith).setValue(!1)}featureFormUpdate(t,o){if(o){const i=this.features[t].requires;if(i&&!this.rbdForm.getValue(i))return void this.rbdForm.get(`features.${t}`).setValue(!1)}this.deepBoxCheck(t,o),this.interlockCheck(t,o)}setFeatures(t){const o=this.rbdForm.get("features");C().forIn(this.features,i=>{-1!==t.indexOf(i.key)&&o.get(i.key).setValue(!0),this.featureFormUpdate(i.key,o.get(i.key).value)})}setResponse(t,o){this.response=t;const i=new v.N(t.pool_name,t.namespace,t.name).toString();if(this.mode===this.rbdFormMode.cloning)this.rbdForm.get("parent").setValue(`${i}@${o}`);else if(this.mode===this.rbdFormMode.copying)o?this.rbdForm.get("parent").setValue(`${i}@${o}`):this.rbdForm.get("parent").setValue(`${i}`);else if(t.parent){const _=t.parent;this.rbdForm.get("parent").setValue(`${_.pool_name}/${_.image_name}@${_.snap_name}`)}this.mode===this.rbdFormMode.editing&&(this.rbdForm.get("name").setValue(t.name),"snapshot"===t?.mirror_mode||t.features_name.includes("journaling")?(this.mirroring=!0,this.rbdForm.get("mirroring").setValue(this.mirroring),this.rbdForm.get("mirroringMode").setValue(t?.mirror_mode),this.rbdForm.get("schedule").setValue(t?.schedule_interval)):(this.mirroring=!1,this.rbdForm.get("mirroring").setValue(this.mirroring)),this.setPoolMirrorMode()),this.rbdForm.get("pool").setValue(t.pool_name),this.onPoolChange(t.pool_name),this.rbdForm.get("namespace").setValue(t.namespace),t.data_pool&&(this.rbdForm.get("useDataPool").setValue(!0),this.rbdForm.get("dataPool").setValue(t.data_pool)),this.rbdForm.get("size").setValue(this.dimlessBinaryPipe.transform(t.size)),this.rbdForm.get("obj_size").setValue(this.dimlessBinaryPipe.transform(t.obj_size)),this.setFeatures(t.features_name),this.rbdForm.get("stripingUnit").setValue(this.dimlessBinaryPipe.transform(t.stripe_unit)),this.rbdForm.get("stripingCount").setValue(t.stripe_count),this.initializeConfigData.next({initialData:this.response.configuration,sourceType:rt.h.image})}createRequest(){const t=new Cs;return t.pool_name=this.rbdForm.getValue("pool"),t.namespace=this.rbdForm.getValue("namespace"),t.name=this.rbdForm.getValue("name"),t.schedule_interval=this.rbdForm.getValue("schedule"),t.size=this.formatter.toBytes(this.rbdForm.getValue("size")),"image"===this.poolMirrorMode&&(t.mirror_mode=this.rbdForm.getValue("mirroringMode")),this.addObjectSizeAndStripingToRequest(t),t.configuration=this.getDirtyConfigurationValues(),t}addObjectSizeAndStripingToRequest(t){t.obj_size=this.formatter.toBytes(this.rbdForm.getValue("obj_size")),C().forIn(this.features,o=>{this.rbdForm.getValue(o.key)&&t.features.push(o.key)}),this.mirroring&&"journal"===this.rbdForm.getValue("mirroringMode")&&t.features.push("journaling"),t.stripe_unit=this.formatter.toBytes(this.rbdForm.getValue("stripingUnit")),t.stripe_count=this.rbdForm.getValue("stripingCount"),t.data_pool=this.rbdForm.getValue("dataPool")}createAction(){const t=this.createRequest();return this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/create",{pool_name:t.pool_name,namespace:t.namespace,image_name:t.name,schedule_interval:t.schedule_interval,start_time:t.start_time}),call:this.rbdService.create(t)})}editRequest(){const t=new lt;if(t.name=this.rbdForm.getValue("name"),t.schedule_interval=this.rbdForm.getValue("schedule"),t.name=this.rbdForm.getValue("name"),t.size=this.formatter.toBytes(this.rbdForm.getValue("size")),C().forIn(this.features,o=>{this.rbdForm.getValue(o.key)&&t.features.push(o.key)}),t.enable_mirror=this.rbdForm.getValue("mirroring"),t.enable_mirror)"journal"===this.rbdForm.getValue("mirroringMode")&&t.features.push("journaling"),"image"===this.poolMirrorMode&&(t.mirror_mode=this.rbdForm.getValue("mirroringMode"));else{const o=t.features.indexOf("journaling",0);o>-1&&t.features.splice(o,1)}return t.configuration=this.getDirtyConfigurationValues(),t}cloneRequest(){const t=new gs;return t.child_pool_name=this.rbdForm.getValue("pool"),t.child_namespace=this.rbdForm.getValue("namespace"),t.child_image_name=this.rbdForm.getValue("name"),this.addObjectSizeAndStripingToRequest(t),t.configuration=this.getDirtyConfigurationValues(!0,rt.h.image),t}editAction(){const t=new v.N(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/edit",{image_spec:t.toString()}),call:this.rbdService.update(t,this.editRequest())})}cloneAction(){const t=this.cloneRequest(),o=new v.N(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/clone",{parent_image_spec:o.toString(),parent_snap_name:this.snapName,child_pool_name:t.child_pool_name,child_namespace:t.child_namespace,child_image_name:t.child_image_name}),call:this.rbdService.cloneSnapshot(o,this.snapName,t)})}copyRequest(){const t=new Ts;return this.snapName&&(t.snapshot_name=this.snapName),t.dest_pool_name=this.rbdForm.getValue("pool"),t.dest_namespace=this.rbdForm.getValue("namespace"),t.dest_image_name=this.rbdForm.getValue("name"),this.addObjectSizeAndStripingToRequest(t),t.configuration=this.getDirtyConfigurationValues(!0,rt.h.image),t}copyAction(){const t=this.copyRequest(),o=new v.N(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/copy",{src_image_spec:o.toString(),dest_pool_name:t.dest_pool_name,dest_namespace:t.dest_namespace,dest_image_name:t.dest_image_name}),call:this.rbdService.copy(o,t)})}submit(){this.mode||this.rbdImage.next("create"),this.rbdImage.pipe((0,ds.P)(),(0,ps.w)(()=>this.mode===this.rbdFormMode.editing?this.editAction():this.mode===this.rbdFormMode.cloning?this.cloneAction():this.mode===this.rbdFormMode.copying?this.copyAction():this.createAction())).subscribe(()=>{},()=>this.rbdForm.setErrors({cdSubmitButton:!0}),()=>this.router.navigate(["/block/rbd"]))}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(m.gz),e.Y36(Ve.q),e.Y36(H),e.Y36(us.H),e.Y36(u.P),e.Y36(Ue.$),e.Y36(L.p4),e.Y36(m.F0),e.Y36(q))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-form"]],features:[e.qOj],decls:1,vars:1,consts:function(){let s,t,o,i,_,a,l,d,g,S,I,P,$,y,Q,Y,ee,te,w,_e,ae,O,me,ge,Te,fe,Ce,Se,Re,G,Ge,ye,xe,Ze,we,He,ke,Ke,qe,Xe,Qe,ze;return s="" + "\ufffd0\ufffd" + " " + "\ufffd1\ufffd" + "",t="Name",o="Pool",i="Use a dedicated data pool",_="Size",a="e.g., 10GiB",l="Features",d="Advanced",g="Striping",S="Object size" + "\ufffd#68\ufffd" + "Objects in the Ceph Storage Cluster have a maximum configurable size (e.g., 2MB, 4MB, etc.). The object size should be large enough to accommodate many stripe units, and should be a multiple of the stripe unit." + "\ufffd/#68\ufffd" + "",I="Stripe unit" + "\ufffd#75\ufffd" + "Stripes have a configurable unit size (e.g., 64kb). The Ceph Client divides the data it will write to objects into equally sized stripe units, except for the last stripe unit. A stripe width, should be a fraction of the Object Size so that an object may contain many stripe units." + "\ufffd/#75\ufffd" + "",P="-- Select stripe unit --",$="Stripe count" + "\ufffd#86\ufffd" + "The Ceph Client writes a sequence of stripe units over a series of objects determined by the stripe count. The series of objects is called an object set. After the Ceph Client writes to the last object in the object set, it returns to the first object in the object set." + "\ufffd/#86\ufffd" + "",y="" + "\ufffd0\ufffd" + " from",Q="This field is required.",Y="'/' and '@' are not allowed.",ee="Loading...",te="-- No rbd pools available --",w="-- Select a pool --",_e="This field is required.",ae="Loading...",O="-- No namespaces available --",me="-- Select a namespace --",ge="You need more than one pool with the rbd application label use to use a dedicated data pool.",Te="Data pool",fe="Dedicated pool that stores the object-data of the RBD.",Ce="Loading...",Se="-- No data pools available --",Re="This field is required.",G="This field is required.",Ge="You have to increase the size.",ye="Size must be a number or in a valid format. eg: 5 GiB",xe="You need to enable a " + "\ufffd#3\ufffd" + "mirror mode" + "\ufffd/#3\ufffd" + " in the selected pool. Please " + "\ufffd#4\ufffd" + "click here to select a mode and enable it in this pool." + "\ufffd/#4\ufffd" + "",Ze="You need to enable " + "\ufffd#3\ufffd" + "image mirror mode" + "\ufffd/#3\ufffd" + " in the selected pool. Please " + "\ufffd#4\ufffd" + "click here to select a mode and enable it in this pool." + "\ufffd/#4\ufffd" + "",we="Create Mirror-Snapshots automatically on a periodic basis. The interval can be specified in days, hours, or minutes using d, h, m suffix respectively. To create mirror snapshots, you must import or create and have available peers to mirror",He="Schedule Interval " + "\ufffd#3\ufffd" + "" + "\ufffd/#3\ufffd" + "",ke="e.g., 12h or 1d or 10m",Ke="Advanced...",qe="This field is required because stripe count is defined!",Xe="Stripe unit is greater than object size.",Qe="This field is required because stripe unit is defined!",ze="Stripe count must be greater than 0.",[["class","cd-col-form",4,"cdFormLoading"],[1,"cd-col-form"],["name","rbdForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"card"],[1,"card-header"],s,[1,"card-body"],["class","form-group row",4,"ngIf"],[1,"form-group","row"],["for","name",1,"cd-col-form-label","required"],t,[1,"cd-col-form-input"],["type","text","placeholder","Name...","id","name","name","name","formControlName","name","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],[1,"form-group","row",3,"change"],["for","pool",1,"cd-col-form-label",3,"ngClass"],o,["class","form-control","type","text","placeholder","Pool name...","id","pool","name","pool","formControlName","pool",4,"ngIf"],["id","pool","name","pool","class","form-select","formControlName","pool",3,"change",4,"ngIf"],[1,"cd-col-form-offset"],[1,"custom-control","custom-checkbox"],["type","checkbox","id","useDataPool","name","useDataPool","formControlName","useDataPool",1,"custom-control-input",3,"change"],["for","useDataPool",1,"custom-control-label"],i,[4,"ngIf"],["for","size",1,"cd-col-form-label","required"],_,["id","size","name","size","type","text","formControlName","size","placeholder",a,"defaultUnit","GiB","cdDimlessBinary","",1,"form-control"],["formGroupName","features",1,"form-group","row"],["for","features",1,"cd-col-form-label"],l,["class","custom-control custom-checkbox",4,"ngFor","ngForOf"],["type","checkbox","id","mirroring","name","mirroring","formControlName","mirroring",1,"custom-control-input",3,"change"],["for","mirroring",1,"custom-control-label"],[1,"row"],[1,"col-sm-12"],["class","float-end margin-right-md","href","",3,"click",4,"ngIf"],[3,"hidden"],[1,"cd-header"],d,[1,"col-md-12"],g,["for","size",1,"cd-col-form-label"],S,["id","obj_size","name","obj_size","formControlName","obj_size",1,"form-select"],[3,"value",4,"ngFor","ngForOf"],["for","stripingUnit",1,"cd-col-form-label",3,"ngClass"],I,["id","stripingUnit","name","stripingUnit","formControlName","stripingUnit",1,"form-select"],[3,"ngValue"],P,["for","stripingCount",1,"cd-col-form-label",3,"ngClass"],$,["id","stripingCount","name","stripingCount","formControlName","stripingCount","type","number",1,"form-control"],[3,"form","initializeData","changes"],[1,"card-footer"],["wrappingClass","text-right",3,"form","submitText","submitActionEvent"],["for","name",1,"cd-col-form-label"],y,["type","text","id","parent","name","parent","formControlName","parent",1,"form-control"],[1,"invalid-feedback"],Q,Y,["type","text","placeholder","Pool name...","id","pool","name","pool","formControlName","pool",1,"form-control"],["id","pool","name","pool","formControlName","pool",1,"form-select",3,"change"],[3,"ngValue",4,"ngIf"],ee,te,w,[3,"value"],_e,[3,"ngClass"],["for","pool",1,"cd-col-form-label"],["class","form-control","type","text","placeholder","Namespace...","id","namespace","name","namespace","formControlName","namespace",4,"ngIf"],["id","namespace","name","namespace","class","form-select","formControlName","namespace",4,"ngIf"],["type","text","placeholder","Namespace...","id","namespace","name","namespace","formControlName","namespace",1,"form-control"],["id","namespace","name","namespace","formControlName","namespace",1,"form-select"],ae,O,me,ge,["for","dataPool",1,"cd-col-form-label"],Te,["html",fe],["class","form-control","type","text","placeholder","Data pool name...","id","dataPool","name","dataPool","formControlName","dataPool",4,"ngIf"],["id","dataPool","name","dataPool","class","form-select","formControlName","dataPool",3,"change",4,"ngIf"],["type","text","placeholder","Data pool name...","id","dataPool","name","dataPool","formControlName","dataPool",1,"form-control"],["id","dataPool","name","dataPool","formControlName","dataPool",1,"form-select",3,"change"],Ce,Se,Re,G,Ge,ye,["type","checkbox",1,"custom-control-input",3,"id","name","formControlName"],[1,"custom-control-label",3,"for"],[3,"html",4,"ngIf"],[3,"html"],xe,[3,"routerLink"],["class","custom-control custom-radio ms-2",4,"ngFor","ngForOf"],[1,"custom-control","custom-radio","ms-2"],["type","radio","name","mirroringMode","formControlName","mirroringMode",1,"form-check-input",3,"id","value","change"],[1,"form-check-label",3,"for"],Ze,[1,"cd-col-form-label"],He,["html",we],["id","schedule","name","schedule","type","text","formControlName","schedule","placeholder",ke,1,"form-control"],["href","",1,"float-end","margin-right-md",3,"click"],Ke,qe,Xe,Qe,ze]},template:function(t,o){1&t&&e.YNc(0,p_,96,50,"div",0),2&t&&e.Q6J("cdFormLoading",o.loading)},dependencies:[c.mk,c.sg,c.O5,r._Y,r.YN,r.Kr,r.Fj,r.wV,r.Wl,r.EJ,r._,r.JJ,r.JL,r.sg,r.u,r.x0,bt.S,A.p,Oe.U,Ss.Q,ft.y,M.o,B.b,K.P,J.V,m.rH,Rs.d,c.rS,ot.m]}),n})();var Lt=p(71225),ct=p(36169),u_=p(72427),dt=p(51847),m_=p(16738),he=p.n(m_),pt=p(62862),g_=p(52266);function T_(n,s){1&n&&(e.TgZ(0,"div",18)(1,"span"),e.SDv(2,19),e.qZA()())}function f_(n,s){1&n&&(e.TgZ(0,"span",20),e.SDv(1,21),e.qZA())}function C_(n,s){1&n&&(e.TgZ(0,"span",20),e.SDv(1,22),e.qZA())}function S_(n,s){if(1&n&&e._UZ(0,"cd-date-time-picker",23),2&n){const t=e.oxw();e.Q6J("control",t.moveForm.get("expiresAt"))}}let R_=(()=>{class n{constructor(t,o,i,_,a){this.rbdService=t,this.activeModal=o,this.actionLabels=i,this.fb=_,this.taskWrapper=a,this.createForm()}createForm(){this.moveForm=this.fb.group({expiresAt:["",[z.h.custom("format",t=>!(""===t||he()(t,"YYYY-MM-DD HH:mm:ss").isValid())),z.h.custom("expired",t=>he()().isAfter(t))]]})}ngOnInit(){this.imageSpec=new v.N(this.poolName,this.namespace,this.imageName),this.imageSpecStr=this.imageSpec.toString(),this.pattern=`${this.poolName}/${this.imageName}`}moveImage(){let t=0;const o=this.moveForm.getValue("expiresAt");o&&(t=he()(o,"YYYY-MM-DD HH:mm:ss").diff(he()(),"seconds",!0)),t<0&&(t=0),this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/trash/move",{image_spec:this.imageSpecStr}),call:this.rbdService.moveTrash(this.imageSpec,t)}).subscribe({complete:()=>{this.activeModal.close()}})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(H),e.Y36(F.Kz),e.Y36(L.p4),e.Y36(pt.O),e.Y36(u.P))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-trash-move-modal"]],decls:23,vars:9,consts:function(){let s,t,o,i,_,a,l;return s="Move an image to trash",t="To move " + "[\ufffd#10\ufffd|\ufffd#11\ufffd]" + "" + "\ufffd0\ufffd" + "" + "[\ufffd/#10\ufffd|\ufffd/#11\ufffd]" + " to trash, click " + "[\ufffd#10\ufffd|\ufffd#11\ufffd]" + "Move" + "[\ufffd/#10\ufffd|\ufffd/#11\ufffd]" + ". Optionally, you can pick an expiration date.",t=e.Zx4(t),o="Protection expires at",i="NOT PROTECTED",_="This image contains snapshot(s), which will prevent it from being removed after moved to trash.",a="Wrong date format. Please use \"YYYY-MM-DD HH:mm:ss\".",l="Protection has already expired. Please pick a future date or leave it empty.",[[3,"modalRef"],[1,"modal-title"],s,[1,"modal-content"],["name","moveForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],["class","alert alert-warning","role","alert",4,"ngIf"],t,[1,"form-group"],["for","expiresAt",1,"col-form-label"],o,["type","text","placeholder",i,"formControlName","expiresAt","triggers","manual",1,"form-control",3,"ngbPopover","click","keypress"],["p","ngbPopover"],["class","invalid-feedback",4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],["popContent",""],["role","alert",1,"alert","alert-warning"],_,[1,"invalid-feedback"],a,l,[3,"control"]]},template:function(t,o){if(1&t){const i=e.EpF();e.TgZ(0,"cd-modal",0),e.ynx(1,1),e.SDv(2,2),e.BQk(),e.ynx(3,3),e.TgZ(4,"form",4,5)(6,"div",6),e.YNc(7,T_,3,0,"div",7),e.TgZ(8,"p"),e.tHW(9,8),e._UZ(10,"kbd")(11,"kbd"),e.N_p(),e.qZA(),e.TgZ(12,"div",9)(13,"label",10),e.SDv(14,11),e.qZA(),e.TgZ(15,"input",12,13),e.NdJ("click",function(){e.CHM(i);const a=e.MAs(16);return e.KtG(a.open())})("keypress",function(){e.CHM(i);const a=e.MAs(16);return e.KtG(a.close())}),e.qZA(),e.YNc(17,f_,2,0,"span",14),e.YNc(18,C_,2,0,"span",14),e.qZA()(),e.TgZ(19,"div",15)(20,"cd-form-button-panel",16),e.NdJ("submitActionEvent",function(){return o.moveImage()}),e.qZA()()(),e.BQk(),e.qZA(),e.YNc(21,S_,1,1,"ng-template",null,17,e.W1O)}if(2&t){const i=e.MAs(5),_=e.MAs(22);e.Q6J("modalRef",o.activeModal),e.xp6(4),e.Q6J("formGroup",o.moveForm),e.xp6(3),e.Q6J("ngIf",o.hasSnapshots),e.xp6(4),e.pQV(o.imageSpecStr),e.QtT(9),e.xp6(4),e.Q6J("ngbPopover",_),e.xp6(2),e.Q6J("ngIf",o.moveForm.showError("expiresAt",i,"format")),e.xp6(1),e.Q6J("ngIf",o.moveForm.showError("expiresAt",i,"expired")),e.xp6(2),e.Q6J("form",o.moveForm)("submitText",o.actionLabels.MOVE)}},dependencies:[c.O5,r._Y,r.Fj,r.JJ,r.JL,r.sg,r.u,F.o8,f.z,g_.J,A.p,M.o,B.b,K.P,J.V]}),n})();var E_=p(60251),vt=p(76317),M_=p(25917),$t=p(51295),ut=p(60737),O_=p(74255),Bt=p(71099),Gt=p(79765);function h_(n,s){1&n&&(e.TgZ(0,"span",16),e.SDv(1,17),e.qZA())}function A_(n,s){if(1&n&&(e.TgZ(0,"span"),e.tHW(1,18),e._UZ(2,"b"),e.N_p(),e.qZA()),2&n){const t=e.oxw();e.xp6(2),e.pQV(t.imageName),e.QtT(1)}}function P_(n,s){1&n&&(e.TgZ(0,"cd-helper"),e.SDv(1,25),e.qZA())}function b_(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",7)(1,"div",20)(2,"div",21)(3,"input",22),e.NdJ("change",function(){e.CHM(t);const i=e.oxw(2);return e.KtG(i.onMirrorCheckBoxChange())}),e.qZA(),e.TgZ(4,"label",23),e.SDv(5,24),e.qZA(),e.YNc(6,P_,2,0,"cd-helper",13),e.qZA()()()}if(2&n){const t=s.ngIf;e.xp6(3),e.uIk("disabled",!(t.length>0)||null),e.xp6(3),e.Q6J("ngIf",!t.length>0)}}function I_(n,s){if(1&n&&(e.ynx(0),e.YNc(1,b_,7,2,"div",19),e.ALo(2,"async"),e.BQk()),2&n){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",e.lcZ(2,1,t.peerConfigured$))}}let N_=(()=>{class n{constructor(t,o,i,_,a,l){this.activeModal=t,this.rbdService=o,this.taskManagerService=i,this.notificationService=_,this.actionLabels=a,this.rbdMirrorService=l,this.editing=!1,this.onSubmit=new Gt.xQ,this.action=this.actionLabels.CREATE,this.resource="RBD Snapshot",this.createForm()}createForm(){this.snapshotForm=new Z.d({snapshotName:new r.p4("",{validators:[r.kI.required]}),mirrorImageSnapshot:new r.p4(!1,{})})}ngOnInit(){this.peerConfigured$=this.rbdMirrorService.getPeerForPool(this.poolName)}setSnapName(t){this.snapName=t,this.snapshotForm.get("snapshotName").setValue(t)}onMirrorCheckBoxChange(){!0===this.snapshotForm.getValue("mirrorImageSnapshot")?(this.snapshotForm.get("snapshotName").setValue(""),this.snapshotForm.get("snapshotName").clearValidators()):(this.snapshotForm.get("snapshotName").setValue(this.snapName),this.snapshotForm.get("snapshotName").setValidators([r.kI.required]),this.snapshotForm.get("snapshotName").updateValueAndValidity())}setEditing(t=!0){this.editing=t,this.action=this.editing?this.actionLabels.RENAME:this.actionLabels.CREATE}editAction(){const t=this.snapshotForm.getValue("snapshotName"),o=new v.N(this.poolName,this.namespace,this.imageName),i=new E.R;i.name="rbd/snap/edit",i.metadata={image_spec:o.toString(),snapshot_name:t},this.rbdService.renameSnapshot(o,this.snapName,t).toPromise().then(()=>{this.taskManagerService.subscribe(i.name,i.metadata,_=>{this.notificationService.notifyTask(_)}),this.activeModal.close(),this.onSubmit.next(this.snapName)}).catch(()=>{this.snapshotForm.setErrors({cdSubmitButton:!0})})}createAction(){const t=this.snapshotForm.getValue("snapshotName"),o=this.snapshotForm.getValue("mirrorImageSnapshot"),i=new v.N(this.poolName,this.namespace,this.imageName),_=new E.R;_.name="rbd/snap/create",_.metadata={image_spec:i.toString(),snapshot_name:t},this.rbdService.createSnapshot(i,t,o).toPromise().then(()=>{this.taskManagerService.subscribe(_.name,_.metadata,a=>{this.notificationService.notifyTask(a)}),this.activeModal.close(),this.onSubmit.next(t)}).catch(()=>{this.snapshotForm.setErrors({cdSubmitButton:!0})})}submit(){this.editing?this.editAction():this.createAction()}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(F.Kz),e.Y36(H),e.Y36(Bt.k),e.Y36(ve.g),e.Y36(L.p4),e.Y36(q))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-snapshot-form-modal"]],decls:21,vars:18,consts:function(){let s,t,o,i,_,a;return s="" + "\ufffd0\ufffd" + " " + "\ufffd1\ufffd" + "",t="Name",o="This field is required.",i="Snapshot mode is enabled on image " + "\ufffd#2\ufffd" + "" + "\ufffd0\ufffd" + "" + "\ufffd/#2\ufffd" + ": snapshot names are auto generated",_="Mirror Image Snapshot",a="The peer must be registered to do this action.",[[3,"modalRef"],[1,"modal-title"],s,[1,"modal-content"],["name","snapshotForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"form-group","row"],["for","snapshotName",1,"cd-col-form-label","required"],t,[1,"cd-col-form-input"],["type","text","placeholder","Snapshot name...","id","snapshotName","name","snapshotName","formControlName","snapshotName","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],[4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],o,i,["class","form-group row",4,"ngIf"],[1,"cd-col-form-offset"],[1,"custom-control","custom-checkbox"],["type","checkbox","formControlName","mirrorImageSnapshot","name","mirrorImageSnapshot","id","mirrorImageSnapshot",1,"custom-control-input",3,"change"],["for","mirrorImageSnapshot",1,"custom-control-label"],_,a]},template:function(t,o){if(1&t&&(e.TgZ(0,"cd-modal",0),e.ynx(1,1),e.SDv(2,2),e.ALo(3,"titlecase"),e.ALo(4,"upperFirst"),e.BQk(),e.ynx(5,3),e.TgZ(6,"form",4,5)(8,"div",6)(9,"div",7)(10,"label",8),e.SDv(11,9),e.qZA(),e.TgZ(12,"div",10),e._UZ(13,"input",11),e.YNc(14,h_,2,0,"span",12),e.YNc(15,A_,3,1,"span",13),e.qZA()(),e.YNc(16,I_,3,3,"ng-container",13),e.qZA(),e.TgZ(17,"div",14)(18,"cd-form-button-panel",15),e.NdJ("submitActionEvent",function(){return o.submit()}),e.ALo(19,"titlecase"),e.ALo(20,"upperFirst"),e.qZA()()(),e.BQk(),e.qZA()),2&t){const i=e.MAs(7);e.Q6J("modalRef",o.activeModal),e.xp6(4),e.pQV(e.lcZ(3,10,o.action))(e.lcZ(4,12,o.resource)),e.QtT(2),e.xp6(2),e.Q6J("formGroup",o.snapshotForm),e.xp6(7),e.uIk("disabled","snapshot"===o.mirroring&&!0===o.snapshotForm.getValue("mirrorImageSnapshot")||null),e.xp6(1),e.Q6J("ngIf",o.snapshotForm.showError("snapshotName",i,"required")),e.xp6(1),e.Q6J("ngIf","snapshot"===o.mirroring&&!0===o.snapshotForm.getValue("mirrorImageSnapshot")||null),e.xp6(1),e.Q6J("ngIf","snapshot"===o.mirroring||null),e.xp6(2),e.Q6J("form",o.snapshotForm)("submitText",e.lcZ(19,14,o.action)+" "+e.lcZ(20,16,o.resource))}},dependencies:[c.O5,r._Y,r.Fj,r.Wl,r.JJ,r.JL,r.sg,r.u,bt.S,f.z,A.p,Oe.U,M.o,B.b,K.P,J.V,c.Ov,c.rS,ot.m]}),n})();class F_{constructor(s,t,o){this.featuresName=t,this.cloneFormatVersion=1,o.cloneFormatVersion().subscribe(i=>{this.cloneFormatVersion=i}),this.create={permission:"create",icon:T.P.add,name:s.CREATE},this.rename={permission:"update",icon:T.P.edit,name:s.RENAME,disable:i=>this.disableForMirrorSnapshot(i)||!i.hasSingleSelection},this.protect={permission:"update",icon:T.P.lock,visible:i=>i.hasSingleSelection&&!i.first().is_protected,name:s.PROTECT,disable:i=>this.disableForMirrorSnapshot(i)||this.getProtectDisableDesc(i,this.featuresName)},this.unprotect={permission:"update",icon:T.P.unlock,visible:i=>i.hasSingleSelection&&i.first().is_protected,name:s.UNPROTECT,disable:i=>this.disableForMirrorSnapshot(i)},this.clone={permission:"create",canBePrimary:i=>i.hasSingleSelection,disable:i=>this.getCloneDisableDesc(i)||this.disableForMirrorSnapshot(i),icon:T.P.clone,name:s.CLONE},this.copy={permission:"create",canBePrimary:i=>i.hasSingleSelection,disable:i=>!i.hasSingleSelection||i.first().cdExecuting||this.disableForMirrorSnapshot(i),icon:T.P.copy,name:s.COPY},this.rollback={permission:"update",icon:T.P.undo,name:s.ROLLBACK,disable:i=>this.disableForMirrorSnapshot(i)||!i.hasSingleSelection},this.deleteSnap={permission:"delete",icon:T.P.destroy,disable:i=>{const _=i.first();return!i.hasSingleSelection||_.cdExecuting||_.is_protected||this.disableForMirrorSnapshot(i)},name:s.DELETE},this.ordering=[this.create,this.rename,this.protect,this.unprotect,this.clone,this.copy,this.rollback,this.deleteSnap]}getProtectDisableDesc(s,t){return!(s.hasSingleSelection&&!s.first().cdExecuting)||!t?.includes("layering")&&"The layering feature needs to be enabled on parent image"}getCloneDisableDesc(s){return!(s.hasSingleSelection&&!s.first().cdExecuting)||1===this.cloneFormatVersion&&!s.first().is_protected&&"Snapshot must be protected in order to clone."}disableForMirrorSnapshot(s){return s.hasSingleSelection&&"snapshot"===s.first().mirror_mode&&s.first().name.includes(".mirror.")}}class D_{}var Be=p(96102);const L_=["nameTpl"],v_=["rollbackTpl"];function $_(n,s){if(1&n&&(e.ynx(0),e.SDv(1,3),e.BQk(),e.TgZ(2,"strong"),e._uU(3),e.qZA(),e._uU(4,".\n")),2&n){const t=s.$implicit;e.xp6(3),e.hij(" ",t.snapName,"")}}let B_=(()=>{class n{constructor(t,o,i,_,a,l,d,g,S,I,P){this.authStorageService=t,this.modalService=o,this.dimlessBinaryPipe=i,this.cdDatePipe=_,this.rbdService=a,this.taskManagerService=l,this.notificationService=d,this.summaryService=g,this.taskListService=S,this.actionLabels=I,this.cdr=P,this.snapshots=[],this.selection=new Ee.r,this.builders={"rbd/snap/create":$=>{const y=new D_;return y.name=$.snapshot_name,y}},this.permission=this.authStorageService.getPermissions().rbdImage}ngOnInit(){this.columns=[{name:"Name",prop:"name",cellTransformation:Le.e.executing,flexGrow:2},{name:"Size",prop:"size",flexGrow:1,cellClass:"text-right",pipe:this.dimlessBinaryPipe},{name:"Used",prop:"disk_usage",flexGrow:1,cellClass:"text-right",pipe:this.dimlessBinaryPipe},{name:"State",prop:"is_protected",flexGrow:1,cellTransformation:Le.e.badge,customTemplateConfig:{map:{true:{value:"PROTECTED",class:"badge-success"},false:{value:"UNPROTECTED",class:"badge-info"}}}},{name:"Created",prop:"timestamp",flexGrow:1,pipe:this.cdDatePipe}],this.imageSpec=new v.N(this.poolName,this.namespace,this.rbdName),this.rbdTableActions=new F_(this.actionLabels,this.featuresName,this.rbdService),this.rbdTableActions.create.click=()=>this.openCreateSnapshotModal(),this.rbdTableActions.rename.click=()=>this.openEditSnapshotModal(),this.rbdTableActions.protect.click=()=>this.toggleProtection(),this.rbdTableActions.unprotect.click=()=>this.toggleProtection();const t=()=>this.selection.first()&&`${this.imageSpec.toStringEncoded()}/${encodeURIComponent(this.selection.first().name)}`;this.rbdTableActions.clone.routerLink=()=>`/block/rbd/clone/${t()}`,this.rbdTableActions.copy.routerLink=()=>`/block/rbd/copy/${t()}`,this.rbdTableActions.rollback.click=()=>this.rollbackModal(),this.rbdTableActions.deleteSnap.click=()=>this.deleteSnapshotModal(),this.tableActions=this.rbdTableActions.ordering,this.taskListService.init(()=>(0,M_.of)(this.snapshots),null,_=>{$t.T.updateChanged(this,{data:_})&&(this.cdr.detectChanges(),this.data=[...this.data])},()=>{$t.T.updateChanged(this,{data:this.snapshots})&&(this.cdr.detectChanges(),this.data=[...this.data])},_=>["rbd/snap/create","rbd/snap/delete","rbd/snap/edit","rbd/snap/rollback"].includes(_.name)&&this.imageSpec.toString()===_.metadata.image_spec,(_,a)=>_.name===a.metadata.snapshot_name,this.builders)}ngOnChanges(){this.columns&&(this.imageSpec=new v.N(this.poolName,this.namespace,this.rbdName),this.rbdTableActions&&(this.rbdTableActions.featuresName=this.featuresName),this.taskListService.fetch())}openSnapshotModal(t,o=null){this.modalRef=this.modalService.show(N_,{mirroring:this.mirroring}),this.modalRef.componentInstance.poolName=this.poolName,this.modalRef.componentInstance.imageName=this.rbdName,this.modalRef.componentInstance.namespace=this.namespace,o?this.modalRef.componentInstance.setEditing():o=`${this.rbdName}_${he()().toISOString(!0)}`,this.modalRef.componentInstance.setSnapName(o),this.modalRef.componentInstance.onSubmit.subscribe(_=>{const a=new ut.o;a.name=t,a.metadata={image_spec:this.imageSpec.toString(),snapshot_name:_},this.summaryService.addRunningTask(a)})}openCreateSnapshotModal(){this.openSnapshotModal("rbd/snap/create")}openEditSnapshotModal(){this.openSnapshotModal("rbd/snap/edit",this.selection.first().name)}toggleProtection(){const t=this.selection.first().name,o=this.selection.first().is_protected,i=new E.R;i.name="rbd/snap/edit";const _=new v.N(this.poolName,this.namespace,this.rbdName);i.metadata={image_spec:_.toString(),snapshot_name:t},this.rbdService.protectSnapshot(_,t,!o).toPromise().then(()=>{const a=new ut.o;a.name=i.name,a.metadata=i.metadata,this.summaryService.addRunningTask(a),this.taskManagerService.subscribe(i.name,i.metadata,l=>{this.notificationService.notifyTask(l)})})}_asyncTask(t,o,i){const _=new E.R;_.name=o,_.metadata={image_spec:new v.N(this.poolName,this.namespace,this.rbdName).toString(),snapshot_name:i};const a=new v.N(this.poolName,this.namespace,this.rbdName);this.rbdService[t](a,i).toPromise().then(()=>{const l=new ut.o;l.name=_.name,l.metadata=_.metadata,this.summaryService.addRunningTask(l),this.modalRef.close(),this.taskManagerService.subscribe(l.name,l.metadata,d=>{this.notificationService.notifyTask(d)})}).catch(()=>{this.modalRef.componentInstance.stopLoadingSpinner()})}rollbackModal(){const t=this.selection.selected[0].name,o=new v.N(this.poolName,this.namespace,this.rbdName).toString(),i={titleText:"RBD snapshot rollback",buttonText:"Rollback",bodyTpl:this.rollbackTpl,bodyData:{snapName:`${o}@${t}`},onSubmit:()=>{this._asyncTask("rollbackSnapshot","rbd/snap/rollback",t)}};this.modalRef=this.modalService.show(ct.Y,i)}deleteSnapshotModal(){const t=this.selection.selected[0].name;this.modalRef=this.modalService.show(ue.M,{itemDescription:"RBD snapshot",itemNames:[t],submitAction:()=>this._asyncTask("deleteSnapshot","rbd/snap/delete",t)})}updateSelection(t){this.selection=t}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(pe.Z),e.Y36(Ue.$),e.Y36(Be.N),e.Y36(H),e.Y36(Bt.k),e.Y36(ve.g),e.Y36(O_.J),e.Y36(de.j),e.Y36(L.p4),e.Y36(e.sBO))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-snapshot-list"]],viewQuery:function(t,o){if(1&t&&(e.Gf(L_,5),e.Gf(v_,7)),2&t){let i;e.iGM(i=e.CRH())&&(o.nameTpl=i.first),e.iGM(i=e.CRH())&&(o.rollbackTpl=i.first)}},inputs:{snapshots:"snapshots",featuresName:"featuresName",poolName:"poolName",namespace:"namespace",mirroring:"mirroring",primary:"primary",rbdName:"rbdName"},features:[e._Bn([de.j]),e.TTD],decls:4,vars:5,consts:function(){let s;return s="You are about to rollback",[["columnMode","flex","selectionType","single",3,"data","columns","updateSelection"],[1,"table-actions",3,"permission","selection","tableActions"],["rollbackTpl",""],s]},template:function(t,o){1&t&&(e.TgZ(0,"cd-table",0),e.NdJ("updateSelection",function(_){return o.updateSelection(_)}),e._UZ(1,"cd-table-actions",1),e.qZA(),e.YNc(2,$_,5,1,"ng-template",null,2,e.W1O)),2&t&&(e.Q6J("data",o.data)("columns",o.columns),e.xp6(1),e.Q6J("permission",o.permission)("selection",o.selection)("tableActions",o.tableActions))},dependencies:[W.a,Me.K],changeDetection:0}),n})();var G_=p(42176),y_=p(41039);const x_=["poolConfigurationSourceTpl"];function Z_(n,s){1&n&&(e.ynx(0),e.tHW(1,3),e._UZ(2,"strong"),e.N_p(),e.BQk())}function w_(n,s){if(1&n&&(e.TgZ(0,"span")(1,"span",38),e._uU(2),e.qZA()()),2&n){const t=s.$implicit;e.xp6(2),e.Oqu(t)}}function H_(n,s){if(1&n&&(e.TgZ(0,"span")(1,"span",39),e.SDv(2,40),e.qZA()()),2&n){e.oxw(3);const t=e.MAs(1);e.xp6(1),e.Q6J("ngbTooltip",t)}}function k_(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"dimlessBinary"),e.qZA()),2&n){const t=e.oxw(3);e.xp6(1),e.hij(" ",e.lcZ(2,1,t.selection.disk_usage)," ")}}function K_(n,s){if(1&n&&(e.TgZ(0,"span")(1,"span",39),e.SDv(2,41),e.qZA()()),2&n){e.oxw(3);const t=e.MAs(1);e.xp6(1),e.Q6J("ngbTooltip",t)}}function q_(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"dimlessBinary"),e.qZA()),2&n){const t=e.oxw(3);e.xp6(1),e.hij(" ",e.lcZ(2,1,t.selection.total_disk_usage)," ")}}function X_(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&n){const t=e.oxw(4);e.xp6(1),e.hij("/",t.selection.parent.pool_namespace,"")}}function Q_(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.YNc(2,X_,2,1,"span",1),e._uU(3),e.qZA()),2&n){const t=e.oxw(3);e.xp6(1),e.Oqu(t.selection.parent.pool_name),e.xp6(1),e.Q6J("ngIf",t.selection.parent.pool_namespace),e.xp6(1),e.AsE("/",t.selection.parent.image_name,"@",t.selection.parent.snap_name,"")}}function z_(n,s){1&n&&(e.TgZ(0,"span"),e._uU(1,"-"),e.qZA())}function J_(n,s){if(1&n&&(e.TgZ(0,"table",17)(1,"tbody")(2,"tr")(3,"td",18),e.SDv(4,19),e.qZA(),e.TgZ(5,"td",20),e._uU(6),e.qZA()(),e.TgZ(7,"tr")(8,"td",21),e.SDv(9,22),e.qZA(),e.TgZ(10,"td"),e._uU(11),e.qZA()(),e.TgZ(12,"tr")(13,"td",21),e.SDv(14,23),e.qZA(),e.TgZ(15,"td"),e._uU(16),e.ALo(17,"empty"),e.qZA()(),e.TgZ(18,"tr")(19,"td",21),e.SDv(20,24),e.qZA(),e.TgZ(21,"td"),e._uU(22),e.ALo(23,"cdDate"),e.qZA()(),e.TgZ(24,"tr")(25,"td",21),e.SDv(26,25),e.qZA(),e.TgZ(27,"td"),e._uU(28),e.ALo(29,"dimlessBinary"),e.qZA()(),e.TgZ(30,"tr")(31,"td",21),e.SDv(32,26),e.qZA(),e.TgZ(33,"td"),e._uU(34),e.ALo(35,"dimless"),e.qZA()(),e.TgZ(36,"tr")(37,"td",21),e.SDv(38,27),e.qZA(),e.TgZ(39,"td"),e._uU(40),e.ALo(41,"dimlessBinary"),e.qZA()(),e.TgZ(42,"tr")(43,"td",21),e.SDv(44,28),e.qZA(),e.TgZ(45,"td"),e.YNc(46,w_,3,1,"span",29),e.qZA()(),e.TgZ(47,"tr")(48,"td",21),e.SDv(49,30),e.qZA(),e.TgZ(50,"td"),e.YNc(51,H_,3,1,"span",1),e.YNc(52,k_,3,3,"span",1),e.qZA()(),e.TgZ(53,"tr")(54,"td",21),e.SDv(55,31),e.qZA(),e.TgZ(56,"td"),e.YNc(57,K_,3,1,"span",1),e.YNc(58,q_,3,3,"span",1),e.qZA()(),e.TgZ(59,"tr")(60,"td",21),e.SDv(61,32),e.qZA(),e.TgZ(62,"td"),e._uU(63),e.ALo(64,"dimlessBinary"),e.qZA()(),e.TgZ(65,"tr")(66,"td",21),e.SDv(67,33),e.qZA(),e.TgZ(68,"td"),e._uU(69),e.qZA()(),e.TgZ(70,"tr")(71,"td",21),e.SDv(72,34),e.qZA(),e.TgZ(73,"td"),e.YNc(74,Q_,4,4,"span",1),e.YNc(75,z_,2,0,"span",1),e.qZA()(),e.TgZ(76,"tr")(77,"td",21),e.SDv(78,35),e.qZA(),e.TgZ(79,"td"),e._uU(80),e.qZA()(),e.TgZ(81,"tr")(82,"td",21),e.SDv(83,36),e.qZA(),e.TgZ(84,"td"),e._uU(85),e.qZA()(),e.TgZ(86,"tr")(87,"td",21),e.SDv(88,37),e.qZA(),e.TgZ(89,"td"),e._uU(90),e.qZA()()()()),2&n){const t=e.oxw(2);e.xp6(6),e.Oqu(t.selection.name),e.xp6(5),e.Oqu(t.selection.pool_name),e.xp6(5),e.Oqu(e.lcZ(17,19,t.selection.data_pool)),e.xp6(6),e.Oqu(e.lcZ(23,21,t.selection.timestamp)),e.xp6(6),e.Oqu(e.lcZ(29,23,t.selection.size)),e.xp6(6),e.Oqu(e.lcZ(35,25,t.selection.num_objs)),e.xp6(6),e.Oqu(e.lcZ(41,27,t.selection.obj_size)),e.xp6(6),e.Q6J("ngForOf",t.selection.features_name),e.xp6(5),e.Q6J("ngIf",-1===(null==t.selection.features_name?null:t.selection.features_name.indexOf("fast-diff"))),e.xp6(1),e.Q6J("ngIf",-1!==(null==t.selection.features_name?null:t.selection.features_name.indexOf("fast-diff"))),e.xp6(5),e.Q6J("ngIf",-1===(null==t.selection.features_name?null:t.selection.features_name.indexOf("fast-diff"))),e.xp6(1),e.Q6J("ngIf",-1!==(null==t.selection.features_name?null:t.selection.features_name.indexOf("fast-diff"))),e.xp6(5),e.Oqu(e.lcZ(64,29,t.selection.stripe_unit)),e.xp6(6),e.Oqu(t.selection.stripe_count),e.xp6(5),e.Q6J("ngIf",t.selection.parent),e.xp6(1),e.Q6J("ngIf",!t.selection.parent),e.xp6(5),e.Oqu(t.selection.block_name_prefix),e.xp6(5),e.Oqu(t.selection.order),e.xp6(5),e.Oqu(t.selection.image_format)}}function Y_(n,s){if(1&n&&e._UZ(0,"cd-rbd-snapshot-list",42),2&n){const t=e.oxw(2);e.Q6J("snapshots",t.selection.snapshots)("featuresName",t.selection.features_name)("poolName",t.selection.pool_name)("primary",t.selection.primary)("namespace",t.selection.namespace)("mirroring",t.selection.mirror_mode)("rbdName",t.selection.name)}}function V_(n,s){if(1&n&&e._UZ(0,"cd-rbd-configuration-table",43),2&n){const t=e.oxw(2);e.Q6J("data",t.selection.configuration)}}function U_(n,s){if(1&n&&e._UZ(0,"cd-grafana",44),2&n){const t=e.oxw(2);e.Q6J("grafanaPath",t.rbdDashboardUrl)("type","metrics")}}function j_(n,s){if(1&n&&(e.ynx(0),e.TgZ(1,"nav",4,5),e.ynx(3,6),e.TgZ(4,"a",7),e.SDv(5,8),e.qZA(),e.YNc(6,J_,91,31,"ng-template",9),e.BQk(),e.ynx(7,10),e.TgZ(8,"a",7),e.SDv(9,11),e.qZA(),e.YNc(10,Y_,1,7,"ng-template",9),e.BQk(),e.ynx(11,12),e.TgZ(12,"a",7),e.SDv(13,13),e.qZA(),e.YNc(14,V_,1,1,"ng-template",9),e.BQk(),e.ynx(15,14),e.TgZ(16,"a",7),e.SDv(17,15),e.qZA(),e.YNc(18,U_,1,2,"ng-template",9),e.BQk(),e.qZA(),e._UZ(19,"div",16),e.BQk()),2&n){const t=e.MAs(2);e.xp6(19),e.Q6J("ngbNavOutlet",t)}}function W_(n,s){1&n&&(e.ynx(0),e.TgZ(1,"cd-alert-panel",45),e.SDv(2,46),e.qZA(),e.BQk())}function ea(n,s){1&n&&(e.ynx(0),e.TgZ(1,"strong",49),e.SDv(2,50),e.qZA(),e.BQk())}function ta(n,s){1&n&&(e.TgZ(0,"span",51),e.SDv(1,52),e.qZA())}function oa(n,s){if(1&n&&(e.YNc(0,ea,3,0,"ng-container",47),e.YNc(1,ta,2,0,"ng-template",null,48,e.W1O)),2&n){const t=s.value,o=e.MAs(2);e.Q6J("ngIf",+t)("ngIfElse",o)}}let na=(()=>{class n{ngOnChanges(){this.selection&&(this.rbdDashboardUrl=`rbd-details?var-Pool=${this.selection.pool_name}&var-Image=${this.selection.name}`)}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-details"]],viewQuery:function(t,o){if(1&t&&(e.Gf(x_,7),e.Gf(F.Pz,7)),2&t){let i;e.iGM(i=e.CRH())&&(o.poolConfigurationSourceTpl=i.first),e.iGM(i=e.CRH())&&(o.nav=i.first)}},inputs:{selection:"selection",images:"images"},features:[e.TTD],decls:6,vars:2,consts:function(){let s,t,o,i,_,a,l,d,g,S,I,P,$,y,Q,Y,ee,te,w,_e,ae,O,me,ge,Te,fe,Ce,Se,Re;return s="Only available for RBD images with " + "\ufffd#2\ufffd" + "fast-diff" + "\ufffd/#2\ufffd" + " enabled",t="Details",o="Snapshots",i="Configuration",_="Performance",a="Name",l="Pool",d="Data Pool",g="Created",S="Size",I="Objects",P="Object size",$="Features",y="Provisioned",Q="Total provisioned",Y="Striping unit",ee="Striping count",te="Parent",w="Block name prefix",_e="Order",ae="Format Version",O="N/A",me="N/A",ge="RBD details",Te="Information can not be displayed for RBD in status 'Removing'.",fe="This setting overrides the global value",Ce="Image",Se="This is the global value. No value for this option has been set for this image.",Re="Global",[["usageNotAvailableTooltipTpl",""],[4,"ngIf"],["poolConfigurationSourceTpl",""],s,["ngbNav","","cdStatefulTab","rbd-details",1,"nav-tabs"],["nav","ngbNav"],["ngbNavItem","details"],["ngbNavLink",""],t,["ngbNavContent",""],["ngbNavItem","snapshots"],o,["ngbNavItem","configuration"],i,["ngbNavItem","performance"],_,[3,"ngbNavOutlet"],[1,"table","table-striped","table-bordered"],[1,"bold","w-25"],a,[1,"w-75"],[1,"bold"],l,d,g,S,I,P,$,[4,"ngFor","ngForOf"],y,Q,Y,ee,te,w,_e,ae,[1,"badge","badge-dark","me-2"],["placement","top",1,"form-text","text-muted",3,"ngbTooltip"],O,me,[3,"snapshots","featuresName","poolName","primary","namespace","mirroring","rbdName"],[3,"data"],["title",ge,"uid","YhCYGcuZz","grafanaStyle","one",3,"grafanaPath","type"],["type","warning"],Te,[4,"ngIf","ngIfElse"],["global",""],["ngbTooltip",fe],Ce,["ngbTooltip",Se],Re]},template:function(t,o){1&t&&(e.YNc(0,Z_,3,0,"ng-template",null,0,e.W1O),e.YNc(2,j_,20,1,"ng-container",1),e.YNc(3,W_,3,0,"ng-container",1),e.YNc(4,oa,3,2,"ng-template",null,2,e.W1O)),2&t&&(e.xp6(2),e.Q6J("ngIf",o.selection&&"REMOVING"!==o.selection.source),e.xp6(1),e.Q6J("ngIf",o.selection&&"REMOVING"===o.selection.source))},dependencies:[c.sg,c.O5,F.uN,F.Pz,F.nv,F.Vx,F.tO,F.Dy,F._L,vt.F,it.G,ht.m,B_,G_.P,Ue.$,st.n,Be.N,y_.W]}),n})();const et=function(){return{exact:!0}};function ia(n,s){1&n&&(e.TgZ(0,"li",1)(1,"a",9),e.SDv(2,10),e.qZA()()),2&n&&(e.xp6(1),e.Q6J("routerLinkActiveOptions",e.DdM(1,et)))}let tt=(()=>{class n{constructor(t){this.authStorageService=t,this.grafanaPermission=this.authStorageService.getPermissions().grafana}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-tabs"]],decls:11,vars:7,consts:function(){let s,t,o,i;return s="Images",t="Namespaces",o="Trash",i="Overall Performance",[[1,"nav","nav-tabs"],[1,"nav-item"],["routerLink","/block/rbd","routerLinkActive","active","ariaCurrentWhenActive","page",1,"nav-link",3,"routerLinkActiveOptions"],s,["routerLink","/block/rbd/namespaces","routerLinkActive","active","ariaCurrentWhenActive","page",1,"nav-link",3,"routerLinkActiveOptions"],t,["routerLink","/block/rbd/trash","routerLinkActive","active","ariaCurrentWhenActive","page",1,"nav-link",3,"routerLinkActiveOptions"],o,["class","nav-item",4,"ngIf"],["routerLink","/block/rbd/performance","routerLinkActive","active","ariaCurrentWhenActive","page",1,"nav-link",3,"routerLinkActiveOptions"],i]},template:function(t,o){1&t&&(e.TgZ(0,"ul",0)(1,"li",1)(2,"a",2),e.SDv(3,3),e.qZA()(),e.TgZ(4,"li",1)(5,"a",4),e.SDv(6,5),e.qZA()(),e.TgZ(7,"li",1)(8,"a",6),e.SDv(9,7),e.qZA()(),e.YNc(10,ia,3,2,"li",8),e.qZA()),2&t&&(e.xp6(2),e.Q6J("routerLinkActiveOptions",e.DdM(4,et)),e.xp6(3),e.Q6J("routerLinkActiveOptions",e.DdM(5,et)),e.xp6(3),e.Q6J("routerLinkActiveOptions",e.DdM(6,et)),e.xp6(2),e.Q6J("ngIf",o.grafanaPermission.read))},dependencies:[c.O5,m.rH,m.Od]}),n})();const sa=["usageTpl"],_a=["parentTpl"],aa=["nameTpl"],ra=["ScheduleTpl"],la=["mirroringTpl"],ca=["flattenTpl"],da=["deleteTpl"],pa=["removingStatTpl"],ua=["forcePromoteConfirmation"],ma=["usedTmpl"],ga=["totalUsedTmpl"],Ta=["imageUsageTpl"];function fa(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&n){const t=e.oxw(2).value;e.xp6(1),e.hij("/",t.pool_namespace,"")}}function Ca(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.YNc(2,fa,2,1,"span",13),e._uU(3),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.Oqu(t.pool_name),e.xp6(1),e.Q6J("ngIf",t.pool_namespace),e.xp6(1),e.AsE("/",t.image_name,"@",t.snap_name,"")}}function Sa(n,s){1&n&&(e.TgZ(0,"span"),e._uU(1,"-"),e.qZA())}function Ra(n,s){if(1&n&&(e.YNc(0,Ca,4,4,"span",13),e.YNc(1,Sa,2,0,"span",13)),2&n){const t=s.value;e.Q6J("ngIf",t),e.xp6(1),e.Q6J("ngIf",!t)}}function Ea(n,s){if(1&n&&(e.TgZ(0,"span",17),e._uU(1),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.Oqu(t[0])}}function Ma(n,s){if(1&n&&(e.TgZ(0,"span",17),e._uU(1),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.Oqu(t[1])}}function Oa(n,s){1&n&&(e.TgZ(0,"span",17),e.SDv(1,18),e.qZA())}function ha(n,s){1&n&&(e.TgZ(0,"span",17),e.SDv(1,19),e.qZA())}function Aa(n,s){if(1&n&&(e.TgZ(0,"span",17),e._uU(1),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.Oqu(t)}}function Pa(n,s){if(1&n&&(e.YNc(0,Ea,2,1,"span",14),e._uU(1,"\xa0 "),e.YNc(2,Ma,2,1,"span",15),e._uU(3,"\xa0 "),e.YNc(4,Oa,2,0,"span",15),e.YNc(5,ha,2,0,"span",15),e.YNc(6,Aa,2,1,"ng-template",null,16,e.W1O)),2&n){const t=s.value,o=s.row,i=e.MAs(7);e.Q6J("ngIf",3===t.length)("ngIfElse",i),e.xp6(2),e.Q6J("ngIf",3===t.length),e.xp6(2),e.Q6J("ngIf",!0===o.primary),e.xp6(1),e.Q6J("ngIf",!1===o.primary)}}function ba(n,s){if(1&n&&(e.TgZ(0,"span",17),e._uU(1),e.ALo(2,"cdDate"),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.Oqu(e.lcZ(2,1,t[2]))}}function Ia(n,s){1&n&&e.YNc(0,ba,3,3,"span",15),2&n&&e.Q6J("ngIf",3===s.value.length)}function Na(n,s){if(1&n&&(e._uU(0," You are about to flatten "),e.TgZ(1,"strong"),e._uU(2),e.qZA(),e._uU(3,". "),e._UZ(4,"br")(5,"br"),e._uU(6," All blocks will be copied from parent "),e.TgZ(7,"strong"),e._uU(8),e.qZA(),e._uU(9," to child "),e.TgZ(10,"strong"),e._uU(11),e.qZA(),e._uU(12,".\n")),2&n){const t=s.$implicit;e.xp6(2),e.Oqu(t.child),e.xp6(6),e.Oqu(t.parent),e.xp6(3),e.Oqu(t.child)}}function Fa(n,s){if(1&n&&(e.TgZ(0,"li"),e._uU(1),e.qZA()),2&n){const t=s.$implicit;e.xp6(1),e.Oqu(t)}}function Da(n,s){if(1&n&&(e.ynx(0),e.TgZ(1,"span"),e.SDv(2,23),e.qZA(),e.TgZ(3,"ul"),e.YNc(4,Fa,2,1,"li",24),e.qZA(),e.BQk()),2&n){const t=e.oxw(2).snapshots;e.xp6(4),e.Q6J("ngForOf",t)}}function La(n,s){if(1&n&&(e.TgZ(0,"div",21)(1,"span"),e.SDv(2,22),e.qZA(),e._UZ(3,"br"),e.YNc(4,Da,5,1,"ng-container",13),e.qZA()),2&n){const t=e.oxw().snapshots;e.xp6(4),e.Q6J("ngIf",t.length>0)}}function va(n,s){1&n&&e.YNc(0,La,5,1,"div",20),2&n&&e.Q6J("ngIf",s.hasSnapshots)}const $a=function(n,s){return[n,s]};function Ba(n,s){if(1&n&&e._UZ(0,"i",26),2&n){const t=e.oxw(2);e.Q6J("ngClass",e.WLB(1,$a,t.icons.spinner,t.icons.spin))}}function Ga(n,s){if(1&n&&(e.TgZ(0,"span",26),e._uU(1),e.qZA()),2&n){const t=e.oxw(),o=t.column,i=t.row;e.Q6J("ngClass",null!=o&&null!=o.customTemplateConfig&&o.customTemplateConfig.executingClass?o.customTemplateConfig.executingClass:"text-muted italic"),e.xp6(1),e.hij(" (",i.cdExecuting,") ")}}function ya(n,s){if(1&n&&e._UZ(0,"i",28),2&n){const t=e.oxw(2);e.Gre("",t.icons.warning," warn")}}function xa(n,s){if(1&n&&(e.YNc(0,Ba,1,4,"i",25),e.TgZ(1,"span",26),e._uU(2),e.qZA(),e.YNc(3,Ga,2,2,"span",25),e.YNc(4,ya,1,3,"i",27)),2&n){const t=s.column,o=s.value,i=s.row;e.Q6J("ngIf",i.cdExecuting),e.xp6(1),e.Q6J("ngClass",null==t||null==t.customTemplateConfig?null:t.customTemplateConfig.valueClass),e.xp6(1),e.hij(" ",o," "),e.xp6(1),e.Q6J("ngIf",i.cdExecuting),e.xp6(1),e.Q6J("ngIf",i.source&&"REMOVING"===i.source)}}function Za(n,s){if(1&n&&(e.TgZ(0,"cd-alert-panel",29),e._uU(1),e.qZA(),e.TgZ(2,"div",30),e.tHW(3,31),e._UZ(4,"strong"),e.N_p(),e.qZA()),2&n){const t=e.oxw();e.xp6(1),e.Oqu(t.errorMessage)}}function wa(n,s){if(1&n&&(e.TgZ(0,"span",34)(1,"span"),e._uU(2,"-"),e.qZA()()),2&n){e.oxw(2);const t=e.MAs(22);e.Q6J("ngbTooltip",t)}}function Ha(n,s){if(1&n&&e._UZ(0,"cd-usage-bar",36),2&n){const t=e.oxw(2).row;e.Q6J("total",t.size)("used",t.disk_usage)("title",t.name)}}function ka(n,s){if(1&n&&e.YNc(0,Ha,1,3,"cd-usage-bar",35),2&n){const t=e.oxw().row;e.Q6J("ngIf",t)}}function Ka(n,s){if(1&n&&(e.YNc(0,wa,3,1,"span",32),e.YNc(1,ka,1,1,"ng-template",null,33,e.W1O)),2&n){const t=s.row,o=e.MAs(2);e.Q6J("ngIf",t.features_name&&(!t.features_name.includes("fast-diff")||"snapshot"===t.mirror_mode))("ngIfElse",o)}}function qa(n,s){1&n&&e._UZ(0,"div",37),2&n&&e.Q6J("innerHtml","Only available for RBD images with <strong>fast-diff</strong> enabled and without snapshot mirroring",e.oJD)}let Qa=(()=>{class n extends St.o{createRbdFromTaskImageSpec(t){const o=v.N.fromString(t);return this.createRbdFromTask(o.poolName,o.namespace,o.imageName)}createRbdFromTask(t,o,i){const _=new ms;return _.id="-1",_.unique_id="-1",_.name=i,_.namespace=o,_.pool_name=t,_.image_format=Ie.V2,_}constructor(t,o,i,_,a,l,d,g,S){super(),this.authStorageService=t,this.rbdService=o,this.dimlessBinaryPipe=i,this.dimlessPipe=_,this.modalService=a,this.taskWrapper=l,this.taskListService=d,this.urlBuilder=g,this.actionLabels=S,this.tableStatus=new Lt.c("light"),this.selection=new Ee.r,this.icons=T.P,this.count=0,this.tableContext=null,this.builders={"rbd/create":O=>this.createRbdFromTask(O.pool_name,O.namespace,O.image_name),"rbd/delete":O=>this.createRbdFromTaskImageSpec(O.image_spec),"rbd/clone":O=>this.createRbdFromTask(O.child_pool_name,O.child_namespace,O.child_image_name),"rbd/copy":O=>this.createRbdFromTask(O.dest_pool_name,O.dest_namespace,O.dest_image_name)},this.permission=this.authStorageService.getPermissions().rbdImage;const I=()=>this.selection.first()&&new v.N(this.selection.first().pool_name,this.selection.first().namespace,this.selection.first().name).toStringEncoded();this.tableActions=[{permission:"create",icon:T.P.add,routerLink:()=>this.urlBuilder.getCreate(),canBePrimary:O=>!O.hasSingleSelection,name:this.actionLabels.CREATE},{permission:"update",icon:T.P.edit,routerLink:()=>this.urlBuilder.getEdit(I()),name:this.actionLabels.EDIT,disable:O=>this.getRemovingStatusDesc(O)||this.getInvalidNameDisable(O)},{permission:"create",canBePrimary:O=>O.hasSingleSelection,disable:O=>this.getRemovingStatusDesc(O)||this.getInvalidNameDisable(O)||!!O.first().cdExecuting,icon:T.P.copy,routerLink:()=>`/block/rbd/copy/${I()}`,name:this.actionLabels.COPY},{permission:"update",disable:O=>this.getRemovingStatusDesc(O)||this.getInvalidNameDisable(O)||O.first().cdExecuting||!O.first().parent,icon:T.P.flatten,click:()=>this.flattenRbdModal(),name:this.actionLabels.FLATTEN},{permission:"update",icon:T.P.refresh,click:()=>this.resyncRbdModal(),name:this.actionLabels.RESYNC,disable:O=>this.getResyncDisableDesc(O)},{permission:"delete",icon:T.P.destroy,click:()=>this.deleteRbdModal(),name:this.actionLabels.DELETE,disable:O=>this.getDeleteDisableDesc(O)},{permission:"delete",icon:T.P.trash,click:()=>this.trashRbdModal(),name:this.actionLabels.TRASH,disable:O=>this.getRemovingStatusDesc(O)||this.getInvalidNameDisable(O)||O.first().image_format===Ie.V1},{permission:"update",icon:T.P.edit,click:()=>this.removeSchedulingModal(),name:this.actionLabels.REMOVE_SCHEDULING,disable:O=>this.getRemovingStatusDesc(O)||this.getInvalidNameDisable(O)||void 0===O.first().schedule_info},{permission:"update",icon:T.P.edit,click:()=>this.actionPrimary(!0),name:this.actionLabels.PROMOTE,visible:()=>null!=this.selection.first()&&!this.selection.first().primary,disable:()=>"Disabled"===this.selection.first().mirror_mode?"Mirroring needs to be enabled on the image to perform this action":""},{permission:"update",icon:T.P.edit,click:()=>this.actionPrimary(!1),name:this.actionLabels.DEMOTE,visible:()=>null!=this.selection.first()&&this.selection.first().primary,disable:()=>"Disabled"===this.selection.first().mirror_mode?"Mirroring needs to be enabled on the image to perform this action":""}]}ngOnInit(){this.columns=[{name:"Name",prop:"name",flexGrow:2,cellTemplate:this.removingStatTpl},{name:"Pool",prop:"pool_name",flexGrow:2},{name:"Namespace",prop:"namespace",flexGrow:2},{name:"Size",prop:"size",flexGrow:1,cellClass:"text-right",sortable:!1,pipe:this.dimlessBinaryPipe},{name:"Usage",prop:"usage",cellTemplate:this.imageUsageTpl,flexGrow:1.5},{name:"Objects",prop:"num_objs",flexGrow:1,cellClass:"text-right",sortable:!1,pipe:this.dimlessPipe},{name:"Object size",prop:"obj_size",flexGrow:1,cellClass:"text-right",sortable:!1,pipe:this.dimlessBinaryPipe},{name:"Parent",prop:"parent",flexGrow:2,sortable:!1,cellTemplate:this.parentTpl},{name:"Mirroring",prop:"mirror_mode",flexGrow:3,sortable:!1,cellTemplate:this.mirroringTpl},{name:"Next Scheduled Snapshot",prop:"mirror_mode",flexGrow:3,sortable:!1,cellTemplate:this.ScheduleTpl}],this.taskListService.init(i=>this.getRbdImages(i),i=>this.prepareResponse(i),i=>this.images=i,()=>this.onFetchError(),i=>["rbd/clone","rbd/copy","rbd/create","rbd/delete","rbd/edit","rbd/flatten","rbd/trash/move"].includes(i.name),(i,_)=>{let a;switch(_.name){case"rbd/copy":a=new v.N(_.metadata.dest_pool_name,_.metadata.dest_namespace,_.metadata.dest_image_name).toString();break;case"rbd/clone":a=new v.N(_.metadata.child_pool_name,_.metadata.child_namespace,_.metadata.child_image_name).toString();break;case"rbd/create":a=new v.N(_.metadata.pool_name,_.metadata.namespace,_.metadata.image_name).toString();break;default:a=_.metadata.image_spec}return a===new v.N(i.pool_name,i.namespace,i.name).toString()},this.builders)}onFetchError(){this.table.reset(),this.tableStatus=new Lt.c("danger")}getRbdImages(t){return null!==t&&(this.tableContext=t),null==this.tableContext&&(this.tableContext=new h.E(()=>{})),this.rbdService.list(this.tableContext?.toParams())}prepareResponse(t){let o=[];return t.forEach(i=>{o=o.concat(i.value)}),o.forEach(i=>{if(void 0!==i.schedule_info){let _=[];const a="scheduled";let l=+new Date(i.schedule_info.schedule_time);const d=(new Date).getTimezoneOffset();l+=6e4*Math.abs(d),_.push(i.mirror_mode,a,l),i.mirror_mode=_,_=[]}}),this.count=o.length>0?u_.v.getCount(t[0]):0,o}updateSelection(t){this.selection=t}deleteRbdModal(){const t=this.selection.first().pool_name,o=this.selection.first().namespace,i=this.selection.first().name,_=new v.N(t,o,i);this.modalRef=this.modalService.show(ue.M,{itemDescription:"RBD",itemNames:[_],bodyTemplate:this.deleteTpl,bodyContext:{hasSnapshots:this.hasSnapshots(),snapshots:this.listProtectedSnapshots()},submitActionObservable:()=>this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/delete",{image_spec:_.toString()}),call:this.rbdService.delete(_)})})}resyncRbdModal(){const t=this.selection.first().pool_name,o=this.selection.first().namespace,i=this.selection.first().name,_=new v.N(t,o,i);this.modalRef=this.modalService.show(ue.M,{itemDescription:"RBD",itemNames:[_],actionDescription:"resync",submitActionObservable:()=>this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/edit",{image_spec:_.toString()}),call:this.rbdService.update(_,{resync:!0})})})}trashRbdModal(){const t={poolName:this.selection.first().pool_name,namespace:this.selection.first().namespace,imageName:this.selection.first().name,hasSnapshots:this.hasSnapshots()};this.modalRef=this.modalService.show(R_,t)}flattenRbd(t){this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/flatten",{image_spec:t.toString()}),call:this.rbdService.flatten(t)}).subscribe({complete:()=>{this.modalRef.close()}})}flattenRbdModal(){const t=this.selection.first().pool_name,o=this.selection.first().namespace,i=this.selection.first().name,_=this.selection.first().parent,a=new v.N(_.pool_name,_.pool_namespace,_.image_name),l=new v.N(t,o,i),d={titleText:"RBD flatten",buttonText:"Flatten",bodyTpl:this.flattenTpl,bodyData:{parent:`${a}@${_.snap_name}`,child:l.toString()},onSubmit:()=>{this.flattenRbd(l)}};this.modalRef=this.modalService.show(ct.Y,d)}editRequest(){const t=new lt;return t.remove_scheduling=!t.remove_scheduling,t}removeSchedulingModal(){const t=this.selection.first().name,o=new v.N(this.selection.first().pool_name,this.selection.first().namespace,this.selection.first().name);this.modalRef=this.modalService.show(ue.M,{actionDescription:"remove scheduling on",itemDescription:"image",itemNames:[`${t}`],submitActionObservable:()=>new At.y(i=>{this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/edit",{image_spec:o.toString()}),call:this.rbdService.update(o,this.editRequest())}).subscribe({error:_=>i.error(_),complete:()=>{this.modalRef.close()}})})})}actionPrimary(t){const o=new lt;o.primary=t,o.features=null;const i=new v.N(this.selection.first().pool_name,this.selection.first().namespace,this.selection.first().name);this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/edit",{image_spec:i.toString()}),call:this.rbdService.update(i,o)}).subscribe(()=>{},_=>{_.preventDefault(),t&&(this.errorMessage=_.error.detail.replace(/\[.*?\]\s*/,""),o.force=!0,this.modalRef=this.modalService.show(ct.Y,{titleText:"Warning",buttonText:"Enforce",warning:!0,bodyTpl:this.forcePromoteConfirmation,onSubmit:()=>{this.rbdService.update(i,o).subscribe(()=>{this.modalRef.close()},()=>{this.modalRef.close()})}}))})}hasSnapshots(){return(this.selection.first().snapshots||[]).length>0}hasClonedSnapshots(t){return(t.snapshots||[]).some(i=>i.children&&i.children.length>0)}listProtectedSnapshots(){return this.selection.first().snapshots.reduce((i,_)=>(_.is_protected&&i.push(_.name),i),[])}getDeleteDisableDesc(t){const o=t.first();return o&&this.hasClonedSnapshots(o)?"This RBD has cloned snapshots. Please delete related RBDs before deleting this RBD.":this.getInvalidNameDisable(t)||this.hasClonedSnapshots(t.first())}getResyncDisableDesc(t){const o=t.first();return o&&this.imageIsPrimary(o)?"Primary RBD images cannot be resynced":this.getInvalidNameDisable(t)}imageIsPrimary(t){return t.primary}getInvalidNameDisable(t){return t.first()?.name?.match(/[@/]/)?"This RBD image has an invalid name and can't be managed by ceph.":!t.first()||!t.hasSingleSelection}getRemovingStatusDesc(t){return"REMOVING"===t.first()?.source&&"Action not possible for an RBD in status 'Removing'"}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(H),e.Y36(Ue.$),e.Y36(st.n),e.Y36(pe.Z),e.Y36(u.P),e.Y36(de.j),e.Y36(dt.F),e.Y36(L.p4))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-list"]],viewQuery:function(t,o){if(1&t&&(e.Gf(W.a,7),e.Gf(sa,5),e.Gf(_a,7),e.Gf(aa,5),e.Gf(ra,7),e.Gf(la,7),e.Gf(ca,7),e.Gf(da,7),e.Gf(pa,7),e.Gf(ua,7),e.Gf(ma,7),e.Gf(ga,7),e.Gf(Ta,7)),2&t){let i;e.iGM(i=e.CRH())&&(o.table=i.first),e.iGM(i=e.CRH())&&(o.usageTpl=i.first),e.iGM(i=e.CRH())&&(o.parentTpl=i.first),e.iGM(i=e.CRH())&&(o.nameTpl=i.first),e.iGM(i=e.CRH())&&(o.ScheduleTpl=i.first),e.iGM(i=e.CRH())&&(o.mirroringTpl=i.first),e.iGM(i=e.CRH())&&(o.flattenTpl=i.first),e.iGM(i=e.CRH())&&(o.deleteTpl=i.first),e.iGM(i=e.CRH())&&(o.removingStatTpl=i.first),e.iGM(i=e.CRH())&&(o.forcePromoteConfirmation=i.first),e.iGM(i=e.CRH())&&(o.usedTmpl=i.first),e.iGM(i=e.CRH())&&(o.totalUsedTmpl=i.first),e.iGM(i=e.CRH())&&(o.imageUsageTpl=i.first)}},features:[e._Bn([de.j,{provide:dt.F,useValue:new dt.F("block/rbd")}]),e.qOj],decls:23,vars:13,consts:function(){let s,t,o,i,_,a;return s="primary",t="secondary",o="Deleting this image will also delete all its snapshots.",i="The following snapshots are currently protected and will be removed:",_="RBD in status 'Removing'",a="" + "\ufffd#4\ufffd" + " Do you want to force the operation? " + "\ufffd/#4\ufffd" + "",[["columnMode","flex","identifier","unique_id","forceIdentifier","true","selectionType","single",3,"data","columns","searchableObjects","serverSide","count","hasDetails","status","maxLimit","autoReload","fetchData","setExpandedRow","updateSelection"],["table",""],[1,"table-actions",3,"permission","selection","tableActions"],["cdTableDetail","",3,"selection"],["parentTpl",""],["mirroringTpl",""],["ScheduleTpl",""],["flattenTpl",""],["deleteTpl",""],["removingStatTpl",""],["forcePromoteConfirmation",""],["imageUsageTpl",""],["usageTooltip",""],[4,"ngIf"],["class","badge badge-info",4,"ngIf","ngIfElse"],["class","badge badge-info",4,"ngIf"],["probb",""],[1,"badge","badge-info"],s,t,["class","alert alert-warning","role","alert",4,"ngIf"],["role","alert",1,"alert","alert-warning"],o,i,[4,"ngFor","ngForOf"],[3,"ngClass",4,"ngIf"],[3,"ngClass"],["title",_,3,"class",4,"ngIf"],["title",_],["type","warning"],[1,"m-4"],a,[3,"ngbTooltip",4,"ngIf","ngIfElse"],["usageBar",""],[3,"ngbTooltip"],["decimals","2",3,"total","used","title",4,"ngIf"],["decimals","2",3,"total","used","title"],[3,"innerHtml"]]},template:function(t,o){1&t&&(e._UZ(0,"cd-rbd-tabs"),e.TgZ(1,"cd-table",0,1),e.NdJ("fetchData",function(_){return o.taskListService.fetch(_)})("setExpandedRow",function(_){return o.setExpandedRow(_)})("updateSelection",function(_){return o.updateSelection(_)}),e._UZ(3,"cd-table-actions",2)(4,"cd-rbd-details",3),e.qZA(),e.YNc(5,Ra,2,2,"ng-template",null,4,e.W1O),e.YNc(7,Pa,8,5,"ng-template",null,5,e.W1O),e.YNc(9,Ia,1,1,"ng-template",null,6,e.W1O),e.YNc(11,Na,13,3,"ng-template",null,7,e.W1O),e.YNc(13,va,1,1,"ng-template",null,8,e.W1O),e.YNc(15,xa,5,5,"ng-template",null,9,e.W1O),e.YNc(17,Za,5,1,"ng-template",null,10,e.W1O),e.YNc(19,Ka,3,2,"ng-template",null,11,e.W1O),e.YNc(21,qa,1,1,"ng-template",null,12,e.W1O)),2&t&&(e.xp6(1),e.Q6J("data",o.images)("columns",o.columns)("searchableObjects",!0)("serverSide",!0)("count",o.count)("hasDetails",!0)("status",o.tableStatus)("maxLimit",25)("autoReload",-1),e.xp6(2),e.Q6J("permission",o.permission)("selection",o.selection)("tableActions",o.tableActions),e.xp6(1),e.Q6J("selection",o.expandedRow))},dependencies:[c.mk,c.sg,c.O5,F._L,E_.O,it.G,W.a,Me.K,na,tt,Be.N],styles:[".warn[_ngcontent-%COMP%]{color:#d48200}"]}),n})();function za(n,s){1&n&&e._UZ(0,"input",19)}function Ja(n,s){1&n&&(e.TgZ(0,"option",23),e.SDv(1,24),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Ya(n,s){1&n&&(e.TgZ(0,"option",23),e.SDv(1,25),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Va(n,s){1&n&&(e.TgZ(0,"option",23),e.SDv(1,26),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Ua(n,s){if(1&n&&(e.TgZ(0,"option",27),e._uU(1),e.qZA()),2&n){const t=s.$implicit;e.Q6J("value",t.pool_name),e.xp6(1),e.Oqu(t.pool_name)}}function ja(n,s){if(1&n&&(e.TgZ(0,"select",20),e.YNc(1,Ja,2,1,"option",21),e.YNc(2,Ya,2,1,"option",21),e.YNc(3,Va,2,1,"option",21),e.YNc(4,Ua,2,2,"option",22),e.qZA()),2&n){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",null===t.pools),e.xp6(1),e.Q6J("ngIf",null!==t.pools&&0===t.pools.length),e.xp6(1),e.Q6J("ngIf",null!==t.pools&&t.pools.length>0),e.xp6(1),e.Q6J("ngForOf",t.pools)}}function Wa(n,s){1&n&&(e.TgZ(0,"span",28),e.SDv(1,29),e.qZA())}function er(n,s){1&n&&(e.TgZ(0,"span",28),e.SDv(1,30),e.qZA())}function tr(n,s){1&n&&(e.TgZ(0,"span",28),e.SDv(1,31),e.qZA())}let or=(()=>{class n{constructor(t,o,i,_,a,l){this.activeModal=t,this.actionLabels=o,this.authStorageService=i,this.notificationService=_,this.poolService=a,this.rbdService=l,this.pools=null,this.editing=!1,this.poolPermission=this.authStorageService.getPermissions().pool,this.createForm()}createForm(){this.namespaceForm=new Z.d({pool:new r.p4(""),namespace:new r.p4("")},this.validator(),this.asyncValidator())}validator(){return t=>{const o=t.get("pool"),i=t.get("namespace");let _=null;o.value||(_={required:!0}),o.setErrors(_);let a=null;return i.value||(a={required:!0}),i.setErrors(a),null}}asyncValidator(){return t=>new Promise(o=>{const i=t.get("pool"),_=t.get("namespace");this.rbdService.listNamespaces(i.value).subscribe(a=>{if(a.some(l=>l.namespace===_.value)){const l={namespaceExists:!0};_.setErrors(l),o(l)}else o(null)})})}ngOnInit(){this.onSubmit=new Gt.xQ,this.poolPermission.read&&this.poolService.list(["pool_name","type","application_metadata"]).then(t=>{const o=[];for(const i of t)this.rbdService.isRBDPool(i)&&"replicated"===i.type&&o.push(i);if(this.pools=o,1===this.pools.length){const i=this.pools[0].pool_name;this.namespaceForm.get("pool").setValue(i)}})}submit(){const t=this.namespaceForm.getValue("pool"),o=this.namespaceForm.getValue("namespace"),i=new E.R;i.name="rbd/namespace/create",i.metadata={pool:t,namespace:o},this.rbdService.createNamespace(t,o).toPromise().then(()=>{this.notificationService.show(nt.k.success,"Created namespace '" + t + "/" + o + "'"),this.activeModal.close(),this.onSubmit.next()}).catch(()=>{this.namespaceForm.setErrors({cdSubmitButton:!0})})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(F.Kz),e.Y36(L.p4),e.Y36(oe.j),e.Y36(ve.g),e.Y36(Ve.q),e.Y36(H))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-namespace-form-modal"]],decls:23,vars:9,consts:function(){let s,t,o,i,_,a,l,d,g;return s="Create Namespace",t="Pool",o="Name",i="Loading...",_="-- No rbd pools available --",a="-- Select a pool --",l="This field is required.",d="This field is required.",g="Namespace already exists.",[[3,"modalRef"],[1,"modal-title"],s,[1,"modal-content"],["name","namespaceForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"form-group","row"],["for","pool",1,"cd-col-form-label","required"],t,[1,"cd-col-form-input"],["class","form-control","type","text","placeholder","Pool name...","id","pool","name","pool","formControlName","pool",4,"ngIf"],["id","pool","name","pool","class","form-select","formControlName","pool",4,"ngIf"],["class","invalid-feedback",4,"ngIf"],["for","namespace",1,"cd-col-form-label","required"],o,["type","text","placeholder","Namespace name...","id","namespace","name","namespace","formControlName","namespace","autofocus","",1,"form-control"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],["type","text","placeholder","Pool name...","id","pool","name","pool","formControlName","pool",1,"form-control"],["id","pool","name","pool","formControlName","pool",1,"form-select"],[3,"ngValue",4,"ngIf"],[3,"value",4,"ngFor","ngForOf"],[3,"ngValue"],i,_,a,[3,"value"],[1,"invalid-feedback"],l,d,g]},template:function(t,o){if(1&t&&(e.TgZ(0,"cd-modal",0),e.ynx(1,1),e.SDv(2,2),e.BQk(),e.ynx(3,3),e.TgZ(4,"form",4,5)(6,"div",6)(7,"div",7)(8,"label",8),e.SDv(9,9),e.qZA(),e.TgZ(10,"div",10),e.YNc(11,za,1,0,"input",11),e.YNc(12,ja,5,4,"select",12),e.YNc(13,Wa,2,0,"span",13),e.qZA()(),e.TgZ(14,"div",7)(15,"label",14),e.SDv(16,15),e.qZA(),e.TgZ(17,"div",10),e._UZ(18,"input",16),e.YNc(19,er,2,0,"span",13),e.YNc(20,tr,2,0,"span",13),e.qZA()()(),e.TgZ(21,"div",17)(22,"cd-form-button-panel",18),e.NdJ("submitActionEvent",function(){return o.submit()}),e.qZA()()(),e.BQk(),e.qZA()),2&t){const i=e.MAs(5);e.Q6J("modalRef",o.activeModal),e.xp6(4),e.Q6J("formGroup",o.namespaceForm),e.xp6(7),e.Q6J("ngIf",!o.poolPermission.read),e.xp6(1),e.Q6J("ngIf",o.poolPermission.read),e.xp6(1),e.Q6J("ngIf",o.namespaceForm.showError("pool",i,"required")),e.xp6(6),e.Q6J("ngIf",o.namespaceForm.showError("namespace",i,"required")),e.xp6(1),e.Q6J("ngIf",o.namespaceForm.showError("namespace",i,"namespaceExists")),e.xp6(2),e.Q6J("form",o.namespaceForm)("submitText",o.actionLabels.CREATE)}},dependencies:[c.sg,c.O5,r._Y,r.YN,r.Kr,r.Fj,r.EJ,r.JJ,r.JL,r.sg,r.u,f.z,A.p,Oe.U,M.o,B.b,K.P,J.V]}),n})(),nr=(()=>{class n{constructor(t,o,i,_,a,l){this.authStorageService=t,this.rbdService=o,this.poolService=i,this.modalService=_,this.notificationService=a,this.actionLabels=l,this.selection=new Ee.r,this.permission=this.authStorageService.getPermissions().rbdImage,this.tableActions=[{permission:"create",icon:T.P.add,click:()=>this.createModal(),name:this.actionLabels.CREATE},{permission:"delete",icon:T.P.destroy,click:()=>this.deleteModal(),name:this.actionLabels.DELETE,disable:()=>this.getDeleteDisableDesc()}]}ngOnInit(){this.columns=[{name:"Namespace",prop:"namespace",flexGrow:1},{name:"Pool",prop:"pool",flexGrow:1},{name:"Total images",prop:"num_images",flexGrow:1}],this.refresh()}refresh(){this.poolService.list(["pool_name","type","application_metadata"]).then(t=>{t=t.filter(i=>this.rbdService.isRBDPool(i)&&"replicated"===i.type);const o=[];t.forEach(i=>{o.push(this.rbdService.listNamespaces(i.pool_name))}),o.length>0?(0,ce.D)(o).subscribe(i=>{const _=[];for(let a=0;a<i.length;a++){const d=t[a].pool_name;i[a].forEach(g=>{_.push({id:`${d}/${g.namespace}`,pool:d,namespace:g.namespace,num_images:g.num_images})})}this.namespaces=_}):this.namespaces=[]})}updateSelection(t){this.selection=t}createModal(){this.modalRef=this.modalService.show(or),this.modalRef.componentInstance.onSubmit.subscribe(()=>{this.refresh()})}deleteModal(){const t=this.selection.first().pool,o=this.selection.first().namespace;this.modalRef=this.modalService.show(ue.M,{itemDescription:"Namespace",itemNames:[`${t}/${o}`],submitAction:()=>this.rbdService.deleteNamespace(t,o).subscribe(()=>{this.notificationService.show(nt.k.success,"Deleted namespace '" + t + "/" + o + "'"),this.modalRef.close(),this.refresh()},()=>{this.modalRef.componentInstance.stopLoadingSpinner()})})}getDeleteDisableDesc(){return this.selection.first()?.num_images>0?"Namespace contains images":!this.selection?.first()}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(H),e.Y36(Ve.q),e.Y36(pe.Z),e.Y36(ve.g),e.Y36(L.p4))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-namespace-list"]],features:[e._Bn([de.j])],decls:4,vars:5,consts:[["columnMode","flex","identifier","id","forceIdentifier","true","selectionType","single",3,"data","columns","fetchData","updateSelection"],[1,"table-actions","btn-toolbar"],[1,"btn-group",3,"permission","selection","tableActions"]],template:function(t,o){1&t&&(e._UZ(0,"cd-rbd-tabs"),e.TgZ(1,"cd-table",0),e.NdJ("fetchData",function(){return o.refresh()})("updateSelection",function(_){return o.updateSelection(_)}),e.TgZ(2,"div",1),e._UZ(3,"cd-table-actions",2),e.qZA()()),2&t&&(e.xp6(1),e.Q6J("data",o.namespaces)("columns",o.columns),e.xp6(2),e.Q6J("permission",o.permission)("selection",o.selection)("tableActions",o.tableActions))},dependencies:[W.a,Me.K,tt]}),n})(),ir=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-performance"]],decls:2,vars:2,consts:function(){let s;return s="RBD overview",[["title",s,"uid","41FrpeUiz","grafanaStyle","two",3,"grafanaPath","type"]]},template:function(t,o){1&t&&e._UZ(0,"cd-rbd-tabs")(1,"cd-grafana",0),2&t&&(e.xp6(1),e.Q6J("grafanaPath","rbd-overview?")("type","metrics"))},dependencies:[vt.F,tt]}),n})();var sr=p(91801);function _r(n,s){1&n&&e._UZ(0,"input",15)}function ar(n,s){if(1&n&&(e.TgZ(0,"option",20),e._uU(1),e.qZA()),2&n){const t=s.$implicit;e.Q6J("value",t),e.xp6(1),e.Oqu(t)}}function rr(n,s){if(1&n&&(e.TgZ(0,"select",16)(1,"option",17),e.SDv(2,18),e.qZA(),e.YNc(3,ar,2,2,"option",19),e.qZA()),2&n){const t=e.oxw();e.xp6(3),e.Q6J("ngForOf",t.pools)}}let lr=(()=>{class n{constructor(t,o,i,_,a,l,d){this.authStorageService=t,this.rbdService=o,this.activeModal=i,this.actionLabels=_,this.fb=a,this.poolService=l,this.taskWrapper=d,this.poolPermission=this.authStorageService.getPermissions().pool}createForm(){this.purgeForm=this.fb.group({poolName:""})}ngOnInit(){this.poolPermission.read&&this.poolService.list(["pool_name","application_metadata"]).then(t=>{this.pools=t.filter(o=>o.application_metadata.includes("rbd")).map(o=>o.pool_name)}),this.createForm()}purge(){const t=this.purgeForm.getValue("poolName")||"";this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/trash/purge",{pool_name:t}),call:this.rbdService.purgeTrash(t)}).subscribe({error:()=>{this.purgeForm.setErrors({cdSubmitButton:!0})},complete:()=>{this.activeModal.close()}})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(H),e.Y36(F.Kz),e.Y36(L.p4),e.Y36(pt.O),e.Y36(Ve.q),e.Y36(u.P))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-trash-purge-modal"]],decls:18,vars:6,consts:function(){let s,t,o,i,_;return s="Purge Trash",t="To purge, select\xA0 " + "[\ufffd#9\ufffd|\ufffd#10\ufffd]" + "All" + "[\ufffd/#9\ufffd|\ufffd/#10\ufffd]" + "\xA0 or one pool and click\xA0 " + "[\ufffd#9\ufffd|\ufffd#10\ufffd]" + "Purge" + "[\ufffd/#9\ufffd|\ufffd/#10\ufffd]" + ".\xA0",t=e.Zx4(t),o="Pool:",i="Pool name...",_="All",[[3,"modalRef"],[1,"modal-title"],s,[1,"modal-content"],["name","purgeForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t,[1,"form-group"],[1,"col-form-label","mx-auto"],o,["class","form-control","type","text","placeholder",i,"formControlName","poolName",4,"ngIf"],["id","poolName","name","poolName","class","form-control","formControlName","poolName",4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],["type","text","placeholder",i,"formControlName","poolName",1,"form-control"],["id","poolName","name","poolName","formControlName","poolName",1,"form-control"],["value",""],_,[3,"value",4,"ngFor","ngForOf"],[3,"value"]]},template:function(t,o){1&t&&(e.TgZ(0,"cd-modal",0),e.ynx(1,1),e.SDv(2,2),e.BQk(),e.ynx(3,3),e.TgZ(4,"form",4,5)(6,"div",6)(7,"p"),e.tHW(8,7),e._UZ(9,"kbd")(10,"kbd"),e.N_p(),e.qZA(),e.TgZ(11,"div",8)(12,"label",9),e.SDv(13,10),e.qZA(),e.YNc(14,_r,1,0,"input",11),e.YNc(15,rr,4,1,"select",12),e.qZA()(),e.TgZ(16,"div",13)(17,"cd-form-button-panel",14),e.NdJ("submitActionEvent",function(){return o.purge()}),e.qZA()()(),e.BQk(),e.qZA()),2&t&&(e.Q6J("modalRef",o.activeModal),e.xp6(4),e.Q6J("formGroup",o.purgeForm),e.xp6(10),e.Q6J("ngIf",!o.poolPermission.read),e.xp6(1),e.Q6J("ngIf",o.poolPermission.read),e.xp6(2),e.Q6J("form",o.purgeForm)("submitText",o.actionLabels.PURGE))},dependencies:[c.sg,c.O5,r._Y,r.YN,r.Kr,r.Fj,r.EJ,r.JJ,r.JL,r.sg,r.u,f.z,A.p,M.o,B.b,K.P,J.V]}),n})();function cr(n,s){1&n&&(e.TgZ(0,"span",15),e.SDv(1,16),e.qZA())}let dr=(()=>{class n{constructor(t,o,i,_,a){this.rbdService=t,this.activeModal=o,this.actionLabels=i,this.fb=_,this.taskWrapper=a}ngOnInit(){this.imageSpec=new v.N(this.poolName,this.namespace,this.imageName).toString(),this.restoreForm=this.fb.group({name:this.imageName})}restore(){const t=this.restoreForm.getValue("name"),o=new v.N(this.poolName,this.namespace,this.imageId);this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/trash/restore",{image_id_spec:o.toString(),new_image_name:t}),call:this.rbdService.restoreTrash(o,t)}).subscribe({error:()=>{this.restoreForm.setErrors({cdSubmitButton:!0})},complete:()=>{this.activeModal.close()}})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(H),e.Y36(F.Kz),e.Y36(L.p4),e.Y36(pt.O),e.Y36(u.P))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-trash-restore-modal"]],decls:18,vars:7,consts:function(){let s,t,o,i;return s="Restore Image",t="To restore\xA0 " + "[\ufffd#9\ufffd|\ufffd#10\ufffd]" + "" + "\ufffd0\ufffd" + "@" + "\ufffd1\ufffd" + "" + "[\ufffd/#9\ufffd|\ufffd/#10\ufffd]" + ",\xA0 type the image's new name and click\xA0 " + "[\ufffd#9\ufffd|\ufffd#10\ufffd]" + "Restore" + "[\ufffd/#9\ufffd|\ufffd/#10\ufffd]" + ".",t=e.Zx4(t),o="New Name",i="This field is required.",[[3,"modalRef"],[1,"modal-title"],s,[1,"modal-content"],["name","restoreForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t,[1,"form-group"],["for","name",1,"col-form-label"],o,["type","text","name","name","id","name","autocomplete","off","formControlName","name","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],i]},template:function(t,o){if(1&t&&(e.TgZ(0,"cd-modal",0),e.ynx(1,1),e.SDv(2,2),e.BQk(),e.ynx(3,3),e.TgZ(4,"form",4,5)(6,"div",6)(7,"p"),e.tHW(8,7),e._UZ(9,"kbd")(10,"kbd"),e.N_p(),e.qZA(),e.TgZ(11,"div",8)(12,"label",9),e.SDv(13,10),e.qZA(),e._UZ(14,"input",11),e.YNc(15,cr,2,0,"span",12),e.qZA()(),e.TgZ(16,"div",13)(17,"cd-form-button-panel",14),e.NdJ("submitActionEvent",function(){return o.restore()}),e.qZA()()(),e.BQk(),e.qZA()),2&t){const i=e.MAs(5);e.Q6J("modalRef",o.activeModal),e.xp6(4),e.Q6J("formGroup",o.restoreForm),e.xp6(6),e.pQV(o.imageSpec)(o.imageId),e.QtT(8),e.xp6(5),e.Q6J("ngIf",o.restoreForm.showError("name",i,"required")),e.xp6(2),e.Q6J("form",o.restoreForm)("submitText",o.actionLabels.RESTORE)}},dependencies:[c.O5,r._Y,r.Fj,r.JJ,r.JL,r.sg,r.u,f.z,A.p,Oe.U,M.o,B.b,K.P,J.V]}),n})();const pr=["expiresTpl"],ur=["deleteTpl"],mr=function(n){return[n]};function gr(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"button",6),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.purgeModal())}),e._UZ(1,"i",7),e.ynx(2),e.SDv(3,8),e.BQk(),e.qZA()}if(2&n){const t=e.oxw();e.Q6J("disabled",t.disablePurgeBtn),e.xp6(1),e.Q6J("ngClass",e.VKq(2,mr,t.icons.destroy))}}function Tr(n,s){1&n&&(e.ynx(0),e.SDv(1,10),e.BQk())}function fr(n,s){1&n&&(e.ynx(0),e.SDv(1,11),e.BQk())}function Cr(n,s){if(1&n&&(e.YNc(0,Tr,2,0,"ng-container",9),e.YNc(1,fr,2,0,"ng-container",9),e._uU(2),e.ALo(3,"cdDate")),2&n){const t=s.row,o=s.value;e.Q6J("ngIf",t.cdIsExpired),e.xp6(1),e.Q6J("ngIf",!t.cdIsExpired),e.xp6(1),e.hij(" ",e.lcZ(3,3,o),"\n")}}function Sr(n,s){if(1&n&&(e.TgZ(0,"p",13)(1,"strong"),e.ynx(2),e.SDv(3,14),e.ALo(4,"cdDate"),e.BQk(),e.qZA()()),2&n){const t=e.oxw().expiresAt;e.xp6(4),e.pQV(e.lcZ(4,1,t)),e.QtT(3)}}function Rr(n,s){1&n&&e.YNc(0,Sr,5,3,"p",12),2&n&&e.Q6J("ngIf",!s.isExpired)}let Er=(()=>{class n{constructor(t,o,i,_,a,l,d){this.authStorageService=t,this.rbdService=o,this.modalService=i,this.cdDatePipe=_,this.taskListService=a,this.taskWrapper=l,this.actionLabels=d,this.icons=T.P,this.executingTasks=[],this.selection=new Ee.r,this.tableStatus=new se.E,this.disablePurgeBtn=!0,this.permission=this.authStorageService.getPermissions().rbdImage,this.tableActions=[{permission:"update",icon:T.P.undo,click:()=>this.restoreModal(),name:this.actionLabels.RESTORE},{permission:"delete",icon:T.P.destroy,click:()=>this.deleteModal(),name:this.actionLabels.DELETE}]}ngOnInit(){this.columns=[{name:"ID",prop:"id",flexGrow:1,cellTransformation:Le.e.executing},{name:"Name",prop:"name",flexGrow:1},{name:"Pool",prop:"pool_name",flexGrow:1},{name:"Namespace",prop:"namespace",flexGrow:1},{name:"Status",prop:"deferment_end_time",flexGrow:1,cellTemplate:this.expiresTpl},{name:"Deleted At",prop:"deletion_time",flexGrow:1,pipe:this.cdDatePipe}],this.taskListService.init(()=>this.rbdService.listTrash(),i=>this.prepareResponse(i),i=>this.images=i,()=>this.onFetchError(),i=>["rbd/trash/remove","rbd/trash/restore"].includes(i.name),(i,_)=>new v.N(i.pool_name,i.namespace,i.id).toString()===_.metadata.image_id_spec,void 0)}prepareResponse(t){let o=[];const i={};let _;if(t.forEach(a=>{C().isUndefined(i[a.status])&&(i[a.status]=[]),i[a.status].push(a.pool_name),o=o.concat(a.value),this.disablePurgeBtn=!o.length}),i[3]?_=3:i[1]?_=1:i[2]&&(_=2),_){const a=(i[_].length>1?"pools ":"pool ")+i[_].join();this.tableStatus=new se.E(_,a)}else this.tableStatus=new se.E;return o.forEach(a=>{a.cdIsExpired=he()().isAfter(a.deferment_end_time)}),o}onFetchError(){this.table.reset(),this.tableStatus=new se.E(sr.T.ValueException)}updateSelection(t){this.selection=t}restoreModal(){const t={poolName:this.selection.first().pool_name,namespace:this.selection.first().namespace,imageName:this.selection.first().name,imageId:this.selection.first().id};this.modalRef=this.modalService.show(dr,t)}deleteModal(){const t=this.selection.first().pool_name,o=this.selection.first().namespace,i=this.selection.first().id,_=this.selection.first().deferment_end_time,a=he()().isAfter(_),l=new v.N(t,o,i);this.modalRef=this.modalService.show(ue.M,{itemDescription:"RBD",itemNames:[l],bodyTemplate:this.deleteTpl,bodyContext:{expiresAt:_,isExpired:a},submitActionObservable:()=>this.taskWrapper.wrapTaskAroundCall({task:new E.R("rbd/trash/remove",{image_id_spec:l.toString()}),call:this.rbdService.removeTrash(l,!0)})})}purgeModal(){this.modalService.show(lr)}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(H),e.Y36(pe.Z),e.Y36(Be.N),e.Y36(de.j),e.Y36(u.P),e.Y36(L.p4))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-trash-list"]],viewQuery:function(t,o){if(1&t&&(e.Gf(W.a,7),e.Gf(pr,7),e.Gf(ur,7)),2&t){let i;e.iGM(i=e.CRH())&&(o.table=i.first),e.iGM(i=e.CRH())&&(o.expiresTpl=i.first),e.iGM(i=e.CRH())&&(o.deleteTpl=i.first)}},features:[e._Bn([de.j])],decls:9,vars:8,consts:function(){let s,t,o,i;return s="Purge Trash",t="Expired at",o="Protected until",i="This image is protected until " + "\ufffd0\ufffd" + ".",[["columnMode","flex","identifier","id","forceIdentifier","true","selectionType","single",3,"data","columns","status","autoReload","fetchData","updateSelection"],[1,"table-actions","btn-toolbar"],[1,"btn-group",3,"permission","selection","tableActions"],["class","btn btn-light","type","button",3,"disabled","click",4,"ngIf"],["expiresTpl",""],["deleteTpl",""],["type","button",1,"btn","btn-light",3,"disabled","click"],["aria-hidden","true",3,"ngClass"],s,[4,"ngIf"],t,o,["class","text-danger",4,"ngIf"],[1,"text-danger"],i]},template:function(t,o){1&t&&(e._UZ(0,"cd-rbd-tabs"),e.TgZ(1,"cd-table",0),e.NdJ("fetchData",function(){return o.taskListService.fetch()})("updateSelection",function(_){return o.updateSelection(_)}),e.TgZ(2,"div",1),e._UZ(3,"cd-table-actions",2),e.YNc(4,gr,4,4,"button",3),e.qZA()(),e.YNc(5,Cr,4,5,"ng-template",null,4,e.W1O),e.YNc(7,Rr,1,1,"ng-template",null,5,e.W1O)),2&t&&(e.xp6(1),e.Q6J("data",o.images)("columns",o.columns)("status",o.tableStatus)("autoReload",-1),e.xp6(2),e.Q6J("permission",o.permission)("selection",o.selection)("tableActions",o.tableActions),e.xp6(1),e.Q6J("ngIf",o.permission.delete))},dependencies:[c.mk,c.O5,W.a,Me.K,M.o,tt,Be.N]}),n})(),yt=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=e.oAB({type:n}),n.\u0275inj=e.cJS({imports:[c.ez,si,r.u5,r.UX,F.Oz,F.dT,F.HK,Ne.b,Pe.m,m.Bz,ne.xc]}),n})();const Mr=[{path:"",redirectTo:"rbd",pathMatch:"full"},{path:"rbd",canActivate:[j.T,re.P],data:{moduleStatusGuardConfig:{uiApiPath:"block/rbd",redirectTo:"error",header:"No RBD pools available",button_name:"Create RBD pool",button_route:"/pool/create"},breadcrumbs:"Images"},children:[{path:"",component:Qa},{path:"namespaces",component:nr,data:{breadcrumbs:"Namespaces"}},{path:"trash",component:Er,data:{breadcrumbs:"Trash"}},{path:"performance",component:ir,data:{breadcrumbs:"Overall Performance"}},{path:L.MQ.CREATE,component:$e,data:{breadcrumbs:L.Qn.CREATE}},{path:`${L.MQ.EDIT}/:image_spec`,component:$e,data:{breadcrumbs:L.Qn.EDIT}},{path:`${L.MQ.CLONE}/:image_spec/:snap`,component:$e,data:{breadcrumbs:L.Qn.CLONE}},{path:`${L.MQ.COPY}/:image_spec`,component:$e,data:{breadcrumbs:L.Qn.COPY}},{path:`${L.MQ.COPY}/:image_spec/:snap`,component:$e,data:{breadcrumbs:L.Qn.COPY}}]},{path:"mirroring",component:_s,canActivate:[j.T,re.P],data:{moduleStatusGuardConfig:{uiApiPath:"block/mirroring",redirectTo:"error",header:"RBD mirroring is not configured",button_name:"Configure RBD Mirroring",button_title:"This will create rbd-mirror service and a replicated RBD pool",component:"RBD Mirroring",uiConfig:!0},breadcrumbs:"Mirroring"},children:[{path:`${L.MQ.EDIT}/:pool_name`,component:cs,outlet:"modal"}]},{path:"iscsi",canActivate:[j.T],data:{breadcrumbs:"iSCSI"},children:[{path:"",redirectTo:"overview",pathMatch:"full"},{path:"overview",component:ii,data:{breadcrumbs:"Overview"}},{path:"targets",data:{breadcrumbs:"Targets"},children:[{path:"",component:Kn},{path:L.MQ.CREATE,component:Ct,data:{breadcrumbs:L.Qn.CREATE}},{path:`${L.MQ.EDIT}/:target_iqn`,component:Ct,data:{breadcrumbs:L.Qn.EDIT}}]}]}];let Or=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=e.oAB({type:n}),n.\u0275inj=e.cJS({imports:[yt,m.Bz.forChild(Mr)]}),n})()},60950:(mt,Ae,p)=>{p.d(Ae,{d:()=>z});var c=p(64537),r=p(20092),m=p(23815),ne=p.n(m),F=p(7357),Ne=p(65862),L=p(95463),j=p(30633),re=p(28211),Pe=p(34089),le=p(88692),C=p(18372),ce=p(20044);let D=(()=>{class h{constructor(u,f,A,M){this.elementRef=u,this.control=f,this.dimlessBinaryPerSecondPipe=A,this.formatter=M,this.ngModelChange=new c.vpe,this.el=this.elementRef.nativeElement}ngOnInit(){this.setValue(this.el.value),this.ngDataReady&&this.ngDataReady.subscribe(()=>this.setValue(this.el.value))}setValue(u){/^[\d.]+$/.test(u)&&(u+=this.defaultUnit||"m");const f=this.formatter.toBytes(u,0),A=this.round(f);this.el.value=this.dimlessBinaryPerSecondPipe.transform(A),null!==f?(this.ngModelChange.emit(this.el.value),this.control.control.setValue(this.el.value)):(this.ngModelChange.emit(null),this.control.control.setValue(null))}round(u){if(null!==u&&0!==u){if(!ne().isUndefined(this.minBytes)&&u<this.minBytes)return this.minBytes;if(!ne().isUndefined(this.maxBytes)&&u>this.maxBytes)return this.maxBytes;if(!ne().isUndefined(this.roundPower)){const f=Math.round(Math.log(u)/Math.log(this.roundPower));return Math.pow(this.roundPower,f)}}return u}onBlur(u){this.setValue(u)}}return h.\u0275fac=function(u){return new(u||h)(c.Y36(c.SBq),c.Y36(r.a5),c.Y36(ce.O),c.Y36(re.H))},h.\u0275dir=c.lG2({type:h,selectors:[["","cdDimlessBinaryPerSecond",""]],hostBindings:function(u,f){1&u&&c.NdJ("blur",function(M){return f.onBlur(M.target.value)})},inputs:{ngDataReady:"ngDataReady",minBytes:"minBytes",maxBytes:"maxBytes",roundPower:"roundPower",defaultUnit:"defaultUnit"},outputs:{ngModelChange:"ngModelChange"}}),h})(),ie=(()=>{class h{constructor(u,f){this.control=u,this.formatter=f}setValue(u){const f=this.formatter.toMilliseconds(u);this.control.control.setValue(`${f} ms`)}ngOnInit(){this.setValue(this.control.value),this.ngDataReady&&this.ngDataReady.subscribe(()=>this.setValue(this.control.value))}onUpdate(u){this.setValue(u)}}return h.\u0275fac=function(u){return new(u||h)(c.Y36(r.a5),c.Y36(re.H))},h.\u0275dir=c.lG2({type:h,selectors:[["","cdMilliseconds",""]],hostBindings:function(u,f){1&u&&c.NdJ("blur",function(M){return f.onUpdate(M.target.value)})},inputs:{ngDataReady:"ngDataReady"}}),h})(),V=(()=>{class h{constructor(u,f){this.formatter=u,this.ngControl=f}setValue(u){const f=this.formatter.toIops(u);this.ngControl.control.setValue(`${f} IOPS`)}ngOnInit(){this.setValue(this.ngControl.value),this.ngDataReady&&this.ngDataReady.subscribe(()=>this.setValue(this.ngControl.value))}onUpdate(u){this.setValue(u)}}return h.\u0275fac=function(u){return new(u||h)(c.Y36(re.H),c.Y36(r.a5))},h.\u0275dir=c.lG2({type:h,selectors:[["","cdIops",""]],hostBindings:function(u,f){1&u&&c.NdJ("blur",function(M){return f.onUpdate(M.target.value)})},inputs:{ngDataReady:"ngDataReady"}}),h})();var e=p(87925),X=p(94276),Fe=p(56310),De=p(41582);function v(h,E){if(1&h&&(c.ynx(0),c._UZ(1,"input",17),c.BQk()),2&h){const u=c.oxw().$implicit,f=c.oxw(2);c.xp6(1),c.Q6J("id",u.name)("name",u.name)("formControlName",u.name)("ngDataReady",f.ngDataReady)}}function be(h,E){if(1&h&&(c.ynx(0),c._UZ(1,"input",18),c.BQk()),2&h){const u=c.oxw().$implicit,f=c.oxw(2);c.xp6(1),c.Q6J("id",u.name)("name",u.name)("formControlName",u.name)("ngDataReady",f.ngDataReady)}}function H(h,E){if(1&h&&(c.ynx(0),c._UZ(1,"input",19),c.BQk()),2&h){const u=c.oxw().$implicit,f=c.oxw(2);c.xp6(1),c.Q6J("id",u.name)("name",u.name)("formControlName",u.name)("ngDataReady",f.ngDataReady)}}function N(h,E){1&h&&(c.TgZ(0,"span",20),c.SDv(1,21),c.qZA())}const x=function(h){return{active:h}},T=function(h){return[h]};function k(h,E){if(1&h){const u=c.EpF();c.TgZ(0,"div",10)(1,"label",11),c._uU(2),c.TgZ(3,"cd-helper"),c._uU(4),c.qZA()(),c.TgZ(5,"div")(6,"div",12),c.ynx(7,13),c.YNc(8,v,2,4,"ng-container",14),c.YNc(9,be,2,4,"ng-container",14),c.YNc(10,H,2,4,"ng-container",14),c.BQk(),c.TgZ(11,"button",15),c.NdJ("click",function(){const M=c.CHM(u).$implicit,B=c.oxw(2);return c.KtG(B.reset(M.name))}),c._UZ(12,"i",7),c.qZA()(),c.YNc(13,N,2,0,"span",16),c.qZA()()}if(2&h){const u=E.$implicit,f=c.oxw().$implicit,A=c.oxw(),M=c.MAs(1);c.xp6(1),c.Q6J("for",u.name),c.xp6(1),c.Oqu(u.displayName),c.xp6(2),c.Oqu(u.description),c.xp6(1),c.Gre("cd-col-form-input ",f.heading,""),c.xp6(2),c.Q6J("ngSwitch",u.type),c.xp6(1),c.Q6J("ngSwitchCase",A.configurationType.milliseconds),c.xp6(1),c.Q6J("ngSwitchCase",A.configurationType.bps),c.xp6(1),c.Q6J("ngSwitchCase",A.configurationType.iops),c.xp6(1),c.Q6J("ngClass",c.VKq(13,x,A.isDisabled(u.name))),c.xp6(1),c.Q6J("ngClass",c.VKq(15,T,A.icons.erase)),c.xp6(1),c.Q6J("ngIf",A.form.showError("configuration."+u.name,M,"min"))}}function Z(h,E){if(1&h){const u=c.EpF();c.TgZ(0,"div",4)(1,"h4",5)(2,"span",6),c.NdJ("click",function(){const M=c.CHM(u).$implicit,B=c.oxw();return c.KtG(B.toggleSectionVisibility(M.class))}),c._uU(3),c._UZ(4,"i",7),c.qZA()(),c.TgZ(5,"div",8),c.YNc(6,k,14,17,"div",9),c.qZA()()}if(2&h){const u=E.$implicit,f=c.oxw();c.xp6(3),c.hij(" ",u.heading," "),c.xp6(1),c.Q6J("ngClass",f.sectionVisibility[u.class]?f.icons.minusCircle:f.icons.addCircle),c.xp6(1),c.Tol(u.class),c.Q6J("hidden",!f.sectionVisibility[u.class]),c.xp6(1),c.Q6J("ngForOf",u.options)}}let z=(()=>{class h{constructor(u,f){this.formatterService=u,this.rbdConfigurationService=f,this.initializeData=new F.t(1),this.changes=new c.vpe,this.icons=Ne.P,this.ngDataReady=new c.vpe,this.configurationType=j.r,this.sectionVisibility={}}ngOnInit(){const u=this.createConfigurationFormGroup();this.form.addControl("configuration",u),u.valueChanges.subscribe(()=>{this.changes.emit(this.getDirtyValues.bind(this))}),this.initializeData&&this.initializeData.subscribe(f=>{this.initialData=f.initialData;const A=f.sourceType;this.rbdConfigurationService.getWritableOptionFields().forEach(M=>{const B=f.initialData.filter(K=>K.name===M.name).pop();B&&B.source===A&&this.form.get(`configuration.${M.name}`).setValue(B.value)}),this.ngDataReady.emit()}),this.rbdConfigurationService.getWritableSections().forEach(f=>this.sectionVisibility[f.class]=!1)}getDirtyValues(u=!1,f){if(u&&!f)throw new Error("ProgrammingError: If local values shall be included, a proper localFieldType argument has to be provided, too");const A={};return this.rbdConfigurationService.getWritableOptionFields().forEach(M=>{const B=this.form.get("configuration").get(M.name);this.initialData&&this.initialData[M.name]===B.value||(B.dirty||u&&B.source===f)&&(A[M.name]=null===B.value?B.value:M.type===j.r.bps?this.formatterService.toBytes(B.value):M.type===j.r.milliseconds?this.formatterService.toMilliseconds(B.value):M.type===j.r.iops?this.formatterService.toIops(B.value):B.value)}),A}createConfigurationFormGroup(){const u=new L.d({});return this.rbdConfigurationService.getWritableOptionFields().forEach(f=>{let A;if(f.type!==j.r.milliseconds&&f.type!==j.r.iops&&f.type!==j.r.bps)throw new Error(`Type ${f.type} is unknown, you may need to add it to RbdConfiguration class`);{let M=0;ne().forEach(this.initialData,B=>{B.name===f.name&&(M=B.value)}),A=new r.p4(M,r.kI.min(0))}u.addControl(f.name,A)}),u}reset(u){const f=this.form.get("configuration").get(u);f.disabled?(f.setValue(f.previousValue||0),f.enable(),f.previousValue||f.markAsPristine()):(f.previousValue=f.value,f.setValue(null),f.markAsDirty(),f.disable())}isDisabled(u){return this.form.get("configuration").get(u).disabled}toggleSectionVisibility(u){this.sectionVisibility[u]=!this.sectionVisibility[u]}}return h.\u0275fac=function(u){return new(u||h)(c.Y36(re.H),c.Y36(Pe.n))},h.\u0275cmp=c.Xpm({type:h,selectors:[["cd-rbd-configuration-form"]],inputs:{form:"form",initializeData:"initializeData"},outputs:{changes:"changes"},decls:5,vars:2,consts:function(){let E,u,f;return E="RBD Configuration",u="Remove the local configuration value. The parent configuration value will be inherited and used instead.",f="The minimum value is 0",[[3,"formGroup"],["cfgFormGroup",""],E,["class","col-12",4,"ngFor","ngForOf"],[1,"col-12"],[1,"cd-header"],[1,"collapsible",3,"click"],["aria-hidden","true",3,"ngClass"],[3,"hidden"],["class","form-group row",4,"ngFor","ngForOf"],[1,"form-group","row"],[1,"cd-col-form-label",3,"for"],[1,"input-group"],[3,"ngSwitch"],[4,"ngSwitchCase"],["type","button","data-toggle","button","title",u,1,"btn","btn-light",3,"ngClass","click"],["class","invalid-feedback",4,"ngIf"],["type","text","cdMilliseconds","",1,"form-control",3,"id","name","formControlName","ngDataReady"],["type","text","defaultUnit","b","cdDimlessBinaryPerSecond","",1,"form-control",3,"id","name","formControlName","ngDataReady"],["type","text","cdIops","",1,"form-control",3,"id","name","formControlName","ngDataReady"],[1,"invalid-feedback"],f]},template:function(u,f){1&u&&(c.TgZ(0,"fieldset",0,1)(2,"legend"),c.SDv(3,2),c.qZA(),c.YNc(4,Z,7,7,"div",3),c.qZA()),2&u&&(c.Q6J("formGroup",f.form.get("configuration")),c.xp6(4),c.Q6J("ngForOf",f.rbdConfigurationService.sections))},dependencies:[le.mk,le.sg,le.O5,le.RF,le.n9,r.Fj,r.JJ,r.JL,r.sg,r.u,C.S,D,ie,V,e.o,X.b,Fe.P,De.V],styles:[".collapsible[_ngcontent-%COMP%]{cursor:pointer;user-select:none}"]}),h})()},42176:(mt,Ae,p)=>{p.d(Ae,{P:()=>H});var c=p(59019),r=p(30633),m=p(64537);let ne=(()=>{class N{transform(T){return{0:"global",1:"pool",2:"image"}[T]}}return N.\u0275fac=function(T){return new(T||N)},N.\u0275pipe=m.Yjl({name:"rbdConfigurationSource",type:N,pure:!0}),N})();var F=p(28211),Ne=p(34089),L=p(88692),j=p(20044),re=p(48537),Pe=p(21766);const le=["configurationSourceTpl"],C=["configurationValueTpl"],ce=["poolConfTable"];function D(N,x){1&N&&(m.TgZ(0,"span"),m.SDv(1,6),m.qZA())}function ie(N,x){1&N&&(m.TgZ(0,"strong"),m.SDv(1,7),m.qZA())}function V(N,x){1&N&&(m.TgZ(0,"strong"),m.SDv(1,8),m.qZA())}function e(N,x){1&N&&(m.TgZ(0,"div",4),m.YNc(1,D,2,0,"span",5),m.YNc(2,ie,2,0,"strong",5),m.YNc(3,V,2,0,"strong",5),m.qZA()),2&N&&(m.Q6J("ngSwitch",x.value),m.xp6(1),m.Q6J("ngSwitchCase","global"),m.xp6(1),m.Q6J("ngSwitchCase","image"),m.xp6(1),m.Q6J("ngSwitchCase","pool"))}function X(N,x){if(1&N&&(m.TgZ(0,"span"),m._uU(1),m.ALo(2,"dimlessBinaryPerSecond"),m.qZA()),2&N){const T=m.oxw().value;m.xp6(1),m.Oqu(m.lcZ(2,1,T))}}function Fe(N,x){if(1&N&&(m.TgZ(0,"span"),m._uU(1),m.ALo(2,"milliseconds"),m.qZA()),2&N){const T=m.oxw().value;m.xp6(1),m.Oqu(m.lcZ(2,1,T))}}function De(N,x){if(1&N&&(m.TgZ(0,"span"),m._uU(1),m.ALo(2,"iops"),m.qZA()),2&N){const T=m.oxw().value;m.xp6(1),m.Oqu(m.lcZ(2,1,T))}}function v(N,x){if(1&N&&(m.TgZ(0,"span"),m._uU(1),m.qZA()),2&N){const T=m.oxw().value;m.xp6(1),m.Oqu(T)}}function be(N,x){if(1&N&&(m.TgZ(0,"div",4),m.YNc(1,X,3,3,"span",5),m.YNc(2,Fe,3,3,"span",5),m.YNc(3,De,3,3,"span",5),m.YNc(4,v,2,1,"span",9),m.qZA()),2&N){const T=x.row,k=m.oxw();m.Q6J("ngSwitch",T.type),m.xp6(1),m.Q6J("ngSwitchCase",k.typeField.bps),m.xp6(1),m.Q6J("ngSwitchCase",k.typeField.milliseconds),m.xp6(1),m.Q6J("ngSwitchCase",k.typeField.iops)}}let H=(()=>{class N{constructor(T,k){this.formatterService=T,this.rbdConfigurationService=k,this.sourceField=r.h,this.typeField=r.r}ngOnInit(){this.poolConfigurationColumns=[{prop:"displayName",name:"Name"},{prop:"description",name:"Description"},{prop:"name",name:"Key"},{prop:"source",name:"Source",cellTemplate:this.configurationSourceTpl,pipe:new ne},{prop:"value",name:"Value",cellTemplate:this.configurationValueTpl}]}ngOnChanges(){this.data&&(this.data=this.data.filter(T=>this.rbdConfigurationService.getOptionFields().map(k=>k.name).includes(T.name)))}}return N.\u0275fac=function(T){return new(T||N)(m.Y36(F.H),m.Y36(Ne.n))},N.\u0275cmp=m.Xpm({type:N,selectors:[["cd-rbd-configuration-table"]],viewQuery:function(T,k){if(1&T&&(m.Gf(le,7),m.Gf(C,7),m.Gf(ce,7)),2&T){let Z;m.iGM(Z=m.CRH())&&(k.configurationSourceTpl=Z.first),m.iGM(Z=m.CRH())&&(k.configurationValueTpl=Z.first),m.iGM(Z=m.CRH())&&(k.poolConfTable=Z.first)}},inputs:{data:"data"},features:[m.TTD],decls:6,vars:2,consts:function(){let x,T,k;return x="Global",T="Image",k="Pool",[["identifier","name",3,"data","columns"],["poolConfTable",""],["configurationSourceTpl",""],["configurationValueTpl",""],[3,"ngSwitch"],[4,"ngSwitchCase"],x,T,k,[4,"ngSwitchDefault"]]},template:function(T,k){1&T&&(m._UZ(0,"cd-table",0,1),m.YNc(2,e,4,4,"ng-template",null,2,m.W1O),m.YNc(4,be,5,4,"ng-template",null,3,m.W1O)),2&T&&m.Q6J("data",k.data)("columns",k.poolConfigurationColumns)},dependencies:[L.RF,L.n9,L.ED,c.a,j.O,re.J,Pe.A]}),N})()}}]);