]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/dist/en-US/483.43ef92bcd845cb24eae3.js
1f9b92973d5f257a8050628c1e9d109dbc2810d0
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / dist / en-US / 483.43ef92bcd845cb24eae3.js
1 "use strict";(self.webpackChunkceph_dashboard=self.webpackChunkceph_dashboard||[]).push([[483],{70483:(ct,Oe,p)=>{p.r(Oe),p.d(Oe,{BlockModule:()=>$t,RoutedBlockModule:()=>sr});var l=p(12057),a=p(24751),m=p(6283),ne=p(19723),N=p(38549),Ie=p(37496),v=p(79512),U=p(4222),re=p(54462),Ae=p(44466),be=p(23815),S=p.n(be),le=p(35758),D=p(64762),ie=p(58497),V=p(93523),e=p(74788);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 Ne=p(88002),Fe=p(76189),L=p(19358),he=p(34089);let q=class extends Fe.S{constructor(s,t){super(),this.http=s,this.rbdConfigurationService=t}isRBDPool(s){return-1!==S().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,Ne.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){const o={snapshot_name:t};return this.http.post(`api/block/image/${s.toStringEncoded()}/snap`,o,{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"})}};q.\u0275fac=function(s){return new(s||q)(e.LFG(ie.eN),e.LFG(he.n))},q.\u0275prov=e.Yz7({token:q,factory:q.\u0275fac,providedIn:"root"}),(0,D.gn)([(0,D.fM)(1,V.G),(0,D.w6)("design:type",Function),(0,D.w6)("design:paramtypes",[L.N,String]),(0,D.w6)("design:returntype",void 0)],q.prototype,"createSnapshot",null),(0,D.gn)([(0,D.fM)(2,V.G),(0,D.w6)("design:type",Function),(0,D.w6)("design:paramtypes",[L.N,String,String]),(0,D.w6)("design:returntype",void 0)],q.prototype,"renameSnapshot",null),(0,D.gn)([(0,D.fM)(2,V.G),(0,D.w6)("design:type",Function),(0,D.w6)("design:paramtypes",[L.N,String,Boolean]),(0,D.w6)("design:returntype",void 0)],q.prototype,"protectSnapshot",null),(0,D.gn)([(0,D.fM)(1,V.G),(0,D.w6)("design:type",Function),(0,D.w6)("design:paramtypes",[L.N,String]),(0,D.w6)("design:returntype",void 0)],q.prototype,"restoreTrash",null),q=(0,D.gn)([V.o,(0,D.w6)("design:paramtypes",[ie.eN,he.n])],q);var F=p(7022),y=p(14745),T=p(65862),H=p(93614),x=p(95463),z=p(77205),A=p(86919),R=p(76111),u=p(32337),C=p(60312),h=p(41582),O=p(56310),$=p(87925),k=p(94276),j=p(30839);function to(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 oo(n,s){if(1&n&&(e.TgZ(0,"select",5),e._UZ(1,"option",6),e.YNc(2,to,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 no(n,s){if(1&n&&e._UZ(0,"input",10),2&n){const t=e.oxw(2);e.Q6J("formControlName",t.setting)}}function io(n,s){if(1&n&&e._UZ(0,"input",11),2&n){const t=e.oxw(2);e.Q6J("formControlName",t.setting)}}function so(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.qZA(),e.TgZ(6,"div",12),e._UZ(7,"input",13),e.TgZ(8,"label",14),e._uU(9,"No"),e.qZA(),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 _o(n,s){if(1&n&&(e.TgZ(0,"span"),e.YNc(1,no,1,1,"input",8),e.YNc(2,io,1,1,"input",9),e.YNc(3,so,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 ao(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 ro(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 dt=(()=>{class n{ngOnInit(){const t=[];"min"in this.limits&&t.push(a.kI.min(this.limits.min)),"max"in this.limits&&t.push(a.kI.max(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),e.TgZ(1,"label",1),e._uU(2),e.qZA(),e.YNc(3,oo,3,5,"select",2),e.YNc(4,_o,4,3,"span",3),e.YNc(5,ao,3,1,"span",4),e.YNc(6,ro,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")))},directives:[O.P,a.JL,a.sg,h.V,l.O5,$.o,a.EJ,k.b,a.JJ,a.u,a.YN,a.Kr,l.sg,a.wV,a.Fj,a._],styles:[""]}),n})();var Je=p(88820);function lo(n,s){1&n&&(e.TgZ(0,"span",29),e.SDv(1,30),e.qZA())}function co(n,s){if(1&n&&(e.TgZ(0,"span"),e.TgZ(1,"legend",10),e.SDv(2,21),e.qZA(),e.TgZ(3,"div",12),e.TgZ(4,"div",13),e.TgZ(5,"label",22),e.SDv(6,23),e.qZA(),e._UZ(7,"input",24),e.YNc(8,lo,2,0,"span",25),e.qZA(),e.qZA(),e.TgZ(9,"div",12),e.TgZ(10,"div",13),e.TgZ(11,"label",26),e.SDv(12,27),e.qZA(),e._UZ(13,"input",28),e.qZA(),e.qZA(),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 po(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),e.TgZ(1,"div",13),e._UZ(2,"cd-iscsi-setting",33),e.qZA(),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 uo(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 mo(n,s){if(1&n&&(e.ynx(0),e.YNc(1,uo,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 To=(()=>{class n{constructor(t,o,i){this.activeModal=t,this.iscsiService=o,this.actionLabels=i}ngOnInit(){const t={backstore:new a.NI(this.imagesSettings[this.image].backstore),lun:new a.NI(this.imagesSettings[this.image].lun),wwn:new a.NI(this.imagesSettings[this.image].wwn)};S().forEach(this.backstores,o=>{const i=this.imagesSettings[this.image][o]||{};S().forIn(this.disk_default_controls[o],(_,r)=>{t[r]=new a.NI(i[r])})}),this.settingsForm=new x.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,_={};S().forIn(this.settingsForm.controls,(r,c)=>{""!==r.value&&null!==r.value&&c in this.disk_default_controls[this.settingsForm.value.backstore]&&(_[c]=r.value,S().forEach(this.backstores,d=>{d!==t&&c in(this.imagesSettings[this.image][d]||{})&&(this.imagesSettings[this.image][d][c]=r.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=Object.assign({},this.imagesSettings),this.control.updateValueAndValidity({emitEvent:!1}),this.activeModal.close()}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(N.Kz),e.Y36(X),e.Y36(v.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,_,r,c,d;return s="Configure",t="Changing these parameters from their default values is usually not necessary.",o="Settings",i="Backstore",_="Identifier",r="lun",c="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-control"],[3,"value",4,"ngFor","ngForOf"],[4,"ngFor","ngForOf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],_,["for","lun",1,"col-form-label","required"],r,["type","number","id","lun","name","lun","formControlName","lun",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["for","wwn",1,"col-form-label"],c,["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),e.ynx(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),e.TgZ(10,"div",6),e.TgZ(11,"p",7),e.SDv(12,8),e.qZA(),e.YNc(13,co,14,1,"span",9),e.TgZ(14,"legend",10),e.SDv(15,11),e.qZA(),e.TgZ(16,"div",12),e.TgZ(17,"div",13),e.TgZ(18,"label",14),e.SDv(19,15),e.qZA(),e.TgZ(20,"select",16),e.YNc(21,po,3,4,"option",17),e.qZA(),e.qZA(),e.qZA(),e.YNc(22,mo,2,1,"ng-container",18),e.qZA(),e.TgZ(23,"div",19),e.TgZ(24,"cd-form-button-panel",20),e.NdJ("submitActionEvent",function(){return o.save()}),e.qZA(),e.qZA(),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))},directives:[C.z,a._Y,a.JL,a.sg,h.V,l.O5,O.P,$.o,a.EJ,k.b,a.JJ,a.u,l.sg,j.p,a.wV,a.Fj,a.YN,a.Kr,dt],pipes:[Je.V,l.Nd],styles:[""]}),n})();function fo(n,s){if(1&n&&(e.TgZ(0,"div",12),e.TgZ(1,"div",13),e._UZ(2,"cd-iscsi-setting",14),e.qZA(),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 Co=(()=>{class n{constructor(t,o,i){this.activeModal=t,this.iscsiService=o,this.actionLabels=i}ngOnInit(){const t={};S().forIn(this.target_default_controls,(o,i)=>{t[i]=new a.NI(this.target_controls.value[i])}),this.settingsForm=new x.d(t)}save(){const t={};S().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(N.Kz),e.Y36(X),e.Y36(v.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),e.TgZ(6,"div",6),e.TgZ(7,"p",7),e.SDv(8,8),e.qZA(),e.YNc(9,fo,3,4,"div",9),e.ALo(10,"keyvalue"),e.qZA(),e.TgZ(11,"div",10),e.TgZ(12,"cd-form-button-panel",11),e.NdJ("submitActionEvent",function(){return o.save()}),e.qZA(),e.qZA(),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))},directives:[C.z,a._Y,a.JL,a.sg,h.V,l.sg,j.p,O.P,dt],pipes:[l.Nd],styles:[""]}),n})();var de=p(63285),pt=p(63622);let So=(()=>{class n{constructor(t){this.ngControl=t}onInput(t){this.setValue(t)}setValue(t){t=S().isString(t)?t.trim():t,this.ngControl.control.setValue(t)}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(a.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 Eo=p(39092),gt=p(4416),Ye=p(58039),et=p(10545);function Ro(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,42),e.qZA())}function Mo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,43),e.qZA())}function Oo(n,s){1&n&&(e.TgZ(0,"span",41),e.ynx(1),e.SDv(2,44),e.BQk(),e._UZ(3,"br"),e.ynx(4),e.SDv(5,45),e.BQk(),e._UZ(6,"br"),e.TgZ(7,"a",46),e.SDv(8,47),e.qZA(),e.qZA())}function Ao(n,s){1&n&&(e.TgZ(0,"span",48),e.SDv(1,49),e.qZA())}const J=function(n){return[n]};function ho(n,s){if(1&n){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",50),e._UZ(2,"input",51),e.TgZ(3,"span",14),e.TgZ(4,"button",52),e.NdJ("click",function(){const i=e.CHM(t),_=i.index,r=i.$implicit;return e.oxw(2).removePortal(_,r)}),e._UZ(5,"i",16),e.qZA(),e.qZA(),e.qZA(),e.BQk()}if(2&n){const t=s.$implicit,o=e.oxw(2);e.xp6(2),e.Q6J("value",t),e.xp6(3),e.Q6J("ngClass",e.VKq(2,J,o.icons.destroy))}}function Po(n,s){if(1&n&&(e.TgZ(0,"span",41),e.SDv(1,53),e.qZA()),2&n){const t=e.oxw(2);e.xp6(1),e.pQV(t.minimum_gateways),e.QtT(1)}}function Io(n,s){if(1&n&&(e.TgZ(0,"div",56),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 bo(n,s){if(1&n&&(e.ynx(0),e.SDv(1,57),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 No(n,s){1&n&&(e.ynx(0),e.SDv(1,58),e.BQk())}function Fo(n,s){if(1&n){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",50),e._UZ(2,"input",51),e.TgZ(3,"span",14),e.YNc(4,Io,2,1,"div",54),e.TgZ(5,"button",52),e.NdJ("click",function(){const _=e.CHM(t).$implicit;return e.oxw(2).imageSettingsModal(_)}),e._UZ(6,"i",16),e.qZA(),e.TgZ(7,"button",52),e.NdJ("click",function(){const i=e.CHM(t),_=i.index,r=i.$implicit;return e.oxw(2).removeImage(_,r)}),e._UZ(8,"i",16),e.qZA(),e.qZA(),e.qZA(),e.TgZ(9,"span",48),e.YNc(10,bo,3,3,"ng-container",55),e.YNc(11,No,2,0,"ng-container",55),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("ngIf",o.api_version>=1),e.xp6(2),e.Q6J("ngClass",e.VKq(6,J,o.icons.deepCheck)),e.xp6(2),e.Q6J("ngClass",e.VKq(8,J,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 Do(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,59),e.qZA())}function vo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,60),e.qZA())}function Lo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,78),e.qZA())}function $o(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,79),e.qZA())}function Zo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,80),e.qZA())}function Bo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,81),e.qZA())}function Go(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,82),e.qZA())}function yo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,83),e.qZA())}function xo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,84),e.qZA())}function wo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,85),e.qZA())}function qo(n,s){if(1&n&&(e.TgZ(0,"div",61),e.TgZ(1,"div",8),e.TgZ(2,"label",62),e.ynx(3),e.SDv(4,63),e.BQk(),e.qZA(),e.TgZ(5,"div",11),e._UZ(6,"input",64),e.YNc(7,Lo,2,0,"span",17),e.YNc(8,$o,2,0,"span",17),e.qZA(),e.qZA(),e.TgZ(9,"div",8),e.TgZ(10,"label",65),e.ynx(11),e.SDv(12,66),e.BQk(),e.qZA(),e.TgZ(13,"div",11),e.TgZ(14,"div",12),e._UZ(15,"input",67),e.TgZ(16,"span",14),e._UZ(17,"button",68),e._UZ(18,"cd-copy-2-clipboard-button",69),e.qZA(),e.qZA(),e.YNc(19,Zo,2,0,"span",17),e.YNc(20,Bo,2,0,"span",17),e.qZA(),e.qZA(),e.TgZ(21,"div",8),e.TgZ(22,"label",70),e.ynx(23),e.SDv(24,71),e.BQk(),e.qZA(),e.TgZ(25,"div",11),e._UZ(26,"input",72),e.YNc(27,Go,2,0,"span",17),e.YNc(28,yo,2,0,"span",17),e.qZA(),e.qZA(),e.TgZ(29,"div",8),e.TgZ(30,"label",73),e.ynx(31),e.SDv(32,74),e.BQk(),e.qZA(),e.TgZ(33,"div",11),e.TgZ(34,"div",12),e._UZ(35,"input",75),e.TgZ(36,"span",14),e._UZ(37,"button",76),e._UZ(38,"cd-copy-2-clipboard-button",77),e.qZA(),e.qZA(),e.YNc(39,xo,2,0,"span",17),e.YNc(40,wo,2,0,"span",17),e.qZA(),e.qZA(),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(11),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(11),e.Q6J("ngIf",o.targetForm.showError("mutual_password",t,"required")),e.xp6(1),e.Q6J("ngIf",o.targetForm.showError("mutual_password",t,"pattern"))}}function Ho(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,115),e.qZA())}function ko(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,116),e.qZA())}function Ko(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,117),e.qZA())}function Xo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,118),e.qZA())}function Qo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,119),e.qZA())}function zo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,120),e.qZA())}function Jo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,121),e.qZA())}function Yo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,122),e.qZA())}function Vo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,123),e.qZA())}function Uo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,124),e.qZA())}function jo(n,s){1&n&&(e.TgZ(0,"span",41),e.SDv(1,125),e.qZA())}function Wo(n,s){if(1&n){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",50),e._UZ(2,"input",51),e.TgZ(3,"span",14),e.TgZ(4,"button",52),e.NdJ("click",function(){const i=e.CHM(t),_=i.index,r=i.$implicit,c=e.oxw(),d=c.$implicit,g=c.index;return e.oxw(3).removeInitiatorImage(d,_,g,r)}),e._UZ(5,"i",16),e.qZA(),e.qZA(),e.qZA(),e.BQk()}if(2&n){const t=s.$implicit,o=e.oxw(4);e.xp6(2),e.Q6J("value",t),e.xp6(3),e.Q6J("ngClass",e.VKq(2,J,o.icons.destroy))}}function en(n,s){1&n&&(e.TgZ(0,"span"),e.SDv(1,126),e.qZA())}function tn(n,s){if(1&n&&(e.TgZ(0,"div",22),e.TgZ(1,"div",23),e.TgZ(2,"cd-select",127),e._UZ(3,"i",25),e.ynx(4),e.SDv(5,128),e.BQk(),e.qZA(),e.qZA(),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,J,_.icons.add))}}function on(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",92),e.TgZ(1,"div",5),e.ynx(2),e.SDv(3,93),e.BQk(),e._uU(4),e.TgZ(5,"button",94),e.NdJ("click",function(){const _=e.CHM(t).index;return e.oxw(3).removeInitiator(_)}),e._UZ(6,"i",25),e.qZA(),e.qZA(),e.TgZ(7,"div",7),e.TgZ(8,"div",8),e.TgZ(9,"label",95),e.SDv(10,96),e.qZA(),e.TgZ(11,"div",11),e.TgZ(12,"input",97),e.NdJ("blur",function(){return e.CHM(t),e.oxw(3).updatedInitiatorSelector()}),e.qZA(),e.YNc(13,Ho,2,0,"span",17),e.YNc(14,ko,2,0,"span",17),e.YNc(15,Ko,2,0,"span",17),e.qZA(),e.qZA(),e.ynx(16,61),e.TgZ(17,"div",8),e.TgZ(18,"label",98),e.SDv(19,99),e.qZA(),e.TgZ(20,"div",11),e._UZ(21,"input",100),e.YNc(22,Xo,2,0,"span",17),e.YNc(23,Qo,2,0,"span",17),e.qZA(),e.qZA(),e.TgZ(24,"div",8),e.TgZ(25,"label",101),e.SDv(26,102),e.qZA(),e.TgZ(27,"div",11),e.TgZ(28,"div",12),e._UZ(29,"input",103),e.TgZ(30,"span",14),e._UZ(31,"button",104),e._UZ(32,"cd-copy-2-clipboard-button",105),e.qZA(),e.qZA(),e.YNc(33,zo,2,0,"span",17),e.YNc(34,Jo,2,0,"span",17),e.qZA(),e.qZA(),e.TgZ(35,"div",8),e.TgZ(36,"label",106),e.ynx(37),e.SDv(38,107),e.BQk(),e.qZA(),e.TgZ(39,"div",11),e._UZ(40,"input",108),e.YNc(41,Yo,2,0,"span",17),e.YNc(42,Vo,2,0,"span",17),e.qZA(),e.qZA(),e.TgZ(43,"div",8),e.TgZ(44,"label",109),e.SDv(45,110),e.qZA(),e.TgZ(46,"div",11),e.TgZ(47,"div",12),e._UZ(48,"input",111),e.TgZ(49,"span",14),e._UZ(50,"button",104),e._UZ(51,"cd-copy-2-clipboard-button",105),e.qZA(),e.qZA(),e.YNc(52,Uo,2,0,"span",17),e.YNc(53,jo,2,0,"span",17),e.qZA(),e.qZA(),e.BQk(),e.TgZ(54,"div",8),e.TgZ(55,"label",112),e.SDv(56,113),e.qZA(),e.TgZ(57,"div",11),e.YNc(58,Wo,6,4,"ng-container",21),e.YNc(59,en,2,0,"span",55),e.YNc(60,tn,6,6,"div",114),e.qZA(),e.qZA(),e.qZA(),e.qZA()}if(2&n){const t=s.$implicit,o=s.index;e.oxw(2);const i=e.MAs(2),_=e.oxw();e.Q6J("formGroup",t),e.xp6(4),e.hij(": ",t.getValue("client_iqn")," "),e.xp6(2),e.Q6J("ngClass",e.VKq(25,J,_.icons.destroy)),e.xp6(7),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(2),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(2),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 nn(n,s){1&n&&(e.TgZ(0,"span",48),e.SDv(1,129),e.qZA())}function sn(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",8),e.TgZ(1,"label",86),e.SDv(2,87),e.qZA(),e.TgZ(3,"div",88),e.YNc(4,on,61,27,"div",89),e.TgZ(5,"div",22),e.TgZ(6,"div",23),e.YNc(7,nn,2,0,"span",18),e.TgZ(8,"button",90),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).addInitiator(),!1}),e._UZ(9,"i",25),e.ynx(10),e.SDv(11,91),e.BQk(),e.qZA(),e.qZA(),e.qZA(),e._UZ(12,"hr"),e.qZA(),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,J,t.icons.add))}}function _n(n,s){if(1&n){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",50),e._UZ(2,"input",51),e.TgZ(3,"span",14),e.TgZ(4,"button",52),e.NdJ("click",function(){const _=e.CHM(t).index,r=e.oxw(),c=r.$implicit,d=r.index;return e.oxw(3).removeGroupInitiator(c,_,d)}),e._UZ(5,"i",16),e.qZA(),e.qZA(),e.qZA(),e.BQk()}if(2&n){const t=s.$implicit,o=e.oxw(4);e.xp6(2),e.Q6J("value",t),e.xp6(3),e.Q6J("ngClass",e.VKq(2,J,o.icons.destroy))}}function an(n,s){if(1&n){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",50),e._UZ(2,"input",51),e.TgZ(3,"span",14),e.TgZ(4,"button",52),e.NdJ("click",function(){const _=e.CHM(t).index,r=e.oxw(),c=r.$implicit,d=r.index;return e.oxw(3).removeGroupDisk(c,_,d)}),e._UZ(5,"i",16),e.qZA(),e.qZA(),e.qZA(),e.BQk()}if(2&n){const t=s.$implicit,o=e.oxw(4);e.xp6(2),e.Q6J("value",t),e.xp6(3),e.Q6J("ngClass",e.VKq(2,J,o.icons.destroy))}}function rn(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",92),e.TgZ(1,"div",5),e.ynx(2),e.SDv(3,133),e.BQk(),e._uU(4),e.TgZ(5,"button",94),e.NdJ("click",function(){const _=e.CHM(t).index;return e.oxw(3).removeGroup(_)}),e._UZ(6,"i",25),e.qZA(),e.qZA(),e.TgZ(7,"div",7),e.TgZ(8,"div",8),e.TgZ(9,"label",134),e.SDv(10,135),e.qZA(),e.TgZ(11,"div",11),e._UZ(12,"input",136),e.qZA(),e.qZA(),e.TgZ(13,"div",8),e.TgZ(14,"label",137),e.ynx(15),e.SDv(16,138),e.BQk(),e.qZA(),e.TgZ(17,"div",11),e.YNc(18,_n,6,4,"ng-container",21),e.TgZ(19,"div",22),e.TgZ(20,"div",23),e.TgZ(21,"cd-select",24),e.NdJ("selection",function(i){const r=e.CHM(t).index;return e.oxw(3).onGroupMemberSelection(i,r)}),e._UZ(22,"i",25),e.ynx(23),e.SDv(24,139),e.BQk(),e.qZA(),e.qZA(),e.qZA(),e._UZ(25,"hr"),e.qZA(),e.qZA(),e.TgZ(26,"div",8),e.TgZ(27,"label",28),e.ynx(28),e.SDv(29,140),e.BQk(),e.qZA(),e.TgZ(30,"div",11),e.YNc(31,an,6,4,"ng-container",21),e.TgZ(32,"div",22),e.TgZ(33,"div",23),e.TgZ(34,"cd-select",127),e._UZ(35,"i",25),e.ynx(36),e.SDv(37,141),e.BQk(),e.qZA(),e.qZA(),e.qZA(),e._UZ(38,"hr"),e.qZA(),e.qZA(),e.qZA(),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(2),e.Q6J("ngClass",e.VKq(13,J,i.icons.destroy)),e.xp6(12),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(15,J,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(17,J,i.icons.add))}}function ln(n,s){1&n&&(e.TgZ(0,"span",48),e.SDv(1,142),e.qZA())}function cn(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",8),e.TgZ(1,"label",86),e.SDv(2,130),e.qZA(),e.TgZ(3,"div",131),e.YNc(4,rn,39,19,"div",89),e.TgZ(5,"div",22),e.TgZ(6,"div",23),e.YNc(7,ln,2,0,"span",18),e.TgZ(8,"button",90),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).addGroup(),!1}),e._UZ(9,"i",25),e.ynx(10),e.SDv(11,132),e.BQk(),e.qZA(),e.qZA(),e.qZA(),e.qZA(),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,J,t.icons.add))}}function dn(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",1),e.TgZ(1,"form",2,3),e.TgZ(3,"div",4),e.TgZ(4,"div",5),e.SDv(5,6),e.ALo(6,"titlecase"),e.ALo(7,"upperFirst"),e.qZA(),e.TgZ(8,"div",7),e.TgZ(9,"div",8),e.TgZ(10,"label",9),e.SDv(11,10),e.qZA(),e.TgZ(12,"div",11),e.TgZ(13,"div",12),e._UZ(14,"input",13),e.TgZ(15,"span",14),e.TgZ(16,"button",15),e.NdJ("click",function(){return e.CHM(t),e.oxw().targetSettingsModal()}),e._UZ(17,"i",16),e.qZA(),e.qZA(),e.qZA(),e.YNc(18,Ro,2,0,"span",17),e.YNc(19,Mo,2,0,"span",17),e.YNc(20,Oo,9,0,"span",17),e.YNc(21,Ao,2,0,"span",18),e._UZ(22,"hr"),e.qZA(),e.qZA(),e.TgZ(23,"div",8),e.TgZ(24,"label",19),e.SDv(25,20),e.qZA(),e.TgZ(26,"div",11),e.YNc(27,ho,6,4,"ng-container",21),e.TgZ(28,"div",22),e.TgZ(29,"div",23),e.TgZ(30,"cd-select",24),e.NdJ("selection",function(i){return e.CHM(t),e.oxw().onPortalSelection(i)}),e._UZ(31,"i",25),e.ynx(32),e.SDv(33,26),e.BQk(),e.qZA(),e.qZA(),e.qZA(),e._UZ(34,"input",27),e.YNc(35,Po,2,1,"span",17),e._UZ(36,"hr"),e.qZA(),e.qZA(),e.TgZ(37,"div",8),e.TgZ(38,"label",28),e.SDv(39,29),e.qZA(),e.TgZ(40,"div",11),e.YNc(41,Fo,12,10,"ng-container",21),e._UZ(42,"input",30),e.YNc(43,Do,2,0,"span",17),e.YNc(44,vo,2,0,"span",17),e.TgZ(45,"div",22),e.TgZ(46,"div",23),e.TgZ(47,"cd-select",24),e.NdJ("selection",function(i){return e.CHM(t),e.oxw().onImageSelection(i)}),e._UZ(48,"i",25),e.ynx(49),e.SDv(50,31),e.BQk(),e.qZA(),e.qZA(),e.qZA(),e._UZ(51,"hr"),e.qZA(),e.qZA(),e.TgZ(52,"div",8),e.TgZ(53,"div",32),e.TgZ(54,"div",33),e._UZ(55,"input",34),e.TgZ(56,"label",35),e.SDv(57,36),e.qZA(),e.qZA(),e._UZ(58,"hr"),e.qZA(),e.qZA(),e.YNc(59,qo,41,8,"div",37),e.YNc(60,sn,13,5,"div",38),e.YNc(61,cn,12,5,"div",38),e.qZA(),e.TgZ(62,"div",39),e.TgZ(63,"cd-form-button-panel",40),e.NdJ("submitActionEvent",function(){return e.CHM(t),e.oxw().submit()}),e.ALo(64,"titlecase"),e.ALo(65,"upperFirst"),e.qZA(),e.qZA(),e.qZA(),e.qZA(),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(10),e.Q6J("ngClass",e.VKq(34,J,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,J,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,J,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(64,30,o.action)+" "+e.lcZ(65,32,o.resource))}}let ut=(()=>{class n extends H.E{constructor(t,o,i,_,r,c,d){super(),this.iscsiService=t,this.modalService=o,this.rbdService=i,this.router=_,this.route=r,this.taskWrapper=c,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 F.a({noOptions:"There are no portals available."}),images:new F.a({noOptions:"There are no images available."}),initiatorImage:new F.a({noOptions:"There are no images available. Please make sure you add an image to the target."}),groupInitiator:new F.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 A.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,le.D)(o).subscribe(i=>{const _=S()(i[0]).filter(c=>c.target_iqn!==this.target_iqn).flatMap(c=>c.disks).map(c=>`${c.pool}/${c.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=S()(i[1]).flatMap(c=>c.value).filter(c=>!c.namespace&&!(-1!==_.indexOf(`${c.pool_name}/${c.name}`)||0===this.getValidBackstores(c).length)).value(),this.imagesSelections=this.imagesAll.map(c=>new y.$(!1,`${c.pool_name}/${c.name}`,""));const r=[];i[2].forEach(c=>{c.ip_addresses.forEach(d=>{r.push(new y.$(!1,c.name+":"+d,""))})}),this.portalsSelections=[...r],this.cephIscsiConfigVersion=i[4].ceph_iscsi_config_version,this.createForm(),i[5]&&this.resolveModel(i[5]),this.loadingReady()})}createForm(){if(this.targetForm=new x.d({target_iqn:new a.NI("iqn.2001-07.com.ceph:"+Date.now(),{validators:[a.kI.required,a.kI.pattern(this.IQN_REGEX)]}),target_controls:new a.NI({}),portals:new a.NI([],{validators:[z.h.custom("minGateways",t=>S().uniq(t.map(i=>i.split(":")[0])).length<Math.max(1,this.minimum_gateways))]}),disks:new a.NI([],{validators:[z.h.custom("dupLunId",t=>{const o=this.getLunIds(t);return o.length!==S().uniq(o).length}),z.h.custom("dupWwn",t=>{const o=this.getWwns(t);return o.length!==S().uniq(o).length})]}),initiators:new a.Oe([]),groups:new a.Oe([]),acl_enabled:new a.NI(!1)}),this.cephIscsiConfigVersion>10){const t=new x.d({user:new a.NI(""),password:new a.NI(""),mutual_user:new a.NI(""),mutual_password:new a.NI("")});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=[];S().forEach(t.portals,_=>{o.push(`${_.host}:${_.ip}`)}),this.targetForm.patchValue({portals:o});const i=[];S().forEach(t.disks,_=>{const r=`${_.pool}/${_.image}`;i.push(r),this.imagesSettings[r]={backstore:_.backstore},this.imagesSettings[r][_.backstore]=_.controls,"lun"in _&&(this.imagesSettings[r].lun=_.lun),"wwn"in _&&(this.imagesSettings[r].wwn=_.wwn),this.onImageSelection({option:{name:r,selected:!0}})}),this.targetForm.patchValue({disks:i}),S().forEach(t.clients,_=>{const r=this.addInitiator();_.luns=S().map(_.luns,c=>`${c.pool}/${c.image}`),r.patchValue(_)}),t.groups.forEach((_,r)=>{const c=this.addGroup();_.disks=S().map(_.disks,d=>`${d.pool}/${d.image}`),c.patchValue(_),S().forEach(_.members,d=>{this.onGroupMemberSelection({option:new y.$(!0,d,"")},r)})})}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)}),S().forEach(this.imagesInitiatorSelections,(o,i)=>{this.imagesInitiatorSelections[i]=o.filter(_=>_.name!==t)}),S().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 S().map(t,o=>this.imagesSettings[o].lun)}nextLunId(t){const o=this.disks.value.filter(r=>r!==t),i=this.getLunIds(o);let _=0;for(;i.includes(_);)_++;return _}getWwns(t){return S().map(t,i=>this.imagesSettings[i].wwn).filter(i=>S().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]={}}S().forEach(this.imagesInitiatorSelections,(i,_)=>{i.push(new y.$(!1,o.name,"")),this.imagesInitiatorSelections[_]=[...i]}),S().forEach(this.groupDiskSelections,(i,_)=>{i.push(new y.$(!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 x.d({client_iqn:new a.NI("",{validators:[a.kI.required,z.h.custom("notUnique",i=>{const _=this.initiators.controls.reduce(function(r,c){return r.concat(c.value.client_iqn)},[]);return _.indexOf(i)!==_.lastIndexOf(i)}),a.kI.pattern(this.IQN_REGEX)]}),auth:new x.d({user:new a.NI(""),password:new a.NI(""),mutual_user:new a.NI(""),mutual_password:new a.NI("")}),luns:new a.NI([]),cdIsInGroup:new a.NI(!1)});this.setAuthValidator(t),this.initiators.push(t),S().forEach(this.groupMembersSelections,(i,_)=>{i.push(new y.$(!1,"","")),this.groupMembersSelections[_]=[...i]});const o=S().map(this.targetForm.getValue("disks"),i=>new y.$(!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"),[a.kI.required],[a.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"),[a.kI.required],[a.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"),[a.kI.required],[a.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"),[a.kI.required],[a.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),S().forEach(this.groupMembersSelections,(i,_)=>{i.splice(t,1),this.groupMembersSelections[_]=[...i]}),this.groups.controls.forEach(i=>{const _=i.value.members.filter(r=>r!==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})}),S().forEach(this.groupMembersSelections,(t,o)=>{S().forEach(t,(i,_)=>{const r=i.name;i.name=this.initiators.controls[_].value.client_iqn,this.groups.controls.forEach(c=>{const d=c.value.members,g=d.indexOf(r);-1!==g&&(d[g]=i.name),c.get("members").setValue(d)})}),this.groupMembersSelections[o]=[...this.groupMembersSelections[o]]})}removeInitiatorImage(t,o,i,_){const r=t.getValue("luns");return r.splice(o,1),t.patchValue({luns:r}),this.imagesInitiatorSelections[i].forEach(c=>{c.name===_&&(c.selected=!1)}),!1}get groups(){return this.targetForm.get("groups")}addGroup(){const t=new x.d({group_id:new a.NI("",{validators:[a.kI.required]}),members:new a.NI([]),disks:new a.NI([])});this.groups.push(t);const o=S().map(this.targetForm.getValue("disks"),_=>new y.$(!1,_,""));this.groupDiskSelections.push(o);const i=S().map(this.initiators.value,_=>new y.$(!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(c=>c.selected).map(c=>c.name)),this.initiators.controls.forEach((r,c)=>{r.value.client_iqn===i.name&&(r.patchValue({luns:_}),r.get("cdIsInGroup").setValue(i.selected),S().forEach(this.groupMembersSelections,d=>{d[c].enabled=!i.selected}),this.imagesInitiatorSelections[c].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 y.$(!1,_,"")},i)}removeGroupDisk(t,o,i){const _=t.getValue("disks")[o];t.getValue("disks").splice(o,1),this.groupDiskSelections[i].forEach(r=>{r.name===_&&(r.selected=!1)}),this.groupDiskSelections[i]=[...this.groupDiskSelections[i]]}submit(){const t=S().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 r=this.targetForm.getValue("acl_enabled");o.auth={user:r?"":_.getValue("user"),password:r?"":_.getValue("password"),mutual_user:r?"":_.getValue("mutual_user"),mutual_password:r?"":_.getValue("mutual_password")}}let i;t.disks.forEach(_=>{const r=_.split("/"),c=this.imagesSettings[_].backstore;o.disks.push({pool:r[0],image:r[1],backstore:c,controls:this.imagesSettings[_][c],lun:this.imagesSettings[_].lun,wwn:this.imagesSettings[_].wwn})}),t.portals.forEach(_=>{const r=_.indexOf(":");o.portals.push({host:_.substring(0,r),ip:_.substring(r+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 r=[];_.luns.forEach(c=>{const d=c.split("/");r.push({pool:d[0],image:d[1]})}),_.luns=r}),o.clients=t.initiators),o.acl_enabled&&(t.groups.forEach(_=>{const r=[];_.disks.forEach(c=>{const d=c.split("/");r.push({pool:d[0],image:d[1]})}),_.disks=r}),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 R.R("iscsi/target/edit",{target_iqn:o.target_iqn}),call:this.iscsiService.updateTarget(this.target_iqn,o)})):i=this.taskWrapper.wrapTaskAroundCall({task:new R.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(Co,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(To,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(de.Z),e.Y36(q),e.Y36(m.F0),e.Y36(m.gz),e.Y36(u.P),e.Y36(v.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,_,r,c,d,g,f,I,P,Z,B,Q,Y,ee,te,w,_e,ae,M,ge,ue,me,Te,fe,Ce,G,Be,Ge,ye,xe,we,qe,He,ke,Ke,Xe,Qe,ze,b,Zt,Bt,Gt,yt,xt,wt,qt,Ht,kt,Kt,Xt,Qt,zt,Jt,Yt,Vt,Ut,jt,Wt,eo;return s="" + "\ufffd0\ufffd" + " " + "\ufffd1\ufffd" + "",t="Target IQN",o="Portals",i="Add portal",_="Images",r="Add image",c="ACL authentication",d="This field is required.",g="IQN has wrong pattern.",f="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",Z="This target has modified advanced settings.",B="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",M="Mutual Password",ge="This field is required.",ue="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",me="This field is required.",Te="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",fe="This field is required.",Ce="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",G="This field is required.",Be="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",Ge="Initiators",ye="Add initiator",xe="Initiator",we="Client IQN",qe="User",He="Password",ke="Mutual User",Ke="Mutual Password",Xe="Images",Qe="Initiator IQN needs to be unique.",ze="This field is required.",b="IQN has wrong pattern.",Zt="This field is required.",Bt="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",Gt="This field is required.",yt="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",xt="This field is required.",wt="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",qt="This field is required.",Ht="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",kt="Initiator belongs to a group. Images will be configure in the group.",Kt="Add image",Xt="No items added.",Qt="Groups",zt="Add group",Jt="Group",Yt="Name",Vt="Initiators",Ut="Add initiator",jt="Images",Wt="Add image",eo="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"],[1,"input-group-append"],["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-right",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"],r,[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"],c,["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,f,I,["target","_blank","href","https://en.wikipedia.org/wiki/ISCSI#Addressing"],P,[1,"form-text","text-muted"],Z,[1,"input-group","cd-mb"],["type","text","disabled","",1,"cd-form-control",3,"value"],["type","button",1,"btn","btn-light",3,"click"],B,["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"],M,["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"],ge,ue,me,Te,fe,Ce,G,Be,["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-right",3,"click"],ye,[1,"card","mb-2",3,"formGroup"],xe,["type","button",1,"close",3,"click"],["for","client_iqn",1,"cd-col-form-label","required"],we,["type","text","formControlName","client_iqn","cdTrim","",1,"form-control",3,"blur"],["for","user",1,"cd-col-form-label"],qe,["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"],Xe,["class","row",4,"ngIf"],Qe,ze,b,Zt,Bt,Gt,yt,xt,wt,qt,Ht,kt,["elemClass","btn btn-light float-right",3,"data","options","messages"],Kt,Xt,Qt,["formArrayName","groups",1,"cd-col-form-input"],zt,Jt,["for","group_id",1,"cd-col-form-label","required"],Yt,["type","text","formControlName","group_id",1,"form-control"],["for","members",1,"cd-col-form-label"],Vt,Ut,jt,Wt,eo]},template:function(t,o){1&t&&e.YNc(0,dn,66,40,"div",0),2&t&&e.Q6J("cdFormLoading",o.loading)},directives:[pt.y,a._Y,a.JL,a.sg,h.V,O.P,$.o,a.Fj,k.b,a.JJ,a.u,So,l.mk,l.O5,l.sg,Eo.H,a.Wl,j.p,a.x0,gt.C,Ye.s,a.CE],pipes:[l.rS,et.m,Je.V],styles:[".cd-mb[_ngcontent-%COMP%]{margin-bottom:10px}"]}),n})();var mt=p(68136),pe=p(30982),W=p(35905),De=p(99466),Se=p(68774),Tt=p(55657),ce=p(38047),tt=p(18001),ve=p(97161),oe=p(74937);function pn(n,s){1&n&&(e.TgZ(0,"span",30),e.SDv(1,31),e.qZA())}function gn(n,s){1&n&&(e.TgZ(0,"span",30),e.SDv(1,32),e.qZA())}function un(n,s){1&n&&(e.TgZ(0,"span",30),e.SDv(1,33),e.qZA())}function mn(n,s){1&n&&(e.TgZ(0,"span",30),e.SDv(1,34),e.qZA())}function Tn(n,s){1&n&&(e.TgZ(0,"span",30),e.SDv(1,35),e.qZA())}function fn(n,s){1&n&&(e.TgZ(0,"span",30),e.SDv(1,36),e.qZA())}function Cn(n,s){1&n&&(e.TgZ(0,"span",30),e.SDv(1,37),e.qZA())}function Sn(n,s){1&n&&(e.TgZ(0,"span",30),e.SDv(1,38),e.qZA())}let En=(()=>{class n{constructor(t,o,i,_,r){this.authStorageService=t,this.activeModal=o,this.actionLabels=i,this.iscsiService=_,this.notificationService=r,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 x.d({user:new a.NI({value:"",disabled:!this.hasPermission}),password:new a.NI({value:"",disabled:!this.hasPermission}),mutual_user:new a.NI({value:"",disabled:!this.hasPermission}),mutual_password:new a.NI({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"),[a.kI.required],[a.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"),[a.kI.required],[a.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"),[a.kI.required],[a.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"),[a.kI.required],[a.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(tt.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(N.Kz),e.Y36(v.p4),e.Y36(X),e.Y36(ve.g))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi-target-discovery-modal"]],decls:46,vars:13,consts:function(){let s,t,o,i,_,r,c,d,g,f,I,P,Z;return s="Discovery Authentication",t="User",o="Password",i="Mutual User",_="Mutual Password",r="This field is required.",c="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 '/'.",f="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.",Z="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"],[1,"input-group-append"],["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"],r,c,d,g,f,I,P,Z]},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),e.TgZ(6,"div",6),e.TgZ(7,"div",7),e.TgZ(8,"label",8),e.SDv(9,9),e.qZA(),e.TgZ(10,"div",10),e._UZ(11,"input",11),e.YNc(12,pn,2,0,"span",12),e.YNc(13,gn,2,0,"span",12),e.qZA(),e.qZA(),e.TgZ(14,"div",7),e.TgZ(15,"label",13),e.SDv(16,14),e.qZA(),e.TgZ(17,"div",10),e.TgZ(18,"div",15),e._UZ(19,"input",16),e.TgZ(20,"span",17),e._UZ(21,"button",18),e._UZ(22,"cd-copy-2-clipboard-button",19),e.qZA(),e.qZA(),e.YNc(23,un,2,0,"span",12),e.YNc(24,mn,2,0,"span",12),e.qZA(),e.qZA(),e.TgZ(25,"div",7),e.TgZ(26,"label",20),e.ynx(27),e.SDv(28,21),e.BQk(),e.qZA(),e.TgZ(29,"div",10),e._UZ(30,"input",22),e.YNc(31,Tn,2,0,"span",12),e.YNc(32,fn,2,0,"span",12),e.qZA(),e.qZA(),e.TgZ(33,"div",7),e.TgZ(34,"label",23),e.SDv(35,24),e.qZA(),e.TgZ(36,"div",10),e.TgZ(37,"div",15),e._UZ(38,"input",25),e.TgZ(39,"span",17),e._UZ(40,"button",26),e._UZ(41,"cd-copy-2-clipboard-button",27),e.qZA(),e.qZA(),e.YNc(42,Cn,2,0,"span",12),e.YNc(43,Sn,2,0,"span",12),e.qZA(),e.qZA(),e.qZA(),e.TgZ(44,"div",28),e.TgZ(45,"cd-form-button-panel",29),e.NdJ("submitActionEvent",function(){return o.submitAction()}),e.qZA(),e.qZA(),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(10),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(10),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)}},directives:[C.z,a._Y,a.JL,a.sg,h.V,O.P,$.o,a.Fj,k.b,a.JJ,a.u,l.O5,gt.C,Ye.s,j.p],styles:[""]}),n})();var Rn=p(86969);let ft=(()=>{class n{constructor(t){this.router=t}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(m.F0))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi-tabs"]],decls:8,vars:1,consts:function(){let s,t;return s="Overview",t="Targets",[["ngbNav","",1,"nav-tabs",3,"activeId","navChange"],["nav","ngbNav"],["ngbNavItem","/block/iscsi/overview"],["ngbNavLink",""],s,["ngbNavItem","/block/iscsi/targets"],t]},template:function(t,o){1&t&&(e.TgZ(0,"ul",0,1),e.NdJ("navChange",function(_){return o.router.navigate([_.nextId])}),e.TgZ(2,"li",2),e.TgZ(3,"a",3),e.SDv(4,4),e.qZA(),e.qZA(),e.TgZ(5,"li",5),e.TgZ(6,"a",3),e.SDv(7,6),e.qZA(),e.qZA(),e.qZA()),2&t&&e.Q6J("activeId",o.router.url)},directives:[N.Pz,N.nv,N.Vx],styles:[""]}),n})();var Ct=p(34501),Mn=p(30490),Ee=p(94928),On=p(68962);const An=["highlightTpl"],hn=["detailTable"],Pn=["tree"],In=function(){return["logged_in"]},bn=function(){return["logged_out"]},Nn=function(n,s){return{"badge-success":n,"badge-danger":s}};function Fn(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,Nn,e.DdM(5,In).includes(t.data.status),e.DdM(6,bn).includes(t.data.status))),e.xp6(1),e.hij(" ",t.data.status," ")}}function Dn(n,s){if(1&n&&(e.TgZ(0,"div",9),e.TgZ(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 vn(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 Ln(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 $n(n,s){if(1&n&&(e.YNc(0,vn,2,1,"span",12),e.YNc(1,Ln,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 Zn=(()=>{class n{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)}}}}set content(t){this.detailTable=t,t&&t.updateColumns()}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=S().cloneDeep(this.selectedItem.target_controls);this.cephIscsiConfigVersion>10&&S().extend(t,S().cloneDeep(this.selectedItem.auth)),this.metadata={root:t};const o={target:{expanded:S().join(this.selectedItem.cdExecuting?[T.P.large,T.P.spinner,T.P.spin]:[T.P.large,T.P.bullseye]," ")},initiators:{expanded:S().join([T.P.large,T.P.user]," "),leaf:S().join([T.P.user]," ")},groups:{expanded:S().join([T.P.large,T.P.users]," "),leaf:S().join([T.P.users]," ")},disks:{expanded:S().join([T.P.large,T.P.disk]," "),leaf:S().join([T.P.disk]," ")},portals:{expanded:S().join([T.P.large,T.P.server]," "),leaf:S().join([T.P.server]," ")}},i=[];S().forEach(this.selectedItem.disks,d=>{const g="disk_"+d.pool+"_"+d.image;this.metadata[g]={controls:d.controls,backstore:d.backstore},["wwn","lun"].forEach(f=>{f in d&&(this.metadata[g][f]=d[f])}),i.push({name:`${d.pool}/${d.image}`,cdId:g,cdIcon:o.disks.leaf})});const _=[];S().forEach(this.selectedItem.portals,d=>{_.push({name:`${d.host}:${d.ip}`,cdIcon:o.portals.leaf})});const r=[];S().forEach(this.selectedItem.clients,d=>{const g=S().cloneDeep(d.auth);d.info&&(S().extend(g,d.info),delete g.state,S().forEach(Object.keys(d.info.state),P=>{g[P.toLowerCase()]=d.info.state[P]})),this.metadata["client_"+d.client_iqn]=g;const f=[];d.luns.forEach(P=>{f.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"),r.push({name:d.client_iqn,status:I,cdId:"client_"+d.client_iqn,children:f,cdIcon:o.initiators.leaf})});const c=[];S().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 f=[];d.members.forEach(I=>{f.push({name:I,cdId:"client_"+I})}),c.push({name:d.group_id,cdIcon:o.groups.leaf,children:[{name:"Disks",children:g,cdIcon:o.disks.expanded},{name:"Initiators",children:f,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:r,cdIcon:o.initiators.expanded},{name:"Groups",isExpanded:!0,children:c,cdIcon:o.groups.expanded}]}]}format(t){return"boolean"==typeof t?this.booleanTextPipe.transform(t):t}onNodeSelected(t,o){var i,_,r,c;if(ne.iM.ACTIVATE(t,o,!0),o.data.cdId){this.title=o.data.name;const d=this.metadata[o.data.cdId]||{};"root"===o.data.cdId?(null===(i=this.detailTable)||void 0===i||i.toggleColumn({prop:"default",isHidden:!0}),this.data=S().map(this.settings.target_default_controls,(g,f)=>({displayName:f,default:g=this.format(g),current:S().isUndefined(d[f])?g:this.format(d[f])})),this.cephIscsiConfigVersion>10&&["user","password","mutual_user","mutual_password"].forEach(g=>{this.data.push({displayName:g,default:null,current:d[g]})})):o.data.cdId.toString().startsWith("disk_")?(null===(_=this.detailTable)||void 0===_||_.toggleColumn({prop:"default",isHidden:!0}),this.data=S().map(this.settings.disk_default_controls[d.backstore],(g,f)=>({displayName:f,default:g=this.format(g),current:S().isUndefined(d.controls[f])?g:this.format(d.controls[f])})),this.data.push({displayName:"backstore",default:this.iscsiBackstorePipe.transform(this.settings.default_backstore),current:this.iscsiBackstorePipe.transform(d.backstore)}),["wwn","lun"].forEach(g=>{g in d&&this.data.push({displayName:g,default:void 0,current:d[g]})})):(null===(r=this.detailTable)||void 0===r||r.toggleColumn({prop:"default",isHidden:!1}),this.data=S().map(d,(g,f)=>({displayName:f,default:void 0,current:this.format(g)})))}else this.data=void 0;null===(c=this.detailTable)||void 0===c||c.updateColumns()}onUpdateData(){this.tree.treeModel.expandAll()}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(Je.V),e.Y36(On.T))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi-target-details"]],viewQuery:function(t,o){if(1&t&&(e.Gf(An,7),e.Gf(hn,5),e.Gf(Pn,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),e.TgZ(1,"div",1),e.TgZ(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,Fn,6,10,"ng-template",null,5,e.W1O),e.qZA(),e.qZA(),e.YNc(8,Dn,5,4,"div",6),e.qZA(),e.YNc(9,$n,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))},directives:[ne.qr,l.O5,l.mk,W.a],styles:[""]}),n})();function Bn(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 Gn(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,Bn,6,1,"ng-container",5),e.qZA()),2&n){const t=e.oxw();e.xp6(4),e.Q6J("ngIf",t.status)}}function yn(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 xn=function(n){return[n]};function wn(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"cd-table",7,8),e.NdJ("fetchData",function(){return e.CHM(t),e.oxw().getTargets()})("setExpandedRow",function(i){return e.CHM(t),e.oxw().setExpandedRow(i)})("updateSelection",function(i){return e.CHM(t),e.oxw().updateSelection(i)}),e.TgZ(2,"div",9),e._UZ(3,"cd-table-actions",10),e.TgZ(4,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw().configureDiscoveryAuth()}),e._UZ(5,"i",12),e.ynx(6),e.SDv(7,13),e.BQk(),e.qZA(),e.qZA(),e.YNc(8,yn,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,xn,t.icons.key)),e.xp6(3),e.Q6J("ngIf",t.expandedRow)}}let qn=(()=>{class n extends mt.o{constructor(t,o,i,_,r,c,d,g,f){super(f),this.authStorageService=t,this.iscsiService=o,this.joinPipe=i,this.taskListService=_,this.notAvailablePipe=r,this.modalService=c,this.taskWrapper=d,this.actionLabels=g,this.ngZone=f,this.available=void 0,this.selection=new Se.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:De.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&&(null==t?void 0:t.cdExecuting)?t.cdExecuting:t&&S().isUndefined(null==t?void 0:t.info)?"Unavailable gateway(s)":!t}getDeleteDisableDesc(){var t;const o=this.selection.first();return(null==o?void 0:o.cdExecuting)?o.cdExecuting:o&&S().isUndefined(null==o?void 0:o.info)?"Unavailable gateway(s)":o&&(null===(t=null==o?void 0:o.info)||void 0===t?void 0:t.num_sessions)?"Target has active sessions":!o}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(pe.M,{itemDescription:"iSCSI target",itemNames:[t],submitActionObservable:()=>this.taskWrapper.wrapTaskAroundCall({task:new R.R("iscsi/target/delete",{target_iqn:t}),call:this.iscsiService.deleteTarget(t)})})}configureDiscoveryAuth(){this.modalService.show(En)}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(X),e.Y36(Rn.A),e.Y36(ce.j),e.Y36(Tt.g),e.Y36(de.Z),e.Y36(u.P),e.Y36(v.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([ce.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,Gn,5,1,"cd-alert-panel",0),e.YNc(2,wn,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))},directives:[ft,l.O5,Ct.G,Mn.K,W.a,Ee.K,$.o,l.mk,Zn],styles:[""]}),n})();var ot=p(66369),Hn=p(76446),kn=p(90068);const Kn=["iscsiSparklineTpl"],Xn=["iscsiPerSecondTpl"],Qn=["iscsiRelativeDateTpl"];function zn(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 Jn(n,s){1&n&&(e.TgZ(0,"span",10),e._uU(1," n/a "),e.qZA())}function Yn(n,s){if(1&n&&(e.YNc(0,zn,2,2,"span",7),e.YNc(1,Jn,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 Vn(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 Un(n,s){1&n&&(e.TgZ(0,"span",10),e._uU(1," n/a "),e.qZA())}function jn(n,s){if(1&n&&(e.YNc(0,Vn,2,1,"span",7),e.YNc(1,Un,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 Wn(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 ei(n,s){1&n&&(e.TgZ(0,"span",10),e._uU(1," n/a "),e.qZA())}function ti(n,s){if(1&n&&(e.YNc(0,Wn,4,5,"span",7),e.YNc(1,ei,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 oi=(()=>{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:De.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(ot.n),e.Y36(Je.V))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-iscsi"]],viewQuery:function(t,o){if(1&t&&(e.Gf(Kn,7),e.Gf(Xn,7),e.Gf(Qn,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:13,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,"cd-table",1),e.NdJ("fetchData",function(){return o.refresh()}),e.qZA(),e.TgZ(4,"legend"),e.SDv(5,2),e.qZA(),e._UZ(6,"cd-table",3),e.YNc(7,Yn,2,2,"ng-template",null,4,e.W1O),e.YNc(9,jn,2,2,"ng-template",null,5,e.W1O),e.YNc(11,ti,2,2,"ng-template",null,6,e.W1O)),2&t&&(e.xp6(3),e.Q6J("data",o.gateways)("columns",o.gatewaysColumns),e.xp6(3),e.Q6J("data",o.images)("columns",o.imagesColumns))},directives:[ft,W.a,l.O5,Hn.l],pipes:[Tt.g,kn.h],styles:[""]}),n})(),ni=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=e.oAB({type:n}),n.\u0275inj=e.cJS({imports:[[l.ez,Ae.m,N.Oz,m.Bz,a.u5,a.UX,N.ZQ]]}),n})();var ii=p(75319),si=p(26215),_i=p(45435),St=p(46947);let K=class{constructor(s,t){this.http=s,this.timerService=t,this.REFRESH_INTERVAL=3e4,this.summaryDataSource=new si.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,_i.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}`)}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"})}};K.\u0275fac=function(s){return new(s||K)(e.LFG(ie.eN),e.LFG(St.f))},K.\u0275prov=e.Yz7({token:K,factory:K.\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)],K.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)],K.prototype,"importBootstrapToken",null),K=(0,D.gn)([V.o,(0,D.w6)("design:paramtypes",[ie.eN,St.f])],K);var nt=p(58071),ai=p(68307),Et=p(12627),Re=p(82945),ri=p(39749),li=p(13472);function ci(n,s){1&n&&(e.TgZ(0,"span",25),e.SDv(1,26),e.qZA())}function di(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(),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 pi(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 x.d({siteName:new a.NI("",{validators:[a.kI.required]}),pools:new a.cw({},{validators:[this.validatePools()]}),token:new a.NI("",{})})}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((_,r)=>(_.push({name:r.name,mirror_mode:r.mirror_mode}),_),[]);const i=this.createBootstrapForm.get("pools");S().each(this.pools,_=>{const r=_.name,c="disabled"===_.mirror_mode,d=i.controls[r];d?c&&d.disabled?d.enable():!c&&d.enabled&&(d.disable(),d.setValue(!0)):i.addControl(r,new a.NI({value:!c,disabled:!c}))})})}ngOnDestroy(){this.subs&&this.subs.unsubscribe()}validatePools(){return t=>{let o=0;return S().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");S().each(i.controls,(g,f)=>{!0===g.value&&(t=f,g.disabled||o.push(f))});const _={mirror_mode:"image"},r=(0,nt.z)(this.rbdMirroringService.setSiteName(this.createBootstrapForm.getValue("siteName")),(0,le.D)(o.map(g=>this.rbdMirroringService.updatePool(g,_))),this.rbdMirroringService.createBootstrapToken(t).pipe((0,ai.b)(g=>this.createBootstrapForm.get("token").setValue(g.token)))).pipe((0,Et.Z)()),c=()=>{this.rbdMirroringService.refresh(),this.createBootstrapForm.setErrors({cdSubmitButton:!0})};this.taskWrapper.wrapTaskAroundCall({task:new R.R("rbd/mirroring/bootstrap/create",{}),call:r}).subscribe({error:c,complete:c})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(N.Kz),e.Y36(K),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,_,r,c,d,g,f,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",r="Generate",c="Token",d="Generated token...",g="Close",f="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-right",3,"form","submitAction"],r,["for","token",1,"col-form-label"],c,["placeholder",d,"id","token","formControlName","token","readonly","",1,"form-control","resize-vertical"],["source","token",1,"float-right"],[1,"modal-footer"],["name",g,3,"backAction"],[1,"invalid-feedback"],f,[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),e.TgZ(6,"div",6),e.TgZ(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),e.TgZ(12,"label",9),e.SDv(13,10),e.qZA(),e._UZ(14,"input",11),e.YNc(15,ci,2,0,"span",12),e.qZA(),e.TgZ(16,"div",13),e.TgZ(17,"label",14),e.SDv(18,15),e.qZA(),e.YNc(19,di,4,5,"div",16),e.YNc(20,pi,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),e.TgZ(24,"label",19),e.TgZ(25,"span"),e.SDv(26,20),e.qZA(),e.qZA(),e.TgZ(27,"textarea",21),e._uU(28," "),e.qZA(),e.qZA(),e._UZ(29,"cd-copy-2-clipboard-button",22),e.qZA(),e.TgZ(30,"div",23),e.TgZ(31,"cd-back-button",24),e.NdJ("backAction",function(){return o.activeModal.close()}),e.qZA(),e.qZA(),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)}},directives:[C.z,a._Y,a.JL,h.V,a.sg,O.P,$.o,a.Fj,k.b,a.JJ,a.u,Re.U,l.O5,a.x0,l.sg,ri.w,Ye.s,li.W,a.Wl],styles:[".form-group.ng-invalid[_ngcontent-%COMP%] .invalid-feedback[_ngcontent-%COMP%]{display:block}"]}),n})();function ui(n,s){1&n&&(e.TgZ(0,"span",26),e.SDv(1,27),e.qZA())}function mi(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 Ti(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(),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 fi(n,s){1&n&&(e.TgZ(0,"span",26),e.SDv(1,32),e.qZA())}function Ci(n,s){1&n&&(e.TgZ(0,"span",26),e.SDv(1,33),e.qZA())}function Si(n,s){1&n&&(e.TgZ(0,"span",26),e.SDv(1,34),e.qZA())}let Ei=(()=>{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 x.d({siteName:new a.NI("",{validators:[a.kI.required]}),direction:new a.NI("rx-tx",{}),pools:new a.cw({},{validators:[this.validatePools()]}),token:new a.NI("",{validators:[a.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((_,r)=>(_.push({name:r.name,mirror_mode:r.mirror_mode}),_),[]);const i=this.importBootstrapForm.get("pools");S().each(this.pools,_=>{const r=_.name,c="disabled"===_.mirror_mode,d=i.controls[r];d?c&&d.disabled?d.enable():!c&&d.enabled&&(d.disable(),d.setValue(!0)):i.addControl(r,new a.NI({value:!c,disabled:!c}))})})}ngOnDestroy(){this.subs&&this.subs.unsubscribe()}validatePools(){return t=>{let o=0;return S().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(o){}return{invalidToken:!0}}}import(){const t=[],o=[],i=this.importBootstrapForm.get("pools");S().each(i.controls,(g,f)=>{!0===g.value&&(t.push(f),g.disabled||o.push(f))});const _={mirror_mode:"image"};let r=(0,nt.z)(this.rbdMirroringService.setSiteName(this.importBootstrapForm.getValue("siteName")),(0,le.D)(o.map(g=>this.rbdMirroringService.updatePool(g,_))));r=t.reduce((g,f)=>(0,nt.z)(g,this.rbdMirroringService.importBootstrapToken(f,this.importBootstrapForm.getValue("direction"),this.importBootstrapForm.getValue("token"))),r).pipe((0,Et.Z)());const c=()=>{this.rbdMirroringService.refresh(),this.importBootstrapForm.setErrors({cdSubmitButton:!0})};this.taskWrapper.wrapTaskAroundCall({task:new R.R("rbd/mirroring/bootstrap/import",{}),call:r}).subscribe({error:c,complete:()=>{c(),this.activeModal.close()}})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(N.Kz),e.Y36(v.p4),e.Y36(K),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,_,r,c,d,g,f,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",r="Pools",c="Token",d="Generated token...",g="This field is required.",f="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"],r,["class","custom-control custom-checkbox",4,"ngFor","ngForOf"],["for","token",1,"col-form-label","required"],c,["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"],f,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),e.TgZ(6,"div",6),e.TgZ(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),e.TgZ(12,"label",9),e.SDv(13,10),e.qZA(),e._UZ(14,"input",11),e.YNc(15,ui,2,0,"span",12),e.qZA(),e.TgZ(16,"div",8),e.TgZ(17,"label",13),e.TgZ(18,"span"),e.SDv(19,14),e.qZA(),e.qZA(),e.TgZ(20,"select",15),e.YNc(21,mi,2,2,"option",16),e.qZA(),e.qZA(),e.TgZ(22,"div",17),e.TgZ(23,"label",18),e.SDv(24,19),e.qZA(),e.YNc(25,Ti,4,5,"div",20),e.YNc(26,fi,2,0,"span",12),e.qZA(),e.TgZ(27,"div",8),e.TgZ(28,"label",21),e.SDv(29,22),e.qZA(),e.TgZ(30,"textarea",23),e._uU(31," "),e.qZA(),e.YNc(32,Ci,2,0,"span",12),e.YNc(33,Si,2,0,"span",12),e.qZA(),e.qZA(),e.TgZ(34,"div",24),e.TgZ(35,"cd-form-button-panel",25),e.NdJ("submitActionEvent",function(){return o.import()}),e.qZA(),e.qZA(),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)}},directives:[C.z,a._Y,a.JL,h.V,a.sg,O.P,$.o,a.Fj,k.b,a.JJ,a.u,Re.U,l.O5,a.EJ,l.sg,a.x0,j.p,a.YN,a.Kr,a.Wl],styles:[""]}),n})();var se=p(69158),Ri=p(58111);let it=(()=>{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 Mi=["healthTmpl"];function Oi(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 Ai=(()=>{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(K),e.Y36(Ri.F))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-mirroring-daemons"]],viewQuery:function(t,o){if(1&t&&e.Gf(Mi,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,Oi,3,4,"ng-template",null,1,e.W1O)),2&t&&e.Q6J("data",o.data)("columns",o.columns)("autoReload",-1)("status",o.tableStatus)},directives:[W.a,l.mk],pipes:[it],styles:[""]}),n})();var Rt=p(18891);class hi{}function Pi(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,25),e.qZA())}function Ii(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,26),e.qZA())}function bi(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,27),e.qZA())}function Ni(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,28),e.qZA())}function Fi(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,29),e.qZA())}function Di(n,s){1&n&&(e.TgZ(0,"span",24),e.SDv(1,30),e.qZA())}let vi=(()=>{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 x.d({clusterName:new a.NI("",{validators:[a.kI.required,this.validateClusterName]}),clientID:new a.NI("",{validators:[a.kI.required,this.validateClientID]}),monAddr:new a.NI("",{validators:[this.validateMonAddr]}),key:new a.NI("",{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(o){}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 hi;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 R.R("rbd/mirroring/peer/edit",{pool_name:this.poolName}),call:this.rbdMirroringService.updatePeer(this.poolName,this.peerUUID,t)}:{task:new R.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(N.Kz),e.Y36(v.p4),e.Y36(K),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,_,r,c,d,g,f,I,P,Z,B,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",r="Name...",c="CephX ID",d="CephX ID...",g="Monitor Addresses",f="Comma-delimited addresses...",I="CephX Key",P="Base64-encoded key...",Z="This field is required.",B="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",r,"id","clusterName","name","clusterName","formControlName","clusterName","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["for","clientID",1,"col-form-label","required"],c,["type","text","placeholder",d,"id","clientID","name","clientID","formControlName","clientID",1,"form-control"],["for","monAddr",1,"col-form-label"],g,["type","text","placeholder",f,"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"],Z,B,Q,Y,ee,te]},template:function(t,o){if(1&t&&(e.TgZ(0,"cd-modal",0),e.TgZ(1,"span",1),e.SDv(2,2),e.qZA(),e.ynx(3,3),e.TgZ(4,"form",4,5),e.TgZ(6,"div",6),e.TgZ(7,"p"),e.TgZ(8,"span"),e.tHW(9,7),e._UZ(10,"kbd"),e._UZ(11,"kbd"),e.N_p(),e.qZA(),e.qZA(),e.TgZ(12,"div",8),e.TgZ(13,"label",9),e.SDv(14,10),e.qZA(),e._UZ(15,"input",11),e.YNc(16,Pi,2,0,"span",12),e.YNc(17,Ii,2,0,"span",12),e.qZA(),e.TgZ(18,"div",8),e.TgZ(19,"label",13),e.SDv(20,14),e.qZA(),e._UZ(21,"input",15),e.YNc(22,bi,2,0,"span",12),e.YNc(23,Ni,2,0,"span",12),e.qZA(),e.TgZ(24,"div",8),e.TgZ(25,"label",16),e.TgZ(26,"span"),e.SDv(27,17),e.qZA(),e.qZA(),e._UZ(28,"input",18),e.YNc(29,Fi,2,0,"span",12),e.qZA(),e.TgZ(30,"div",8),e.TgZ(31,"label",19),e.TgZ(32,"span"),e.SDv(33,20),e.qZA(),e.qZA(),e._UZ(34,"input",21),e.YNc(35,Di,2,0,"span",12),e.qZA(),e.qZA(),e.TgZ(36,"div",22),e.TgZ(37,"cd-form-button-panel",23),e.NdJ("submitActionEvent",function(){return o.update()}),e.qZA(),e.qZA(),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)}},directives:[C.z,a._Y,a.JL,h.V,a.sg,O.P,$.o,a.Fj,k.b,a.JJ,a.u,Re.U,l.O5,j.p],styles:[""]}),n})();const Li=["healthTmpl"];function $i(n,s){if(1&n&&(e.TgZ(0,"span",4),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 Bi=(()=>{class n{constructor(t,o,i,_,r){this.authStorageService=t,this.rbdMirroringService=o,this.modalService=i,this.taskWrapper=_,this.router=r,this.selection=new Se.r,this.tableStatus=new se.E,this.data=[],this.permission=this.authStorageService.getPermissions().rbdMirroring;const c={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()},f={permission:"delete",icon:T.P.destroy,name:"Delete Peer",click:()=>this.deletePeersModal(),visible:()=>!!this.getPeerUUID()};this.tableActions=[c,d,g,f]}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",flexGrow:2},{prop:"image_remote_count",name:"# Remote",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:[v.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(vi,o)}deletePeersModal(){const t=this.selection.first().name,o=this.getPeerUUID();this.modalRef=this.modalService.show(pe.M,{itemDescription:"mirror peer",itemNames:[`${t} (${o})`],submitActionObservable:()=>new Rt.y(i=>{this.taskWrapper.wrapTaskAroundCall({task:new R.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(K),e.Y36(de.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(Li,7),2&t){let i;e.iGM(i=e.CRH())&&(o.healthTmpl=i.first)}},decls:5,vars:7,consts:[["columnMode","flex","identifier","name","forceIdentifier","true","selectionType","single",3,"data","columns","autoReload","status","fetchData","updateSelection"],[1,"table-actions",3,"permission","selection","tableActions"],["healthTmpl",""],["name","modal"],[3,"ngClass"]],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,$i,3,4,"ng-template",null,2,e.W1O),e._UZ(4,"router-outlet",3)),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))},directives:[W.a,Ee.K,m.lC,l.mk],pipes:[it],styles:[""]}),n})();var Mt=p(59376);const Gi=["stateTmpl"],yi=["syncTmpl"],xi=["progressTmpl"];function wi(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"cd-table",13),e.NdJ("fetchData",function(){return e.CHM(t),e.oxw().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 qi(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"cd-table",13),e.NdJ("fetchData",function(){return e.CHM(t),e.oxw().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 Hi(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"cd-table",13),e.NdJ("fetchData",function(){return e.CHM(t),e.oxw().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 ki(n,s){if(1&n&&(e.TgZ(0,"span",14),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 Ki(n,s){1&n&&e._UZ(0,"div")}function Xi(n,s){if(1&n&&e._UZ(0,"ngb-progressbar",17),2&n){const t=e.oxw().value;e.Q6J("value",t)("showValue",!0)}}function Qi(n,s){if(1&n&&(e.YNc(0,Ki,1,0,"div",15),e.YNc(1,Xi,1,2,"ngb-progressbar",16)),2&n){const t=s.row;e.Q6J("ngIf","Replaying"===t.state),e.xp6(1),e.Q6J("ngIf","Syncing"===t.state)}}let zi=(()=>{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:"progress",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",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(K))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-mirroring-images"]],viewQuery:function(t,o){if(1&t&&(e.Gf(Gi,7),e.Gf(yi,7),e.Gf(xi,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)}},decls:19,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",""],["columnMode","flex",3,"data","columns","autoReload","status","fetchData"],[3,"ngClass"],[4,"ngIf"],["type","info",3,"value","showValue",4,"ngIf"],["type","info",3,"value","showValue"]]},template:function(t,o){if(1&t&&(e.TgZ(0,"ul",0,1),e.TgZ(2,"li",2),e.TgZ(3,"a",3),e.SDv(4,4),e.qZA(),e.YNc(5,wi,1,4,"ng-template",5),e.qZA(),e.TgZ(6,"li",6),e.TgZ(7,"a",3),e.SDv(8,7),e.qZA(),e.YNc(9,qi,1,4,"ng-template",5),e.qZA(),e.TgZ(10,"li",8),e.TgZ(11,"a",3),e.SDv(12,9),e.qZA(),e.YNc(13,Hi,1,4,"ng-template",5),e.qZA(),e.qZA(),e._UZ(14,"div",10),e.YNc(15,ki,3,4,"ng-template",null,11,e.W1O),e.YNc(17,Qi,2,2,"ng-template",null,12,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)}},directives:[N.Pz,Mt.m,N.nv,N.Vx,N.uN,N.tO,W.a,l.mk,l.O5,N.Ly],pipes:[it],styles:[""]}),n})();function Ji(n,s){if(1&n&&e._UZ(0,"i",18),2&n){const t=e.oxw();e.Q6J("ngClass",t.icons.edit)}}function Yi(n,s){if(1&n&&e._UZ(0,"i",18),2&n){const t=e.oxw();e.Q6J("ngClass",t.icons.check)}}let Vi=(()=>{class n{constructor(t,o,i,_){this.authStorageService=t,this.rbdMirroringService=o,this.modalService=i,this.taskWrapper=_,this.selection=new Se.r,this.peersExist=!0,this.subs=new ii.w,this.editing=!1,this.icons=T.P,this.permission=this.authStorageService.getPermissions().rbdMirroring;const r={permission:"update",icon:T.P.upload,click:()=>this.createBootstrapModal(),name:"Create Bootstrap Token",canBePrimary:()=>!0,disable:()=>!1},c={permission:"update",icon:T.P.download,click:()=>this.importBootstrapModal(),name:"Import Bootstrap Token",disable:()=>this.peersExist};this.tableActions=[r,c]}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 x.d({siteName:new a.NI({value:"",disabled:!0})})}ngOnDestroy(){this.subs.unsubscribe()}updateSiteName(){this.editing&&this.taskWrapper.wrapTaskAroundCall({task:new R.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(Ei,{siteName:this.siteName})}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(K),e.Y36(de.Z),e.Y36(u.P))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-mirroring"]],decls:29,vars:9,consts:function(){let s,t,o,i;return s="Site Name",t="Daemons",o="Pools",i="Images",[[1,"row"],[1,"col-md-12"],["name","rbdmirroringForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"d-flex","flex-row"],["for","siteName",1,"col-form-label"],s,[1,"col-md-4","input-group","mb-3","mr-auto"],["type","text","id","siteName","name","siteName","formControlName","siteName",1,"form-control"],[1,"input-group-append"],["id","editSiteName",1,"btn","btn-light",3,"click"],[3,"ngClass",4,"ngIf"],[3,"source","byId"],[1,"table-actions",3,"permission","selection","tableActions"],[1,"col-sm-6"],t,o,i,[3,"ngClass"]]},template:function(t,o){1&t&&(e.TgZ(0,"div",0),e.TgZ(1,"div",1),e.TgZ(2,"form",2,3),e.TgZ(4,"div",4),e.TgZ(5,"label",5),e.SDv(6,6),e.qZA(),e.TgZ(7,"div",7),e._UZ(8,"input",8),e.TgZ(9,"div",9),e.TgZ(10,"button",10),e.NdJ("click",function(){return o.updateSiteName()}),e.YNc(11,Ji,1,1,"i",11),e.YNc(12,Yi,1,1,"i",11),e.qZA(),e._UZ(13,"cd-copy-2-clipboard-button",12),e.qZA(),e.qZA(),e._UZ(14,"cd-table-actions",13),e.qZA(),e.qZA(),e.qZA(),e.qZA(),e.TgZ(15,"div",0),e.TgZ(16,"div",14),e.TgZ(17,"legend"),e.SDv(18,15),e.qZA(),e._UZ(19,"cd-mirroring-daemons"),e.qZA(),e.TgZ(20,"div",14),e.TgZ(21,"legend"),e.SDv(22,16),e.qZA(),e._UZ(23,"cd-mirroring-pools"),e.qZA(),e.qZA(),e.TgZ(24,"div",0),e.TgZ(25,"div",1),e.TgZ(26,"legend"),e.SDv(27,17),e.qZA(),e._UZ(28,"cd-mirroring-images"),e.qZA(),e.qZA()),2&t&&(e.xp6(2),e.Q6J("formGroup",o.rbdmirroringForm),e.xp6(6),e.uIk("disabled",!o.editing||null),e.xp6(3),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(1),e.Q6J("permission",o.permission)("selection",o.selection)("tableActions",o.tableActions))},directives:[a._Y,a.JL,h.V,a.sg,$.o,a.Fj,k.b,a.JJ,a.u,l.O5,Ye.s,Ee.K,Ai,Bi,zi,l.mk],styles:[""]}),n})();class Ui{}function ji(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 Wi(n,s){1&n&&(e.TgZ(0,"span",17),e.SDv(1,18),e.qZA())}let es=(()=>{class n{constructor(t,o,i,_,r,c){this.activeModal=t,this.actionLabels=o,this.rbdMirroringService=i,this.taskWrapper=_,this.route=r,this.location=c,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 x.d({mirrorMode:new a.NI("",{validators:[a.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 Ui;t.mirror_mode=this.editModeForm.getValue("mirrorMode"),this.taskWrapper.wrapTaskAroundCall({task:new R.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(N.Kz),e.Y36(v.p4),e.Y36(K),e.Y36(u.P),e.Y36(m.gz),e.Y36(l.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-control"],[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),e.TgZ(6,"div",6),e.TgZ(7,"p"),e.ynx(8),e.tHW(9,7),e._UZ(10,"kbd"),e._UZ(11,"kbd"),e.N_p(),e.BQk(),e.qZA(),e.TgZ(12,"div",8),e.TgZ(13,"label",9),e.TgZ(14,"span"),e.SDv(15,10),e.qZA(),e.qZA(),e.TgZ(16,"select",11),e.YNc(17,ji,2,2,"option",12),e.qZA(),e.YNc(18,Wi,2,0,"span",13),e.qZA(),e.qZA(),e.TgZ(19,"div",14),e.TgZ(20,"cd-form-button-panel",15),e.NdJ("submitActionEvent",function(){return o.update()}),e.qZA(),e.qZA(),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)}},directives:[C.z,a._Y,a.JL,h.V,a.sg,O.P,$.o,a.EJ,k.b,a.JJ,a.u,l.sg,l.O5,j.p,a.YN,a.Kr],styles:[""]}),n})();var Ot=p(80226),ts=p(28049),os=p(43190),Ve=p(80842),st=p(30633),Le=p(47557),ns=p(28211);class is{}var Pe=(()=>{return(n=Pe||(Pe={}))[n.V1=1]="V1",n[n.V2=2]="V2",Pe;var n})();class ss{constructor(){this.features=[]}}class _s{constructor(){this.features=[]}}class rs extends class{}{constructor(){super(...arguments),this.features=[]}}class _t{constructor(){this.features=[],this.remove_scheduling=!1}}var Ue=(()=>{return(n=Ue||(Ue={})).editing="editing",n.cloning="cloning",n.copying="copying",Ue;var n})(),ls=p(17932),cs=p(18372),ds=p(54555);function ps(n,s){if(1&n&&(e.TgZ(0,"div",9),e.TgZ(1,"label",58),e.SDv(2,59),e.ALo(3,"titlecase"),e.qZA(),e.TgZ(4,"div",12),e._UZ(5,"input",60),e._UZ(6,"hr"),e.qZA(),e.qZA()),2&n){const t=e.oxw(2);e.xp6(3),e.pQV(e.lcZ(3,1,t.action)),e.QtT(2)}}function gs(n,s){1&n&&(e.TgZ(0,"span",61),e.ynx(1),e.SDv(2,62),e.BQk(),e.qZA())}function us(n,s){1&n&&(e.TgZ(0,"span",61),e.ynx(1),e.SDv(2,63),e.BQk(),e.qZA())}function ms(n,s){1&n&&e._UZ(0,"input",64)}function Ts(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,67),e.qZA()),2&n&&e.Q6J("ngValue",null)}function fs(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,68),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Cs(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,69),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Ss(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 Es(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"select",65),e.NdJ("change",function(){return e.CHM(t),e.oxw(2).setPoolMirrorMode()}),e.YNc(1,Ts,2,1,"option",66),e.YNc(2,fs,2,1,"option",66),e.YNc(3,Cs,2,1,"option",66),e.YNc(4,Ss,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 Rs(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,71),e.qZA())}const Ms=function(n,s){return[n,s]};function Os(n,s){if(1&n&&(e.TgZ(0,"div",9),e.TgZ(1,"div",20),e._UZ(2,"i",72),e.qZA(),e.qZA()),2&n){const t=e.oxw(2);e.xp6(2),e.Q6J("ngClass",e.WLB(1,Ms,t.icons.spinner,t.icons.spin))}}function As(n,s){1&n&&e._UZ(0,"input",76)}function hs(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,78),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Ps(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,79),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Is(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,80),e.qZA()),2&n&&e.Q6J("ngValue",null)}function bs(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 Ns(n,s){if(1&n&&(e.TgZ(0,"select",77),e.YNc(1,hs,2,1,"option",66),e.YNc(2,Ps,2,1,"option",66),e.YNc(3,Is,2,1,"option",66),e.YNc(4,bs,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 Fs(n,s){if(1&n&&(e.TgZ(0,"div",9),e.TgZ(1,"label",73),e._uU(2," Namespace "),e.qZA(),e.TgZ(3,"div",12),e.YNc(4,As,1,0,"input",74),e.YNc(5,Ns,5,4,"select",75),e.qZA(),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 Ds(n,s){1&n&&(e.TgZ(0,"cd-helper"),e.TgZ(1,"span"),e.SDv(2,81),e.qZA(),e.qZA())}function vs(n,s){1&n&&e._UZ(0,"input",87)}function Ls(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,89),e.qZA()),2&n&&e.Q6J("ngValue",null)}function $s(n,s){1&n&&(e.TgZ(0,"option",50),e.SDv(1,90),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Zs(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 Bs(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 Gs(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"select",88),e.NdJ("change",function(i){return e.CHM(t),e.oxw(3).onDataPoolChange(i.target.value)}),e.YNc(1,Ls,2,1,"option",66),e.YNc(2,$s,2,1,"option",66),e.YNc(3,Zs,2,1,"option",66),e.YNc(4,Bs,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 ys(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,91),e.qZA())}const je=function(n){return{required:n}};function xs(n,s){if(1&n&&(e.TgZ(0,"div",9),e.TgZ(1,"label",82),e.TgZ(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,vs,1,0,"input",85),e.YNc(7,Gs,5,4,"select",86),e.YNc(8,ys,2,0,"span",14),e.qZA(),e.qZA()),2&n){e.oxw();const t=e.MAs(2),o=e.oxw();e.xp6(2),e.Q6J("ngClass",e.VKq(4,je,"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 ws(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,92),e.qZA())}function qs(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,93),e.qZA())}function Hs(n,s){if(1&n&&e._UZ(0,"cd-helper",97),2&n){const t=e.oxw().$implicit;e.s9C("html",t.helperHtml)}}function ks(n,s){if(1&n&&(e.TgZ(0,"div",21),e._UZ(1,"input",94),e.TgZ(2,"label",95),e._uU(3),e.qZA(),e.YNc(4,Hs,1,1,"cd-helper",96),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 At=function(n){return["edit",n]},ht=function(n){return{modal:n}},Pt=function(n){return{outlets:n}},It=function(n){return["/block/mirroring",n]};function Ks(n,s){if(1&n&&(e.TgZ(0,"cd-helper"),e.TgZ(1,"span"),e.tHW(2,98),e._UZ(3,"b"),e._UZ(4,"a",99),e.N_p(),e.qZA(),e.qZA()),2&n){const t=e.oxw(2);e.xp6(4),e.Q6J("routerLink",e.VKq(7,It,e.VKq(5,Pt,e.VKq(3,ht,e.VKq(1,At,t.currentPoolName)))))}}function Xs(n,s){if(1&n&&(e.TgZ(0,"cd-helper"),e.TgZ(1,"span"),e.tHW(2,103),e._UZ(3,"b"),e._UZ(4,"a",99),e.N_p(),e.qZA(),e.qZA()),2&n){const t=e.oxw(4);e.xp6(4),e.Q6J("routerLink",e.VKq(7,It,e.VKq(5,Pt,e.VKq(3,ht,e.VKq(1,At,t.currentPoolName)))))}}function Qs(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",101),e.TgZ(1,"input",102),e.NdJ("change",function(){return e.CHM(t),e.oxw(3).setExclusiveLock()}),e.qZA(),e.TgZ(2,"label",95),e._uU(3),e.ALo(4,"titlecase"),e.qZA(),e.YNc(5,Xs,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 zs(n,s){if(1&n&&(e.TgZ(0,"div"),e.YNc(1,Qs,6,8,"div",100),e.qZA()),2&n){const t=e.oxw(2);e.xp6(1),e.Q6J("ngForOf",t.mirroringOptions)}}function Js(n,s){if(1&n&&(e.TgZ(0,"div",9),e.TgZ(1,"label",104),e.tHW(2,105),e._UZ(3,"cd-helper",106),e.N_p(),e.qZA(),e.TgZ(4,"div",12),e._UZ(5,"input",107),e.qZA(),e.qZA()),2&n){const t=e.oxw(2);e.xp6(5),e.uIk("disabled",t.mode===t.rbdFormMode.editing||null)}}function Ys(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"a",108),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).advancedEnabled=!0,!1}),e.SDv(1,109),e.qZA()}}function Vs(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 Us(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 js(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,110),e.qZA())}function Ws(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,111),e.qZA())}function e_(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,112),e.qZA())}function t_(n,s){1&n&&(e.TgZ(0,"span",61),e.SDv(1,113),e.qZA())}function o_(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"div",1),e.TgZ(1,"form",2,3),e.TgZ(3,"div",4),e.TgZ(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,ps,7,3,"div",8),e.TgZ(10,"div",9),e.TgZ(11,"label",10),e.SDv(12,11),e.qZA(),e.TgZ(13,"div",12),e._UZ(14,"input",13),e.YNc(15,gs,3,0,"span",14),e.YNc(16,us,3,0,"span",14),e.qZA(),e.qZA(),e.TgZ(17,"div",15),e.NdJ("change",function(i){return e.CHM(t),e.oxw().onPoolChange(i.target.value)}),e.TgZ(18,"label",16),e.SDv(19,17),e.qZA(),e.TgZ(20,"div",12),e.YNc(21,ms,1,0,"input",18),e.YNc(22,Es,5,4,"select",19),e.YNc(23,Rs,2,0,"span",14),e.qZA(),e.qZA(),e.YNc(24,Os,3,4,"div",8),e.YNc(25,Fs,6,2,"div",8),e.TgZ(26,"div",9),e.TgZ(27,"div",20),e.TgZ(28,"div",21),e.TgZ(29,"input",22),e.NdJ("change",function(){return e.CHM(t),e.oxw().onUseDataPoolChange()}),e.qZA(),e.TgZ(30,"label",23),e.SDv(31,24),e.qZA(),e.YNc(32,Ds,3,0,"cd-helper",25),e.qZA(),e.qZA(),e.qZA(),e.YNc(33,xs,9,6,"div",8),e.TgZ(34,"div",9),e.TgZ(35,"label",26),e.SDv(36,27),e.qZA(),e.TgZ(37,"div",12),e._UZ(38,"input",28),e.YNc(39,ws,2,0,"span",14),e.YNc(40,qs,2,0,"span",14),e.qZA(),e.qZA(),e.TgZ(41,"div",29),e.TgZ(42,"label",30),e.SDv(43,31),e.qZA(),e.TgZ(44,"div",12),e.YNc(45,ks,5,6,"div",32),e.qZA(),e.qZA(),e.TgZ(46,"div",9),e.TgZ(47,"div",20),e.TgZ(48,"div",21),e.TgZ(49,"input",33),e.NdJ("change",function(){return e.CHM(t),e.oxw().setMirrorMode()}),e.qZA(),e.TgZ(50,"label",34),e._uU(51,"Mirroring"),e.qZA(),e.YNc(52,Ks,5,9,"cd-helper",25),e.qZA(),e.YNc(53,zs,2,1,"div",25),e.qZA(),e.qZA(),e.YNc(54,Js,6,1,"div",8),e.TgZ(55,"div",35),e.TgZ(56,"div",36),e.YNc(57,Ys,2,0,"a",37),e.qZA(),e.qZA(),e.TgZ(58,"div",38),e.TgZ(59,"legend",39),e.SDv(60,40),e.qZA(),e.TgZ(61,"div",41),e.TgZ(62,"h4",39),e.SDv(63,42),e.qZA(),e.TgZ(64,"div",9),e.TgZ(65,"label",43),e.tHW(66,44),e._UZ(67,"cd-helper"),e.N_p(),e.qZA(),e.TgZ(68,"div",12),e.TgZ(69,"select",45),e.YNc(70,Vs,2,2,"option",46),e.qZA(),e.qZA(),e.qZA(),e.TgZ(71,"div",9),e.TgZ(72,"label",47),e.tHW(73,48),e._UZ(74,"cd-helper"),e.N_p(),e.qZA(),e.TgZ(75,"div",12),e.TgZ(76,"select",49),e.TgZ(77,"option",50),e.SDv(78,51),e.qZA(),e.YNc(79,Us,2,2,"option",46),e.qZA(),e.YNc(80,js,2,0,"span",14),e.YNc(81,Ws,2,0,"span",14),e.qZA(),e.qZA(),e.TgZ(82,"div",9),e.TgZ(83,"label",52),e.tHW(84,53),e._UZ(85,"cd-helper"),e.N_p(),e.qZA(),e.TgZ(86,"div",12),e._UZ(87,"input",54),e.YNc(88,e_,2,0,"span",14),e.YNc(89,t_,2,0,"span",14),e.qZA(),e.qZA(),e.qZA(),e.TgZ(90,"cd-rbd-configuration-form",55),e.NdJ("changes",function(i){return e.CHM(t),e.oxw().getDirtyConfigurationValues=i}),e.qZA(),e.qZA(),e.qZA(),e.TgZ(91,"div",56),e.TgZ(92,"cd-form-button-panel",57),e.NdJ("submitActionEvent",function(){return e.CHM(t),e.oxw().submit()}),e.ALo(93,"titlecase"),e.ALo(94,"upperFirst"),e.qZA(),e.qZA(),e.qZA(),e.qZA(),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,35,o.action))(e.lcZ(7,37,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(43,je,"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(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(45,je,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(47,je,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(93,39,o.action)+" "+e.lcZ(94,41,o.resource))}}let $e=(()=>{class n extends H.E{constructor(t,o,i,_,r,c,d,g,f,I){super(),this.authStorageService=t,this.route=o,this.poolService=i,this.rbdService=_,this.formatter=r,this.taskWrapper=c,this.dimlessBinaryPipe=d,this.actionLabels=g,this.router=f,this.rbdMirroringService=I,this.namespaces=[],this.namespacesByPoolCache={},this.pools=null,this.allPools=null,this.dataPools=null,this.allDataPools=[],this.featuresList=[],this.initializeConfigData=new Ot.t(1),this.advancedEnabled=!1,this.rbdFormMode=Ue,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 Ot.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},layering:{desc:"Layering",requires:null,allowEnable:!1,allowDisable:!1},"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 S().map(t,(o,i)=>Object.assign(o,{key:i}))}createForm(){this.rbdForm=new x.d({parent:new a.NI(""),name:new a.NI("",{validators:[a.kI.required,a.kI.pattern(/^[^@/]+?$/)]}),pool:new a.NI(null,{validators:[a.kI.required]}),namespace:new a.NI(null),useDataPool:new a.NI(!1),dataPool:new a.NI(null),size:new a.NI(null,{updateOn:"blur"}),obj_size:new a.NI(this.defaultObjectSize),features:new x.d(this.featuresList.reduce((t,o)=>(t[o.key]=new a.NI({value:!1,disabled:!!o.initDisabled}),t),{})),mirroring:new a.NI(!1),schedule:new a.NI("",{validators:[a.kI.pattern(/^([0-9]+)d|([0-9]+)h|([0-9]+)m$/)]}),mirroringMode:new a.NI(this.mirroringOptions[0]),stripingUnit:new a.NI(this.defaultStripingUnit),stripingCount:new a.NI(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===Pe.V1&&(this.rbdForm.get("deep-flatten").disable(),this.rbdForm.get("layering").disable(),this.rbdForm.get("exclusive-lock").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()}setPoolMirrorMode(){var t;this.currentPoolName=this.mode===this.rbdFormMode.editing?null===(t=this.response)||void 0===t?void 0:t.pool_name:this.rbdForm.getValue("pool"),this.currentPoolName&&(this.rbdMirroringService.refresh(),this.rbdMirroringService.subscribeSummary(o=>{const i=o.content_data.pools.find(_=>_.name===this.currentPoolName);this.poolMirrorMode=i.mirror_mode,"disabled"===i.mirror_mode?(this.mirroring=!1,this.rbdForm.get("mirroring").setValue(this.mirroring),this.rbdForm.get("mirroring").disable()):this.mode!==this.rbdFormMode.editing&&(this.rbdForm.get("mirroring").enable(),this.mirroring=!0,this.rbdForm.get("mirroring").setValue(this.mirroring))})),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,S().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=L.N.fromString(decodeURIComponent(o.image_spec));o.snap&&(this.snapName=decodeURIComponent(o.snap)),t.rbd=this.rbdService.get(i)}):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,le.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 r=null;i.value&&null==_.value&&(r={required:!0}),_.setErrors(r);const c=o.get("size"),d=o.get("obj_size"),g=t.toBytes(null!=d.value?d.value:this.defaultObjectSize),f=o.get("stripingCount"),I=null!=f.value?f.value:this.defaultStripingCount;let P=null;null===c.value?P={required:!0}:I*g>t.toBytes(c.value)&&(P={invalidSizeObject:!0}),c.setErrors(P);const Z=o.get("stripingUnit");let B=null;null===Z.value&&null!==f.value?B={required:!0}:null!==Z.value&&t.toBytes(Z.value)>g&&(B={invalidStripingUnit:!0}),Z.setErrors(B);let Q=null;return null===f.value&&null!==Z.value?Q={required:!0}:I<1&&(Q={min:!0}),f.setErrors(Q),null}}deepBoxCheck(t,o){this.getDependentChildFeatures(t).forEach(_=>{const r=this.rbdForm.get(_.key);o?r.enable({emitEvent:!1}):(r.disable({emitEvent:!1}),r.setValue(!1,{emitEvent:!1}),this.deepBoxCheck(_.key,o));const c=this.rbdForm.get("features");this.mode===this.rbdFormMode.editing&&c.get(_.key).enabled&&(-1!==this.response.features_name.indexOf(_.key)&&!_.allowDisable||-1===this.response.features_name.indexOf(_.key)&&!_.allowEnable)&&c.get(_.key).disable()})}getDependentChildFeatures(t){return S().filter(this.features,o=>o.requires===t)||[]}interlockCheck(t,o){const i=this.featuresList.find(_=>_.key===t);if(this.response){const _=null!=i.interlockedWith,r=this.featuresList.find(d=>d.interlockedWith===i.key),c=!!this.response.features_name.find(d=>d===i.key);if(_){if(c!==!!this.response.features_name.find(g=>g===i.interlockedWith))return}else if(r&&!!this.response.features_name.find(g=>g===r.key)!==c)return}o?S().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");S().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 L.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"===(null==t?void 0:t.mirror_mode)||t.features_name.includes("journaling")?(this.mirroring=!0,this.rbdForm.get("mirroring").setValue(this.mirroring),this.rbdForm.get("mirroringMode").setValue(null==t?void 0:t.mirror_mode),this.rbdForm.get("schedule").setValue(null==t?void 0: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:st.h.image})}createRequest(){const t=new rs;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")),S().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 R.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 _t;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")),S().forIn(this.features,o=>{this.rbdForm.getValue(o.key)&&t.features.push(o.key)}),t.enable_mirror=this.rbdForm.getValue("mirroring"),"image"===this.poolMirrorMode)t.enable_mirror&&(t.mirror_mode=this.rbdForm.getValue("mirroringMode"));else if(t.enable_mirror)t.features.push("journaling");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 ss;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,st.h.image),t}editAction(){const t=new L.N(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new R.R("rbd/edit",{image_spec:t.toString()}),call:this.rbdService.update(t,this.editRequest())})}cloneAction(){const t=this.cloneRequest(),o=new L.N(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new R.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 _s;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,st.h.image),t}copyAction(){const t=this.copyRequest(),o=new L.N(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new R.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,ts.P)(),(0,os.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(q),e.Y36(ns.H),e.Y36(u.P),e.Y36(Le.$),e.Y36(v.p4),e.Y36(m.F0),e.Y36(K))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-form"]],features:[e.qOj],decls:1,vars:1,consts:function(){let s,t,o,i,_,r,c,d,g,f,I,P,Z,B,Q,Y,ee,te,w,_e,ae,M,ge,ue,me,Te,fe,Ce,G,Be,Ge,ye,xe,we,qe,He,ke,Ke,Xe,Qe,ze;return s="" + "\ufffd0\ufffd" + " " + "\ufffd1\ufffd" + "",t="Name",o="Pool",i="Use a dedicated data pool",_="Size",r="e.g., 10GiB",c="Features",d="Advanced",g="Striping",f="Object size" + "\ufffd#67\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/#67\ufffd" + "",I="Stripe unit" + "\ufffd#74\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/#74\ufffd" + "",P="-- Select stripe unit --",Z="Stripe count" + "\ufffd#85\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/#85\ufffd" + "",B="" + "\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...",M="-- No namespaces available --",ge="-- Select a namespace --",ue="You need more than one pool with the rbd application label use to use a dedicated data pool.",me="Data pool",Te="Dedicated pool that stores the object-data of the RBD.",fe="Loading...",Ce="-- No data pools available --",G="This field is required.",Be="This field is required.",Ge="You have to increase the size.",ye="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" + "",xe="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.",qe="Schedule Interval " + "\ufffd#3\ufffd" + "" + "\ufffd/#3\ufffd" + "",He="e.g., 12h or 1d or 10m",ke="Advanced...",Ke="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-control","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",r,"defaultUnit","GiB","cdDimlessBinary","",1,"form-control"],["formGroupName","features",1,"form-group","row"],["for","features",1,"cd-col-form-label"],c,["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-right 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"],f,["id","obj_size","name","obj_size","formControlName","obj_size",1,"form-control"],[3,"value",4,"ngFor","ngForOf"],["for","stripingUnit",1,"cd-col-form-label",3,"ngClass"],I,["id","stripingUnit","name","stripingUnit","formControlName","stripingUnit",1,"form-control"],[3,"ngValue"],P,["for","stripingCount",1,"cd-col-form-label",3,"ngClass"],Z,["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"],B,["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-control",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-control","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-control"],ae,M,ge,ue,["for","dataPool",1,"cd-col-form-label"],me,["html",Te],["class","form-control","type","text","placeholder","Data pool name...","id","dataPool","name","dataPool","formControlName","dataPool",4,"ngIf"],["id","dataPool","name","dataPool","class","form-control","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-control",3,"change"],fe,Ce,G,Be,Ge,["type","checkbox",1,"custom-control-input",3,"id","name","formControlName"],[1,"custom-control-label",3,"for"],[3,"html",4,"ngIf"],[3,"html"],ye,[3,"routerLink"],["class","custom-control custom-radio ml-2",4,"ngFor","ngForOf"],[1,"custom-control","custom-radio","ml-2"],["type","radio","name","mirroringMode","formControlName","mirroringMode",1,"custom-control-input",3,"id","value","change"],xe,[1,"cd-col-form-label"],qe,["html",we],["id","schedule","name","schedule","type","text","formControlName","schedule","placeholder",He,1,"form-control"],["href","",1,"float-right","margin-right-md",3,"click"],ke,Ke,Xe,Qe,ze]},template:function(t,o){1&t&&e.YNc(0,o_,95,49,"div",0),2&t&&e.Q6J("cdFormLoading",o.loading)},directives:[pt.y,a._Y,a.JL,a.sg,h.V,l.O5,O.P,$.o,a.Fj,k.b,a.JJ,a.u,Re.U,l.mk,a.Wl,ls.Q,a.x0,l.sg,cs.S,a.EJ,a.YN,a.Kr,a.wV,ds.d,j.p,m.yS,a._],pipes:[l.rS,et.m],styles:[""]}),n})();var bt=p(71225),Nt=p(36169);let n_=(()=>{class n{constructor(){}static getCount(t){var o;return Number(null===(o=t.headers)||void 0===o?void 0:o.get("X-Total-Count"))}}return n.\u0275fac=function(t){return new(t||n)},n.\u0275prov=e.Yz7({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();var at=p(51847),i_=p(16738),Me=p.n(i_),rt=p(62862),s_=p(52266);function __(n,s){1&n&&(e.TgZ(0,"div",18),e.TgZ(1,"span"),e.SDv(2,19),e.qZA(),e.qZA())}function a_(n,s){1&n&&(e.TgZ(0,"span",20),e.SDv(1,21),e.qZA())}function r_(n,s){1&n&&(e.TgZ(0,"span",20),e.SDv(1,22),e.qZA())}function l_(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 c_=(()=>{class n{constructor(t,o,i,_,r){this.rbdService=t,this.activeModal=o,this.actionLabels=i,this.fb=_,this.taskWrapper=r,this.createForm()}createForm(){this.moveForm=this.fb.group({expiresAt:["",[z.h.custom("format",t=>!(""===t||Me()(t,"YYYY-MM-DD HH:mm:ss").isValid())),z.h.custom("expired",t=>Me()().isAfter(t))]]})}ngOnInit(){this.imageSpec=new L.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=Me()(o,"YYYY-MM-DD HH:mm:ss").diff(Me()(),"seconds",!0)),t<0&&(t=0),this.taskWrapper.wrapTaskAroundCall({task:new R.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(q),e.Y36(N.Kz),e.Y36(v.p4),e.Y36(rt.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,_,r,c;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.",r="Wrong date format. Please use \"YYYY-MM-DD HH:mm:ss\".",c="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"],r,c,[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),e.TgZ(6,"div",6),e.YNc(7,__,3,0,"div",7),e.TgZ(8,"p"),e.tHW(9,8),e._UZ(10,"kbd"),e._UZ(11,"kbd"),e.N_p(),e.qZA(),e.TgZ(12,"div",9),e.TgZ(13,"label",10),e.SDv(14,11),e.qZA(),e.TgZ(15,"input",12,13),e.NdJ("click",function(){return e.CHM(i),e.MAs(16).open()})("keypress",function(){return e.CHM(i),e.MAs(16).close()}),e.qZA(),e.YNc(17,a_,2,0,"span",14),e.YNc(18,r_,2,0,"span",14),e.qZA(),e.qZA(),e.TgZ(19,"div",15),e.TgZ(20,"cd-form-button-panel",16),e.NdJ("submitActionEvent",function(){return o.moveImage()}),e.qZA(),e.qZA(),e.qZA(),e.BQk(),e.qZA(),e.YNc(21,l_,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)}},directives:[C.z,a._Y,a.JL,a.sg,h.V,l.O5,O.P,$.o,a.Fj,k.b,a.JJ,a.u,N.o8,j.p,s_.J],styles:[""]}),n})();function d_(n,s){1&n&&(e.TgZ(0,"li",10),e.TgZ(1,"a",3),e.SDv(2,11),e.qZA(),e.qZA())}let We=(()=>{class n{constructor(t,o){this.authStorageService=t,this.router=o,this.grafanaPermission=this.authStorageService.getPermissions().grafana}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(m.F0))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-tabs"]],decls:12,vars:2,consts:function(){let s,t,o,i;return s="Images",t="Namespaces",o="Trash",i="Overall Performance",[["ngbNav","",1,"nav-tabs",3,"activeId","navChange"],["nav","ngbNav"],["ngbNavItem","/block/rbd"],["ngbNavLink",""],s,["ngbNavItem","/block/rbd/namespaces"],t,["ngbNavItem","/block/rbd/trash"],o,["ngbNavItem","/block/rbd/performance",4,"ngIf"],["ngbNavItem","/block/rbd/performance"],i]},template:function(t,o){1&t&&(e.TgZ(0,"ul",0,1),e.NdJ("navChange",function(_){return o.router.navigate([_.nextId])}),e.TgZ(2,"li",2),e.TgZ(3,"a",3),e.SDv(4,4),e.qZA(),e.qZA(),e.TgZ(5,"li",5),e.TgZ(6,"a",3),e.SDv(7,6),e.qZA(),e.qZA(),e.TgZ(8,"li",7),e.TgZ(9,"a",3),e.SDv(10,8),e.qZA(),e.qZA(),e.YNc(11,d_,3,0,"li",9),e.qZA()),2&t&&(e.Q6J("activeId",o.router.url),e.xp6(11),e.Q6J("ngIf",o.grafanaPermission.read))},directives:[N.Pz,N.nv,N.Vx,l.O5],styles:[""]}),n})();var p_=p(25917),Ft=p(51295),lt=p(60737),g_=p(74255),Dt=p(71099),vt=p(79765);function u_(n,s){1&n&&(e.TgZ(0,"span",16),e.SDv(1,17),e.qZA())}function m_(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)}}let T_=(()=>{class n{constructor(t,o,i,_,r){this.activeModal=t,this.rbdService=o,this.taskManagerService=i,this.notificationService=_,this.actionLabels=r,this.editing=!1,this.onSubmit=new vt.xQ,this.action=this.actionLabels.CREATE,this.resource="RBD Snapshot",this.createForm()}createForm(){this.snapshotForm=new x.d({snapshotName:new a.NI("",{validators:[a.kI.required]})})}setSnapName(t){this.snapName=t,"snapshot"!==this.mirroring?this.snapshotForm.get("snapshotName").setValue(t):this.snapshotForm.get("snapshotName").clearValidators()}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 L.N(this.poolName,this.namespace,this.imageName),i=new R.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=new L.N(this.poolName,this.namespace,this.imageName),i=new R.R;i.name="rbd/snap/create",i.metadata={image_spec:o.toString(),snapshot_name:t},this.rbdService.createSnapshot(o,t).toPromise().then(()=>{this.taskManagerService.subscribe(i.name,i.metadata,_=>{this.notificationService.notifyTask(_)}),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(N.Kz),e.Y36(q),e.Y36(Dt.k),e.Y36(ve.g),e.Y36(v.p4))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-snapshot-form-modal"]],decls:22,vars:17,consts:function(){let s,t,o,i;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",[[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]},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),e.TgZ(8,"div",6),e.TgZ(9,"div",7),e.TgZ(10,"label",8),e.SDv(11,9),e.qZA(),e.TgZ(12,"div",10),e._UZ(13,"input",11),e.YNc(14,u_,2,0,"span",12),e._UZ(15,"br"),e._UZ(16,"br"),e.YNc(17,m_,3,1,"span",13),e.qZA(),e.qZA(),e.qZA(),e.TgZ(18,"div",14),e.TgZ(19,"cd-form-button-panel",15),e.NdJ("submitActionEvent",function(){return o.submit()}),e.ALo(20,"titlecase"),e.ALo(21,"upperFirst"),e.qZA(),e.qZA(),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,9,o.action))(e.lcZ(4,11,o.resource)),e.QtT(2),e.xp6(2),e.Q6J("formGroup",o.snapshotForm),e.xp6(7),e.uIk("disabled","snapshot"===o.mirroring||null),e.xp6(1),e.Q6J("ngIf",o.snapshotForm.showError("snapshotName",i,"required")),e.xp6(3),e.Q6J("ngIf","snapshot"===o.mirroring),e.xp6(2),e.Q6J("form",o.snapshotForm)("submitText",e.lcZ(20,13,o.action)+" "+e.lcZ(21,15,o.resource))}},directives:[C.z,a._Y,a.JL,a.sg,h.V,O.P,$.o,a.Fj,k.b,a.JJ,a.u,Re.U,l.O5,j.p],pipes:[l.rS,et.m],styles:[""]}),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)},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.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.featuresName)||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)},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]}getCloneDisableDesc(s,t){return!(s.hasSingleSelection&&!s.first().cdExecuting)||((null==t?void 0:t.includes("layering"))?1===this.cloneFormatVersion&&!s.first().is_protected&&"Snapshot must be protected in order to clone.":"Parent image must support Layering")}disableForMirrorSnapshot(s){return s.hasSingleSelection&&"snapshot"===s.first().mirror_mode&&s.first().name.includes(".mirror.")}}class C_{}var Ze=p(96102);const S_=["nameTpl"],E_=["rollbackTpl"];function R_(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 M_=(()=>{class n{constructor(t,o,i,_,r,c,d,g,f,I,P){this.authStorageService=t,this.modalService=o,this.dimlessBinaryPipe=i,this.cdDatePipe=_,this.rbdService=r,this.taskManagerService=c,this.notificationService=d,this.summaryService=g,this.taskListService=f,this.actionLabels=I,this.cdr=P,this.snapshots=[],this.selection=new Se.r,this.builders={"rbd/snap/create":Z=>{const B=new C_;return B.name=Z.snapshot_name,B}},this.permission=this.authStorageService.getPermissions().rbdImage}ngOnInit(){this.columns=[{name:"Name",prop:"name",cellTransformation:De.e.executing,flexGrow:2},{name:"Size",prop:"size",flexGrow:1,cellClass:"text-right",pipe:this.dimlessBinaryPipe},{name:"Provisioned",prop:"disk_usage",flexGrow:1,cellClass:"text-right",pipe:this.dimlessBinaryPipe},{name:"State",prop:"is_protected",flexGrow:1,cellTransformation:De.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 L.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,p_.of)(this.snapshots),null,_=>{Ft.T.updateChanged(this,{data:_})&&(this.cdr.detectChanges(),this.data=[...this.data])},()=>{Ft.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,(_,r)=>_.name===r.metadata.snapshot_name,this.builders)}ngOnChanges(){this.columns&&(this.imageSpec=new L.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(T_,{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}_${Me()().toISOString(!0)}`,this.modalRef.componentInstance.setSnapName(o),this.modalRef.componentInstance.onSubmit.subscribe(_=>{const r=new lt.o;r.name=t,r.metadata={image_spec:this.imageSpec.toString(),snapshot_name:_},this.summaryService.addRunningTask(r)})}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 R.R;i.name="rbd/snap/edit";const _=new L.N(this.poolName,this.namespace,this.rbdName);i.metadata={image_spec:_.toString(),snapshot_name:t},this.rbdService.protectSnapshot(_,t,!o).toPromise().then(()=>{const r=new lt.o;r.name=i.name,r.metadata=i.metadata,this.summaryService.addRunningTask(r),this.taskManagerService.subscribe(i.name,i.metadata,c=>{this.notificationService.notifyTask(c)})})}_asyncTask(t,o,i){const _=new R.R;_.name=o,_.metadata={image_spec:new L.N(this.poolName,this.namespace,this.rbdName).toString(),snapshot_name:i};const r=new L.N(this.poolName,this.namespace,this.rbdName);this.rbdService[t](r,i).toPromise().then(()=>{const c=new lt.o;c.name=_.name,c.metadata=_.metadata,this.summaryService.addRunningTask(c),this.modalRef.close(),this.taskManagerService.subscribe(c.name,c.metadata,d=>{this.notificationService.notifyTask(d)})}).catch(()=>{this.modalRef.componentInstance.stopLoadingSpinner()})}rollbackModal(){const t=this.selection.selected[0].name,o=new L.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(Nt.Y,i)}deleteSnapshotModal(){const t=this.selection.selected[0].name;this.modalRef=this.modalService.show(pe.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(de.Z),e.Y36(Le.$),e.Y36(Ze.N),e.Y36(q),e.Y36(Dt.k),e.Y36(ve.g),e.Y36(g_.J),e.Y36(ce.j),e.Y36(v.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(S_,5),e.Gf(E_,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",rbdName:"rbdName"},features:[e._Bn([ce.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,R_,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))},directives:[W.a,Ee.K],styles:[""],changeDetection:0}),n})();var O_=p(71752),Lt=p(76317),A_=p(41039);const h_=["poolConfigurationSourceTpl"];function P_(n,s){1&n&&(e.ynx(0),e.tHW(1,3),e._UZ(2,"strong"),e.N_p(),e.BQk())}function I_(n,s){if(1&n&&(e.TgZ(0,"span"),e.TgZ(1,"span",38),e._uU(2),e.qZA(),e.qZA()),2&n){const t=s.$implicit;e.xp6(2),e.Oqu(t)}}function b_(n,s){if(1&n&&(e.TgZ(0,"span"),e.TgZ(1,"span",39),e.SDv(2,40),e.qZA(),e.qZA()),2&n){e.oxw(3);const t=e.MAs(1);e.xp6(1),e.Q6J("ngbTooltip",t)}}function N_(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 F_(n,s){if(1&n&&(e.TgZ(0,"span"),e.TgZ(1,"span",39),e.SDv(2,41),e.qZA(),e.qZA()),2&n){e.oxw(3);const t=e.MAs(1);e.xp6(1),e.Q6J("ngbTooltip",t)}}function D_(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 v_(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 L_(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.YNc(2,v_,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 $_(n,s){1&n&&(e.TgZ(0,"span"),e._uU(1,"-"),e.qZA())}function Z_(n,s){if(1&n&&(e.TgZ(0,"table",17),e.TgZ(1,"tbody"),e.TgZ(2,"tr"),e.TgZ(3,"td",18),e.SDv(4,19),e.qZA(),e.TgZ(5,"td",20),e._uU(6),e.qZA(),e.qZA(),e.TgZ(7,"tr"),e.TgZ(8,"td",21),e.SDv(9,22),e.qZA(),e.TgZ(10,"td"),e._uU(11),e.qZA(),e.qZA(),e.TgZ(12,"tr"),e.TgZ(13,"td",21),e.SDv(14,23),e.qZA(),e.TgZ(15,"td"),e._uU(16),e.ALo(17,"empty"),e.qZA(),e.qZA(),e.TgZ(18,"tr"),e.TgZ(19,"td",21),e.SDv(20,24),e.qZA(),e.TgZ(21,"td"),e._uU(22),e.ALo(23,"cdDate"),e.qZA(),e.qZA(),e.TgZ(24,"tr"),e.TgZ(25,"td",21),e.SDv(26,25),e.qZA(),e.TgZ(27,"td"),e._uU(28),e.ALo(29,"dimlessBinary"),e.qZA(),e.qZA(),e.TgZ(30,"tr"),e.TgZ(31,"td",21),e.SDv(32,26),e.qZA(),e.TgZ(33,"td"),e._uU(34),e.ALo(35,"dimless"),e.qZA(),e.qZA(),e.TgZ(36,"tr"),e.TgZ(37,"td",21),e.SDv(38,27),e.qZA(),e.TgZ(39,"td"),e._uU(40),e.ALo(41,"dimlessBinary"),e.qZA(),e.qZA(),e.TgZ(42,"tr"),e.TgZ(43,"td",21),e.SDv(44,28),e.qZA(),e.TgZ(45,"td"),e.YNc(46,I_,3,1,"span",29),e.qZA(),e.qZA(),e.TgZ(47,"tr"),e.TgZ(48,"td",21),e.SDv(49,30),e.qZA(),e.TgZ(50,"td"),e.YNc(51,b_,3,1,"span",1),e.YNc(52,N_,3,3,"span",1),e.qZA(),e.qZA(),e.TgZ(53,"tr"),e.TgZ(54,"td",21),e.SDv(55,31),e.qZA(),e.TgZ(56,"td"),e.YNc(57,F_,3,1,"span",1),e.YNc(58,D_,3,3,"span",1),e.qZA(),e.qZA(),e.TgZ(59,"tr"),e.TgZ(60,"td",21),e.SDv(61,32),e.qZA(),e.TgZ(62,"td"),e._uU(63),e.ALo(64,"dimlessBinary"),e.qZA(),e.qZA(),e.TgZ(65,"tr"),e.TgZ(66,"td",21),e.SDv(67,33),e.qZA(),e.TgZ(68,"td"),e._uU(69),e.qZA(),e.qZA(),e.TgZ(70,"tr"),e.TgZ(71,"td",21),e.SDv(72,34),e.qZA(),e.TgZ(73,"td"),e.YNc(74,L_,4,4,"span",1),e.YNc(75,$_,2,0,"span",1),e.qZA(),e.qZA(),e.TgZ(76,"tr"),e.TgZ(77,"td",21),e.SDv(78,35),e.qZA(),e.TgZ(79,"td"),e._uU(80),e.qZA(),e.qZA(),e.TgZ(81,"tr"),e.TgZ(82,"td",21),e.SDv(83,36),e.qZA(),e.TgZ(84,"td"),e._uU(85),e.qZA(),e.qZA(),e.TgZ(86,"tr"),e.TgZ(87,"td",21),e.SDv(88,37),e.qZA(),e.TgZ(89,"td"),e._uU(90),e.qZA(),e.qZA(),e.qZA(),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 B_(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)("namespace",t.selection.namespace)("mirroring",t.selection.mirror_mode)("rbdName",t.selection.name)}}function G_(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 y_(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 x_(n,s){if(1&n&&(e.ynx(0),e.TgZ(1,"ul",4,5),e.TgZ(3,"li",6),e.TgZ(4,"a",7),e.SDv(5,8),e.qZA(),e.YNc(6,Z_,91,31,"ng-template",9),e.qZA(),e.TgZ(7,"li",10),e.TgZ(8,"a",7),e.SDv(9,11),e.qZA(),e.YNc(10,B_,1,6,"ng-template",9),e.qZA(),e.TgZ(11,"li",12),e.TgZ(12,"a",7),e.SDv(13,13),e.qZA(),e.YNc(14,G_,1,1,"ng-template",9),e.qZA(),e.TgZ(15,"li",14),e.TgZ(16,"a",7),e.SDv(17,15),e.qZA(),e.YNc(18,y_,1,2,"ng-template",9),e.qZA(),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 q_(n,s){1&n&&(e.ynx(0),e.TgZ(1,"strong",49),e.SDv(2,50),e.qZA(),e.BQk())}function H_(n,s){1&n&&(e.TgZ(0,"span",51),e.SDv(1,52),e.qZA())}function k_(n,s){if(1&n&&(e.YNc(0,q_,3,0,"ng-container",47),e.YNc(1,H_,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 K_=(()=>{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(h_,7),e.Gf(N.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,_,r,c,d,g,f,I,P,Z,B,Q,Y,ee,te,w,_e,ae,M,ge,ue,me,Te,fe,Ce;return s="Only available for RBD images with " + "\ufffd#2\ufffd" + "fast-diff" + "\ufffd/#2\ufffd" + " enabled",t="Details",o="Snapshots",i="Configuration",_="Performance",r="Name",c="Pool",d="Data Pool",g="Created",f="Size",I="Objects",P="Object size",Z="Features",B="Provisioned",Q="Total provisioned",Y="Striping unit",ee="Striping count",te="Parent",w="Block name prefix",_e="Order",ae="Format Version",M="N/A",ge="N/A",ue="Information can not be displayed for RBD in status 'Removing'.",me="This setting overrides the global value",Te="Image",fe="This is the global value. No value for this option has been set for this image.",Ce="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"],r,[1,"w-75"],[1,"bold"],c,d,g,f,I,P,Z,[4,"ngFor","ngForOf"],B,Q,Y,ee,te,w,_e,ae,[1,"badge","badge-dark","mr-2"],["placement","top",1,"form-text","text-muted",3,"ngbTooltip"],M,ge,[3,"snapshots","featuresName","poolName","namespace","mirroring","rbdName"],[3,"data"],["uid","YhCYGcuZz","grafanaStyle","one",3,"grafanaPath","type"],["type","warning"],ue,[4,"ngIf","ngIfElse"],["global",""],["ngbTooltip",me],Te,["ngbTooltip",fe],Ce]},template:function(t,o){1&t&&(e.YNc(0,P_,3,0,"ng-template",null,0,e.W1O),e.YNc(2,x_,20,1,"ng-container",1),e.YNc(3,w_,3,0,"ng-container",1),e.YNc(4,k_,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))},directives:[l.O5,N.Pz,Mt.m,N.nv,N.Vx,N.uN,N.tO,l.sg,N._L,M_,O_.P,Lt.F,Ct.G],pipes:[A_.W,Ze.N,Le.$,ot.n],styles:[""]}),n})();const X_=["usageTpl"],Q_=["parentTpl"],z_=["nameTpl"],J_=["mirroringTpl"],Y_=["flattenTpl"],V_=["deleteTpl"],U_=["removingStatTpl"],j_=["provisionedNotAvailableTooltipTpl"],W_=["totalProvisionedNotAvailableTooltipTpl"];function ea(n,s){1&n&&e._UZ(0,"div",12),2&n&&e.Q6J("innerHtml","Only available for RBD images with <strong>fast-diff</strong> enabled",e.oJD)}function ta(n,s){if(1&n&&(e.TgZ(0,"span",15),e.SDv(1,16),e.qZA()),2&n){const t=e.oxw(2);e.Q6J("ngbTooltip",t.usageNotAvailableTooltipTpl)}}function oa(n,s){if(1&n&&(e.SDv(0,17),e.ALo(1,"dimlessBinary")),2&n){const t=e.oxw().row;e.xp6(1),e.pQV(e.lcZ(1,1,t.disk_usage)),e.QtT(0)}}function na(n,s){if(1&n&&(e.YNc(0,ta,2,1,"span",13),e.YNc(1,oa,2,3,"ng-template",null,14,e.W1O)),2&n){const t=s.row,o=e.MAs(2);e.Q6J("ngIf",null===t.disk_usage&&!t.features_name.includes("fast-diff"))("ngIfElse",o)}}function ia(n,s){if(1&n&&(e.TgZ(0,"span",15),e.SDv(1,19),e.qZA()),2&n){const t=e.oxw(2);e.Q6J("ngbTooltip",t.usageNotAvailableTooltipTpl)}}function sa(n,s){if(1&n&&(e.SDv(0,20),e.ALo(1,"dimlessBinary")),2&n){const t=e.oxw().row;e.xp6(1),e.pQV(e.lcZ(1,1,t.total_disk_usage)),e.QtT(0)}}function _a(n,s){if(1&n&&(e.YNc(0,ia,2,1,"span",13),e.YNc(1,sa,2,3,"ng-template",null,18,e.W1O)),2&n){const t=s.row,o=e.MAs(2);e.Q6J("ngIf",null===t.total_disk_usage&&!t.features_name.includes("fast-diff"))("ngIfElse",o)}}function aa(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 ra(n,s){if(1&n&&(e.TgZ(0,"span"),e._uU(1),e.YNc(2,aa,2,1,"span",21),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 la(n,s){1&n&&(e.TgZ(0,"span"),e._uU(1,"-"),e.qZA())}function ca(n,s){if(1&n&&(e.YNc(0,ra,4,4,"span",21),e.YNc(1,la,2,0,"span",21)),2&n){const t=s.value;e.Q6J("ngIf",t),e.xp6(1),e.Q6J("ngIf",!t)}}function da(n,s){if(1&n&&(e.TgZ(0,"span",26),e._uU(1),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.Oqu(t[0])}}function pa(n,s){if(1&n&&(e.TgZ(0,"span",27),e.ALo(1,"cdDate"),e._uU(2),e.qZA()),2&n){const t=e.oxw().value;e.Q6J("ngbTooltip","Next scheduled snapshot on "+e.lcZ(1,2,t[2])),e.xp6(2),e.Oqu(t[1])}}function ga(n,s){1&n&&(e.TgZ(0,"span",26),e.SDv(1,28),e.qZA())}function ua(n,s){1&n&&(e.TgZ(0,"span",26),e.SDv(1,29),e.qZA())}function ma(n,s){if(1&n&&(e.TgZ(0,"span",26),e._uU(1),e.qZA()),2&n){const t=e.oxw().value;e.xp6(1),e.Oqu(t)}}function Ta(n,s){if(1&n&&(e.YNc(0,da,2,1,"span",22),e._uU(1,"\xa0 "),e.YNc(2,pa,3,4,"span",23),e.YNc(3,ga,2,0,"span",24),e.YNc(4,ua,2,0,"span",24),e.YNc(5,ma,2,1,"ng-template",null,25,e.W1O)),2&n){const t=s.value,o=s.row,i=e.MAs(6);e.Q6J("ngIf",3===t.length)("ngIfElse",i),e.xp6(2),e.Q6J("ngIf",3===t.length),e.xp6(1),e.Q6J("ngIf",!0===o.primary),e.xp6(1),e.Q6J("ngIf",!1===o.primary)}}function fa(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"),e._UZ(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 Ca(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 Sa(n,s){if(1&n&&(e.ynx(0),e.TgZ(1,"span"),e.SDv(2,33),e.qZA(),e.TgZ(3,"ul"),e.YNc(4,Ca,2,1,"li",34),e.qZA(),e.BQk()),2&n){const t=e.oxw(2).snapshots;e.xp6(4),e.Q6J("ngForOf",t)}}function Ea(n,s){if(1&n&&(e.TgZ(0,"div",31),e.TgZ(1,"span"),e.SDv(2,32),e.qZA(),e._UZ(3,"br"),e.YNc(4,Sa,5,1,"ng-container",21),e.qZA()),2&n){const t=e.oxw().snapshots;e.xp6(4),e.Q6J("ngIf",t.length>0)}}function Ra(n,s){1&n&&e.YNc(0,Ea,5,1,"div",30),2&n&&e.Q6J("ngIf",s.hasSnapshots)}const Ma=function(n,s){return[n,s]};function Oa(n,s){if(1&n&&e._UZ(0,"i",36),2&n){const t=e.oxw(2);e.Q6J("ngClass",e.WLB(1,Ma,t.icons.spinner,t.icons.spin))}}function Aa(n,s){if(1&n&&(e.TgZ(0,"span",36),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 ha(n,s){if(1&n&&e._UZ(0,"i",38),2&n){const t=e.oxw(2);e.Gre("",t.icons.warning," warn")}}function Pa(n,s){if(1&n&&(e.YNc(0,Oa,1,4,"i",35),e.TgZ(1,"span",36),e._uU(2),e.qZA(),e.YNc(3,Aa,2,2,"span",35),e.YNc(4,ha,1,3,"i",37)),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)}}let ba=(()=>{class n extends mt.o{constructor(t,o,i,_,r,c,d,g,f){super(),this.authStorageService=t,this.rbdService=o,this.dimlessBinaryPipe=i,this.dimlessPipe=_,this.modalService=r,this.taskWrapper=c,this.taskListService=d,this.urlBuilder=g,this.actionLabels=f,this.tableStatus=new bt.c("light"),this.selection=new Se.r,this.icons=T.P,this.count=0,this.tableContext=null,this.builders={"rbd/create":M=>this.createRbdFromTask(M.pool_name,M.namespace,M.image_name),"rbd/delete":M=>this.createRbdFromTaskImageSpec(M.image_spec),"rbd/clone":M=>this.createRbdFromTask(M.child_pool_name,M.child_namespace,M.child_image_name),"rbd/copy":M=>this.createRbdFromTask(M.dest_pool_name,M.dest_namespace,M.dest_image_name)},this.permission=this.authStorageService.getPermissions().rbdImage;const I=()=>this.selection.first()&&new L.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:M=>!M.hasSingleSelection,name:this.actionLabels.CREATE},{permission:"update",icon:T.P.edit,routerLink:()=>this.urlBuilder.getEdit(I()),name:this.actionLabels.EDIT,disable:M=>this.getRemovingStatusDesc(M)||this.getInvalidNameDisable(M)},{permission:"create",canBePrimary:M=>M.hasSingleSelection,disable:M=>this.getRemovingStatusDesc(M)||this.getInvalidNameDisable(M)||!!M.first().cdExecuting,icon:T.P.copy,routerLink:()=>`/block/rbd/copy/${I()}`,name:this.actionLabels.COPY},{permission:"update",disable:M=>this.getRemovingStatusDesc(M)||this.getInvalidNameDisable(M)||M.first().cdExecuting||!M.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:M=>this.getResyncDisableDesc(M)},{permission:"delete",icon:T.P.destroy,click:()=>this.deleteRbdModal(),name:this.actionLabels.DELETE,disable:M=>this.getDeleteDisableDesc(M)},{permission:"delete",icon:T.P.trash,click:()=>this.trashRbdModal(),name:this.actionLabels.TRASH,disable:M=>this.getRemovingStatusDesc(M)||this.getInvalidNameDisable(M)||M.first().image_format===Pe.V1},{permission:"update",icon:T.P.edit,click:()=>this.removeSchedulingModal(),name:this.actionLabels.REMOVE_SCHEDULING,disable:M=>this.getRemovingStatusDesc(M)||this.getInvalidNameDisable(M)||void 0===M.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},{permission:"update",icon:T.P.edit,click:()=>this.actionPrimary(!1),name:this.actionLabels.DEMOTE,visible:()=>null!=this.selection.first()&&this.selection.first().primary}]}createRbdFromTaskImageSpec(t){const o=L.N.fromString(t);return this.createRbdFromTask(o.poolName,o.namespace,o.imageName)}createRbdFromTask(t,o,i){const _=new is;return _.id="-1",_.unique_id="-1",_.name=i,_.namespace=o,_.pool_name=t,_.image_format=Pe.V2,_}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:"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:"Provisioned",prop:"disk_usage",cellClass:"text-center",flexGrow:1,pipe:this.dimlessBinaryPipe,sortable:!1,cellTemplate:this.provisionedNotAvailableTooltipTpl},{name:"Total provisioned",prop:"total_disk_usage",cellClass:"text-center",flexGrow:1,pipe:this.dimlessBinaryPipe,sortable:!1,cellTemplate:this.totalProvisionedNotAvailableTooltipTpl},{name:"Parent",prop:"parent",flexGrow:2,sortable:!1,cellTemplate:this.parentTpl},{name:"Mirroring",prop:"mirror_mode",flexGrow:3,sortable:!1,cellTemplate:this.mirroringTpl}],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 r;switch(_.name){case"rbd/copy":r=new L.N(_.metadata.dest_pool_name,_.metadata.dest_namespace,_.metadata.dest_image_name).toString();break;case"rbd/clone":r=new L.N(_.metadata.child_pool_name,_.metadata.child_namespace,_.metadata.child_image_name).toString();break;case"rbd/create":r=new L.N(_.metadata.pool_name,_.metadata.namespace,_.metadata.image_name).toString();break;default:r=_.metadata.image_spec}return r===new L.N(i.pool_name,i.namespace,i.name).toString()},this.builders)}onFetchError(){this.table.reset(),this.tableStatus=new bt.c("danger")}getRbdImages(t){var o;return null!==t&&(this.tableContext=t),null==this.tableContext&&(this.tableContext=new A.E(()=>{})),this.rbdService.list(null===(o=this.tableContext)||void 0===o?void 0:o.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 r="scheduled";let c=+new Date(i.schedule_info.schedule_time);const d=(new Date).getTimezoneOffset();c+=6e4*Math.abs(d),_.push(i.mirror_mode,r,c),i.mirror_mode=_,_=[]}}),this.count=o.length>0?n_.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 L.N(t,o,i);this.modalRef=this.modalService.show(pe.M,{itemDescription:"RBD",itemNames:[_],bodyTemplate:this.deleteTpl,bodyContext:{hasSnapshots:this.hasSnapshots(),snapshots:this.listProtectedSnapshots()},submitActionObservable:()=>this.taskWrapper.wrapTaskAroundCall({task:new R.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 L.N(t,o,i);this.modalRef=this.modalService.show(pe.M,{itemDescription:"RBD",itemNames:[_],actionDescription:"resync",submitActionObservable:()=>this.taskWrapper.wrapTaskAroundCall({task:new R.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(c_,t)}flattenRbd(t){this.taskWrapper.wrapTaskAroundCall({task:new R.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,r=new L.N(_.pool_name,_.pool_namespace,_.image_name),c=new L.N(t,o,i),d={titleText:"RBD flatten",buttonText:"Flatten",bodyTpl:this.flattenTpl,bodyData:{parent:`${r}@${_.snap_name}`,child:c.toString()},onSubmit:()=>{this.flattenRbd(c)}};this.modalRef=this.modalService.show(Nt.Y,d)}editRequest(){const t=new _t;return t.remove_scheduling=!t.remove_scheduling,t}removeSchedulingModal(){const t=this.selection.first().name,o=new L.N(this.selection.first().pool_name,this.selection.first().namespace,this.selection.first().name);this.modalRef=this.modalService.show(pe.M,{actionDescription:"remove scheduling on",itemDescription:"image",itemNames:[`${t}`],submitActionObservable:()=>new Rt.y(i=>{this.taskWrapper.wrapTaskAroundCall({task:new R.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 _t;o.primary=t;const i=new L.N(this.selection.first().pool_name,this.selection.first().namespace,this.selection.first().name);this.taskWrapper.wrapTaskAroundCall({task:new R.R("rbd/edit",{image_spec:i.toString()}),call:this.rbdService.update(i,o)}).subscribe()}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){var o;const i=t.first();return(null===(o=null==i?void 0:i.name)||void 0===o?void 0:o.match(/[@/]/))?"This RBD image has an invalid name and can't be managed by ceph.":!t.first()||!t.hasSingleSelection}getRemovingStatusDesc(t){const o=t.first();return"REMOVING"===(null==o?void 0:o.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(q),e.Y36(Le.$),e.Y36(ot.n),e.Y36(de.Z),e.Y36(u.P),e.Y36(ce.j),e.Y36(at.F),e.Y36(v.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(X_,5),e.Gf(Q_,7),e.Gf(z_,5),e.Gf(J_,7),e.Gf(Y_,7),e.Gf(V_,7),e.Gf(U_,7),e.Gf(j_,7),e.Gf(W_,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.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.provisionedNotAvailableTooltipTpl=i.first),e.iGM(i=e.CRH())&&(o.totalProvisionedNotAvailableTooltipTpl=i.first)}},features:[e._Bn([ce.j,{provide:at.F,useValue:new at.F("block/rbd")}]),e.qOj],decls:21,vars:13,consts:function(){let s,t,o,i,_,r,c,d,g;return s="N/A",t="" + "\ufffd0\ufffd" + "",o="N/A",i="" + "\ufffd0\ufffd" + "",_="primary",r="secondary",c="Deleting this image will also delete all its snapshots.",d="The following snapshots are currently protected and will be removed:",g="RBD in status 'Removing'",[["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"],["scheduleStatus",""],["provisionedNotAvailableTooltipTpl",""],["totalProvisionedNotAvailableTooltipTpl",""],["parentTpl",""],["mirroringTpl",""],["flattenTpl",""],["deleteTpl",""],["removingStatTpl",""],[3,"innerHtml"],["placement","top",3,"ngbTooltip",4,"ngIf","ngIfElse"],["provisioned",""],["placement","top",3,"ngbTooltip"],s,t,["totalProvisioned",""],o,i,[4,"ngIf"],["class","badge badge-info",4,"ngIf","ngIfElse"],["class","badge badge-info",3,"ngbTooltip",4,"ngIf"],["class","badge badge-info",4,"ngIf"],["probb",""],[1,"badge","badge-info"],[1,"badge","badge-info",3,"ngbTooltip"],_,r,["class","alert alert-warning","role","alert",4,"ngIf"],["role","alert",1,"alert","alert-warning"],c,d,[4,"ngFor","ngForOf"],[3,"ngClass",4,"ngIf"],[3,"ngClass"],["title",g,3,"class",4,"ngIf"],["title",g]]},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),e._UZ(4,"cd-rbd-details",3),e.qZA(),e.YNc(5,ea,1,1,"ng-template",null,4,e.W1O),e.YNc(7,na,3,2,"ng-template",null,5,e.W1O),e.YNc(9,_a,3,2,"ng-template",null,6,e.W1O),e.YNc(11,ca,2,2,"ng-template",null,7,e.W1O),e.YNc(13,Ta,7,5,"ng-template",null,8,e.W1O),e.YNc(15,fa,13,3,"ng-template",null,9,e.W1O),e.YNc(17,Ra,1,1,"ng-template",null,10,e.W1O),e.YNc(19,Pa,5,5,"ng-template",null,11,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))},directives:[We,W.a,Ee.K,K_,l.O5,N._L,l.sg,l.mk],pipes:[Le.$,Ze.N],styles:[".warn[_ngcontent-%COMP%]{color:#ffc200}"]}),n})();function Na(n,s){1&n&&e._UZ(0,"input",19)}function Fa(n,s){1&n&&(e.TgZ(0,"option",23),e.SDv(1,24),e.qZA()),2&n&&e.Q6J("ngValue",null)}function Da(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 La(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 $a(n,s){if(1&n&&(e.TgZ(0,"select",20),e.YNc(1,Fa,2,1,"option",21),e.YNc(2,Da,2,1,"option",21),e.YNc(3,va,2,1,"option",21),e.YNc(4,La,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 Za(n,s){1&n&&(e.TgZ(0,"span",28),e.SDv(1,29),e.qZA())}function Ba(n,s){1&n&&(e.TgZ(0,"span",28),e.SDv(1,30),e.qZA())}function Ga(n,s){1&n&&(e.TgZ(0,"span",28),e.SDv(1,31),e.qZA())}let ya=(()=>{class n{constructor(t,o,i,_,r,c){this.activeModal=t,this.actionLabels=o,this.authStorageService=i,this.notificationService=_,this.poolService=r,this.rbdService=c,this.pools=null,this.editing=!1,this.poolPermission=this.authStorageService.getPermissions().pool,this.createForm()}createForm(){this.namespaceForm=new x.d({pool:new a.NI(""),namespace:new a.NI("")},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 r=null;return i.value||(r={required:!0}),i.setErrors(r),null}}asyncValidator(){return t=>new Promise(o=>{const i=t.get("pool"),_=t.get("namespace");this.rbdService.listNamespaces(i.value).subscribe(r=>{if(r.some(c=>c.namespace===_.value)){const c={namespaceExists:!0};_.setErrors(c),o(c)}else o(null)})})}ngOnInit(){this.onSubmit=new vt.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 R.R;i.name="rbd/namespace/create",i.metadata={pool:t,namespace:o},this.rbdService.createNamespace(t,o).toPromise().then(()=>{this.notificationService.show(tt.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(N.Kz),e.Y36(v.p4),e.Y36(oe.j),e.Y36(ve.g),e.Y36(Ve.q),e.Y36(q))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-namespace-form-modal"]],decls:23,vars:9,consts:function(){let s,t,o,i,_,r,c,d,g;return s="Create Namespace",t="Pool",o="Name",i="Loading...",_="-- No rbd pools available --",r="-- Select a pool --",c="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-control","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-control"],[3,"ngValue",4,"ngIf"],[3,"value",4,"ngFor","ngForOf"],[3,"ngValue"],i,_,r,[3,"value"],[1,"invalid-feedback"],c,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),e.TgZ(6,"div",6),e.TgZ(7,"div",7),e.TgZ(8,"label",8),e.SDv(9,9),e.qZA(),e.TgZ(10,"div",10),e.YNc(11,Na,1,0,"input",11),e.YNc(12,$a,5,4,"select",12),e.YNc(13,Za,2,0,"span",13),e.qZA(),e.qZA(),e.TgZ(14,"div",7),e.TgZ(15,"label",14),e.SDv(16,15),e.qZA(),e.TgZ(17,"div",10),e._UZ(18,"input",16),e.YNc(19,Ba,2,0,"span",13),e.YNc(20,Ga,2,0,"span",13),e.qZA(),e.qZA(),e.qZA(),e.TgZ(21,"div",17),e.TgZ(22,"cd-form-button-panel",18),e.NdJ("submitActionEvent",function(){return o.submit()}),e.qZA(),e.qZA(),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)}},directives:[C.z,a._Y,a.JL,a.sg,h.V,O.P,l.O5,$.o,a.Fj,k.b,a.JJ,a.u,Re.U,j.p,a.EJ,l.sg,a.YN,a.Kr],styles:[""]}),n})(),xa=(()=>{class n{constructor(t,o,i,_,r,c){this.authStorageService=t,this.rbdService=o,this.poolService=i,this.modalService=_,this.notificationService=r,this.actionLabels=c,this.selection=new Se.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,le.D)(o).subscribe(i=>{const _=[];for(let r=0;r<i.length;r++){const d=t[r].pool_name;i[r].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(ya),this.modalRef.componentInstance.onSubmit.subscribe(()=>{this.refresh()})}deleteModal(){const t=this.selection.first().pool,o=this.selection.first().namespace;this.modalRef=this.modalService.show(pe.M,{itemDescription:"Namespace",itemNames:[`${t}/${o}`],submitAction:()=>this.rbdService.deleteNamespace(t,o).subscribe(()=>{this.notificationService.show(tt.k.success,"Deleted namespace '" + t + "/" + o + "'"),this.modalRef.close(),this.refresh()},()=>{this.modalRef.componentInstance.stopLoadingSpinner()})})}getDeleteDisableDesc(){var t;const o=this.selection.first();return(null==o?void 0:o.num_images)>0?"Namespace contains images":!(null===(t=this.selection)||void 0===t?void 0:t.first())}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(q),e.Y36(Ve.q),e.Y36(de.Z),e.Y36(ve.g),e.Y36(v.p4))},n.\u0275cmp=e.Xpm({type:n,selectors:[["cd-rbd-namespace-list"]],features:[e._Bn([ce.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(),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))},directives:[We,W.a,Ee.K],styles:[""]}),n})(),wa=(()=>{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:[["uid","41FrpeUiz","grafanaStyle","two",3,"grafanaPath","type"]],template:function(t,o){1&t&&(e._UZ(0,"cd-rbd-tabs"),e._UZ(1,"cd-grafana",0)),2&t&&(e.xp6(1),e.Q6J("grafanaPath","rbd-overview?")("type","metrics"))},directives:[We,Lt.F],styles:[""]}),n})();var qa=p(91801);function Ha(n,s){1&n&&e._UZ(0,"input",15)}function ka(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 Ka(n,s){if(1&n&&(e.TgZ(0,"select",16),e.TgZ(1,"option",17),e.SDv(2,18),e.qZA(),e.YNc(3,ka,2,2,"option",19),e.qZA()),2&n){const t=e.oxw();e.xp6(3),e.Q6J("ngForOf",t.pools)}}let Xa=(()=>{class n{constructor(t,o,i,_,r,c,d){this.authStorageService=t,this.rbdService=o,this.activeModal=i,this.actionLabels=_,this.fb=r,this.poolService=c,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 R.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(q),e.Y36(N.Kz),e.Y36(v.p4),e.Y36(rt.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),e.TgZ(6,"div",6),e.TgZ(7,"p"),e.tHW(8,7),e._UZ(9,"kbd"),e._UZ(10,"kbd"),e.N_p(),e.qZA(),e.TgZ(11,"div",8),e.TgZ(12,"label",9),e.SDv(13,10),e.qZA(),e.YNc(14,Ha,1,0,"input",11),e.YNc(15,Ka,4,1,"select",12),e.qZA(),e.qZA(),e.TgZ(16,"div",13),e.TgZ(17,"cd-form-button-panel",14),e.NdJ("submitActionEvent",function(){return o.purge()}),e.qZA(),e.qZA(),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))},directives:[C.z,a._Y,a.JL,a.sg,h.V,O.P,l.O5,j.p,$.o,a.Fj,k.b,a.JJ,a.u,a.EJ,a.YN,a.Kr,l.sg],styles:[""]}),n})();function Qa(n,s){1&n&&(e.TgZ(0,"span",15),e.SDv(1,16),e.qZA())}let za=(()=>{class n{constructor(t,o,i,_,r){this.rbdService=t,this.activeModal=o,this.actionLabels=i,this.fb=_,this.taskWrapper=r}ngOnInit(){this.imageSpec=new L.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 L.N(this.poolName,this.namespace,this.imageId);this.taskWrapper.wrapTaskAroundCall({task:new R.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(q),e.Y36(N.Kz),e.Y36(v.p4),e.Y36(rt.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),e.TgZ(6,"div",6),e.TgZ(7,"p"),e.tHW(8,7),e._UZ(9,"kbd"),e._UZ(10,"kbd"),e.N_p(),e.qZA(),e.TgZ(11,"div",8),e.TgZ(12,"label",9),e.SDv(13,10),e.qZA(),e._UZ(14,"input",11),e.YNc(15,Qa,2,0,"span",12),e.qZA(),e.qZA(),e.TgZ(16,"div",13),e.TgZ(17,"cd-form-button-panel",14),e.NdJ("submitActionEvent",function(){return o.restore()}),e.qZA(),e.qZA(),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)}},directives:[C.z,a._Y,a.JL,a.sg,h.V,O.P,$.o,a.Fj,k.b,a.JJ,a.u,Re.U,l.O5,j.p],styles:[""]}),n})();const Ja=["expiresTpl"],Ya=["deleteTpl"],Va=function(n){return[n]};function Ua(n,s){if(1&n){const t=e.EpF();e.TgZ(0,"button",6),e.NdJ("click",function(){return e.CHM(t),e.oxw().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,Va,t.icons.destroy))}}function ja(n,s){1&n&&(e.ynx(0),e.SDv(1,10),e.BQk())}function Wa(n,s){1&n&&(e.ynx(0),e.SDv(1,11),e.BQk())}function er(n,s){if(1&n&&(e.YNc(0,ja,2,0,"ng-container",9),e.YNc(1,Wa,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 tr(n,s){if(1&n&&(e.TgZ(0,"p",13),e.TgZ(1,"strong"),e.ynx(2),e.SDv(3,14),e.ALo(4,"cdDate"),e.BQk(),e.qZA(),e.qZA()),2&n){const t=e.oxw().expiresAt;e.xp6(4),e.pQV(e.lcZ(4,1,t)),e.QtT(3)}}function or(n,s){1&n&&e.YNc(0,tr,5,3,"p",12),2&n&&e.Q6J("ngIf",!s.isExpired)}let nr=(()=>{class n{constructor(t,o,i,_,r,c,d){this.authStorageService=t,this.rbdService=o,this.modalService=i,this.cdDatePipe=_,this.taskListService=r,this.taskWrapper=c,this.actionLabels=d,this.icons=T.P,this.executingTasks=[],this.selection=new Se.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:De.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 L.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(r=>{S().isUndefined(i[r.status])&&(i[r.status]=[]),i[r.status].push(r.pool_name),o=o.concat(r.value),this.disablePurgeBtn=!o.length}),i[3]?_=3:i[1]?_=1:i[2]&&(_=2),_){const r=(i[_].length>1?"pools ":"pool ")+i[_].join();this.tableStatus=new se.E(_,r)}else this.tableStatus=new se.E;return o.forEach(r=>{r.cdIsExpired=Me()().isAfter(r.deferment_end_time)}),o}onFetchError(){this.table.reset(),this.tableStatus=new se.E(qa.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(za,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,r=Me()().isAfter(_),c=new L.N(t,o,i);this.modalRef=this.modalService.show(pe.M,{itemDescription:"RBD",itemNames:[c],bodyTemplate:this.deleteTpl,bodyContext:{expiresAt:_,isExpired:r},submitActionObservable:()=>this.taskWrapper.wrapTaskAroundCall({task:new R.R("rbd/trash/remove",{image_id_spec:c.toString()}),call:this.rbdService.removeTrash(c,!0)})})}purgeModal(){this.modalService.show(Xa)}}return n.\u0275fac=function(t){return new(t||n)(e.Y36(oe.j),e.Y36(q),e.Y36(de.Z),e.Y36(Ze.N),e.Y36(ce.j),e.Y36(u.P),e.Y36(v.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(Ja,7),e.Gf(Ya,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([ce.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,Ua,4,4,"button",3),e.qZA(),e.qZA(),e.YNc(5,er,4,5,"ng-template",null,4,e.W1O),e.YNc(7,or,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))},directives:[We,W.a,Ee.K,l.O5,$.o,l.mk],pipes:[Ze.N],styles:[""]}),n})(),$t=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=e.oAB({type:n}),n.\u0275inj=e.cJS({imports:[[l.ez,ni,a.u5,a.UX,N.Oz,N.dT,N.HK,Ie.b,Ae.m,m.Bz,ne.xc]]}),n})();const ir=[{path:"",redirectTo:"rbd",pathMatch:"full"},{path:"rbd",canActivate:[U.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:ba},{path:"namespaces",component:xa,data:{breadcrumbs:"Namespaces"}},{path:"trash",component:nr,data:{breadcrumbs:"Trash"}},{path:"performance",component:wa,data:{breadcrumbs:"Overall Performance"}},{path:v.MQ.CREATE,component:$e,data:{breadcrumbs:v.Qn.CREATE}},{path:`${v.MQ.EDIT}/:image_spec`,component:$e,data:{breadcrumbs:v.Qn.EDIT}},{path:`${v.MQ.CLONE}/:image_spec/:snap`,component:$e,data:{breadcrumbs:v.Qn.CLONE}},{path:`${v.MQ.COPY}/:image_spec`,component:$e,data:{breadcrumbs:v.Qn.COPY}},{path:`${v.MQ.COPY}/:image_spec/:snap`,component:$e,data:{breadcrumbs:v.Qn.COPY}}]},{path:"mirroring",component:Vi,canActivate:[U.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:`${v.MQ.EDIT}/:pool_name`,component:es,outlet:"modal"}]},{path:"iscsi",canActivate:[U.T],data:{breadcrumbs:"iSCSI"},children:[{path:"",redirectTo:"overview",pathMatch:"full"},{path:"overview",component:oi,data:{breadcrumbs:"Overview"}},{path:"targets",data:{breadcrumbs:"Targets"},children:[{path:"",component:qn},{path:v.MQ.CREATE,component:ut,data:{breadcrumbs:v.Qn.CREATE}},{path:`${v.MQ.EDIT}/:target_iqn`,component:ut,data:{breadcrumbs:v.Qn.EDIT}}]}]}];let sr=(()=>{class n{}return n.\u0275fac=function(t){return new(t||n)},n.\u0275mod=e.oAB({type:n}),n.\u0275inj=e.cJS({imports:[[$t,m.Bz.forChild(ir)]]}),n})()},54555:(ct,Oe,p)=>{p.d(Oe,{d:()=>z});var l=p(74788),a=p(24751),m=p(23815),ne=p.n(m),N=p(80226),Ie=p(65862),v=p(95463),U=p(30633),re=p(28211),Ae=p(34089),be=p(41582),S=p(12057),le=p(56310),D=p(18372),ie=p(87925),V=p(94276);let e=(()=>{class A{constructor(u,C){this.control=u,this.formatter=C}setValue(u){const C=this.formatter.toMilliseconds(u);this.control.control.setValue(`${C} ms`)}ngOnInit(){this.setValue(this.control.value),this.ngDataReady&&this.ngDataReady.subscribe(()=>this.setValue(this.control.value))}onUpdate(u){this.setValue(u)}}return A.\u0275fac=function(u){return new(u||A)(l.Y36(a.a5),l.Y36(re.H))},A.\u0275dir=l.lG2({type:A,selectors:[["","cdMilliseconds",""]],hostBindings:function(u,C){1&u&&l.NdJ("blur",function(O){return C.onUpdate(O.target.value)})},inputs:{ngDataReady:"ngDataReady"}}),A})();var X=p(20044);let Ne=(()=>{class A{constructor(u,C,h,O){this.elementRef=u,this.control=C,this.dimlessBinaryPerSecondPipe=h,this.formatter=O,this.ngModelChange=new l.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 C=this.formatter.toBytes(u,0),h=this.round(C);this.el.value=this.dimlessBinaryPerSecondPipe.transform(h),null!==C?(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 C=Math.round(Math.log(u)/Math.log(this.roundPower));return Math.pow(this.roundPower,C)}}return u}onBlur(u){this.setValue(u)}}return A.\u0275fac=function(u){return new(u||A)(l.Y36(l.SBq),l.Y36(a.a5),l.Y36(X.O),l.Y36(re.H))},A.\u0275dir=l.lG2({type:A,selectors:[["","cdDimlessBinaryPerSecond",""]],hostBindings:function(u,C){1&u&&l.NdJ("blur",function(O){return C.onBlur(O.target.value)})},inputs:{ngDataReady:"ngDataReady",minBytes:"minBytes",maxBytes:"maxBytes",roundPower:"roundPower",defaultUnit:"defaultUnit"},outputs:{ngModelChange:"ngModelChange"}}),A})(),Fe=(()=>{class A{constructor(u,C){this.formatter=u,this.ngControl=C}setValue(u){const C=this.formatter.toIops(u);this.ngControl.control.setValue(`${C} IOPS`)}ngOnInit(){this.setValue(this.ngControl.value),this.ngDataReady&&this.ngDataReady.subscribe(()=>this.setValue(this.ngControl.value))}onUpdate(u){this.setValue(u)}}return A.\u0275fac=function(u){return new(u||A)(l.Y36(re.H),l.Y36(a.a5))},A.\u0275dir=l.lG2({type:A,selectors:[["","cdIops",""]],hostBindings:function(u,C){1&u&&l.NdJ("blur",function(O){return C.onUpdate(O.target.value)})},inputs:{ngDataReady:"ngDataReady"}}),A})();function L(A,R){if(1&A&&(l.ynx(0),l._UZ(1,"input",18),l.BQk()),2&A){const u=l.oxw().$implicit,C=l.oxw(2);l.xp6(1),l.Q6J("id",u.name)("name",u.name)("formControlName",u.name)("ngDataReady",C.ngDataReady)}}function he(A,R){if(1&A&&(l.ynx(0),l._UZ(1,"input",19),l.BQk()),2&A){const u=l.oxw().$implicit,C=l.oxw(2);l.xp6(1),l.Q6J("id",u.name)("name",u.name)("formControlName",u.name)("ngDataReady",C.ngDataReady)}}function q(A,R){if(1&A&&(l.ynx(0),l._UZ(1,"input",20),l.BQk()),2&A){const u=l.oxw().$implicit,C=l.oxw(2);l.xp6(1),l.Q6J("id",u.name)("name",u.name)("formControlName",u.name)("ngDataReady",C.ngDataReady)}}function F(A,R){1&A&&(l.TgZ(0,"span",21),l.SDv(1,22),l.qZA())}const y=function(A){return{active:A}},T=function(A){return[A]};function H(A,R){if(1&A){const u=l.EpF();l.TgZ(0,"div",10),l.TgZ(1,"label",11),l._uU(2),l.TgZ(3,"cd-helper"),l._uU(4),l.qZA(),l.qZA(),l.TgZ(5,"div"),l.TgZ(6,"div",12),l.ynx(7,13),l.YNc(8,L,2,4,"ng-container",14),l.YNc(9,he,2,4,"ng-container",14),l.YNc(10,q,2,4,"ng-container",14),l.BQk(),l.TgZ(11,"span",15),l.TgZ(12,"button",16),l.NdJ("click",function(){const O=l.CHM(u).$implicit;return l.oxw(2).reset(O.name)}),l._UZ(13,"i",7),l.qZA(),l.qZA(),l.qZA(),l.YNc(14,F,2,0,"span",17),l.qZA(),l.qZA()}if(2&A){const u=R.$implicit,C=l.oxw().$implicit,h=l.oxw(),O=l.MAs(1);l.xp6(1),l.Q6J("for",u.name),l.xp6(1),l.Oqu(u.displayName),l.xp6(2),l.Oqu(u.description),l.xp6(1),l.Gre("cd-col-form-input ",C.heading,""),l.xp6(2),l.Q6J("ngSwitch",u.type),l.xp6(1),l.Q6J("ngSwitchCase",h.configurationType.milliseconds),l.xp6(1),l.Q6J("ngSwitchCase",h.configurationType.bps),l.xp6(1),l.Q6J("ngSwitchCase",h.configurationType.iops),l.xp6(2),l.Q6J("ngClass",l.VKq(13,y,h.isDisabled(u.name))),l.xp6(1),l.Q6J("ngClass",l.VKq(15,T,h.icons.erase)),l.xp6(1),l.Q6J("ngIf",h.form.showError("configuration."+u.name,O,"min"))}}function x(A,R){if(1&A){const u=l.EpF();l.TgZ(0,"div",4),l.TgZ(1,"h4",5),l.TgZ(2,"span",6),l.NdJ("click",function(){const O=l.CHM(u).$implicit;return l.oxw().toggleSectionVisibility(O.class)}),l._uU(3),l._UZ(4,"i",7),l.qZA(),l.qZA(),l.TgZ(5,"div",8),l.YNc(6,H,15,17,"div",9),l.qZA(),l.qZA()}if(2&A){const u=R.$implicit,C=l.oxw();l.xp6(3),l.hij(" ",u.heading," "),l.xp6(1),l.Q6J("ngClass",C.sectionVisibility[u.class]?C.icons.minusCircle:C.icons.addCircle),l.xp6(1),l.Tol(u.class),l.Q6J("hidden",!C.sectionVisibility[u.class]),l.xp6(1),l.Q6J("ngForOf",u.options)}}let z=(()=>{class A{constructor(u,C){this.formatterService=u,this.rbdConfigurationService=C,this.initializeData=new N.t(1),this.changes=new l.vpe,this.icons=Ie.P,this.ngDataReady=new l.vpe,this.configurationType=U.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(C=>{this.initialData=C.initialData;const h=C.sourceType;this.rbdConfigurationService.getWritableOptionFields().forEach(O=>{const $=C.initialData.filter(k=>k.name===O.name).pop();$&&$.source===h&&this.form.get(`configuration.${O.name}`).setValue($.value)}),this.ngDataReady.emit()}),this.rbdConfigurationService.getWritableSections().forEach(C=>this.sectionVisibility[C.class]=!1)}getDirtyValues(u=!1,C){if(u&&!C)throw new Error("ProgrammingError: If local values shall be included, a proper localFieldType argument has to be provided, too");const h={};return this.rbdConfigurationService.getWritableOptionFields().forEach(O=>{const $=this.form.get("configuration").get(O.name);this.initialData&&this.initialData[O.name]===$.value||($.dirty||u&&$.source===C)&&(h[O.name]=null===$.value?$.value:O.type===U.r.bps?this.formatterService.toBytes($.value):O.type===U.r.milliseconds?this.formatterService.toMilliseconds($.value):O.type===U.r.iops?this.formatterService.toIops($.value):$.value)}),h}createConfigurationFormGroup(){const u=new v.d({});return this.rbdConfigurationService.getWritableOptionFields().forEach(C=>{let h;if(C.type!==U.r.milliseconds&&C.type!==U.r.iops&&C.type!==U.r.bps)throw new Error(`Type ${C.type} is unknown, you may need to add it to RbdConfiguration class`);{let O=0;ne().forEach(this.initialData,$=>{$.name===C.name&&(O=$.value)}),h=new a.NI(O,a.kI.min(0))}u.addControl(C.name,h)}),u}reset(u){const C=this.form.get("configuration").get(u);C.disabled?(C.setValue(C.previousValue||0),C.enable(),C.previousValue||C.markAsPristine()):(C.previousValue=C.value,C.setValue(null),C.markAsDirty(),C.disable())}isDisabled(u){return this.form.get("configuration").get(u).disabled}toggleSectionVisibility(u){this.sectionVisibility[u]=!this.sectionVisibility[u]}}return A.\u0275fac=function(u){return new(u||A)(l.Y36(re.H),l.Y36(Ae.n))},A.\u0275cmp=l.Xpm({type:A,selectors:[["cd-rbd-configuration-form"]],inputs:{form:"form",initializeData:"initializeData"},outputs:{changes:"changes"},decls:5,vars:2,consts:function(){let R,u,C;return R="RBD Configuration",u="Remove the local configuration value. The parent configuration value will be inherited and used instead.",C="The minimum value is 0",[[3,"formGroup"],["cfgFormGroup",""],R,["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"],[1,"input-group-append"],["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"],C]},template:function(u,C){1&u&&(l.TgZ(0,"fieldset",0,1),l.TgZ(2,"legend"),l.SDv(3,2),l.qZA(),l.YNc(4,x,7,7,"div",3),l.qZA()),2&u&&(l.Q6J("formGroup",C.form.get("configuration")),l.xp6(4),l.Q6J("ngForOf",C.rbdConfigurationService.sections))},directives:[a.JL,a.sg,be.V,S.sg,S.mk,le.P,D.S,S.RF,S.n9,ie.o,S.O5,a.Fj,V.b,e,a.JJ,a.u,Ne,Fe],styles:[".collapsible[_ngcontent-%COMP%]{cursor:pointer;user-select:none}"]}),A})()},71752:(ct,Oe,p)=>{p.d(Oe,{P:()=>q});var l=p(35905),a=p(30633),m=p(74788);let ne=(()=>{class F{transform(T){return{0:"global",1:"pool",2:"image"}[T]}}return F.\u0275fac=function(T){return new(T||F)},F.\u0275pipe=m.Yjl({name:"rbdConfigurationSource",type:F,pure:!0}),F})();var N=p(28211),Ie=p(34089),v=p(12057),U=p(20044),re=p(48537),Ae=p(21766);const be=["configurationSourceTpl"],S=["configurationValueTpl"],le=["poolConfTable"];function D(F,y){1&F&&(m.TgZ(0,"span"),m.SDv(1,6),m.qZA())}function ie(F,y){1&F&&(m.TgZ(0,"strong"),m.SDv(1,7),m.qZA())}function V(F,y){1&F&&(m.TgZ(0,"strong"),m.SDv(1,8),m.qZA())}function e(F,y){1&F&&(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&F&&(m.Q6J("ngSwitch",y.value),m.xp6(1),m.Q6J("ngSwitchCase","global"),m.xp6(1),m.Q6J("ngSwitchCase","image"),m.xp6(1),m.Q6J("ngSwitchCase","pool"))}function X(F,y){if(1&F&&(m.TgZ(0,"span"),m._uU(1),m.ALo(2,"dimlessBinaryPerSecond"),m.qZA()),2&F){const T=m.oxw().value;m.xp6(1),m.Oqu(m.lcZ(2,1,T))}}function Ne(F,y){if(1&F&&(m.TgZ(0,"span"),m._uU(1),m.ALo(2,"milliseconds"),m.qZA()),2&F){const T=m.oxw().value;m.xp6(1),m.Oqu(m.lcZ(2,1,T))}}function Fe(F,y){if(1&F&&(m.TgZ(0,"span"),m._uU(1),m.ALo(2,"iops"),m.qZA()),2&F){const T=m.oxw().value;m.xp6(1),m.Oqu(m.lcZ(2,1,T))}}function L(F,y){if(1&F&&(m.TgZ(0,"span"),m._uU(1),m.qZA()),2&F){const T=m.oxw().value;m.xp6(1),m.Oqu(T)}}function he(F,y){if(1&F&&(m.TgZ(0,"div",4),m.YNc(1,X,3,3,"span",5),m.YNc(2,Ne,3,3,"span",5),m.YNc(3,Fe,3,3,"span",5),m.YNc(4,L,2,1,"span",9),m.qZA()),2&F){const T=y.row,H=m.oxw();m.Q6J("ngSwitch",T.type),m.xp6(1),m.Q6J("ngSwitchCase",H.typeField.bps),m.xp6(1),m.Q6J("ngSwitchCase",H.typeField.milliseconds),m.xp6(1),m.Q6J("ngSwitchCase",H.typeField.iops)}}let q=(()=>{class F{constructor(T,H){this.formatterService=T,this.rbdConfigurationService=H,this.sourceField=a.h,this.typeField=a.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(H=>H.name).includes(T.name)))}}return F.\u0275fac=function(T){return new(T||F)(m.Y36(N.H),m.Y36(Ie.n))},F.\u0275cmp=m.Xpm({type:F,selectors:[["cd-rbd-configuration-table"]],viewQuery:function(T,H){if(1&T&&(m.Gf(be,7),m.Gf(S,7),m.Gf(le,7)),2&T){let x;m.iGM(x=m.CRH())&&(H.configurationSourceTpl=x.first),m.iGM(x=m.CRH())&&(H.configurationValueTpl=x.first),m.iGM(x=m.CRH())&&(H.poolConfTable=x.first)}},inputs:{data:"data"},features:[m.TTD],decls:6,vars:2,consts:function(){let y,T,H;return y="Global",T="Image",H="Pool",[["identifier","name",3,"data","columns"],["poolConfTable",""],["configurationSourceTpl",""],["configurationValueTpl",""],[3,"ngSwitch"],[4,"ngSwitchCase"],y,T,H,[4,"ngSwitchDefault"]]},template:function(T,H){1&T&&(m._UZ(0,"cd-table",0,1),m.YNc(2,e,4,4,"ng-template",null,2,m.W1O),m.YNc(4,he,5,4,"ng-template",null,3,m.W1O)),2&T&&m.Q6J("data",H.data)("columns",H.poolConfigurationColumns)},directives:[l.a,v.RF,v.n9,v.ED],pipes:[U.O,re.J,Ae.A],styles:[""]}),F})()}}]);