]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/dist/en-US/1.0f6133f836c4310d2d34.js
update dh_systemd restart patch for pacific
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / dist / en-US / 1.0f6133f836c4310d2d34.js
1 (window.webpackJsonp=window.webpackJsonp||[]).push([[1],{aAWM:function(e,t,a){"use strict";a.d(t,"a",(function(){return M}));var i=a("uIqm"),o=a("PhyI"),s=a("8Y7J");let n=(()=>{class e{transform(e){return{0:"global",1:"pool",2:"image"}[e]}}return e.\u0275fac=function(t){return new(t||e)},e.\u0275pipe=s.Lb({name:"rbdConfigurationSource",type:e,pure:!0}),e})();var r=a("aXbf"),c=a("o8EM"),l=a("SVse"),b=a("IzCI"),d=a("dEH0"),p=a("BQkM");const m=["configurationSourceTpl"],u=["configurationValueTpl"],f=["poolConfTable"];function h(e,t){1&e&&(s.Sb(0,"span"),s.Wb(1,6),s.Rb())}function g(e,t){1&e&&(s.Sb(0,"strong"),s.Wb(1,7),s.Rb())}function S(e,t){1&e&&(s.Sb(0,"strong"),s.Wb(1,8),s.Rb())}function v(e,t){1&e&&(s.Sb(0,"div",4),s.Mc(1,h,2,0,"span",5),s.Mc(2,g,2,0,"strong",5),s.Mc(3,S,2,0,"strong",5),s.Rb()),2&e&&(s.pc("ngSwitch",t.value),s.yb(1),s.pc("ngSwitchCase","global"),s.yb(1),s.pc("ngSwitchCase","image"),s.yb(1),s.pc("ngSwitchCase","pool"))}function y(e,t){if(1&e&&(s.Sb(0,"span"),s.Oc(1),s.jc(2,"dimlessBinaryPerSecond"),s.Rb()),2&e){const e=s.ic().value;s.yb(1),s.Pc(s.kc(2,1,e))}}function R(e,t){if(1&e&&(s.Sb(0,"span"),s.Oc(1),s.jc(2,"milliseconds"),s.Rb()),2&e){const e=s.ic().value;s.yb(1),s.Pc(s.kc(2,1,e))}}function w(e,t){if(1&e&&(s.Sb(0,"span"),s.Oc(1),s.jc(2,"iops"),s.Rb()),2&e){const e=s.ic().value;s.yb(1),s.Pc(s.kc(2,1,e))}}function _(e,t){if(1&e&&(s.Sb(0,"span"),s.Oc(1),s.Rb()),2&e){const e=s.ic().value;s.yb(1),s.Pc(e)}}function k(e,t){if(1&e&&(s.Sb(0,"div",4),s.Mc(1,y,3,3,"span",5),s.Mc(2,R,3,3,"span",5),s.Mc(3,w,3,3,"span",5),s.Mc(4,_,2,1,"span",9),s.Rb()),2&e){const e=t.row,a=s.ic();s.pc("ngSwitch",e.type),s.yb(1),s.pc("ngSwitchCase",a.typeField.bps),s.yb(1),s.pc("ngSwitchCase",a.typeField.milliseconds),s.yb(1),s.pc("ngSwitchCase",a.typeField.iops)}}let M=(()=>{class e{constructor(e,t){this.formatterService=e,this.rbdConfigurationService=t,this.sourceField=o.a,this.typeField=o.b}ngOnInit(){this.poolConfigurationColumns=[{prop:"displayName",name:"Name"},{prop:"description",name:"Description"},{prop:"name",name:"Key"},{prop:"source",name:"Source",cellTemplate:this.configurationSourceTpl,pipe:new n},{prop:"value",name:"Value",cellTemplate:this.configurationValueTpl}]}ngOnChanges(){this.data&&(this.data=this.data.filter(e=>this.rbdConfigurationService.getOptionFields().map(e=>e.name).includes(e.name)))}}return e.\u0275fac=function(t){return new(t||e)(s.Mb(r.a),s.Mb(c.a))},e.\u0275cmp=s.Gb({type:e,selectors:[["cd-rbd-configuration-table"]],viewQuery:function(e,t){var a;1&e&&(s.Jc(m,!0),s.Jc(u,!0),s.Jc(f,!0)),2&e&&(s.zc(a=s.hc())&&(t.configurationSourceTpl=a.first),s.zc(a=s.hc())&&(t.configurationValueTpl=a.first),s.zc(a=s.hc())&&(t.poolConfTable=a.first))},inputs:{data:"data"},features:[s.wb],decls:6,vars:2,consts:function(){return[["identifier","name",3,"data","columns"],["poolConfTable",""],["configurationSourceTpl",""],["configurationValueTpl",""],[3,"ngSwitch"],[4,"ngSwitchCase"],"Global","Image","Pool",[4,"ngSwitchDefault"]]},template:function(e,t){1&e&&(s.Nb(0,"cd-table",0,1),s.Mc(2,v,4,4,"ng-template",null,2,s.Nc),s.Mc(4,k,5,4,"ng-template",null,3,s.Nc)),2&e&&s.pc("data",t.data)("columns",t.poolConfigurationColumns)},directives:[i.a,l.t,l.u,l.v],pipes:[b.a,d.a,p.a],styles:[""]}),e})()},"k/xb":function(e,t,a){"use strict";a.r(t),a.d(t,"BlockModule",(function(){return sn})),a.d(t,"RoutedBlockModule",(function(){return rn}));var i=a("SVse"),o=a("s7LF"),s=a("iInd"),n=a("ohO+"),r=a("G0yt"),c=a("zWsK"),l=a("sne2"),b=a("Vhfg"),d=a("PCNd"),p=a("LvDl"),m=a.n(p),u=a("cp0P"),f=a("mrSG"),h=a("IheW"),g=a("xTzq"),S=a("8Y7J");let v=(()=>{let e=class{constructor(e){this.http=e}listTargets(){return this.http.get("api/iscsi/target")}getTarget(e){return this.http.get("api/iscsi/target/"+e)}updateTarget(e,t){return this.http.put("api/iscsi/target/"+e,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(e){return this.http.post("api/iscsi/target",e,{observe:"response"})}deleteTarget(e){return this.http.delete("api/iscsi/target/"+e,{observe:"response"})}getDiscovery(){return this.http.get("api/iscsi/discoveryauth")}updateDiscovery(e){return this.http.put("api/iscsi/discoveryauth",e)}overview(){return this.http.get("ui-api/iscsi/overview")}};return e.\u0275fac=function(t){return new(t||e)(S.dc(h.b))},e.\u0275prov=S.Ib({token:e,factory:e.\u0275fac,providedIn:"root"}),e=Object(f.b)([g.a,Object(f.d)("design:paramtypes",[h.b])],e),e})();var y=a("lJxs"),R=a("jVDg"),w=a("o8EM");let _=(()=>{let e=class{constructor(e,t){this.http=e,this.rbdConfigurationService=t}isRBDPool(e){return-1!==m.a.indexOf(e.application_metadata,"rbd")&&!e.pool_name.includes("/")}create(e){return this.http.post("api/block/image",e,{observe:"response"})}delete(e){return this.http.delete("api/block/image/"+e.toStringEncoded(),{observe:"response"})}update(e,t){return this.http.put("api/block/image/"+e.toStringEncoded(),t,{observe:"response"})}get(e){return this.http.get("api/block/image/"+e.toStringEncoded())}list(){return this.http.get("api/block/image").pipe(Object(y.a)(e=>e.map(e=>(e.value.map(e=>e.configuration?(e.configuration.map(e=>Object.assign(e,this.rbdConfigurationService.getOptionByName(e.name))),e):e),e))))}copy(e,t){return this.http.post(`api/block/image/${e.toStringEncoded()}/copy`,t,{observe:"response"})}flatten(e){return this.http.post(`api/block/image/${e.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(e,t){const a={snapshot_name:t};return this.http.post(`api/block/image/${e.toStringEncoded()}/snap`,a,{observe:"response"})}renameSnapshot(e,t,a){const i={new_snap_name:a};return this.http.put(`api/block/image/${e.toStringEncoded()}/snap/${t}`,i,{observe:"response"})}protectSnapshot(e,t,a){const i={is_protected:a};return this.http.put(`api/block/image/${e.toStringEncoded()}/snap/${t}`,i,{observe:"response"})}rollbackSnapshot(e,t){return this.http.post(`api/block/image/${e.toStringEncoded()}/snap/${t}/rollback`,null,{observe:"response"})}cloneSnapshot(e,t,a){return this.http.post(`api/block/image/${e.toStringEncoded()}/snap/${t}/clone`,a,{observe:"response"})}deleteSnapshot(e,t){return this.http.delete(`api/block/image/${e.toStringEncoded()}/snap/${t}`,{observe:"response"})}listTrash(){return this.http.get("api/block/image/trash/")}createNamespace(e,t){return this.http.post(`api/block/pool/${e}/namespace`,{namespace:t},{observe:"response"})}listNamespaces(e){return this.http.get(`api/block/pool/${e}/namespace/`)}deleteNamespace(e,t){return this.http.delete(`api/block/pool/${e}/namespace/${t}`,{observe:"response"})}moveTrash(e,t){return this.http.post(`api/block/image/${e.toStringEncoded()}/move_trash`,{delay:t},{observe:"response"})}purgeTrash(e){return this.http.post("api/block/image/trash/purge/?pool_name="+e,null,{observe:"response"})}restoreTrash(e,t){return this.http.post(`api/block/image/trash/${e.toStringEncoded()}/restore`,{new_image_name:t},{observe:"response"})}removeTrash(e,t=!1){return this.http.delete(`api/block/image/trash/${e.toStringEncoded()}/?force=${t}`,{observe:"response"})}};return e.\u0275fac=function(t){return new(t||e)(S.dc(h.b),S.dc(w.a))},e.\u0275prov=S.Ib({token:e,factory:e.\u0275fac,providedIn:"root"}),Object(f.b)([Object(f.e)(1,g.b),Object(f.d)("design:type",Function),Object(f.d)("design:paramtypes",[R.a,String]),Object(f.d)("design:returntype",void 0)],e.prototype,"createSnapshot",null),Object(f.b)([Object(f.e)(2,g.b),Object(f.d)("design:type",Function),Object(f.d)("design:paramtypes",[R.a,String,String]),Object(f.d)("design:returntype",void 0)],e.prototype,"renameSnapshot",null),Object(f.b)([Object(f.e)(2,g.b),Object(f.d)("design:type",Function),Object(f.d)("design:paramtypes",[R.a,String,Boolean]),Object(f.d)("design:returntype",void 0)],e.prototype,"protectSnapshot",null),Object(f.b)([Object(f.e)(1,g.b),Object(f.d)("design:type",Function),Object(f.d)("design:paramtypes",[R.a,String]),Object(f.d)("design:returntype",void 0)],e.prototype,"restoreTrash",null),e=Object(f.b)([g.a,Object(f.d)("design:paramtypes",[h.b,w.a])],e),e})();var k=a("DNAf"),M=a("a96k"),N=a("oxzT"),I=a("spCT"),$=a("QFaf"),T=a("1Ni5"),F=a("kvvV"),P=a("JK/P"),z=a("kn/O"),E=a("ajRT"),C=a("NwgZ"),D=a("ocLN"),O=a("ANnk"),A=a("f69J"),x=a("6+kj");function V(e,t){if(1&e&&(S.Sb(0,"option",6),S.Oc(1),S.Rb()),2&e){const e=t.$implicit;S.pc("ngValue",e),S.yb(1),S.Pc(e)}}function W(e,t){if(1&e&&(S.Sb(0,"select",5),S.Nb(1,"option",6),S.Mc(2,V,2,2,"option",7),S.Rb()),2&e){const e=S.ic();S.qc("id",e.setting),S.qc("name",e.setting),S.pc("formControlName",e.setting),S.yb(1),S.pc("ngValue",null),S.yb(1),S.pc("ngForOf",e.limits.values)}}function q(e,t){if(1&e&&S.Nb(0,"input",10),2&e){const e=S.ic(2);S.pc("formControlName",e.setting)}}function B(e,t){if(1&e&&S.Nb(0,"input",11),2&e){const e=S.ic(2);S.pc("formControlName",e.setting)}}function G(e,t){if(1&e&&(S.Qb(0),S.Nb(1,"br"),S.Sb(2,"div",12),S.Nb(3,"input",13),S.Sb(4,"label",14),S.Oc(5,"Yes"),S.Rb(),S.Rb(),S.Sb(6,"div",12),S.Nb(7,"input",13),S.Sb(8,"label",14),S.Oc(9,"No"),S.Rb(),S.Rb(),S.Pb()),2&e){const e=S.ic(2);S.yb(3),S.pc("id",e.setting+"True")("value",!0)("formControlName",e.setting),S.yb(1),S.pc("for",e.setting+"True"),S.yb(3),S.pc("id",e.setting+"False")("value",!1)("formControlName",e.setting),S.yb(1),S.pc("for",e.setting+"False")}}function L(e,t){if(1&e&&(S.Sb(0,"span"),S.Mc(1,q,1,1,"input",8),S.Mc(2,B,1,1,"input",9),S.Mc(3,G,10,8,"ng-container",3),S.Rb()),2&e){const e=S.ic();S.yb(1),S.pc("ngIf","int"===e.limits.type),S.yb(1),S.pc("ngIf","str"===e.limits.type),S.yb(1),S.pc("ngIf","bool"===e.limits.type)}}function j(e,t){if(1&e&&(S.Sb(0,"span",15),S.Qb(1),S.Wb(2,16),S.Pb(),S.Rb()),2&e){const e=S.ic();S.yb(2),S.ac(e.limits.min),S.Xb(2)}}function Q(e,t){if(1&e&&(S.Sb(0,"span",15),S.Qb(1),S.Wb(2,17),S.Pb(),S.Rb()),2&e){const e=S.ic();S.yb(2),S.ac(e.limits.max),S.Xb(2)}}let U=(()=>{class e{ngOnInit(){const e=[];"min"in this.limits&&e.push(o.A.min(this.limits.min)),"max"in this.limits&&e.push(o.A.max(this.limits.max)),this.settingsForm.get(this.setting).setValidators(e)}}return e.\u0275fac=function(t){return new(t||e)},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-iscsi-setting"]],inputs:{settingsForm:"settingsForm",formDir:"formDir",setting:"setting",limits:"limits"},decls:7,vars:7,consts:function(){return[[1,"form-group",3,"formGroup"],[1,"col-form-label",3,"for"],["class","form-control custom-select",3,"id","name","formControlName",4,"ngIf"],[4,"ngIf"],["class","invalid-feedback",4,"ngIf"],[1,"form-control","custom-select",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"],"Must be greater than or equal to " + "\ufffd0\ufffd" + ".","Must be less than or equal to " + "\ufffd0\ufffd" + "."]},template:function(e,t){1&e&&(S.Sb(0,"div",0),S.Sb(1,"label",1),S.Oc(2),S.Rb(),S.Mc(3,W,3,5,"select",2),S.Mc(4,L,4,3,"span",3),S.Mc(5,j,3,1,"span",4),S.Mc(6,Q,3,1,"span",4),S.Rb()),2&e&&(S.pc("formGroup",t.settingsForm),S.yb(1),S.qc("for",t.setting),S.yb(1),S.Pc(t.setting),S.yb(1),S.pc("ngIf","enum"===t.limits.type),S.yb(1),S.pc("ngIf","enum"!==t.limits.type),S.yb(1),S.pc("ngIf",t.settingsForm.showError(t.setting,t.formDir,"min")),S.yb(1),S.pc("ngIf",t.settingsForm.showError(t.setting,t.formDir,"max")))},directives:[D.a,o.r,o.k,C.a,i.r,O.a,o.z,A.a,o.q,o.i,o.u,o.B,i.q,o.v,o.d,o.w],styles:[""]}),e})();var Y=a("uYzU");function K(e,t){1&e&&(S.Sb(0,"span",29),S.Wb(1,30),S.Rb())}function J(e,t){if(1&e&&(S.Sb(0,"span"),S.Sb(1,"legend",10),S.Wb(2,21),S.Rb(),S.Sb(3,"div",12),S.Sb(4,"div",13),S.Sb(5,"label",22),S.Wb(6,23),S.Rb(),S.Nb(7,"input",24),S.Mc(8,K,2,0,"span",25),S.Rb(),S.Rb(),S.Sb(9,"div",12),S.Sb(10,"div",13),S.Sb(11,"label",26),S.Wb(12,27),S.Rb(),S.Nb(13,"input",28),S.Rb(),S.Rb(),S.Rb()),2&e){const e=S.ic(),t=S.Ac(9);S.yb(8),S.pc("ngIf",e.settingsForm.showError("lun",t,"required"))}}function X(e,t){if(1&e&&(S.Sb(0,"option",31),S.Oc(1),S.jc(2,"iscsiBackstore"),S.Rb()),2&e){const e=t.$implicit;S.pc("value",e),S.yb(1),S.Pc(S.kc(2,2,e))}}function H(e,t){if(1&e&&(S.Sb(0,"div",12),S.Sb(1,"div",13),S.Nb(2,"cd-iscsi-setting",33),S.Rb(),S.Rb()),2&e){const e=t.$implicit,a=S.ic(2).$implicit,i=S.ic(),o=S.Ac(9);S.yb(2),S.pc("settingsForm",i.settingsForm)("formDir",o)("setting",e.key)("limits",i.getDiskControlLimits(a,e.key))}}function Z(e,t){if(1&e&&(S.Qb(0),S.Mc(1,H,3,4,"div",32),S.jc(2,"keyvalue"),S.Pb()),2&e){const e=S.ic().$implicit,t=S.ic();S.yb(1),S.pc("ngForOf",S.kc(2,1,t.disk_default_controls[e]))}}function ee(e,t){if(1&e&&(S.Qb(0),S.Mc(1,Z,3,3,"ng-container",9),S.Pb()),2&e){const e=t.$implicit,a=S.ic();S.yb(1),S.pc("ngIf",a.settingsForm.value.backstore===e)}}let te=(()=>{class e{constructor(e,t,a){this.activeModal=e,this.iscsiService=t,this.actionLabels=a}ngOnInit(){const e={backstore:new o.h(this.imagesSettings[this.image].backstore),lun:new o.h(this.imagesSettings[this.image].lun),wwn:new o.h(this.imagesSettings[this.image].wwn)};m.a.forEach(this.backstores,t=>{const a=this.imagesSettings[this.image][t]||{};m.a.forIn(this.disk_default_controls[t],(t,i)=>{e[i]=new o.h(a[i])})}),this.settingsForm=new $.a(e)}getDiskControlLimits(e,t){return this.disk_controls_limits?this.disk_controls_limits[e][t]:{type:"int"}}save(){const e=this.settingsForm.controls.backstore.value,t=this.settingsForm.controls.lun.value,a=this.settingsForm.controls.wwn.value,i={};m.a.forIn(this.settingsForm.controls,(t,a)=>{""!==t.value&&null!==t.value&&a in this.disk_default_controls[this.settingsForm.value.backstore]&&(i[a]=t.value,m.a.forEach(this.backstores,i=>{i!==e&&a in(this.imagesSettings[this.image][i]||{})&&(this.imagesSettings[this.image][i][a]=t.value)}))}),this.imagesSettings[this.image].backstore=e,this.imagesSettings[this.image].lun=t,this.imagesSettings[this.image].wwn=a,this.imagesSettings[this.image][e]=i,this.imagesSettings=Object.assign({},this.imagesSettings),this.control.updateValueAndValidity({emitEvent:!1}),this.activeModal.close()}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(r.a),S.Mb(v),S.Mb(l.b))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-iscsi-target-image-settings-modal"]],decls:25,vars:8,consts:function(){return[[3,"modalRef"],[1,"modal-title"],"Configure",[1,"modal-content"],["name","settingsForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"alert-warning"],"Changing these parameters from their default values is usually not necessary.",[4,"ngIf"],[1,"cd-header"],"Settings",[1,"form-group","row"],[1,"col-sm-12"],[1,"col-form-label"],"Backstore",["id","backstore","name","backstore","formControlName","backstore",1,"form-control","custom-select"],[3,"value",4,"ngFor","ngForOf"],[4,"ngFor","ngForOf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],"Identifier",["for","lun",1,"col-form-label","required"],"lun",["type","number","id","lun","name","lun","formControlName","lun",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["for","wwn",1,"col-form-label"],"wwn",["type","text","id","wwn","name","wwn","formControlName","wwn",1,"form-control"],[1,"invalid-feedback"],"This field is required.",[3,"value"],["class","form-group row",4,"ngFor","ngForOf"],[3,"settingsForm","formDir","setting","limits"]]},template:function(e,t){1&e&&(S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Qb(2),S.Wb(3,2),S.Pb(),S.Oc(4,"\xa0 "),S.Sb(5,"small"),S.Oc(6),S.Rb(),S.Pb(),S.Qb(7,3),S.Sb(8,"form",4,5),S.Sb(10,"div",6),S.Sb(11,"p",7),S.Wb(12,8),S.Rb(),S.Mc(13,J,14,1,"span",9),S.Sb(14,"legend",10),S.Wb(15,11),S.Rb(),S.Sb(16,"div",12),S.Sb(17,"div",13),S.Sb(18,"label",14),S.Wb(19,15),S.Rb(),S.Sb(20,"select",16),S.Mc(21,X,3,4,"option",17),S.Rb(),S.Rb(),S.Rb(),S.Mc(22,ee,2,1,"ng-container",18),S.Rb(),S.Sb(23,"div",19),S.Sb(24,"cd-form-button-panel",20),S.gc("submitActionEvent",(function(){return t.save()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e&&(S.pc("modalRef",t.activeModal),S.yb(6),S.Pc(t.image),S.yb(2),S.pc("formGroup",t.settingsForm),S.yb(5),S.pc("ngIf",t.api_version>=1),S.yb(8),S.pc("ngForOf",t.backstores),S.yb(1),S.pc("ngForOf",t.backstores),S.yb(2),S.pc("form",t.settingsForm)("submitText",t.actionLabels.UPDATE))},directives:[E.a,o.C,o.r,o.k,C.a,i.r,D.a,O.a,o.z,A.a,o.q,o.i,i.q,x.a,o.v,o.d,o.u,o.B,U],pipes:[Y.a,i.k],styles:[""]}),e})();function ae(e,t){if(1&e&&(S.Sb(0,"div",12),S.Sb(1,"div",13),S.Nb(2,"cd-iscsi-setting",14),S.Rb(),S.Rb()),2&e){const e=t.$implicit,a=S.ic(),i=S.Ac(5);S.yb(2),S.pc("settingsForm",a.settingsForm)("formDir",i)("setting",e.key)("limits",a.getTargetControlLimits(e.key))}}let ie=(()=>{class e{constructor(e,t,a){this.activeModal=e,this.iscsiService=t,this.actionLabels=a}ngOnInit(){const e={};m.a.forIn(this.target_default_controls,(t,a)=>{e[a]=new o.h(this.target_controls.value[a])}),this.settingsForm=new $.a(e)}save(){const e={};m.a.forIn(this.settingsForm.controls,(t,a)=>{""!==t.value&&null!==t.value&&(e[a]=t.value)}),this.target_controls.setValue(e),this.activeModal.close()}getTargetControlLimits(e){return this.target_controls_limits?this.target_controls_limits[e]:["Yes","No"].includes(this.target_default_controls[e])?{type:"bool"}:{type:"int"}}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(r.a),S.Mb(v),S.Mb(l.b))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-iscsi-target-iqn-settings-modal"]],decls:13,vars:7,consts:function(){return[[3,"modalRef"],[1,"modal-title"],"Advanced Settings",[1,"modal-content"],["name","settingsForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"alert-warning"],"Changing these parameters from their default values is usually not necessary.",["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(e,t){1&e&&(S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Wb(2,2),S.Pb(),S.Qb(3,3),S.Sb(4,"form",4,5),S.Sb(6,"div",6),S.Sb(7,"p",7),S.Wb(8,8),S.Rb(),S.Mc(9,ae,3,4,"div",9),S.jc(10,"keyvalue"),S.Rb(),S.Sb(11,"div",10),S.Sb(12,"cd-form-button-panel",11),S.gc("submitActionEvent",(function(){return t.save()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e&&(S.pc("modalRef",t.activeModal),S.yb(4),S.pc("formGroup",t.settingsForm),S.yb(5),S.pc("ngForOf",S.kc(10,5,t.settingsForm.controls)),S.yb(3),S.pc("form",t.settingsForm)("submitText",t.actionLabels.UPDATE))},directives:[E.a,o.C,o.r,o.k,C.a,i.q,x.a,D.a,U],pipes:[i.k],styles:[""]}),e})();var oe=a("zc8c");let se=(()=>{class e{constructor(e){this.ngControl=e}onInput(e){this.setValue(e)}setValue(e){e=m.a.isString(e)?e.trim():e,this.ngControl.control.setValue(e)}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(o.p))},e.\u0275dir=S.Hb({type:e,selectors:[["","cdTrim",""]],hostBindings:function(e,t){1&e&&S.gc("input",(function(e){return t.onInput(e.target.value)}))}}),e})();var ne=a("wnGv"),re=a("D4zM"),ce=a("cEzo"),le=a("8xTl");function be(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,42),S.Rb())}function de(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,43),S.Rb())}function pe(e,t){1&e&&(S.Sb(0,"span",41),S.Qb(1),S.Wb(2,44),S.Pb(),S.Nb(3,"br"),S.Qb(4),S.Wb(5,45),S.Pb(),S.Nb(6,"br"),S.Sb(7,"a",46),S.Wb(8,47),S.Rb(),S.Rb())}function me(e,t){1&e&&(S.Sb(0,"span",48),S.Wb(1,49),S.Rb())}const ue=function(e){return[e]};function fe(e,t){if(1&e){const e=S.Tb();S.Qb(0),S.Sb(1,"div",50),S.Nb(2,"input",51),S.Sb(3,"span",14),S.Sb(4,"button",52),S.gc("click",(function(){S.Dc(e);const a=t.index,i=t.$implicit;return S.ic(2).removePortal(a,i)})),S.Nb(5,"i",16),S.Rb(),S.Rb(),S.Rb(),S.Pb()}if(2&e){const e=t.$implicit,a=S.ic(2);S.yb(2),S.pc("value",e),S.yb(3),S.pc("ngClass",S.uc(2,ue,a.icons.destroy))}}function he(e,t){if(1&e&&(S.Sb(0,"span",41),S.Wb(1,53),S.Rb()),2&e){const e=S.ic(2);S.yb(1),S.ac(e.minimum_gateways),S.Xb(1)}}function ge(e,t){if(1&e&&(S.Sb(0,"div",56),S.Oc(1),S.Rb()),2&e){const e=S.ic().$implicit,t=S.ic(2);S.yb(1),S.Qc("lun: ",t.imagesSettings[e].lun,"")}}function Se(e,t){if(1&e&&(S.Qb(0),S.Wb(1,57),S.jc(2,"iscsiBackstore"),S.Pb()),2&e){const e=S.ic().$implicit,t=S.ic(2);S.yb(2),S.ac(S.kc(2,1,t.imagesSettings[e].backstore)),S.Xb(1)}}function ve(e,t){1&e&&(S.Qb(0),S.Wb(1,58),S.Pb())}function ye(e,t){if(1&e){const e=S.Tb();S.Qb(0),S.Sb(1,"div",50),S.Nb(2,"input",51),S.Sb(3,"span",14),S.Mc(4,ge,2,1,"div",54),S.Sb(5,"button",52),S.gc("click",(function(){S.Dc(e);const a=t.$implicit;return S.ic(2).imageSettingsModal(a)})),S.Nb(6,"i",16),S.Rb(),S.Sb(7,"button",52),S.gc("click",(function(){S.Dc(e);const a=t.index,i=t.$implicit;return S.ic(2).removeImage(a,i)})),S.Nb(8,"i",16),S.Rb(),S.Rb(),S.Rb(),S.Sb(9,"span",48),S.Mc(10,Se,3,3,"ng-container",55),S.Mc(11,ve,2,0,"ng-container",55),S.Rb(),S.Pb()}if(2&e){const e=t.$implicit,a=S.ic(2);S.yb(2),S.pc("value",e),S.yb(2),S.pc("ngIf",a.api_version>=1),S.yb(2),S.pc("ngClass",S.uc(6,ue,a.icons.deepCheck)),S.yb(2),S.pc("ngClass",S.uc(8,ue,a.icons.destroy)),S.yb(2),S.pc("ngIf",a.backstores.length>1),S.yb(1),S.pc("ngIf",a.hasAdvancedSettings(a.imagesSettings[e][a.imagesSettings[e].backstore]))}}function Re(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,59),S.Rb())}function we(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,60),S.Rb())}function _e(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,78),S.Rb())}function ke(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,79),S.Rb())}function Me(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,80),S.Rb())}function Ne(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,81),S.Rb())}function Ie(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,82),S.Rb())}function $e(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,83),S.Rb())}function Te(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,84),S.Rb())}function Fe(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,85),S.Rb())}function Pe(e,t){if(1&e&&(S.Sb(0,"div",61),S.Sb(1,"div",8),S.Sb(2,"label",62),S.Qb(3),S.Wb(4,63),S.Pb(),S.Rb(),S.Sb(5,"div",11),S.Nb(6,"input",64),S.Mc(7,_e,2,0,"span",17),S.Mc(8,ke,2,0,"span",17),S.Rb(),S.Rb(),S.Sb(9,"div",8),S.Sb(10,"label",65),S.Qb(11),S.Wb(12,66),S.Pb(),S.Rb(),S.Sb(13,"div",11),S.Sb(14,"div",12),S.Nb(15,"input",67),S.Sb(16,"span",14),S.Nb(17,"button",68),S.Nb(18,"cd-copy-2-clipboard-button",69),S.Rb(),S.Rb(),S.Mc(19,Me,2,0,"span",17),S.Mc(20,Ne,2,0,"span",17),S.Rb(),S.Rb(),S.Sb(21,"div",8),S.Sb(22,"label",70),S.Qb(23),S.Wb(24,71),S.Pb(),S.Rb(),S.Sb(25,"div",11),S.Nb(26,"input",72),S.Mc(27,Ie,2,0,"span",17),S.Mc(28,$e,2,0,"span",17),S.Rb(),S.Rb(),S.Sb(29,"div",8),S.Sb(30,"label",73),S.Qb(31),S.Wb(32,74),S.Pb(),S.Rb(),S.Sb(33,"div",11),S.Sb(34,"div",12),S.Nb(35,"input",75),S.Sb(36,"span",14),S.Nb(37,"button",76),S.Nb(38,"cd-copy-2-clipboard-button",77),S.Rb(),S.Rb(),S.Mc(39,Te,2,0,"span",17),S.Mc(40,Fe,2,0,"span",17),S.Rb(),S.Rb(),S.Rb()),2&e){S.ic();const e=S.Ac(2),t=S.ic();S.yb(7),S.pc("ngIf",t.targetForm.showError("user",e,"required")),S.yb(1),S.pc("ngIf",t.targetForm.showError("user",e,"pattern")),S.yb(11),S.pc("ngIf",t.targetForm.showError("password",e,"required")),S.yb(1),S.pc("ngIf",t.targetForm.showError("password",e,"pattern")),S.yb(7),S.pc("ngIf",t.targetForm.showError("mutual_user",e,"required")),S.yb(1),S.pc("ngIf",t.targetForm.showError("mutual_user",e,"pattern")),S.yb(11),S.pc("ngIf",t.targetForm.showError("mutual_password",e,"required")),S.yb(1),S.pc("ngIf",t.targetForm.showError("mutual_password",e,"pattern"))}}function ze(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,115),S.Rb())}function Ee(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,116),S.Rb())}function Ce(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,117),S.Rb())}function De(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,118),S.Rb())}function Oe(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,119),S.Rb())}function Ae(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,120),S.Rb())}function xe(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,121),S.Rb())}function Ve(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,122),S.Rb())}function We(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,123),S.Rb())}function qe(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,124),S.Rb())}function Be(e,t){1&e&&(S.Sb(0,"span",41),S.Wb(1,125),S.Rb())}function Ge(e,t){if(1&e){const e=S.Tb();S.Qb(0),S.Sb(1,"div",50),S.Nb(2,"input",51),S.Sb(3,"span",14),S.Sb(4,"button",52),S.gc("click",(function(){S.Dc(e);const a=t.index,i=t.$implicit,o=S.ic(),s=o.$implicit,n=o.index;return S.ic(3).removeInitiatorImage(s,a,n,i)})),S.Nb(5,"i",16),S.Rb(),S.Rb(),S.Rb(),S.Pb()}if(2&e){const e=t.$implicit,a=S.ic(4);S.yb(2),S.pc("value",e),S.yb(3),S.pc("ngClass",S.uc(2,ue,a.icons.destroy))}}function Le(e,t){1&e&&(S.Sb(0,"span"),S.Wb(1,126),S.Rb())}function je(e,t){if(1&e&&(S.Sb(0,"div",22),S.Sb(1,"div",23),S.Sb(2,"cd-select",127),S.Nb(3,"i",25),S.Qb(4),S.Wb(5,128),S.Pb(),S.Rb(),S.Rb(),S.Rb()),2&e){const e=S.ic(),t=e.$implicit,a=e.index,i=S.ic(3);S.yb(2),S.pc("data",t.getValue("luns"))("options",i.imagesInitiatorSelections[a])("messages",i.messages.initiatorImage),S.yb(1),S.pc("ngClass",S.uc(4,ue,i.icons.add))}}function Qe(e,t){if(1&e){const e=S.Tb();S.Sb(0,"div",92),S.Sb(1,"div",5),S.Qb(2),S.Wb(3,93),S.Pb(),S.Oc(4),S.Sb(5,"button",94),S.gc("click",(function(){S.Dc(e);const a=t.index;return S.ic(3).removeInitiator(a)})),S.Nb(6,"i",25),S.Rb(),S.Rb(),S.Sb(7,"div",7),S.Sb(8,"div",8),S.Sb(9,"label",95),S.Wb(10,96),S.Rb(),S.Sb(11,"div",11),S.Sb(12,"input",97),S.gc("blur",(function(){return S.Dc(e),S.ic(3).updatedInitiatorSelector()})),S.Rb(),S.Mc(13,ze,2,0,"span",17),S.Mc(14,Ee,2,0,"span",17),S.Mc(15,Ce,2,0,"span",17),S.Rb(),S.Rb(),S.Qb(16,61),S.Sb(17,"div",8),S.Sb(18,"label",98),S.Wb(19,99),S.Rb(),S.Sb(20,"div",11),S.Nb(21,"input",100),S.Mc(22,De,2,0,"span",17),S.Mc(23,Oe,2,0,"span",17),S.Rb(),S.Rb(),S.Sb(24,"div",8),S.Sb(25,"label",101),S.Wb(26,102),S.Rb(),S.Sb(27,"div",11),S.Sb(28,"div",12),S.Nb(29,"input",103),S.Sb(30,"span",14),S.Nb(31,"button",104),S.Nb(32,"cd-copy-2-clipboard-button",105),S.Rb(),S.Rb(),S.Mc(33,Ae,2,0,"span",17),S.Mc(34,xe,2,0,"span",17),S.Rb(),S.Rb(),S.Sb(35,"div",8),S.Sb(36,"label",106),S.Qb(37),S.Wb(38,107),S.Pb(),S.Rb(),S.Sb(39,"div",11),S.Nb(40,"input",108),S.Mc(41,Ve,2,0,"span",17),S.Mc(42,We,2,0,"span",17),S.Rb(),S.Rb(),S.Sb(43,"div",8),S.Sb(44,"label",109),S.Wb(45,110),S.Rb(),S.Sb(46,"div",11),S.Sb(47,"div",12),S.Nb(48,"input",111),S.Sb(49,"span",14),S.Nb(50,"button",104),S.Nb(51,"cd-copy-2-clipboard-button",105),S.Rb(),S.Rb(),S.Mc(52,qe,2,0,"span",17),S.Mc(53,Be,2,0,"span",17),S.Rb(),S.Rb(),S.Pb(),S.Sb(54,"div",8),S.Sb(55,"label",112),S.Wb(56,113),S.Rb(),S.Sb(57,"div",11),S.Mc(58,Ge,6,4,"ng-container",21),S.Mc(59,Le,2,0,"span",55),S.Mc(60,je,6,6,"div",114),S.Rb(),S.Rb(),S.Rb(),S.Rb()}if(2&e){const e=t.$implicit,a=t.index;S.ic(2);const i=S.Ac(2),o=S.ic();S.pc("formGroupName",a),S.yb(4),S.Qc(": ",e.getValue("client_iqn")," "),S.yb(2),S.pc("ngClass",S.uc(25,ue,o.icons.destroy)),S.yb(7),S.pc("ngIf",e.showError("client_iqn",i,"notUnique")),S.yb(1),S.pc("ngIf",e.showError("client_iqn",i,"required")),S.yb(1),S.pc("ngIf",e.showError("client_iqn",i,"pattern")),S.yb(6),S.pc("id","user"+a),S.yb(1),S.pc("ngIf",e.showError("user",i,"required")),S.yb(1),S.pc("ngIf",e.showError("user",i,"pattern")),S.yb(6),S.pc("id","password"+a),S.yb(2),S.pc("cdPasswordButton","password"+a),S.yb(1),S.pc("source","password"+a),S.yb(1),S.pc("ngIf",e.showError("password",i,"required")),S.yb(1),S.pc("ngIf",e.showError("password",i,"pattern")),S.yb(6),S.pc("id","mutual_user"+a),S.yb(1),S.pc("ngIf",e.showError("mutual_user",i,"required")),S.yb(1),S.pc("ngIf",e.showError("mutual_user",i,"pattern")),S.yb(6),S.pc("id","mutual_password"+a),S.yb(2),S.pc("cdPasswordButton","mutual_password"+a),S.yb(1),S.pc("source","mutual_password"+a),S.yb(1),S.pc("ngIf",e.showError("mutual_password",i,"required")),S.yb(1),S.pc("ngIf",e.showError("mutual_password",i,"pattern")),S.yb(5),S.pc("ngForOf",e.getValue("luns")),S.yb(1),S.pc("ngIf",e.getValue("cdIsInGroup")),S.yb(1),S.pc("ngIf",!e.getValue("cdIsInGroup"))}}function Ue(e,t){1&e&&(S.Sb(0,"span",48),S.Wb(1,129),S.Rb())}function Ye(e,t){if(1&e){const e=S.Tb();S.Sb(0,"div",8),S.Sb(1,"label",86),S.Wb(2,87),S.Rb(),S.Sb(3,"div",88),S.Mc(4,Qe,61,27,"div",89),S.Sb(5,"div",22),S.Sb(6,"div",23),S.Mc(7,Ue,2,0,"span",18),S.Sb(8,"button",90),S.gc("click",(function(){return S.Dc(e),S.ic(2).addInitiator(),!1})),S.Nb(9,"i",25),S.Qb(10),S.Wb(11,91),S.Pb(),S.Rb(),S.Rb(),S.Rb(),S.Nb(12,"hr"),S.Rb(),S.Rb()}if(2&e){const e=S.ic(2);S.yb(4),S.pc("ngForOf",e.initiators.controls),S.yb(3),S.pc("ngIf",0===e.initiators.controls.length),S.yb(2),S.pc("ngClass",S.uc(3,ue,e.icons.add))}}function Ke(e,t){if(1&e){const e=S.Tb();S.Qb(0),S.Sb(1,"div",50),S.Nb(2,"input",51),S.Sb(3,"span",14),S.Sb(4,"button",52),S.gc("click",(function(){S.Dc(e);const a=t.index,i=S.ic(),o=i.$implicit,s=i.index;return S.ic(3).removeGroupInitiator(o,a,s)})),S.Nb(5,"i",16),S.Rb(),S.Rb(),S.Rb(),S.Pb()}if(2&e){const e=t.$implicit,a=S.ic(4);S.yb(2),S.pc("value",e),S.yb(3),S.pc("ngClass",S.uc(2,ue,a.icons.destroy))}}function Je(e,t){if(1&e){const e=S.Tb();S.Qb(0),S.Sb(1,"div",50),S.Nb(2,"input",51),S.Sb(3,"span",14),S.Sb(4,"button",52),S.gc("click",(function(){S.Dc(e);const a=t.index,i=S.ic(),o=i.$implicit,s=i.index;return S.ic(3).removeGroupDisk(o,a,s)})),S.Nb(5,"i",16),S.Rb(),S.Rb(),S.Rb(),S.Pb()}if(2&e){const e=t.$implicit,a=S.ic(4);S.yb(2),S.pc("value",e),S.yb(3),S.pc("ngClass",S.uc(2,ue,a.icons.destroy))}}function Xe(e,t){if(1&e){const e=S.Tb();S.Sb(0,"div",92),S.Sb(1,"div",5),S.Qb(2),S.Wb(3,133),S.Pb(),S.Oc(4),S.Sb(5,"button",94),S.gc("click",(function(){S.Dc(e);const a=t.index;return S.ic(3).removeGroup(a)})),S.Nb(6,"i",25),S.Rb(),S.Rb(),S.Sb(7,"div",7),S.Sb(8,"div",8),S.Sb(9,"label",134),S.Wb(10,135),S.Rb(),S.Sb(11,"div",11),S.Nb(12,"input",136),S.Rb(),S.Rb(),S.Sb(13,"div",8),S.Sb(14,"label",137),S.Qb(15),S.Wb(16,138),S.Pb(),S.Rb(),S.Sb(17,"div",11),S.Mc(18,Ke,6,4,"ng-container",21),S.Sb(19,"div",22),S.Sb(20,"div",23),S.Sb(21,"cd-select",24),S.gc("selection",(function(a){S.Dc(e);const i=t.index;return S.ic(3).onGroupMemberSelection(a,i)})),S.Nb(22,"i",25),S.Qb(23),S.Wb(24,139),S.Pb(),S.Rb(),S.Rb(),S.Rb(),S.Nb(25,"hr"),S.Rb(),S.Rb(),S.Sb(26,"div",8),S.Sb(27,"label",28),S.Qb(28),S.Wb(29,140),S.Pb(),S.Rb(),S.Sb(30,"div",11),S.Mc(31,Je,6,4,"ng-container",21),S.Sb(32,"div",22),S.Sb(33,"div",23),S.Sb(34,"cd-select",127),S.Nb(35,"i",25),S.Qb(36),S.Wb(37,141),S.Pb(),S.Rb(),S.Rb(),S.Rb(),S.Nb(38,"hr"),S.Rb(),S.Rb(),S.Rb(),S.Rb()}if(2&e){const e=t.$implicit,a=t.index,i=S.ic(3);S.pc("formGroupName",a),S.yb(4),S.Qc(": ",e.getValue("group_id")," "),S.yb(2),S.pc("ngClass",S.uc(13,ue,i.icons.destroy)),S.yb(12),S.pc("ngForOf",e.getValue("members")),S.yb(3),S.pc("data",e.getValue("members"))("options",i.groupMembersSelections[a])("messages",i.messages.groupInitiator),S.yb(1),S.pc("ngClass",S.uc(15,ue,i.icons.add)),S.yb(9),S.pc("ngForOf",e.getValue("disks")),S.yb(3),S.pc("data",e.getValue("disks"))("options",i.groupDiskSelections[a])("messages",i.messages.initiatorImage),S.yb(1),S.pc("ngClass",S.uc(17,ue,i.icons.add))}}function He(e,t){1&e&&(S.Sb(0,"span",48),S.Wb(1,142),S.Rb())}function Ze(e,t){if(1&e){const e=S.Tb();S.Sb(0,"div",8),S.Sb(1,"label",86),S.Wb(2,130),S.Rb(),S.Sb(3,"div",131),S.Mc(4,Xe,39,19,"div",89),S.Sb(5,"div",22),S.Sb(6,"div",23),S.Mc(7,He,2,0,"span",18),S.Sb(8,"button",90),S.gc("click",(function(){return S.Dc(e),S.ic(2).addGroup(),!1})),S.Nb(9,"i",25),S.Qb(10),S.Wb(11,132),S.Pb(),S.Rb(),S.Rb(),S.Rb(),S.Rb(),S.Rb()}if(2&e){const e=S.ic(2);S.yb(4),S.pc("ngForOf",e.groups.controls),S.yb(3),S.pc("ngIf",0===e.groups.controls.length),S.yb(2),S.pc("ngClass",S.uc(3,ue,e.icons.add))}}function et(e,t){if(1&e){const e=S.Tb();S.Sb(0,"div",1),S.Sb(1,"form",2,3),S.Sb(3,"div",4),S.Sb(4,"div",5),S.Wb(5,6),S.jc(6,"titlecase"),S.jc(7,"upperFirst"),S.Rb(),S.Sb(8,"div",7),S.Sb(9,"div",8),S.Sb(10,"label",9),S.Wb(11,10),S.Rb(),S.Sb(12,"div",11),S.Sb(13,"div",12),S.Nb(14,"input",13),S.Sb(15,"span",14),S.Sb(16,"button",15),S.gc("click",(function(){return S.Dc(e),S.ic().targetSettingsModal()})),S.Nb(17,"i",16),S.Rb(),S.Rb(),S.Rb(),S.Mc(18,be,2,0,"span",17),S.Mc(19,de,2,0,"span",17),S.Mc(20,pe,9,0,"span",17),S.Mc(21,me,2,0,"span",18),S.Nb(22,"hr"),S.Rb(),S.Rb(),S.Sb(23,"div",8),S.Sb(24,"label",19),S.Wb(25,20),S.Rb(),S.Sb(26,"div",11),S.Mc(27,fe,6,4,"ng-container",21),S.Sb(28,"div",22),S.Sb(29,"div",23),S.Sb(30,"cd-select",24),S.gc("selection",(function(t){return S.Dc(e),S.ic().onPortalSelection(t)})),S.Nb(31,"i",25),S.Qb(32),S.Wb(33,26),S.Pb(),S.Rb(),S.Rb(),S.Rb(),S.Nb(34,"input",27),S.Mc(35,he,2,1,"span",17),S.Nb(36,"hr"),S.Rb(),S.Rb(),S.Sb(37,"div",8),S.Sb(38,"label",28),S.Wb(39,29),S.Rb(),S.Sb(40,"div",11),S.Mc(41,ye,12,10,"ng-container",21),S.Nb(42,"input",30),S.Mc(43,Re,2,0,"span",17),S.Mc(44,we,2,0,"span",17),S.Sb(45,"div",22),S.Sb(46,"div",23),S.Sb(47,"cd-select",24),S.gc("selection",(function(t){return S.Dc(e),S.ic().onImageSelection(t)})),S.Nb(48,"i",25),S.Qb(49),S.Wb(50,31),S.Pb(),S.Rb(),S.Rb(),S.Rb(),S.Nb(51,"hr"),S.Rb(),S.Rb(),S.Sb(52,"div",8),S.Sb(53,"div",32),S.Sb(54,"div",33),S.Nb(55,"input",34),S.Sb(56,"label",35),S.Wb(57,36),S.Rb(),S.Rb(),S.Nb(58,"hr"),S.Rb(),S.Rb(),S.Mc(59,Pe,41,8,"div",37),S.Mc(60,Ye,13,5,"div",38),S.Mc(61,Ze,12,5,"div",38),S.Rb(),S.Sb(62,"div",39),S.Sb(63,"cd-form-button-panel",40),S.gc("submitActionEvent",(function(){return S.Dc(e),S.ic().submit()})),S.jc(64,"titlecase"),S.jc(65,"upperFirst"),S.Rb(),S.Rb(),S.Rb(),S.Rb(),S.Rb()}if(2&e){const e=S.Ac(2),t=S.ic();S.yb(1),S.pc("formGroup",t.targetForm),S.yb(6),S.ac(S.kc(6,26,t.action))(S.kc(7,28,t.resource)),S.Xb(5),S.yb(10),S.pc("ngClass",S.uc(34,ue,t.icons.deepCheck)),S.yb(1),S.pc("ngIf",t.targetForm.showError("target_iqn",e,"required")),S.yb(1),S.pc("ngIf",t.targetForm.showError("target_iqn",e,"pattern")),S.yb(1),S.pc("ngIf",t.targetForm.showError("target_iqn",e,"iqn")),S.yb(1),S.pc("ngIf",t.hasAdvancedSettings(t.targetForm.getValue("target_controls"))),S.yb(6),S.pc("ngForOf",t.portals.value),S.yb(3),S.pc("data",t.portals.value)("options",t.portalsSelections)("messages",t.messages.portals),S.yb(1),S.pc("ngClass",S.uc(36,ue,t.icons.add)),S.yb(4),S.pc("ngIf",t.targetForm.showError("portals",e,"minGateways")),S.yb(6),S.pc("ngForOf",t.targetForm.getValue("disks")),S.yb(2),S.pc("ngIf",t.targetForm.showError("disks",e,"dupLunId")),S.yb(1),S.pc("ngIf",t.targetForm.showError("disks",e,"dupWwn")),S.yb(3),S.pc("data",t.disks.value)("options",t.imagesSelections)("messages",t.messages.images),S.yb(1),S.pc("ngClass",S.uc(38,ue,t.icons.add)),S.yb(11),S.pc("ngIf",t.cephIscsiConfigVersion>10&&!t.targetForm.getValue("acl_enabled")),S.yb(1),S.pc("ngIf",t.targetForm.getValue("acl_enabled")),S.yb(1),S.pc("ngIf",t.targetForm.getValue("acl_enabled")),S.yb(2),S.pc("form",t.targetForm)("submitText",S.kc(64,30,t.action)+" "+S.kc(65,32,t.resource))}}let tt=(()=>{class e extends I.a{constructor(e,t,a,i,o,s,n){super(),this.iscsiService=e,this.modalService=t,this.rbdService=a,this.router=i,this.route=o,this.taskWrapper=s,this.actionLabels=n,this.api_version=0,this.minimum_gateways=1,this.icons=N.a,this.isEdit=!1,this.portalsSelections=[],this.imagesInitiatorSelections=[],this.groupDiskSelections=[],this.groupMembersSelections=[],this.imagesSettings={},this.messages={portals:new k.a({noOptions:"There are no portals available."}),images:new k.a({noOptions:"There are no images available."}),initiatorImage:new k.a({noOptions:"There are no images available. Please make sure you add an image to the target."}),groupInitiator:new k.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 e=[this.iscsiService.listTargets(),this.rbdService.list(),this.iscsiService.portals(),this.iscsiService.settings(),this.iscsiService.version()];this.router.url.startsWith("/block/iscsi/targets/edit")&&(this.isEdit=!0,this.route.params.subscribe(t=>{this.target_iqn=decodeURIComponent(t.target_iqn),e.push(this.iscsiService.getTarget(this.target_iqn))})),this.action=this.isEdit?this.actionLabels.EDIT:this.actionLabels.CREATE,Object(u.a)(e).subscribe(e=>{const t=m()(e[0]).filter(e=>e.target_iqn!==this.target_iqn).flatMap(e=>e.disks).map(e=>`${e.pool}/${e.image}`).value();"api_version"in e[3]&&(this.api_version=e[3].api_version),this.minimum_gateways=e[3].config.minimum_gateways,this.target_default_controls=e[3].target_default_controls,this.target_controls_limits=e[3].target_controls_limits,this.disk_default_controls=e[3].disk_default_controls,this.disk_controls_limits=e[3].disk_controls_limits,this.backstores=e[3].backstores,this.default_backstore=e[3].default_backstore,this.unsupported_rbd_features=e[3].unsupported_rbd_features,this.required_rbd_features=e[3].required_rbd_features,this.imagesAll=m()(e[1]).flatMap(e=>e.value).filter(e=>!e.namespace&&-1===t.indexOf(`${e.pool_name}/${e.name}`)&&0!==this.getValidBackstores(e).length).value(),this.imagesSelections=this.imagesAll.map(e=>new M.a(!1,`${e.pool_name}/${e.name}`,""));const a=[];e[2].forEach(e=>{e.ip_addresses.forEach(t=>{a.push(new M.a(!1,e.name+":"+t,""))})}),this.portalsSelections=[...a],this.cephIscsiConfigVersion=e[4].ceph_iscsi_config_version,this.createForm(),e[5]&&this.resolveModel(e[5]),this.loadingReady()})}createForm(){if(this.targetForm=new $.a({target_iqn:new o.h("iqn.2001-07.com.ceph:"+Date.now(),{validators:[o.A.required,o.A.pattern(this.IQN_REGEX)]}),target_controls:new o.h({}),portals:new o.h([],{validators:[T.a.custom("minGateways",e=>m.a.uniq(e.map(e=>e.split(":")[0])).length<Math.max(1,this.minimum_gateways))]}),disks:new o.h([],{validators:[T.a.custom("dupLunId",e=>{const t=this.getLunIds(e);return t.length!==m.a.uniq(t).length}),T.a.custom("dupWwn",e=>{const t=this.getWwns(e);return t.length!==m.a.uniq(t).length})]}),initiators:new o.e([]),groups:new o.e([]),acl_enabled:new o.h(!1)}),this.cephIscsiConfigVersion>10){const e=new $.a({user:new o.h(""),password:new o.h(""),mutual_user:new o.h(""),mutual_password:new o.h("")});this.setAuthValidator(e),this.targetForm.addControl("auth",e)}}resolveModel(e){this.targetForm.patchValue({target_iqn:e.target_iqn,target_controls:e.target_controls,acl_enabled:e.acl_enabled}),this.cephIscsiConfigVersion>10&&this.targetForm.patchValue({auth:e.auth});const t=[];m.a.forEach(e.portals,e=>{t.push(`${e.host}:${e.ip}`)}),this.targetForm.patchValue({portals:t});const a=[];m.a.forEach(e.disks,e=>{const t=`${e.pool}/${e.image}`;a.push(t),this.imagesSettings[t]={backstore:e.backstore},this.imagesSettings[t][e.backstore]=e.controls,"lun"in e&&(this.imagesSettings[t].lun=e.lun),"wwn"in e&&(this.imagesSettings[t].wwn=e.wwn),this.onImageSelection({option:{name:t,selected:!0}})}),this.targetForm.patchValue({disks:a}),m.a.forEach(e.clients,e=>{const t=this.addInitiator();e.luns=m.a.map(e.luns,e=>`${e.pool}/${e.image}`),t.patchValue(e)}),e.groups.forEach((e,t)=>{const a=this.addGroup();e.disks=m.a.map(e.disks,e=>`${e.pool}/${e.image}`),a.patchValue(e),m.a.forEach(e.members,e=>{this.onGroupMemberSelection({option:new M.a(!0,e,"")},t)})})}hasAdvancedSettings(e){return Object.values(e).length>0}get portals(){return this.targetForm.get("portals")}onPortalSelection(){this.portals.setValue(this.portals.value)}removePortal(e,t){return this.portalsSelections.forEach(e=>{e.name===t&&(e.selected=!1)}),this.portals.value.splice(e,1),this.portals.setValue(this.portals.value),!1}get disks(){return this.targetForm.get("disks")}removeImage(e,t){return this.imagesSelections.forEach(e=>{e.name===t&&(e.selected=!1)}),this.disks.value.splice(e,1),this.removeImageRefs(t),this.targetForm.get("disks").updateValueAndValidity({emitEvent:!1}),!1}removeImageRefs(e){this.initiators.controls.forEach(t=>{const a=t.value.luns.filter(t=>t!==e);t.get("luns").setValue(a)}),this.groups.controls.forEach(t=>{const a=t.value.disks.filter(t=>t!==e);t.get("disks").setValue(a)}),m.a.forEach(this.imagesInitiatorSelections,(t,a)=>{this.imagesInitiatorSelections[a]=t.filter(t=>t.name!==e)}),m.a.forEach(this.groupDiskSelections,(t,a)=>{this.groupDiskSelections[a]=t.filter(t=>t.name!==e)})}getDefaultBackstore(e){let t=this.default_backstore;const a=this.getImageById(e);return this.validFeatures(a,this.default_backstore)||this.backstores.forEach(e=>{e!==this.default_backstore&&this.validFeatures(a,e)&&(t=e)}),t}isLunIdInUse(e,t){const a=this.disks.value.filter(e=>e!==t);return this.getLunIds(a).includes(e)}getLunIds(e){return m.a.map(e,e=>this.imagesSettings[e].lun)}nextLunId(e){const t=this.disks.value.filter(t=>t!==e),a=this.getLunIds(t);let i=0;for(;a.includes(i);)i++;return i}getWwns(e){return m.a.map(e,e=>this.imagesSettings[e].wwn).filter(e=>m.a.isString(e)&&""!==e)}onImageSelection(e){const t=e.option;if(t.selected){if(this.imagesSettings[t.name])this.isLunIdInUse(this.imagesSettings[t.name].lun,t.name)&&(this.imagesSettings[t.name].lun=this.nextLunId(t.name));else{const e=this.getDefaultBackstore(t.name);this.imagesSettings[t.name]={backstore:e,lun:this.nextLunId(t.name)},this.imagesSettings[t.name][e]={}}m.a.forEach(this.imagesInitiatorSelections,(e,a)=>{e.push(new M.a(!1,t.name,"")),this.imagesInitiatorSelections[a]=[...e]}),m.a.forEach(this.groupDiskSelections,(e,a)=>{e.push(new M.a(!1,t.name,"")),this.groupDiskSelections[a]=[...e]})}else this.removeImageRefs(t.name);this.targetForm.get("disks").updateValueAndValidity({emitEvent:!1})}get initiators(){return this.targetForm.get("initiators")}addInitiator(){const e=new $.a({client_iqn:new o.h("",{validators:[o.A.required,T.a.custom("notUnique",e=>{const t=this.initiators.controls.reduce((function(e,t){return e.concat(t.value.client_iqn)}),[]);return t.indexOf(e)!==t.lastIndexOf(e)}),o.A.pattern(this.IQN_REGEX)]}),auth:new $.a({user:new o.h(""),password:new o.h(""),mutual_user:new o.h(""),mutual_password:new o.h("")}),luns:new o.h([]),cdIsInGroup:new o.h(!1)});this.setAuthValidator(e),this.initiators.push(e),m.a.forEach(this.groupMembersSelections,(e,t)=>{e.push(new M.a(!1,"","")),this.groupMembersSelections[t]=[...e]});const t=m.a.map(this.targetForm.getValue("disks"),e=>new M.a(!1,e,""));return this.imagesInitiatorSelections.push(t),e}setAuthValidator(e){T.a.validateIf(e.get("user"),()=>e.getValue("password")||e.getValue("mutual_user")||e.getValue("mutual_password"),[o.A.required],[o.A.pattern(this.USER_REGEX)],[e.get("password"),e.get("mutual_user"),e.get("mutual_password")]),T.a.validateIf(e.get("password"),()=>e.getValue("user")||e.getValue("mutual_user")||e.getValue("mutual_password"),[o.A.required],[o.A.pattern(this.PASSWORD_REGEX)],[e.get("user"),e.get("mutual_user"),e.get("mutual_password")]),T.a.validateIf(e.get("mutual_user"),()=>e.getValue("mutual_password"),[o.A.required],[o.A.pattern(this.USER_REGEX)],[e.get("user"),e.get("password"),e.get("mutual_password")]),T.a.validateIf(e.get("mutual_password"),()=>e.getValue("mutual_user"),[o.A.required],[o.A.pattern(this.PASSWORD_REGEX)],[e.get("user"),e.get("password"),e.get("mutual_user")])}removeInitiator(e){const t=this.initiators.value[e];this.initiators.removeAt(e),m.a.forEach(this.groupMembersSelections,(t,a)=>{t.splice(e,1),this.groupMembersSelections[a]=[...t]}),this.groups.controls.forEach(e=>{const a=e.value.members.filter(e=>e!==t.client_iqn);e.get("members").setValue(a)}),this.imagesInitiatorSelections.splice(e,1)}updatedInitiatorSelector(){this.initiators.controls.forEach(e=>{e.get("client_iqn").updateValueAndValidity({emitEvent:!1})}),m.a.forEach(this.groupMembersSelections,(e,t)=>{m.a.forEach(e,(e,t)=>{const a=e.name;e.name=this.initiators.controls[t].value.client_iqn,this.groups.controls.forEach(t=>{const i=t.value.members,o=i.indexOf(a);-1!==o&&(i[o]=e.name),t.get("members").setValue(i)})}),this.groupMembersSelections[t]=[...this.groupMembersSelections[t]]})}removeInitiatorImage(e,t,a,i){const o=e.getValue("luns");return o.splice(t,1),e.patchValue({luns:o}),this.imagesInitiatorSelections[a].forEach(e=>{e.name===i&&(e.selected=!1)}),!1}get groups(){return this.targetForm.get("groups")}addGroup(){const e=new $.a({group_id:new o.h("",{validators:[o.A.required]}),members:new o.h([]),disks:new o.h([])});this.groups.push(e);const t=m.a.map(this.targetForm.getValue("disks"),e=>new M.a(!1,e,""));this.groupDiskSelections.push(t);const a=m.a.map(this.initiators.value,e=>new M.a(!1,e.client_iqn,"",!e.cdIsInGroup));return this.groupMembersSelections.push(a),e}removeGroup(e){this.groups.removeAt(e),this.groupMembersSelections[e].filter(e=>e.selected).forEach(t=>{t.selected=!1,this.onGroupMemberSelection({option:t},e)}),this.groupMembersSelections.splice(e,1),this.groupDiskSelections.splice(e,1)}onGroupMemberSelection(e,t){const a=e.option;let i=[];if(!a.selected){const e=this.groupDiskSelections[t].filter(e=>e.selected);i=e.map(e=>e.name)}this.initiators.controls.forEach((e,t)=>{e.value.client_iqn===a.name&&(e.patchValue({luns:i}),e.get("cdIsInGroup").setValue(a.selected),m.a.forEach(this.groupMembersSelections,e=>{e[t].enabled=!a.selected}),this.imagesInitiatorSelections[t].forEach(e=>{e.selected=i.includes(e.name)}))})}removeGroupInitiator(e,t,a){const i=e.getValue("members")[t];e.getValue("members").splice(t,1),this.onGroupMemberSelection({option:new M.a(!1,i,"")},a)}removeGroupDisk(e,t,a){const i=e.getValue("disks")[t];e.getValue("disks").splice(t,1),this.groupDiskSelections[a].forEach(e=>{e.name===i&&(e.selected=!1)}),this.groupDiskSelections[a]=[...this.groupDiskSelections[a]]}submit(){const e=m.a.cloneDeep(this.targetForm.value),t={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 e=this.targetForm.get("auth");e.getValue("user")||e.get("user").setValue(""),e.getValue("password")||e.get("password").setValue(""),e.getValue("mutual_user")||e.get("mutual_user").setValue(""),e.getValue("mutual_password")||e.get("mutual_password").setValue("");const a=this.targetForm.getValue("acl_enabled");t.auth={user:a?"":e.getValue("user"),password:a?"":e.getValue("password"),mutual_user:a?"":e.getValue("mutual_user"),mutual_password:a?"":e.getValue("mutual_password")}}let a;e.disks.forEach(e=>{const a=e.split("/"),i=this.imagesSettings[e].backstore;t.disks.push({pool:a[0],image:a[1],backstore:i,controls:this.imagesSettings[e][i],lun:this.imagesSettings[e].lun,wwn:this.imagesSettings[e].wwn})}),e.portals.forEach(e=>{const a=e.indexOf(":");t.portals.push({host:e.substring(0,a),ip:e.substring(a+1)})}),t.acl_enabled&&(e.initiators.forEach(e=>{e.auth.user||(e.auth.user=""),e.auth.password||(e.auth.password=""),e.auth.mutual_user||(e.auth.mutual_user=""),e.auth.mutual_password||(e.auth.mutual_password=""),delete e.cdIsInGroup;const t=[];e.luns.forEach(e=>{const a=e.split("/");t.push({pool:a[0],image:a[1]})}),e.luns=t}),t.clients=e.initiators),t.acl_enabled&&(e.groups.forEach(e=>{const t=[];e.disks.forEach(e=>{const a=e.split("/");t.push({pool:a[0],image:a[1]})}),e.disks=t}),t.groups=e.groups),this.isEdit?(t.new_target_iqn=t.target_iqn,t.target_iqn=this.target_iqn,a=this.taskWrapper.wrapTaskAroundCall({task:new F.a("iscsi/target/edit",{target_iqn:t.target_iqn}),call:this.iscsiService.updateTarget(this.target_iqn,t)})):a=this.taskWrapper.wrapTaskAroundCall({task:new F.a("iscsi/target/create",{target_iqn:t.target_iqn}),call:this.iscsiService.createTarget(t)}),a.subscribe({error:()=>{this.targetForm.setErrors({cdSubmitButton:!0})},complete:()=>this.router.navigate(["/block/iscsi/targets"])})}targetSettingsModal(){const e={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(ie,e)}imageSettingsModal(e){const t={imagesSettings:this.imagesSettings,image:e,api_version:this.api_version,disk_default_controls:this.disk_default_controls,disk_controls_limits:this.disk_controls_limits,backstores:this.getValidBackstores(this.getImageById(e)),control:this.targetForm.get("disks")};this.modalRef=this.modalService.show(te,t)}validFeatures(e,t){const a=e.features,i=this.required_rbd_features[t];return(a&i)===i&&0==(a&this.unsupported_rbd_features[t])}getImageById(e){return this.imagesAll.find(t=>e===`${t.pool_name}/${t.name}`)}getValidBackstores(e){return this.backstores.filter(t=>this.validFeatures(e,t))}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(v),S.Mb(P.a),S.Mb(_),S.Mb(s.e),S.Mb(s.a),S.Mb(z.a),S.Mb(l.b))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-iscsi-target-form"]],features:[S.vb],decls:1,vars:1,consts:function(){return[["class","cd-col-form",4,"cdFormLoading"],[1,"cd-col-form"],["name","targetForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"card"],[1,"card-header"],"" + "\ufffd0\ufffd" + " " + "\ufffd1\ufffd" + "",[1,"card-body"],[1,"form-group","row"],["for","target_iqn",1,"cd-col-form-label","required"],"Target IQN",[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"],"Portals",[4,"ngFor","ngForOf"],[1,"row"],[1,"col-md-12"],["elemClass","btn btn-light float-right",3,"data","options","messages","selection"],[3,"ngClass"],"Add portal",["type","hidden","id","portals","name","portals","formControlName","portals",1,"form-control"],["for","disks",1,"cd-col-form-label"],"Images",["type","hidden","id","disks","name","disks","formControlName","disks",1,"form-control"],"Add image",[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"],"ACL authentication",["formGroupName","auth",4,"ngIf"],["class","form-group row",4,"ngIf"],[1,"card-footer"],["wrappingClass","text-right",3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],"This field is required.","IQN has wrong pattern.","An IQN has the following notation 'iqn.$year-$month.$reversedAddress:$definedName'","For example: iqn.2016-06.org.dashboard:storage:disk.sn-a8675309",["target","_blank","href","https://en.wikipedia.org/wiki/ISCSI#Addressing"],"More information",[1,"form-text","text-muted"],"This target has modified advanced settings.",[1,"input-group","cd-mb"],["type","text","disabled","",1,"cd-form-control",3,"value"],["type","button",1,"btn","btn-light",3,"click"],"At least " + "\ufffd0\ufffd" + " gateways are required.",["class","input-group-text",4,"ngIf"],[4,"ngIf"],[1,"input-group-text"],"Backstore: " + "\ufffd0\ufffd" + ".\xA0","This image has modified settings.","Duplicated LUN numbers.","Duplicated WWN.",["formGroupName","auth"],["for","target_user",1,"cd-col-form-label"],"User",["type","text","autocomplete","off","id","target_user","name","target_user","formControlName","user",1,"form-control"],["for","target_password",1,"cd-col-form-label"],"Password",["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"],"Mutual User",["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"],"Mutual Password",["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"],"This field is required.","User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.","This field is required.","Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.","This field is required.","User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.","This field is required.","Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",["for","initiators",1,"cd-col-form-label"],"Initiators",["formArrayName","initiators",1,"cd-col-form-input"],["class","card mb-2",3,"formGroupName",4,"ngFor","ngForOf"],[1,"btn","btn-light","float-right",3,"click"],"Add initiator",[1,"card","mb-2",3,"formGroupName"],"Initiator",["type","button",1,"close",3,"click"],["for","client_iqn",1,"cd-col-form-label","required"],"Client IQN",["type","text","formControlName","client_iqn","cdTrim","",1,"form-control",3,"blur"],["for","user",1,"cd-col-form-label"],"User",["formControlName","user","autocomplete","off","type","text",1,"form-control",3,"id"],["for","password",1,"cd-col-form-label"],"Password",["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"],"Mutual User",["formControlName","mutual_user","autocomplete","off","type","text",1,"form-control",3,"id"],["for","mutual_password",1,"cd-col-form-label"],"Mutual Password",["formControlName","mutual_password","autocomplete","new-password","type","password",1,"form-control",3,"id"],["for","luns",1,"cd-col-form-label"],"Images",["class","row",4,"ngIf"],"Initiator IQN needs to be unique.","This field is required.","IQN has wrong pattern.","This field is required.","User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.","This field is required.","Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.","This field is required.","User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.","This field is required.","Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.","Initiator belongs to a group. Images will be configure in the group.",["elemClass","btn btn-light float-right",3,"data","options","messages"],"Add image","No items added.","Groups",["formArrayName","groups",1,"cd-col-form-input"],"Add group","Group",["for","group_id",1,"cd-col-form-label","required"],"Name",["type","text","formControlName","group_id",1,"form-control"],["for","members",1,"cd-col-form-label"],"Initiators","Add initiator","Images","Add image","No items added."]},template:function(e,t){1&e&&S.Mc(0,et,66,40,"div",0),2&e&&S.pc("cdFormLoading",t.loading)},directives:[oe.a,o.C,o.r,o.k,C.a,D.a,O.a,o.d,A.a,o.q,o.i,se,i.p,i.r,i.q,ne.a,o.b,x.a,o.l,re.a,ce.a,o.f],pipes:[i.A,le.a,Y.a],styles:[".cd-mb[_ngcontent-%COMP%]{margin-bottom:10px}"]}),e})();var at=a("+fVR"),it=a("0+/T"),ot=a("uIqm"),st=a("x38r"),nt=a("vCyI"),rt=a("FFMq"),ct=a("G1/K"),lt=a("aexS"),bt=a("VTlA"),dt=a("mtw6"),pt=a("9nlD");function mt(e,t){1&e&&(S.Sb(0,"span",30),S.Wb(1,31),S.Rb())}function ut(e,t){1&e&&(S.Sb(0,"span",30),S.Wb(1,32),S.Rb())}function ft(e,t){1&e&&(S.Sb(0,"span",30),S.Wb(1,33),S.Rb())}function ht(e,t){1&e&&(S.Sb(0,"span",30),S.Wb(1,34),S.Rb())}function gt(e,t){1&e&&(S.Sb(0,"span",30),S.Wb(1,35),S.Rb())}function St(e,t){1&e&&(S.Sb(0,"span",30),S.Wb(1,36),S.Rb())}function vt(e,t){1&e&&(S.Sb(0,"span",30),S.Wb(1,37),S.Rb())}function yt(e,t){1&e&&(S.Sb(0,"span",30),S.Wb(1,38),S.Rb())}let Rt=(()=>{class e{constructor(e,t,a,i,o){this.authStorageService=e,this.activeModal=t,this.actionLabels=a,this.iscsiService=i,this.notificationService=o,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(e=>{this.discoveryForm.patchValue(e)})}createForm(){this.discoveryForm=new $.a({user:new o.h({value:"",disabled:!this.hasPermission}),password:new o.h({value:"",disabled:!this.hasPermission}),mutual_user:new o.h({value:"",disabled:!this.hasPermission}),mutual_password:new o.h({value:"",disabled:!this.hasPermission})}),T.a.validateIf(this.discoveryForm.get("user"),()=>this.discoveryForm.getValue("password")||this.discoveryForm.getValue("mutual_user")||this.discoveryForm.getValue("mutual_password"),[o.A.required],[o.A.pattern(this.USER_REGEX)],[this.discoveryForm.get("password"),this.discoveryForm.get("mutual_user"),this.discoveryForm.get("mutual_password")]),T.a.validateIf(this.discoveryForm.get("password"),()=>this.discoveryForm.getValue("user")||this.discoveryForm.getValue("mutual_user")||this.discoveryForm.getValue("mutual_password"),[o.A.required],[o.A.pattern(this.PASSWORD_REGEX)],[this.discoveryForm.get("user"),this.discoveryForm.get("mutual_user"),this.discoveryForm.get("mutual_password")]),T.a.validateIf(this.discoveryForm.get("mutual_user"),()=>this.discoveryForm.getValue("mutual_password"),[o.A.required],[o.A.pattern(this.USER_REGEX)],[this.discoveryForm.get("user"),this.discoveryForm.get("password"),this.discoveryForm.get("mutual_password")]),T.a.validateIf(this.discoveryForm.get("mutual_password"),()=>this.discoveryForm.getValue("mutual_user"),[o.A.required],[o.A.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(dt.a.success,"Updated discovery authentication"),this.activeModal.close()},()=>{this.discoveryForm.setErrors({cdSubmitButton:!0})})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(lt.a),S.Mb(r.a),S.Mb(l.b),S.Mb(v),S.Mb(pt.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-iscsi-target-discovery-modal"]],decls:46,vars:13,consts:function(){return[[3,"modalRef"],[1,"modal-title"],"Discovery Authentication",[1,"modal-content"],["name","discoveryForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"form-group","row"],["for","user",1,"cd-col-form-label"],"User",[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"],"Password",[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"],"Mutual User",["id","mutual_user","formControlName","mutual_user","type","text","autocomplete","off",1,"form-control"],["for","mutual_password",1,"cd-col-form-label"],"Mutual Password",["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"],"This field is required.","User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.","This field is required.","Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.","This field is required.","User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.","This field is required.","Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'."]},template:function(e,t){if(1&e&&(S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Wb(2,2),S.Pb(),S.Qb(3,3),S.Sb(4,"form",4,5),S.Sb(6,"div",6),S.Sb(7,"div",7),S.Sb(8,"label",8),S.Wb(9,9),S.Rb(),S.Sb(10,"div",10),S.Nb(11,"input",11),S.Mc(12,mt,2,0,"span",12),S.Mc(13,ut,2,0,"span",12),S.Rb(),S.Rb(),S.Sb(14,"div",7),S.Sb(15,"label",13),S.Wb(16,14),S.Rb(),S.Sb(17,"div",10),S.Sb(18,"div",15),S.Nb(19,"input",16),S.Sb(20,"span",17),S.Nb(21,"button",18),S.Nb(22,"cd-copy-2-clipboard-button",19),S.Rb(),S.Rb(),S.Mc(23,ft,2,0,"span",12),S.Mc(24,ht,2,0,"span",12),S.Rb(),S.Rb(),S.Sb(25,"div",7),S.Sb(26,"label",20),S.Qb(27),S.Wb(28,21),S.Pb(),S.Rb(),S.Sb(29,"div",10),S.Nb(30,"input",22),S.Mc(31,gt,2,0,"span",12),S.Mc(32,St,2,0,"span",12),S.Rb(),S.Rb(),S.Sb(33,"div",7),S.Sb(34,"label",23),S.Wb(35,24),S.Rb(),S.Sb(36,"div",10),S.Sb(37,"div",15),S.Nb(38,"input",25),S.Sb(39,"span",17),S.Nb(40,"button",26),S.Nb(41,"cd-copy-2-clipboard-button",27),S.Rb(),S.Rb(),S.Mc(42,vt,2,0,"span",12),S.Mc(43,yt,2,0,"span",12),S.Rb(),S.Rb(),S.Rb(),S.Sb(44,"div",28),S.Sb(45,"cd-form-button-panel",29),S.gc("submitActionEvent",(function(){return t.submitAction()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e){const e=S.Ac(5);S.pc("modalRef",t.activeModal),S.yb(4),S.pc("formGroup",t.discoveryForm),S.yb(8),S.pc("ngIf",t.discoveryForm.showError("user",e,"required")),S.yb(1),S.pc("ngIf",t.discoveryForm.showError("user",e,"pattern")),S.yb(10),S.pc("ngIf",t.discoveryForm.showError("password",e,"required")),S.yb(1),S.pc("ngIf",t.discoveryForm.showError("password",e,"pattern")),S.yb(7),S.pc("ngIf",t.discoveryForm.showError("mutual_user",e,"required")),S.yb(1),S.pc("ngIf",t.discoveryForm.showError("mutual_user",e,"pattern")),S.yb(10),S.pc("ngIf",t.discoveryForm.showError("mutual_password",e,"required")),S.yb(1),S.pc("ngIf",t.discoveryForm.showError("mutual_password",e,"pattern")),S.yb(2),S.pc("form",t.discoveryForm)("showSubmit",t.hasPermission)("submitText",t.actionLabels.SUBMIT)}},directives:[E.a,o.C,o.r,o.k,C.a,D.a,O.a,o.d,A.a,o.q,o.i,i.r,re.a,ce.a,x.a],styles:[""]}),e})(),wt=(()=>{class e{constructor(e){this.router=e}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(s.e))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-iscsi-tabs"]],decls:8,vars:1,consts:function(){return[["ngbNav","",1,"nav-tabs",3,"activeId","navChange"],["nav","ngbNav"],["ngbNavItem","/block/iscsi/overview"],["ngbNavLink",""],"Overview",["ngbNavItem","/block/iscsi/targets"],"Targets"]},template:function(e,t){1&e&&(S.Sb(0,"ul",0,1),S.gc("navChange",(function(e){return t.router.navigate([e.nextId])})),S.Sb(2,"li",2),S.Sb(3,"a",3),S.Wb(4,4),S.Rb(),S.Rb(),S.Sb(5,"li",5),S.Sb(6,"a",3),S.Wb(7,6),S.Rb(),S.Rb(),S.Rb()),2&e&&S.pc("activeId",t.router.url)},directives:[r.p,r.r,r.s],styles:[""]}),e})();var _t=a("/NlG"),kt=a("6qls"),Mt=a("S7zO"),Nt=a("iExv");const It=["highlightTpl"],$t=["detailTable"],Tt=["tree"],Ft=function(){return["logged_in"]},Pt=function(){return["logged_out"]},zt=function(e,t){return{"badge-success":e,"badge-danger":t}};function Et(e,t){if(1&e&&(S.Nb(0,"i"),S.Sb(1,"span"),S.Oc(2),S.Rb(),S.Oc(3," \xa0 "),S.Sb(4,"span",8),S.Oc(5),S.Rb()),2&e){const e=t.$implicit;S.Ab(e.data.cdIcon),S.yb(2),S.Pc(e.data.name),S.yb(2),S.pc("ngClass",S.vc(7,zt,S.tc(5,Ft).includes(e.data.status),S.tc(6,Pt).includes(e.data.status))),S.yb(1),S.Qc(" ",e.data.status," ")}}function Ct(e,t){if(1&e&&(S.Sb(0,"div",9),S.Sb(1,"legend"),S.Oc(2),S.Rb(),S.Nb(3,"cd-table",10,11),S.Rb()),2&e){const e=S.ic();S.yb(2),S.Pc(e.title),S.yb(1),S.pc("data",e.data)("columns",e.columns)("limit",0)}}function Dt(e,t){if(1&e&&(S.Sb(0,"span"),S.Oc(1),S.Rb()),2&e){const e=S.ic().value;S.yb(1),S.Pc(e)}}function Ot(e,t){if(1&e&&(S.Sb(0,"strong"),S.Oc(1),S.Rb()),2&e){const e=S.ic().value;S.yb(1),S.Pc(e)}}function At(e,t){if(1&e&&(S.Mc(0,Dt,2,1,"span",12),S.Mc(1,Ot,2,1,"strong",12)),2&e){const e=t.row;S.pc("ngIf",void 0===e.default||e.default===e.current),S.yb(1),S.pc("ngIf",void 0!==e.default&&e.default!==e.current)}}let xt=(()=>{class e{constructor(e,t){this.iscsiBackstorePipe=e,this.booleanTextPipe=t,this.icons=N.a,this.metadata={},this.nodes=[],this.treeOptions={useVirtualScroll:!0,actionMapping:{mouse:{click:this.onNodeSelected.bind(this)}}}}set content(e){this.detailTable=e,e&&e.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 e=m.a.cloneDeep(this.selectedItem.target_controls);this.cephIscsiConfigVersion>10&&m.a.extend(e,m.a.cloneDeep(this.selectedItem.auth)),this.metadata={root:e};const t={target:{expanded:m.a.join(this.selectedItem.cdExecuting?[N.a.large,N.a.spinner,N.a.spin]:[N.a.large,N.a.bullseye]," ")},initiators:{expanded:m.a.join([N.a.large,N.a.user]," "),leaf:m.a.join([N.a.user]," ")},groups:{expanded:m.a.join([N.a.large,N.a.users]," "),leaf:m.a.join([N.a.users]," ")},disks:{expanded:m.a.join([N.a.large,N.a.disk]," "),leaf:m.a.join([N.a.disk]," ")},portals:{expanded:m.a.join([N.a.large,N.a.server]," "),leaf:m.a.join([N.a.server]," ")}},a=[];m.a.forEach(this.selectedItem.disks,e=>{const i="disk_"+e.pool+"_"+e.image;this.metadata[i]={controls:e.controls,backstore:e.backstore},["wwn","lun"].forEach(t=>{t in e&&(this.metadata[i][t]=e[t])}),a.push({name:`${e.pool}/${e.image}`,cdId:i,cdIcon:t.disks.leaf})});const i=[];m.a.forEach(this.selectedItem.portals,e=>{i.push({name:`${e.host}:${e.ip}`,cdIcon:t.portals.leaf})});const o=[];m.a.forEach(this.selectedItem.clients,e=>{const a=m.a.cloneDeep(e.auth);e.info&&(m.a.extend(a,e.info),delete a.state,m.a.forEach(Object.keys(e.info.state),t=>{a[t.toLowerCase()]=e.info.state[t]})),this.metadata["client_"+e.client_iqn]=a;const i=[];e.luns.forEach(e=>{i.push({name:`${e.pool}/${e.image}`,cdId:"disk_"+e.pool+"_"+e.image,cdIcon:t.disks.leaf})});let s="";e.info&&(s=Object.keys(e.info.state).includes("LOGGED_IN")?"logged_in":"logged_out"),o.push({name:e.client_iqn,status:s,cdId:"client_"+e.client_iqn,children:i,cdIcon:t.initiators.leaf})});const s=[];m.a.forEach(this.selectedItem.groups,e=>{const a=[];e.disks.forEach(e=>{a.push({name:`${e.pool}/${e.image}`,cdId:"disk_"+e.pool+"_"+e.image,cdIcon:t.disks.leaf})});const i=[];e.members.forEach(e=>{i.push({name:e,cdId:"client_"+e})}),s.push({name:e.group_id,cdIcon:t.groups.leaf,children:[{name:"Disks",children:a,cdIcon:t.disks.expanded},{name:"Initiators",children:i,cdIcon:t.initiators.expanded}]})}),this.nodes=[{name:this.selectedItem.target_iqn,cdId:"root",isExpanded:!0,cdIcon:t.target.expanded,children:[{name:"Disks",isExpanded:!0,children:a,cdIcon:t.disks.expanded},{name:"Portals",isExpanded:!0,children:i,cdIcon:t.portals.expanded},{name:"Initiators",isExpanded:!0,children:o,cdIcon:t.initiators.expanded},{name:"Groups",isExpanded:!0,children:s,cdIcon:t.groups.expanded}]}]}format(e){return"boolean"==typeof e?this.booleanTextPipe.transform(e):e}onNodeSelected(e,t){var a,i,o,s;if(n.a.ACTIVATE(e,t,!0),t.data.cdId){this.title=t.data.name;const e=this.metadata[t.data.cdId]||{};"root"===t.data.cdId?(null===(a=this.detailTable)||void 0===a||a.toggleColumn({prop:"default",isHidden:!0}),this.data=m.a.map(this.settings.target_default_controls,(t,a)=>({displayName:a,default:t=this.format(t),current:m.a.isUndefined(e[a])?t:this.format(e[a])})),this.cephIscsiConfigVersion>10&&["user","password","mutual_user","mutual_password"].forEach(t=>{this.data.push({displayName:t,default:null,current:e[t]})})):t.data.cdId.toString().startsWith("disk_")?(null===(i=this.detailTable)||void 0===i||i.toggleColumn({prop:"default",isHidden:!0}),this.data=m.a.map(this.settings.disk_default_controls[e.backstore],(t,a)=>({displayName:a,default:t=this.format(t),current:m.a.isUndefined(e.controls[a])?t:this.format(e.controls[a])})),this.data.push({displayName:"backstore",default:this.iscsiBackstorePipe.transform(this.settings.default_backstore),current:this.iscsiBackstorePipe.transform(e.backstore)}),["wwn","lun"].forEach(t=>{t in e&&this.data.push({displayName:t,default:void 0,current:e[t]})})):(null===(o=this.detailTable)||void 0===o||o.toggleColumn({prop:"default",isHidden:!1}),this.data=m.a.map(e,(e,t)=>({displayName:t,default:void 0,current:this.format(e)})))}else this.data=void 0;null===(s=this.detailTable)||void 0===s||s.updateColumns()}onUpdateData(){this.tree.treeModel.expandAll()}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(Y.a),S.Mb(Nt.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-iscsi-target-details"]],viewQuery:function(e,t){var a;1&e&&(S.Jc(It,!0),S.Tc($t,!0),S.Tc(Tt,!0)),2&e&&(S.zc(a=S.hc())&&(t.highlightTpl=a.first),S.zc(a=S.hc())&&(t.content=a.first),S.zc(a=S.hc())&&(t.tree=a.first))},inputs:{selection:"selection",settings:"settings",cephIscsiConfigVersion:"cephIscsiConfigVersion"},features:[S.wb],decls:11,vars:3,consts:function(){return[[1,"row"],[1,"col-6"],"iSCSI Topology",[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(e,t){1&e&&(S.Sb(0,"div",0),S.Sb(1,"div",1),S.Sb(2,"legend"),S.Wb(3,2),S.Rb(),S.Sb(4,"tree-root",3,4),S.gc("updateData",(function(){return t.onUpdateData()})),S.Mc(6,Et,6,10,"ng-template",null,5,S.Nc),S.Rb(),S.Rb(),S.Mc(8,Ct,5,4,"div",6),S.Rb(),S.Mc(9,At,2,2,"ng-template",null,7,S.Nc)),2&e&&(S.yb(4),S.pc("nodes",t.nodes)("options",t.treeOptions),S.yb(4),S.pc("ngIf",t.data))},directives:[n.b,i.r,i.p,ot.a],styles:[""]}),e})();function Vt(e,t){if(1&e&&(S.Qb(0),S.Nb(1,"br"),S.Sb(2,"span"),S.Wb(3,7),S.Rb(),S.Sb(4,"pre"),S.Oc(5),S.Rb(),S.Pb()),2&e){const e=S.ic(2);S.yb(5),S.Pc(e.status)}}function Wt(e,t){if(1&e&&(S.Sb(0,"cd-alert-panel",2),S.Yb(1,3),S.Qb(2),S.cc(3,4),S.Nb(4,"cd-doc",5),S.Zb(),S.Pb(),S.Mc(5,Vt,6,1,"ng-container",6),S.Rb()),2&e){const e=S.ic();S.yb(5),S.pc("ngIf",e.status)}}function qt(e,t){if(1&e&&S.Nb(0,"cd-iscsi-target-details",16),2&e){const e=S.ic(2);S.pc("cephIscsiConfigVersion",e.cephIscsiConfigVersion)("selection",e.expandedRow)("settings",e.settings)}}const Bt=function(e){return[e]};function Gt(e,t){if(1&e){const e=S.Tb();S.Sb(0,"cd-table",8,9),S.gc("setExpandedRow",(function(t){return S.Dc(e),S.ic().setExpandedRow(t)}))("updateSelection",(function(t){return S.Dc(e),S.ic().updateSelection(t)})),S.Sb(2,"div",10),S.Nb(3,"cd-table-actions",11),S.Sb(4,"button",12),S.gc("click",(function(){return S.Dc(e),S.ic().configureDiscoveryAuth()})),S.Nb(5,"i",13),S.Qb(6),S.Wb(7,14),S.Pb(),S.Rb(),S.Rb(),S.Mc(8,qt,1,3,"cd-iscsi-target-details",15),S.Rb()}if(2&e){const e=S.ic();S.pc("data",e.targets)("columns",e.columns)("hasDetails",!0),S.yb(3),S.pc("permission",e.permission)("selection",e.selection)("tableActions",e.tableActions),S.yb(2),S.pc("ngClass",S.uc(8,Bt,e.icons.key)),S.yb(3),S.pc("ngIf",e.expandedRow)}}let Lt=(()=>{class e extends at.a{constructor(e,t,a,i,o,s,n,r){super(),this.authStorageService=e,this.iscsiService=t,this.joinPipe=a,this.taskListService=i,this.notAvailablePipe=o,this.modalService=s,this.taskWrapper=n,this.actionLabels=r,this.available=void 0,this.selection=new nt.a,this.targets=[],this.icons=N.a,this.builders={"iscsi/target/create":e=>({target_iqn:e.target_iqn})},this.permission=this.authStorageService.getPermissions().iscsi,this.tableActions=[{permission:"create",icon:N.a.add,routerLink:()=>"/block/iscsi/targets/create",name:this.actionLabels.CREATE},{permission:"update",icon:N.a.edit,routerLink:()=>"/block/iscsi/targets/edit/"+this.selection.first().target_iqn,name:this.actionLabels.EDIT,disable:()=>this.getEditDisableDesc()},{permission:"delete",icon:N.a.destroy,click:()=>this.deleteIscsiTargetModal(),name:this.actionLabels.DELETE,disable:()=>this.getDeleteDisableDesc()}]}ngOnInit(){this.columns=[{name:"Target",prop:"target_iqn",flexGrow:2,cellTransformation:st.a.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(e=>{this.available=e.available,e.available?(this.iscsiService.version().subscribe(e=>{this.cephIscsiConfigVersion=e.ceph_iscsi_config_version,this.taskListService.init(()=>this.iscsiService.listTargets(),e=>this.prepareResponse(e),e=>this.targets=e,()=>this.onFetchError(),this.taskFilter,this.itemFilter,this.builders)}),this.iscsiService.settings().subscribe(e=>{this.settings=e})):this.status=e.message})}ngOnDestroy(){this.summaryDataSubscription&&this.summaryDataSubscription.unsubscribe()}getEditDisableDesc(){const e=this.selection.first();return e&&(null==e?void 0:e.cdExecuting)?e.cdExecuting:e&&m.a.isUndefined(null==e?void 0:e.info)?"Unavailable gateway(s)":!e}getDeleteDisableDesc(){var e;const t=this.selection.first();return(null==t?void 0:t.cdExecuting)?t.cdExecuting:t&&m.a.isUndefined(null==t?void 0:t.info)?"Unavailable gateway(s)":t&&(null===(e=null==t?void 0:t.info)||void 0===e?void 0:e.num_sessions)?"Target has active sessions":!t}prepareResponse(e){return e.forEach(e=>{e.cdPortals=e.portals.map(e=>`${e.host}:${e.ip}`),e.cdImages=e.disks.map(e=>`${e.pool}/${e.image}`)}),e}onFetchError(){this.table.reset()}itemFilter(e,t){return e.target_iqn===t.metadata.target_iqn}taskFilter(e){return["iscsi/target/create","iscsi/target/edit","iscsi/target/delete"].includes(e.name)}updateSelection(e){this.selection=e}deleteIscsiTargetModal(){const e=this.selection.first().target_iqn;this.modalRef=this.modalService.show(it.a,{itemDescription:"iSCSI target",itemNames:[e],submitActionObservable:()=>this.taskWrapper.wrapTaskAroundCall({task:new F.a("iscsi/target/delete",{target_iqn:e}),call:this.iscsiService.deleteTarget(e)})})}configureDiscoveryAuth(){this.modalService.show(Rt)}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(lt.a),S.Mb(v),S.Mb(rt.a),S.Mb(bt.a),S.Mb(ct.a),S.Mb(P.a),S.Mb(z.a),S.Mb(l.b))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-iscsi-target-list"]],viewQuery:function(e,t){var a;1&e&&S.Tc(ot.a,!0),2&e&&S.zc(a=S.hc())&&(t.table=a.first)},features:[S.xb([bt.a]),S.vb],decls:3,vars:2,consts:function(){return[["type","info",4,"ngIf",6,"title"],["columnMode","flex","identifier","target_iqn","forceIdentifier","true","selectionType","single",3,"data","columns","hasDetails","setExpandedRow","updateSelection",4,"ngIf"],["type","info",6,"title"],["title","iSCSI Targets not available"],"Please consult the " + "\ufffd#4\ufffd" + "" + "\ufffd/#4\ufffd" + " on how to configure and enable the iSCSI Targets management functionality.",["section","iscsi"],[4,"ngIf"],"Available information:",["columnMode","flex","identifier","target_iqn","forceIdentifier","true","selectionType","single",3,"data","columns","hasDetails","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"],"Discovery authentication",["cdTableDetail","",3,"cephIscsiConfigVersion","selection","settings",4,"ngIf"],["cdTableDetail","",3,"cephIscsiConfigVersion","selection","settings"]]},template:function(e,t){1&e&&(S.Nb(0,"cd-iscsi-tabs"),S.Mc(1,Wt,6,1,"cd-alert-panel",0),S.Mc(2,Gt,9,10,"cd-table",1)),2&e&&(S.yb(1),S.pc("ngIf",!1===t.available),S.yb(1),S.pc("ngIf",!0===t.available))},directives:[wt,i.r,_t.a,kt.a,ot.a,Mt.a,O.a,i.p,xt],styles:[""]}),e})();var jt=a("o4+5"),Qt=a("dgut"),Ut=a("Dwqy");const Yt=["iscsiSparklineTpl"],Kt=["iscsiPerSecondTpl"],Jt=["iscsiRelativeDateTpl"];function Xt(e,t){if(1&e&&(S.Sb(0,"span"),S.Nb(1,"cd-sparkline",9),S.Rb()),2&e){const e=S.ic(),t=e.value,a=e.row;S.yb(1),S.pc("data",t)("isBinary",a.cdIsBinary)}}function Ht(e,t){1&e&&(S.Sb(0,"span",10),S.Oc(1," n/a "),S.Rb())}function Zt(e,t){if(1&e&&(S.Mc(0,Xt,2,2,"span",7),S.Mc(1,Ht,2,0,"span",8)),2&e){const e=t.row;S.pc("ngIf","user:rbd"===e.backstore),S.yb(1),S.pc("ngIf","user:rbd"!==e.backstore)}}function ea(e,t){if(1&e&&(S.Sb(0,"span"),S.Oc(1),S.Rb()),2&e){const e=S.ic().value;S.yb(1),S.Qc(" ",e," /s ")}}function ta(e,t){1&e&&(S.Sb(0,"span",10),S.Oc(1," n/a "),S.Rb())}function aa(e,t){if(1&e&&(S.Mc(0,ea,2,1,"span",7),S.Mc(1,ta,2,0,"span",8)),2&e){const e=t.row;S.pc("ngIf","user:rbd"===e.backstore),S.yb(1),S.pc("ngIf","user:rbd"!==e.backstore)}}function ia(e,t){if(1&e&&(S.Sb(0,"span"),S.Oc(1),S.jc(2,"notAvailable"),S.jc(3,"relativeDate"),S.Rb()),2&e){const e=S.ic().value;S.yb(1),S.Qc(" ",S.kc(2,1,S.kc(3,3,e))," ")}}function oa(e,t){1&e&&(S.Sb(0,"span",10),S.Oc(1," n/a "),S.Rb())}function sa(e,t){if(1&e&&(S.Mc(0,ia,4,5,"span",7),S.Mc(1,oa,2,0,"span",8)),2&e){const e=t.row;S.pc("ngIf","user:rbd"===e.backstore),S.yb(1),S.pc("ngIf","user:rbd"!==e.backstore)}}let na=(()=>{class e{constructor(e,t,a){this.iscsiService=e,this.dimlessPipe=t,this.iscsiBackstorePipe=a,this.gateways=[],this.images=[]}ngOnInit(){this.gatewaysColumns=[{name:"Name",prop:"name"},{name:"State",prop:"state",flexGrow:1,cellTransformation:st.a.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(e=>{this.gateways=e.gateways,this.images=e.images,this.images.map(e=>(e.stats_history&&(e.stats_history.rd_bytes=e.stats_history.rd_bytes.map(e=>e[1]),e.stats_history.wr_bytes=e.stats_history.wr_bytes.map(e=>e[1])),e.cdIsBinary=!0,e))})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(v),S.Mb(jt.a),S.Mb(Y.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-iscsi"]],viewQuery:function(e,t){var a;1&e&&(S.Jc(Yt,!0),S.Jc(Kt,!0),S.Jc(Jt,!0)),2&e&&(S.zc(a=S.hc())&&(t.iscsiSparklineTpl=a.first),S.zc(a=S.hc())&&(t.iscsiPerSecondTpl=a.first),S.zc(a=S.hc())&&(t.iscsiRelativeDateTpl=a.first))},decls:13,vars:4,consts:function(){return["Gateways",[3,"data","columns","fetchData"],"Images",[3,"data","columns"],["iscsiSparklineTpl",""],["iscsiPerSecondTpl",""],["iscsiRelativeDateTpl",""],[4,"ngIf"],["class","text-muted",4,"ngIf"],[3,"data","isBinary"],[1,"text-muted"]]},template:function(e,t){1&e&&(S.Nb(0,"cd-iscsi-tabs"),S.Sb(1,"legend"),S.Wb(2,0),S.Rb(),S.Sb(3,"cd-table",1),S.gc("fetchData",(function(){return t.refresh()})),S.Rb(),S.Sb(4,"legend"),S.Wb(5,2),S.Rb(),S.Nb(6,"cd-table",3),S.Mc(7,Zt,2,2,"ng-template",null,4,S.Nc),S.Mc(9,aa,2,2,"ng-template",null,5,S.Nc),S.Mc(11,sa,2,2,"ng-template",null,6,S.Nc)),2&e&&(S.yb(3),S.pc("data",t.gateways)("columns",t.gatewaysColumns),S.yb(3),S.pc("data",t.images)("columns",t.imagesColumns))},directives:[wt,ot.a,i.r,Qt.a],pipes:[ct.a,Ut.a],styles:[""]}),e})(),ra=(()=>{class e{}return e.\u0275mod=S.Kb({type:e}),e.\u0275inj=S.Jb({factory:function(t){return new(t||e)},imports:[[i.c,d.a,r.t,s.i,o.m,o.x,r.A]]}),e})();var ca=a("quSY"),la=a("2Vo4"),ba=a("pLZG"),da=a("lOp/");let pa=(()=>{let e=class{constructor(e,t){this.http=e,this.timerService=t,this.REFRESH_INTERVAL=3e4,this.summaryDataSource=new la.a(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 e=>{this.summaryDataSource.next(e)}}subscribeSummary(e,t){return this.summaryData$.pipe(Object(ba.a)(e=>!!e)).subscribe(e,t)}getPool(e){return this.http.get("api/block/mirroring/pool/"+e)}updatePool(e,t){return this.http.put("api/block/mirroring/pool/"+e,t,{observe:"response"})}getSiteName(){return this.http.get("api/block/mirroring/site_name")}setSiteName(e){return this.http.put("api/block/mirroring/site_name",{site_name:e},{observe:"response"})}createBootstrapToken(e){return this.http.post(`api/block/mirroring/pool/${e}/bootstrap/token`,{})}importBootstrapToken(e,t,a){return this.http.post(`api/block/mirroring/pool/${e}/bootstrap/peer`,{direction:t,token:a},{observe:"response"})}getPeer(e,t){return this.http.get(`api/block/mirroring/pool/${e}/peer/${t}`)}addPeer(e,t){return this.http.post(`api/block/mirroring/pool/${e}/peer`,t,{observe:"response"})}updatePeer(e,t,a){return this.http.put(`api/block/mirroring/pool/${e}/peer/${t}`,a,{observe:"response"})}deletePeer(e,t){return this.http.delete(`api/block/mirroring/pool/${e}/peer/${t}`,{observe:"response"})}};return e.\u0275fac=function(t){return new(t||e)(S.dc(h.b),S.dc(da.a))},e.\u0275prov=S.Ib({token:e,factory:e.\u0275fac,providedIn:"root"}),Object(f.b)([Object(f.e)(0,g.b),Object(f.d)("design:type",Function),Object(f.d)("design:paramtypes",[String]),Object(f.d)("design:returntype",void 0)],e.prototype,"setSiteName",null),Object(f.b)([Object(f.e)(1,g.b),Object(f.e)(2,g.b),Object(f.d)("design:type",Function),Object(f.d)("design:paramtypes",[String,String,String]),Object(f.d)("design:returntype",void 0)],e.prototype,"importBootstrapToken",null),e=Object(f.b)([g.a,Object(f.d)("design:paramtypes",[h.b,da.a])],e),e})();var ma=a("GyhO"),ua=a("vkgz"),fa=a("NJ9Y"),ha=a("IZUe"),ga=a("sb0X"),Sa=a("Z21x");function va(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,29),S.Rb())}function ya(e,t){if(1&e&&(S.Sb(0,"div",30),S.Nb(1,"input",31),S.Sb(2,"label",32),S.Oc(3),S.Rb(),S.Rb()),2&e){const e=t.$implicit;S.yb(1),S.qc("id",e.name),S.qc("name",e.name),S.qc("formControlName",e.name),S.yb(1),S.qc("for",e.name),S.yb(1),S.Pc(e.name)}}function Ra(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,33),S.Rb())}let wa=(()=>{class e{constructor(e,t,a){this.activeModal=e,this.rbdMirroringService=t,this.taskWrapper=a,this.pools=[],this.createForm()}createForm(){this.createBootstrapForm=new $.a({siteName:new o.h("",{validators:[o.A.required]}),pools:new o.j({},{validators:[this.validatePools()]}),token:new o.h("",{})})}ngOnInit(){this.createBootstrapForm.get("siteName").setValue(this.siteName),this.rbdMirroringService.getSiteName().subscribe(e=>{this.createBootstrapForm.get("siteName").setValue(e.site_name)}),this.subs=this.rbdMirroringService.subscribeSummary(e=>{this.pools=e.content_data.pools.reduce((e,t)=>(e.push({name:t.name,mirror_mode:t.mirror_mode}),e),[]);const t=this.createBootstrapForm.get("pools");m.a.each(this.pools,e=>{const a=e.name,i="disabled"===e.mirror_mode,s=t.controls[a];s?i&&s.disabled?s.enable():!i&&s.enabled&&(s.disable(),s.setValue(!0)):t.addControl(a,new o.h({value:!i,disabled:!i}))})})}ngOnDestroy(){this.subs&&this.subs.unsubscribe()}validatePools(){return e=>{let t=0;return m.a.each(e.controls,e=>{!0===e.value&&++t}),t>0?null:{requirePool:!0}}}generate(){this.createBootstrapForm.get("token").setValue("");let e="";const t=[],a=this.createBootstrapForm.get("pools");m.a.each(a.controls,(a,i)=>{!0===a.value&&(e=i,a.disabled||t.push(i))});const i={mirror_mode:"image"},o=Object(ma.a)(this.rbdMirroringService.setSiteName(this.createBootstrapForm.getValue("siteName")),Object(u.a)(t.map(e=>this.rbdMirroringService.updatePool(e,i))),this.rbdMirroringService.createBootstrapToken(e).pipe(Object(ua.a)(e=>this.createBootstrapForm.get("token").setValue(e.token)))).pipe(Object(fa.a)()),s=()=>{this.rbdMirroringService.refresh(),this.createBootstrapForm.setErrors({cdSubmitButton:!0})};this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/mirroring/bootstrap/create",{}),call:o}).subscribe({error:s,complete:s})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(r.a),S.Mb(pa),S.Mb(z.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-bootstrap-create-modal"]],decls:35,vars:6,consts:function(){return[[3,"modalRef"],[1,"modal-title"],"Create Bootstrap Token",[1,"modal-content"],["name","createBootstrapForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],"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" + ".",[1,"form-group"],["for","siteName",1,"col-form-label","required"],"Site Name",["type","text","id","siteName","name","siteName","formControlName","siteName","autofocus","",1,"form-control",6,"placeholder"],["placeholder","Name..."],["class","invalid-feedback",4,"ngIf"],["formGroupName","pools",1,"form-group"],["for","pools",1,"col-form-label","required"],"Pools",["class","custom-control custom-checkbox",4,"ngFor","ngForOf"],[1,"mb-4","float-right",3,"form","submitAction"],"Generate",["for","token",1,"col-form-label"],"Token",["id","token","formControlName","token","readonly","",1,"form-control","resize-vertical",6,"placeholder"],["placeholder","Generated token..."],["source","token",1,"float-right"],[1,"modal-footer"],[3,"backAction",6,"name"],["name","Close"],[1,"invalid-feedback"],"This field is required.",[1,"custom-control","custom-checkbox"],["type","checkbox",1,"custom-control-input",3,"id","name","formControlName"],[1,"custom-control-label",3,"for"],"At least one pool is required."]},template:function(e,t){if(1&e&&(S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Wb(2,2),S.Pb(),S.Qb(3,3),S.Sb(4,"form",4,5),S.Sb(6,"div",6),S.Sb(7,"p"),S.Qb(8),S.cc(9,7),S.Nb(10,"kbd"),S.Zb(),S.Pb(),S.Rb(),S.Sb(11,"div",8),S.Sb(12,"label",9),S.Wb(13,10),S.Rb(),S.Sb(14,"input",11),S.Yb(15,12),S.Rb(),S.Mc(16,va,2,0,"span",13),S.Rb(),S.Sb(17,"div",14),S.Sb(18,"label",15),S.Wb(19,16),S.Rb(),S.Mc(20,ya,4,5,"div",17),S.Mc(21,Ra,2,0,"span",13),S.Rb(),S.Sb(22,"cd-submit-button",18),S.gc("submitAction",(function(){return t.generate()})),S.Wb(23,19),S.Rb(),S.Sb(24,"div",8),S.Sb(25,"label",20),S.Sb(26,"span"),S.Wb(27,21),S.Rb(),S.Rb(),S.Sb(28,"textarea",22),S.Yb(29,23),S.Oc(30," "),S.Rb(),S.Rb(),S.Nb(31,"cd-copy-2-clipboard-button",24),S.Rb(),S.Sb(32,"div",25),S.Sb(33,"cd-back-button",26),S.Yb(34,27),S.gc("backAction",(function(){return t.activeModal.close()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e){const e=S.Ac(5);S.pc("modalRef",t.activeModal),S.yb(4),S.pc("formGroup",t.createBootstrapForm),S.yb(12),S.pc("ngIf",t.createBootstrapForm.showError("siteName",e,"required")),S.yb(4),S.pc("ngForOf",t.pools),S.yb(1),S.pc("ngIf",t.createBootstrapForm.showError("pools",e,"requirePool")),S.yb(1),S.pc("form",t.createBootstrapForm)}},directives:[E.a,o.C,o.r,C.a,o.k,D.a,O.a,o.d,A.a,o.q,o.i,ha.a,i.r,o.l,i.q,ga.a,ce.a,Sa.a,o.b],styles:[".form-group.ng-invalid[_ngcontent-%COMP%] .invalid-feedback[_ngcontent-%COMP%]{display:block}"]}),e})();function _a(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,29),S.Rb())}function ka(e,t){if(1&e&&(S.Sb(0,"option",30),S.Oc(1),S.Rb()),2&e){const e=t.$implicit;S.pc("value",e.key),S.yb(1),S.Pc(e.desc)}}function Ma(e,t){if(1&e&&(S.Sb(0,"div",31),S.Nb(1,"input",32),S.Sb(2,"label",33),S.Oc(3),S.Rb(),S.Rb()),2&e){const e=t.$implicit;S.yb(1),S.qc("id",e.name),S.qc("name",e.name),S.qc("formControlName",e.name),S.yb(1),S.qc("for",e.name),S.yb(1),S.Pc(e.name)}}function Na(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,34),S.Rb())}function Ia(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,35),S.Rb())}function $a(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,36),S.Rb())}let Ta=(()=>{class e{constructor(e,t,a,i){this.activeModal=e,this.actionLabels=t,this.rbdMirroringService=a,this.taskWrapper=i,this.pools=[],this.directions=[{key:"rx-tx",desc:"Bidirectional"},{key:"rx",desc:"Unidirectional (receive-only)"}],this.createForm()}createForm(){this.importBootstrapForm=new $.a({siteName:new o.h("",{validators:[o.A.required]}),direction:new o.h("rx-tx",{}),pools:new o.j({},{validators:[this.validatePools()]}),token:new o.h("",{validators:[o.A.required,this.validateToken()]})})}ngOnInit(){this.rbdMirroringService.getSiteName().subscribe(e=>{this.importBootstrapForm.get("siteName").setValue(e.site_name)}),this.subs=this.rbdMirroringService.subscribeSummary(e=>{this.pools=e.content_data.pools.reduce((e,t)=>(e.push({name:t.name,mirror_mode:t.mirror_mode}),e),[]);const t=this.importBootstrapForm.get("pools");m.a.each(this.pools,e=>{const a=e.name,i="disabled"===e.mirror_mode,s=t.controls[a];s?i&&s.disabled?s.enable():!i&&s.enabled&&(s.disable(),s.setValue(!0)):t.addControl(a,new o.h({value:!i,disabled:!i}))})})}ngOnDestroy(){this.subs&&this.subs.unsubscribe()}validatePools(){return e=>{let t=0;return m.a.each(e.controls,e=>{!0===e.value&&++t}),t>0?null:{requirePool:!0}}}validateToken(){return e=>{try{if(JSON.parse(atob(e.value)))return null}catch(t){}return{invalidToken:!0}}}import(){const e=[],t=[],a=this.importBootstrapForm.get("pools");m.a.each(a.controls,(a,i)=>{!0===a.value&&(e.push(i),a.disabled||t.push(i))});const i={mirror_mode:"image"};let o=Object(ma.a)(this.rbdMirroringService.setSiteName(this.importBootstrapForm.getValue("siteName")),Object(u.a)(t.map(e=>this.rbdMirroringService.updatePool(e,i))));o=e.reduce((e,t)=>Object(ma.a)(e,this.rbdMirroringService.importBootstrapToken(t,this.importBootstrapForm.getValue("direction"),this.importBootstrapForm.getValue("token"))),o).pipe(Object(fa.a)());const s=()=>{this.rbdMirroringService.refresh(),this.importBootstrapForm.setErrors({cdSubmitButton:!0})};this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/mirroring/bootstrap/import",{}),call:o}).subscribe({error:s,complete:()=>{s(),this.activeModal.close()}})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(r.a),S.Mb(l.b),S.Mb(pa),S.Mb(z.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-bootstrap-import-modal"]],decls:38,vars:10,consts:function(){return[[3,"modalRef"],[1,"modal-title"],"Import Bootstrap Token",[1,"modal-content"],["name","importBootstrapForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],"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" + ".",[1,"form-group"],["for","siteName",1,"col-form-label","required"],"Site Name",["type","text","id","siteName","name","siteName","formControlName","siteName","autofocus","",1,"form-control",6,"placeholder"],["placeholder","Name..."],["class","invalid-feedback",4,"ngIf"],["for","direction",1,"col-form-label"],"Direction",["id","direction","name","direction","formControlName","direction",1,"form-control","custom-select"],[3,"value",4,"ngFor","ngForOf"],["formGroupName","pools",1,"form-group"],["for","pools",1,"col-form-label","required"],"Pools",["class","custom-control custom-checkbox",4,"ngFor","ngForOf"],["for","token",1,"col-form-label","required"],"Token",["id","token","formControlName","token",1,"form-control","resize-vertical",6,"placeholder"],["placeholder","Generated token..."],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],"This field is required.",[3,"value"],[1,"custom-control","custom-checkbox"],["type","checkbox",1,"custom-control-input",3,"id","name","formControlName"],[1,"custom-control-label",3,"for"],"At least one pool is required.","This field is required.","The token is invalid."]},template:function(e,t){if(1&e&&(S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Wb(2,2),S.Pb(),S.Qb(3,3),S.Sb(4,"form",4,5),S.Sb(6,"div",6),S.Sb(7,"p"),S.Qb(8),S.cc(9,7),S.Nb(10,"kbd"),S.Zb(),S.Pb(),S.Rb(),S.Sb(11,"div",8),S.Sb(12,"label",9),S.Wb(13,10),S.Rb(),S.Sb(14,"input",11),S.Yb(15,12),S.Rb(),S.Mc(16,_a,2,0,"span",13),S.Rb(),S.Sb(17,"div",8),S.Sb(18,"label",14),S.Sb(19,"span"),S.Wb(20,15),S.Rb(),S.Rb(),S.Sb(21,"select",16),S.Mc(22,ka,2,2,"option",17),S.Rb(),S.Rb(),S.Sb(23,"div",18),S.Sb(24,"label",19),S.Wb(25,20),S.Rb(),S.Mc(26,Ma,4,5,"div",21),S.Mc(27,Na,2,0,"span",13),S.Rb(),S.Sb(28,"div",8),S.Sb(29,"label",22),S.Wb(30,23),S.Rb(),S.Sb(31,"textarea",24),S.Yb(32,25),S.Oc(33," "),S.Rb(),S.Mc(34,Ia,2,0,"span",13),S.Mc(35,$a,2,0,"span",13),S.Rb(),S.Rb(),S.Sb(36,"div",26),S.Sb(37,"cd-form-button-panel",27),S.gc("submitActionEvent",(function(){return t.import()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e){const e=S.Ac(5);S.pc("modalRef",t.activeModal),S.yb(4),S.pc("formGroup",t.importBootstrapForm),S.yb(12),S.pc("ngIf",t.importBootstrapForm.showError("siteName",e,"required")),S.yb(6),S.pc("ngForOf",t.directions),S.yb(4),S.pc("ngForOf",t.pools),S.yb(1),S.pc("ngIf",t.importBootstrapForm.showError("pools",e,"requirePool")),S.yb(7),S.pc("ngIf",t.importBootstrapForm.showError("token",e,"required")),S.yb(1),S.pc("ngIf",t.importBootstrapForm.showError("token",e,"invalidToken")),S.yb(2),S.pc("form",t.importBootstrapForm)("submitText",t.actionLabels.SUBMIT)}},directives:[E.a,o.C,o.r,C.a,o.k,D.a,O.a,o.d,A.a,o.q,o.i,ha.a,i.r,o.z,i.q,o.l,x.a,o.u,o.B,o.b],styles:[""]}),e})(),Fa=(()=>{class e{constructor(e,t,a,i){this.activeModal=e,this.actionLabels=t,this.rbdMirroringService=a,this.taskWrapper=i,this.createForm()}createForm(){this.editSiteNameForm=new $.a({siteName:new o.h("",{})})}ngOnInit(){this.editSiteNameForm.get("siteName").setValue(this.siteName),this.rbdMirroringService.getSiteName().subscribe(e=>{this.editSiteNameForm.get("siteName").setValue(e.site_name)})}update(){this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/mirroring/site_name/edit",{}),call:this.rbdMirroringService.setSiteName(this.editSiteNameForm.getValue("siteName"))}).subscribe({error:()=>this.editSiteNameForm.setErrors({cdSubmitButton:!0}),complete:()=>{this.rbdMirroringService.refresh(),this.activeModal.close()}})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(r.a),S.Mb(l.b),S.Mb(pa),S.Mb(z.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-edit-site-mode-modal"]],decls:18,vars:4,consts:function(){return[[3,"modalRef"],[1,"modal-title"],"Edit site name",[1,"modal-content"],["name","editSiteNameForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],"Edit the site name and click\xA0 " + "\ufffd#10\ufffd" + "Update" + "\ufffd/#10\ufffd" + ".",[1,"form-group"],["for","siteName",1,"col-form-label","required"],"Site Name",["type","text","id","siteName","name","siteName","formControlName","siteName","autofocus","",1,"form-control",6,"placeholder"],["placeholder","Name..."],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"]]},template:function(e,t){1&e&&(S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Wb(2,2),S.Pb(),S.Qb(3,3),S.Sb(4,"form",4,5),S.Sb(6,"div",6),S.Sb(7,"p"),S.Qb(8),S.cc(9,7),S.Nb(10,"kbd"),S.Zb(),S.Pb(),S.Rb(),S.Sb(11,"div",8),S.Sb(12,"label",9),S.Wb(13,10),S.Rb(),S.Sb(14,"input",11),S.Yb(15,12),S.Rb(),S.Rb(),S.Rb(),S.Sb(16,"div",13),S.Sb(17,"cd-form-button-panel",14),S.gc("submitActionEvent",(function(){return t.update()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e&&(S.pc("modalRef",t.activeModal),S.yb(4),S.pc("formGroup",t.editSiteNameForm),S.yb(13),S.pc("form",t.editSiteNameForm)("submitText",t.actionLabels.UPDATE))},directives:[E.a,o.C,o.r,C.a,o.k,D.a,O.a,o.d,A.a,o.q,o.i,ha.a,x.a],styles:[""]}),e})();var Pa=a("VxPD"),za=a("85J/");let Ea=(()=>{class e{transform(e){return"warning"===e?"badge badge-warning":"error"===e?"badge badge-danger":"success"===e?"badge badge-success":"badge badge-info"}}return e.\u0275fac=function(t){return new(t||e)},e.\u0275pipe=S.Lb({name:"mirrorHealthColor",type:e,pure:!0}),e})();const Ca=["healthTmpl"];function Da(e,t){if(1&e&&(S.Sb(0,"span",2),S.jc(1,"mirrorHealthColor"),S.Oc(2),S.Rb()),2&e){const e=t.value;S.pc("ngClass",S.kc(1,2,t.row.health_color)),S.yb(2),S.Pc(e)}}let Oa=(()=>{class e{constructor(e,t){this.rbdMirroringService=e,this.cephShortVersionPipe=t,this.tableStatus=new Pa.a}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(e=>{this.data=e.content_data.daemons,this.tableStatus=new Pa.a(e.status)})}ngOnDestroy(){this.subs.unsubscribe()}refresh(){this.rbdMirroringService.refresh()}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(pa),S.Mb(za.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-mirroring-daemons"]],viewQuery:function(e,t){var a;1&e&&S.Jc(Ca,!0),2&e&&S.zc(a=S.hc())&&(t.healthTmpl=a.first)},decls:3,vars:4,consts:[["columnMode","flex",3,"data","columns","autoReload","status","fetchData"],["healthTmpl",""],[3,"ngClass"]],template:function(e,t){1&e&&(S.Sb(0,"cd-table",0),S.gc("fetchData",(function(){return t.refresh()})),S.Rb(),S.Mc(1,Da,3,4,"ng-template",null,1,S.Nc)),2&e&&S.pc("data",t.data)("columns",t.columns)("autoReload",-1)("status",t.tableStatus)},directives:[ot.a,i.p],pipes:[Ea],styles:[""]}),e})();var Aa=a("HDdC");class xa{}function Va(e,t){if(1&e&&(S.Sb(0,"option",16),S.Oc(1),S.Rb()),2&e){const e=t.$implicit;S.pc("value",e.id),S.yb(1),S.Pc(e.name)}}function Wa(e,t){1&e&&(S.Sb(0,"span",17),S.Wb(1,18),S.Rb())}let qa=(()=>{class e{constructor(e,t,a,i){this.activeModal=e,this.actionLabels=t,this.rbdMirroringService=a,this.taskWrapper=i,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 $.a({mirrorMode:new o.h("",{validators:[o.A.required,this.validateMode.bind(this)]})})}ngOnInit(){this.pattern=""+this.poolName,this.rbdMirroringService.getPool(this.poolName).subscribe(e=>{this.setResponse(e)}),this.subs=this.rbdMirroringService.subscribeSummary(e=>{this.peerExists=!1;const t=e.content_data.pools.find(e=>this.poolName===e.name);this.peerExists=t&&t.peer_uuids.length})}ngOnDestroy(){this.subs.unsubscribe()}validateMode(e){return"disabled"===e.value&&this.peerExists?{cannotDisable:{value:e.value}}:null}setResponse(e){this.editModeForm.get("mirrorMode").setValue(e.mirror_mode)}update(){const e=new xa;e.mirror_mode=this.editModeForm.getValue("mirrorMode"),this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/mirroring/pool/edit",{pool_name:this.poolName}),call:this.rbdMirroringService.updatePool(this.poolName,e)}).subscribe({error:()=>this.editModeForm.setErrors({cdSubmitButton:!0}),complete:()=>{this.rbdMirroringService.refresh(),this.activeModal.close()}})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(r.a),S.Mb(l.b),S.Mb(pa),S.Mb(z.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-pool-edit-mode-modal"]],decls:21,vars:7,consts:function(){var e,t;return e="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]" + ".",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","editModeForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t=S.bc(t),[1,"form-group"],["for","mirrorMode",1,"col-form-label"],"Mode",["id","mirrorMode","name","mirrorMode","formControlName","mirrorMode",1,"form-control","custom-select"],[3,"value",4,"ngFor","ngForOf"],["class","invalid-feedback",4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[3,"value"],[1,"invalid-feedback"],"Peer clusters must be removed prior to disabling mirror."]},template:function(e,t){if(1&e&&(S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Wb(2,2),S.Pb(),S.Qb(3,3),S.Sb(4,"form",4,5),S.Sb(6,"div",6),S.Sb(7,"p"),S.Qb(8),S.cc(9,7),S.Nb(10,"kbd"),S.Nb(11,"kbd"),S.Zb(),S.Pb(),S.Rb(),S.Sb(12,"div",8),S.Sb(13,"label",9),S.Sb(14,"span"),S.Wb(15,10),S.Rb(),S.Rb(),S.Sb(16,"select",11),S.Mc(17,Va,2,2,"option",12),S.Rb(),S.Mc(18,Wa,2,0,"span",13),S.Rb(),S.Rb(),S.Sb(19,"div",14),S.Sb(20,"cd-form-button-panel",15),S.gc("submitActionEvent",(function(){return t.update()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e){const e=S.Ac(5);S.pc("modalRef",t.activeModal),S.yb(4),S.pc("formGroup",t.editModeForm),S.yb(7),S.ac(t.poolName),S.Xb(9),S.yb(6),S.pc("ngForOf",t.mirrorModes),S.yb(1),S.pc("ngIf",t.editModeForm.showError("mirrorMode",e,"cannotDisable")),S.yb(2),S.pc("form",t.editModeForm)("submitText",t.actionLabels.UPDATE)}},directives:[E.a,o.C,o.r,C.a,o.k,D.a,O.a,o.z,A.a,o.q,o.i,i.q,i.r,x.a,o.u,o.B],styles:[""]}),e})();class Ba{}function Ga(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,29),S.Rb())}function La(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,30),S.Rb())}function ja(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,31),S.Rb())}function Qa(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,32),S.Rb())}function Ua(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,33),S.Rb())}function Ya(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,34),S.Rb())}let Ka=(()=>{class e{constructor(e,t,a,i){this.activeModal=e,this.actionLabels=t,this.rbdMirroringService=a,this.taskWrapper=i,this.bsConfig={containerClass:"theme-default"},this.createForm()}createForm(){this.editPeerForm=new $.a({clusterName:new o.h("",{validators:[o.A.required,this.validateClusterName]}),clientID:new o.h("",{validators:[o.A.required,this.validateClientID]}),monAddr:new o.h("",{validators:[this.validateMonAddr]}),key:new o.h("",{validators:[this.validateKey]})})}ngOnInit(){this.pattern=`${this.poolName}/${this.peerUUID}`,"edit"===this.mode&&this.rbdMirroringService.getPeer(this.poolName,this.peerUUID).subscribe(e=>{this.setResponse(e)})}validateClusterName(e){if(!e.value.match(/^[\w\-_]*$/))return{invalidClusterName:{value:e.value}}}validateClientID(e){if(!e.value.match(/^(?!client\.)[\w\-_.]*$/))return{invalidClientID:{value:e.value}}}validateMonAddr(e){if(!e.value.match(/^[,; ]*([\w.\-_\[\]]+(:[\d]+)?[,; ]*)*$/))return{invalidMonAddr:{value:e.value}}}validateKey(e){try{if(""===e.value||atob(e.value))return null}catch(t){}return{invalidKey:{value:e.value}}}setResponse(e){this.response=e,this.editPeerForm.get("clusterName").setValue(e.cluster_name),this.editPeerForm.get("clientID").setValue(e.client_id),this.editPeerForm.get("monAddr").setValue(e.mon_host),this.editPeerForm.get("key").setValue(e.key)}update(){const e=new Ba;let t;e.cluster_name=this.editPeerForm.getValue("clusterName"),e.client_id=this.editPeerForm.getValue("clientID"),e.mon_host=this.editPeerForm.getValue("monAddr"),e.key=this.editPeerForm.getValue("key"),t=this.taskWrapper.wrapTaskAroundCall("edit"===this.mode?{task:new F.a("rbd/mirroring/peer/edit",{pool_name:this.poolName}),call:this.rbdMirroringService.updatePeer(this.poolName,this.peerUUID,e)}:{task:new F.a("rbd/mirroring/peer/add",{pool_name:this.poolName}),call:this.rbdMirroringService.addPeer(this.poolName,e)}),t.subscribe({error:()=>this.editPeerForm.setErrors({cdSubmitButton:!0}),complete:()=>{this.rbdMirroringService.refresh(),this.activeModal.close()}})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(r.a),S.Mb(l.b),S.Mb(pa),S.Mb(z.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-pool-edit-peer-modal"]],decls:42,vars:13,consts:function(){var e,t,a,i;return e="{VAR_SELECT, select, edit {Edit} other {Add}}",e=S.bc(e,{VAR_SELECT:"\ufffd0\ufffd"}),t="" + e + " pool mirror peer",a="{VAR_SELECT, select, edit {Edit} other {Add}}",a=S.bc(a,{VAR_SELECT:"\ufffd0\ufffd"}),i="" + a + " 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]" + ".",[[3,"modalRef"],[1,"modal-title"],t,[1,"modal-content"],["name","editPeerForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],i=S.bc(i),[1,"form-group"],["for","clusterName",1,"col-form-label","required"],"Cluster Name",["type","text","id","clusterName","name","clusterName","formControlName","clusterName","autofocus","",1,"form-control",6,"placeholder"],["placeholder","Name..."],["class","invalid-feedback",4,"ngIf"],["for","clientID",1,"col-form-label","required"],"CephX ID",["type","text","id","clientID","name","clientID","formControlName","clientID",1,"form-control",6,"placeholder"],["placeholder","CephX ID..."],["for","monAddr",1,"col-form-label"],"Monitor Addresses",["type","text","id","monAddr","name","monAddr","formControlName","monAddr",1,"form-control",6,"placeholder"],["placeholder","Comma-delimited addresses..."],["for","key",1,"col-form-label"],"CephX Key",["type","text","id","key","name","key","formControlName","key",1,"form-control",6,"placeholder"],["placeholder","Base64-encoded key..."],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],"This field is required.","The cluster name is not valid.","This field is required.","The CephX ID is not valid.","The monitory address is not valid.","CephX key must be base64 encoded."]},template:function(e,t){if(1&e&&(S.Sb(0,"cd-modal",0),S.Sb(1,"span",1),S.Wb(2,2),S.Rb(),S.Qb(3,3),S.Sb(4,"form",4,5),S.Sb(6,"div",6),S.Sb(7,"p"),S.Sb(8,"span"),S.cc(9,7),S.Nb(10,"kbd"),S.Nb(11,"kbd"),S.Zb(),S.Rb(),S.Rb(),S.Sb(12,"div",8),S.Sb(13,"label",9),S.Wb(14,10),S.Rb(),S.Sb(15,"input",11),S.Yb(16,12),S.Rb(),S.Mc(17,Ga,2,0,"span",13),S.Mc(18,La,2,0,"span",13),S.Rb(),S.Sb(19,"div",8),S.Sb(20,"label",14),S.Wb(21,15),S.Rb(),S.Sb(22,"input",16),S.Yb(23,17),S.Rb(),S.Mc(24,ja,2,0,"span",13),S.Mc(25,Qa,2,0,"span",13),S.Rb(),S.Sb(26,"div",8),S.Sb(27,"label",18),S.Sb(28,"span"),S.Wb(29,19),S.Rb(),S.Rb(),S.Sb(30,"input",20),S.Yb(31,21),S.Rb(),S.Mc(32,Ua,2,0,"span",13),S.Rb(),S.Sb(33,"div",8),S.Sb(34,"label",22),S.Sb(35,"span"),S.Wb(36,23),S.Rb(),S.Rb(),S.Sb(37,"input",24),S.Yb(38,25),S.Rb(),S.Mc(39,Ya,2,0,"span",13),S.Rb(),S.Rb(),S.Sb(40,"div",26),S.Sb(41,"cd-form-button-panel",27),S.gc("submitActionEvent",(function(){return t.update()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e){const e=S.Ac(5);S.pc("modalRef",t.activeModal),S.yb(2),S.ac(t.mode),S.Xb(2),S.yb(2),S.pc("formGroup",t.editPeerForm),S.yb(7),S.ac(t.mode)(t.poolName),S.Xb(9),S.yb(6),S.pc("ngIf",t.editPeerForm.showError("clusterName",e,"required")),S.yb(1),S.pc("ngIf",t.editPeerForm.showError("clusterName",e,"invalidClusterName")),S.yb(6),S.pc("ngIf",t.editPeerForm.showError("clientID",e,"required")),S.yb(1),S.pc("ngIf",t.editPeerForm.showError("clientID",e,"invalidClientID")),S.yb(7),S.pc("ngIf",t.editPeerForm.showError("monAddr",e,"invalidMonAddr")),S.yb(7),S.pc("ngIf",t.editPeerForm.showError("key",e,"invalidKey")),S.yb(2),S.pc("form",t.editPeerForm)("submitText",t.actionLabels.SUBMIT)}},directives:[E.a,o.C,o.r,C.a,o.k,D.a,O.a,o.d,A.a,o.q,o.i,ha.a,i.r,x.a],styles:[""]}),e})();const Ja=["healthTmpl"];function Xa(e,t){if(1&e&&(S.Sb(0,"span",3),S.jc(1,"mirrorHealthColor"),S.Oc(2),S.Rb()),2&e){const e=t.value;S.pc("ngClass",S.kc(1,2,t.row.health_color)),S.yb(2),S.Pc(e)}}let Ha=(()=>{class e{constructor(e,t,a,i){this.authStorageService=e,this.rbdMirroringService=t,this.modalService=a,this.taskWrapper=i,this.selection=new nt.a,this.tableStatus=new Pa.a,this.data=[],this.permission=this.authStorageService.getPermissions().rbdMirroring;const o={permission:"update",icon:N.a.edit,click:()=>this.editModeModal(),name:"Edit Mode",canBePrimary:()=>!0},s={permission:"create",icon:N.a.add,name:"Add Peer",click:()=>this.editPeersModal("add"),disable:()=>!this.selection.first()||"disabled"===this.selection.first().mirror_mode,visible:()=>!this.getPeerUUID(),canBePrimary:()=>!1},n={permission:"update",icon:N.a.exchange,name:"Edit Peer",click:()=>this.editPeersModal("edit"),visible:()=>!!this.getPeerUUID()},r={permission:"delete",icon:N.a.destroy,name:"Delete Peer",click:()=>this.deletePeersModal(),visible:()=>!!this.getPeerUUID()};this.tableActions=[o,s,n,r]}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(e=>{this.data=e.content_data.pools,this.tableStatus=new Pa.a(e.status)})}ngOnDestroy(){this.subs.unsubscribe()}refresh(){this.rbdMirroringService.refresh()}editModeModal(){const e={poolName:this.selection.first().name};this.modalRef=this.modalService.show(qa,e)}editPeersModal(e){const t={poolName:this.selection.first().name,mode:e};"edit"===e&&(t.peerUUID=this.getPeerUUID()),this.modalRef=this.modalService.show(Ka,t)}deletePeersModal(){const e=this.selection.first().name,t=this.getPeerUUID();this.modalRef=this.modalService.show(it.a,{itemDescription:"mirror peer",itemNames:[`${e} (${t})`],submitActionObservable:()=>new Aa.a(a=>{this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/mirroring/peer/delete",{pool_name:e}),call:this.rbdMirroringService.deletePeer(e,t)}).subscribe({error:e=>a.error(e),complete:()=>{this.rbdMirroringService.refresh(),a.complete()}})})})}getPeerUUID(){const e=this.selection.first(),t=this.data.find(t=>e&&e.name===t.name);if(t&&t.peer_uuids)return t.peer_uuids[0]}updateSelection(e){this.selection=e}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(lt.a),S.Mb(pa),S.Mb(P.a),S.Mb(z.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-mirroring-pools"]],viewQuery:function(e,t){var a;1&e&&S.Jc(Ja,!0),2&e&&S.zc(a=S.hc())&&(t.healthTmpl=a.first)},decls:4,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",""],[3,"ngClass"]],template:function(e,t){1&e&&(S.Sb(0,"cd-table",0),S.gc("fetchData",(function(){return t.refresh()}))("updateSelection",(function(e){return t.updateSelection(e)})),S.Nb(1,"cd-table-actions",1),S.Rb(),S.Mc(2,Xa,3,4,"ng-template",null,2,S.Nc)),2&e&&(S.pc("data",t.data)("columns",t.columns)("autoReload",-1)("status",t.tableStatus),S.yb(1),S.pc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions))},directives:[ot.a,Mt.a,i.p],pipes:[Ea],styles:[""]}),e})();var Za=a("JP8w");const ei=["stateTmpl"],ti=["syncTmpl"],ai=["progressTmpl"];function ii(e,t){if(1&e){const e=S.Tb();S.Sb(0,"cd-table",14),S.gc("fetchData",(function(){return S.Dc(e),S.ic().refresh()})),S.Rb()}if(2&e){const e=S.ic();S.pc("data",e.image_error.data)("columns",e.image_error.columns)("autoReload",-1)("status",e.tableStatus)}}function oi(e,t){if(1&e){const e=S.Tb();S.Sb(0,"cd-table",14),S.gc("fetchData",(function(){return S.Dc(e),S.ic().refresh()})),S.Rb()}if(2&e){const e=S.ic();S.pc("data",e.image_syncing.data)("columns",e.image_syncing.columns)("autoReload",-1)("status",e.tableStatus)}}function si(e,t){if(1&e){const e=S.Tb();S.Sb(0,"cd-table",14),S.gc("fetchData",(function(){return S.Dc(e),S.ic().refresh()})),S.Rb()}if(2&e){const e=S.ic();S.pc("data",e.image_ready.data)("columns",e.image_ready.columns)("autoReload",-1)("status",e.tableStatus)}}function ni(e,t){if(1&e&&(S.Sb(0,"span",15),S.jc(1,"mirrorHealthColor"),S.Oc(2),S.Rb()),2&e){const e=t.value;S.pc("ngClass",S.kc(1,2,t.row.state_color)),S.yb(2),S.Pc(e)}}function ri(e,t){1&e&&(S.Sb(0,"span",16),S.Wb(1,17),S.Rb())}function ci(e,t){1&e&&S.Nb(0,"ngb-progressbar",18),2&e&&S.pc("value",t.value)("showValue",!0)}let li=(()=>{class e{constructor(e){this.rbdMirroringService=e,this.image_error={data:[],columns:{}},this.image_syncing={data:[],columns:{}},this.image_ready={data:[],columns:{}},this.tableStatus=new Pa.a}ngOnInit(){this.image_error.columns=[{prop:"pool_name",name:"Pool",flexGrow:2},{prop:"name",name:"Image",flexGrow:2},{prop:"description",name:"Issue",flexGrow:4},{prop:"state",name:"State",cellTemplate:this.stateTmpl,flexGrow:1}],this.image_syncing.columns=[{prop:"pool_name",name:"Pool",flexGrow:2},{prop:"name",name:"Image",flexGrow:2},{prop:"progress",name:"Progress",cellTemplate:this.progressTmpl,flexGrow:2},{prop:"state",name:"State",cellTemplate:this.syncTmpl,flexGrow:1}],this.image_ready.columns=[{prop:"pool_name",name:"Pool",flexGrow:2},{prop:"name",name:"Image",flexGrow:2},{prop:"description",name:"Description",flexGrow:4},{prop:"state",name:"State",cellTemplate:this.stateTmpl,flexGrow:1}],this.subs=this.rbdMirroringService.subscribeSummary(e=>{this.image_error.data=e.content_data.image_error,this.image_syncing.data=e.content_data.image_syncing,this.image_ready.data=e.content_data.image_ready,this.tableStatus=new Pa.a(e.status)})}ngOnDestroy(){this.subs.unsubscribe()}refresh(){this.rbdMirroringService.refresh()}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(pa))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-mirroring-images"]],viewQuery:function(e,t){var a;1&e&&(S.Jc(ei,!0),S.Jc(ti,!0),S.Jc(ai,!0)),2&e&&(S.zc(a=S.hc())&&(t.stateTmpl=a.first),S.zc(a=S.hc())&&(t.syncTmpl=a.first),S.zc(a=S.hc())&&(t.progressTmpl=a.first))},decls:21,vars:1,consts:function(){return[["ngbNav","","cdStatefulTab","image-list",1,"nav-tabs"],["nav","ngbNav"],["ngbNavItem","issues"],["ngbNavLink",""],"Issues",["ngbNavContent",""],["ngbNavItem","syncing"],"Syncing",["ngbNavItem","ready"],"Ready",[3,"ngbNavOutlet"],["stateTmpl",""],["syncTmpl",""],["progressTmpl",""],["columnMode","flex",3,"data","columns","autoReload","status","fetchData"],[3,"ngClass"],[1,"badge","badge-info"],"Syncing",["type","info",3,"value","showValue"]]},template:function(e,t){if(1&e&&(S.Sb(0,"ul",0,1),S.Sb(2,"li",2),S.Sb(3,"a",3),S.Wb(4,4),S.Rb(),S.Mc(5,ii,1,4,"ng-template",5),S.Rb(),S.Sb(6,"li",6),S.Sb(7,"a",3),S.Wb(8,7),S.Rb(),S.Mc(9,oi,1,4,"ng-template",5),S.Rb(),S.Sb(10,"li",8),S.Sb(11,"a",3),S.Wb(12,9),S.Rb(),S.Mc(13,si,1,4,"ng-template",5),S.Rb(),S.Rb(),S.Nb(14,"div",10),S.Mc(15,ni,3,4,"ng-template",null,11,S.Nc),S.Mc(17,ri,2,0,"ng-template",null,12,S.Nc),S.Mc(19,ci,1,2,"ng-template",null,13,S.Nc)),2&e){const e=S.Ac(1);S.yb(14),S.pc("ngbNavOutlet",e)}},directives:[r.p,Za.a,r.r,r.s,r.q,r.u,ot.a,i.p,r.z],pipes:[Ea],styles:[""]}),e})(),bi=(()=>{class e{constructor(e,t,a){this.authStorageService=e,this.rbdMirroringService=t,this.modalService=a,this.selection=new nt.a,this.peersExist=!0,this.subs=new ca.a,this.permission=this.authStorageService.getPermissions().rbdMirroring;const i={permission:"update",icon:N.a.edit,click:()=>this.editSiteNameModal(),name:"Edit Site Name",canBePrimary:()=>!0,disable:()=>!1},o={permission:"update",icon:N.a.upload,click:()=>this.createBootstrapModal(),name:"Create Bootstrap Token",disable:()=>!1},s={permission:"update",icon:N.a.download,click:()=>this.importBootstrapModal(),name:"Import Bootstrap Token",disable:()=>this.peersExist};this.tableActions=[i,o,s]}ngOnInit(){this.subs.add(this.rbdMirroringService.startPolling()),this.subs.add(this.rbdMirroringService.subscribeSummary(e=>{this.status=e.content_data.status,this.siteName=e.site_name,this.peersExist=!!e.content_data.pools.find(e=>e.peer_uuids.length>0)}))}ngOnDestroy(){this.subs.unsubscribe()}editSiteNameModal(){this.modalRef=this.modalService.show(Fa,{siteName:this.siteName})}createBootstrapModal(){this.modalRef=this.modalService.show(wa,{siteName:this.siteName})}importBootstrapModal(){this.modalRef=this.modalService.show(Ta,{siteName:this.siteName})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(lt.a),S.Mb(pa),S.Mb(P.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-mirroring"]],decls:21,vars:4,consts:function(){return[[1,"row"],[1,"col-md-12"],"Site Name:",[1,"table-actions","float-right",3,"permission","selection","tableActions"],[1,"col-sm-6"],"Daemons","Pools","Images"]},template:function(e,t){1&e&&(S.Sb(0,"div",0),S.Sb(1,"div",1),S.Sb(2,"span"),S.Sb(3,"strong"),S.Wb(4,2),S.Rb(),S.Oc(5),S.Rb(),S.Nb(6,"cd-table-actions",3),S.Rb(),S.Rb(),S.Sb(7,"div",0),S.Sb(8,"div",4),S.Sb(9,"legend"),S.Wb(10,5),S.Rb(),S.Nb(11,"cd-mirroring-daemons"),S.Rb(),S.Sb(12,"div",4),S.Sb(13,"legend"),S.Wb(14,6),S.Rb(),S.Nb(15,"cd-mirroring-pools"),S.Rb(),S.Rb(),S.Sb(16,"div",0),S.Sb(17,"div",1),S.Sb(18,"legend"),S.Wb(19,7),S.Rb(),S.Nb(20,"cd-mirroring-images"),S.Rb(),S.Rb()),2&e&&(S.yb(5),S.Qc(" ",t.siteName,""),S.yb(1),S.pc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions))},directives:[Mt.a,Oa,Ha,li],styles:[""]}),e})();var di=a("jtHE"),pi=a("SxV6"),mi=a("eIep"),ui=a("Ekvf"),fi=a("PhyI"),hi=a("Fgil"),gi=a("aXbf");class Si{}var vi=function(e){return e[e.V1=1]="V1",e[e.V2=2]="V2",e}({});class yi{constructor(){this.features=[]}}class Ri{constructor(){this.features=[]}}class wi extends class{}{constructor(){super(...arguments),this.features=[]}}class _i{constructor(){this.features=[]}}var ki=function(e){return e.editing="editing",e.cloning="cloning",e.copying="copying",e}({}),Mi=a("EmSq"),Ni=a("rFfW"),Ii=a("p4Cf");function $i(e,t){if(1&e&&(S.Sb(0,"div",9),S.Sb(1,"label",57),S.Wb(2,58),S.jc(3,"titlecase"),S.Rb(),S.Sb(4,"div",12),S.Nb(5,"input",59),S.Nb(6,"hr"),S.Rb(),S.Rb()),2&e){const e=S.ic(2);S.yb(3),S.ac(S.kc(3,1,e.action)),S.Xb(2)}}function Ti(e,t){1&e&&(S.Sb(0,"span",60),S.Qb(1),S.Wb(2,61),S.Pb(),S.Rb())}function Fi(e,t){1&e&&(S.Sb(0,"span",60),S.Qb(1),S.Wb(2,62),S.Pb(),S.Rb())}function Pi(e,t){1&e&&S.Nb(0,"input",63)}function zi(e,t){1&e&&(S.Sb(0,"option",49),S.Wb(1,66),S.Rb()),2&e&&S.pc("ngValue",null)}function Ei(e,t){1&e&&(S.Sb(0,"option",49),S.Wb(1,67),S.Rb()),2&e&&S.pc("ngValue",null)}function Ci(e,t){1&e&&(S.Sb(0,"option",49),S.Wb(1,68),S.Rb()),2&e&&S.pc("ngValue",null)}function Di(e,t){if(1&e&&(S.Sb(0,"option",69),S.Oc(1),S.Rb()),2&e){const e=t.$implicit;S.pc("value",e.pool_name),S.yb(1),S.Pc(e.pool_name)}}function Oi(e,t){if(1&e&&(S.Sb(0,"select",64),S.Mc(1,zi,2,1,"option",65),S.Mc(2,Ei,2,1,"option",65),S.Mc(3,Ci,2,1,"option",65),S.Mc(4,Di,2,2,"option",45),S.Rb()),2&e){const e=S.ic(2);S.yb(1),S.pc("ngIf",null===e.pools),S.yb(1),S.pc("ngIf",null!==e.pools&&0===e.pools.length),S.yb(1),S.pc("ngIf",null!==e.pools&&e.pools.length>0),S.yb(1),S.pc("ngForOf",e.pools)}}function Ai(e,t){1&e&&(S.Sb(0,"span",60),S.Wb(1,70),S.Rb())}const xi=function(e,t){return[e,t]};function Vi(e,t){if(1&e&&(S.Sb(0,"div",9),S.Sb(1,"div",20),S.Nb(2,"i",71),S.Rb(),S.Rb()),2&e){const e=S.ic(2);S.yb(2),S.pc("ngClass",S.vc(1,xi,e.icons.spinner,e.icons.spin))}}function Wi(e,t){1&e&&S.Nb(0,"input",75)}function qi(e,t){1&e&&(S.Sb(0,"option",49),S.Wb(1,77),S.Rb()),2&e&&S.pc("ngValue",null)}function Bi(e,t){1&e&&(S.Sb(0,"option",49),S.Wb(1,78),S.Rb()),2&e&&S.pc("ngValue",null)}function Gi(e,t){1&e&&(S.Sb(0,"option",49),S.Wb(1,79),S.Rb()),2&e&&S.pc("ngValue",null)}function Li(e,t){if(1&e&&(S.Sb(0,"option",69),S.Oc(1),S.Rb()),2&e){const e=t.$implicit;S.pc("value",e),S.yb(1),S.Pc(e)}}function ji(e,t){if(1&e&&(S.Sb(0,"select",76),S.Mc(1,qi,2,1,"option",65),S.Mc(2,Bi,2,1,"option",65),S.Mc(3,Gi,2,1,"option",65),S.Mc(4,Li,2,2,"option",45),S.Rb()),2&e){const e=S.ic(3);S.yb(1),S.pc("ngIf",null===e.pools),S.yb(1),S.pc("ngIf",null!==e.pools&&0===e.pools.length),S.yb(1),S.pc("ngIf",null!==e.pools&&e.pools.length>0),S.yb(1),S.pc("ngForOf",e.namespaces)}}function Qi(e,t){if(1&e&&(S.Sb(0,"div",9),S.Sb(1,"label",72),S.Oc(2," Namespace "),S.Rb(),S.Sb(3,"div",12),S.Mc(4,Wi,1,0,"input",73),S.Mc(5,ji,5,4,"select",74),S.Rb(),S.Rb()),2&e){const e=S.ic(2);S.yb(4),S.pc("ngIf","editing"===e.mode||!e.poolPermission.read),S.yb(1),S.pc("ngIf","editing"!==e.mode&&e.poolPermission.read)}}function Ui(e,t){1&e&&(S.Sb(0,"cd-helper"),S.Sb(1,"span"),S.Wb(2,80),S.Rb(),S.Rb())}function Yi(e,t){1&e&&S.Nb(0,"input",87)}function Ki(e,t){1&e&&(S.Sb(0,"option",49),S.Wb(1,89),S.Rb()),2&e&&S.pc("ngValue",null)}function Ji(e,t){1&e&&(S.Sb(0,"option",49),S.Wb(1,90),S.Rb()),2&e&&S.pc("ngValue",null)}function Xi(e,t){1&e&&(S.Sb(0,"option",49),S.Oc(1,"-- Select a data pool -- "),S.Rb()),2&e&&S.pc("ngValue",null)}function Hi(e,t){if(1&e&&(S.Sb(0,"option",69),S.Oc(1),S.Rb()),2&e){const e=t.$implicit;S.pc("value",e.pool_name),S.yb(1),S.Pc(e.pool_name)}}function Zi(e,t){if(1&e){const e=S.Tb();S.Sb(0,"select",88),S.gc("change",(function(t){return S.Dc(e),S.ic(3).onDataPoolChange(t.target.value)})),S.Mc(1,Ki,2,1,"option",65),S.Mc(2,Ji,2,1,"option",65),S.Mc(3,Xi,2,1,"option",65),S.Mc(4,Hi,2,2,"option",45),S.Rb()}if(2&e){const e=S.ic(3);S.yb(1),S.pc("ngIf",null===e.dataPools),S.yb(1),S.pc("ngIf",null!==e.dataPools&&0===e.dataPools.length),S.yb(1),S.pc("ngIf",null!==e.dataPools&&e.dataPools.length>0),S.yb(1),S.pc("ngForOf",e.dataPools)}}function eo(e,t){1&e&&(S.Sb(0,"span",60),S.Wb(1,91),S.Rb())}const to=function(e){return{required:e}};function ao(e,t){if(1&e&&(S.Sb(0,"div",9),S.Sb(1,"label",81),S.Sb(2,"span",71),S.Wb(3,82),S.Rb(),S.Sb(4,"cd-helper",83),S.Yb(5,84),S.Rb(),S.Rb(),S.Sb(6,"div",12),S.Mc(7,Yi,1,0,"input",85),S.Mc(8,Zi,5,4,"select",86),S.Mc(9,eo,2,0,"span",14),S.Rb(),S.Rb()),2&e){S.ic();const e=S.Ac(2),t=S.ic();S.yb(2),S.pc("ngClass",S.uc(4,to,"editing"!==t.mode)),S.yb(5),S.pc("ngIf","editing"===t.mode||!t.poolPermission.read),S.yb(1),S.pc("ngIf","editing"!==t.mode&&t.poolPermission.read),S.yb(1),S.pc("ngIf",t.rbdForm.showError("dataPool",e,"required"))}}function io(e,t){1&e&&(S.Sb(0,"span",60),S.Wb(1,92),S.Rb())}function oo(e,t){1&e&&(S.Sb(0,"span",60),S.Wb(1,93),S.Rb())}function so(e,t){if(1&e&&S.Nb(0,"cd-helper",97),2&e){const e=S.ic().$implicit;S.qc("html",e.helperHtml)}}function no(e,t){if(1&e&&(S.Sb(0,"div",21),S.Nb(1,"input",94),S.Sb(2,"label",95),S.Oc(3),S.Rb(),S.Mc(4,so,1,1,"cd-helper",96),S.Rb()),2&e){const e=t.$implicit;S.yb(1),S.qc("id",e.key),S.qc("name",e.key),S.qc("formControlName",e.key),S.yb(1),S.qc("for",e.key),S.yb(1),S.Pc(e.desc),S.yb(1),S.pc("ngIf",e.helperHtml)}}function ro(e,t){if(1&e){const e=S.Tb();S.Sb(0,"a",98),S.gc("click",(function(){return S.Dc(e),S.ic(2).advancedEnabled=!0,!1})),S.Wb(1,99),S.Rb()}}function co(e,t){if(1&e&&(S.Sb(0,"option",69),S.Oc(1),S.Rb()),2&e){const e=t.$implicit;S.pc("value",e),S.yb(1),S.Pc(e)}}function lo(e,t){if(1&e&&(S.Sb(0,"option",69),S.Oc(1),S.Rb()),2&e){const e=t.$implicit;S.pc("value",e),S.yb(1),S.Pc(e)}}function bo(e,t){1&e&&(S.Sb(0,"span",60),S.Wb(1,100),S.Rb())}function po(e,t){1&e&&(S.Sb(0,"span",60),S.Wb(1,101),S.Rb())}function mo(e,t){1&e&&(S.Sb(0,"span",60),S.Wb(1,102),S.Rb())}function uo(e,t){1&e&&(S.Sb(0,"span",60),S.Wb(1,103),S.Rb())}function fo(e,t){if(1&e){const e=S.Tb();S.Sb(0,"div",1),S.Sb(1,"form",2,3),S.Sb(3,"div",4),S.Sb(4,"div",5),S.Wb(5,6),S.jc(6,"titlecase"),S.jc(7,"upperFirst"),S.Rb(),S.Sb(8,"div",7),S.Mc(9,$i,7,3,"div",8),S.Sb(10,"div",9),S.Sb(11,"label",10),S.Wb(12,11),S.Rb(),S.Sb(13,"div",12),S.Nb(14,"input",13),S.Mc(15,Ti,3,0,"span",14),S.Mc(16,Fi,3,0,"span",14),S.Rb(),S.Rb(),S.Sb(17,"div",15),S.gc("change",(function(t){return S.Dc(e),S.ic().onPoolChange(t.target.value)})),S.Sb(18,"label",16),S.Wb(19,17),S.Rb(),S.Sb(20,"div",12),S.Mc(21,Pi,1,0,"input",18),S.Mc(22,Oi,5,4,"select",19),S.Mc(23,Ai,2,0,"span",14),S.Rb(),S.Rb(),S.Mc(24,Vi,3,4,"div",8),S.Mc(25,Qi,6,2,"div",8),S.Sb(26,"div",9),S.Sb(27,"div",20),S.Sb(28,"div",21),S.Sb(29,"input",22),S.gc("change",(function(){return S.Dc(e),S.ic().onUseDataPoolChange()})),S.Rb(),S.Sb(30,"label",23),S.Wb(31,24),S.Rb(),S.Mc(32,Ui,3,0,"cd-helper",25),S.Rb(),S.Rb(),S.Rb(),S.Mc(33,ao,10,6,"div",8),S.Sb(34,"div",9),S.Sb(35,"label",26),S.Wb(36,27),S.Rb(),S.Sb(37,"div",12),S.Sb(38,"input",28),S.Yb(39,29),S.Rb(),S.Mc(40,io,2,0,"span",14),S.Mc(41,oo,2,0,"span",14),S.Rb(),S.Rb(),S.Sb(42,"div",30),S.Sb(43,"label",31),S.Wb(44,32),S.Rb(),S.Sb(45,"div",12),S.Mc(46,no,5,6,"div",33),S.Rb(),S.Rb(),S.Sb(47,"div",34),S.Sb(48,"div",35),S.Mc(49,ro,2,0,"a",36),S.Rb(),S.Rb(),S.Sb(50,"div",37),S.Sb(51,"legend",38),S.Wb(52,39),S.Rb(),S.Sb(53,"div",40),S.Sb(54,"h4",38),S.Wb(55,41),S.Rb(),S.Sb(56,"div",9),S.Sb(57,"label",42),S.Wb(58,43),S.Rb(),S.Sb(59,"div",12),S.Sb(60,"select",44),S.Mc(61,co,2,2,"option",45),S.Rb(),S.Rb(),S.Rb(),S.Sb(62,"div",9),S.Sb(63,"label",46),S.Wb(64,47),S.Rb(),S.Sb(65,"div",12),S.Sb(66,"select",48),S.Sb(67,"option",49),S.Wb(68,50),S.Rb(),S.Mc(69,lo,2,2,"option",45),S.Rb(),S.Mc(70,bo,2,0,"span",14),S.Mc(71,po,2,0,"span",14),S.Rb(),S.Rb(),S.Sb(72,"div",9),S.Sb(73,"label",51),S.Wb(74,52),S.Rb(),S.Sb(75,"div",12),S.Nb(76,"input",53),S.Mc(77,mo,2,0,"span",14),S.Mc(78,uo,2,0,"span",14),S.Rb(),S.Rb(),S.Rb(),S.Sb(79,"cd-rbd-configuration-form",54),S.gc("changes",(function(t){return S.Dc(e),S.ic().getDirtyConfigurationValues=t})),S.Rb(),S.Rb(),S.Rb(),S.Sb(80,"div",55),S.Sb(81,"cd-form-button-panel",56),S.gc("submitActionEvent",(function(){return S.Dc(e),S.ic().submit()})),S.jc(82,"titlecase"),S.jc(83,"upperFirst"),S.Rb(),S.Rb(),S.Rb(),S.Rb(),S.Rb()}if(2&e){const e=S.Ac(2),t=S.ic();S.yb(1),S.pc("formGroup",t.rbdForm),S.yb(6),S.ac(S.kc(6,32,t.action))(S.kc(7,34,t.resource)),S.Xb(5),S.yb(2),S.pc("ngIf",t.rbdForm.getValue("parent")),S.yb(6),S.pc("ngIf",t.rbdForm.showError("name",e,"required")),S.yb(1),S.pc("ngIf",t.rbdForm.showError("name",e,"pattern")),S.yb(2),S.pc("ngClass",S.uc(40,to,"editing"!==t.mode)),S.yb(3),S.pc("ngIf","editing"===t.mode||!t.poolPermission.read),S.yb(1),S.pc("ngIf","editing"!==t.mode&&t.poolPermission.read),S.yb(1),S.pc("ngIf",t.rbdForm.showError("pool",e,"required")),S.yb(1),S.pc("ngIf","editing"!==t.mode&&t.rbdForm.getValue("pool")&&null===t.namespaces),S.yb(1),S.pc("ngIf","editing"===t.mode&&t.rbdForm.getValue("namespace")||"editing"!==t.mode&&(t.namespaces&&t.namespaces.length>0||!t.poolPermission.read)),S.yb(7),S.pc("ngIf",t.allDataPools.length<=1),S.yb(1),S.pc("ngIf",t.rbdForm.getValue("useDataPool")),S.yb(7),S.pc("ngIf",t.rbdForm.showError("size",e,"required")),S.yb(1),S.pc("ngIf",t.rbdForm.showError("size",e,"invalidSizeObject")),S.yb(5),S.pc("ngForOf",t.featuresList),S.yb(3),S.pc("ngIf",!t.advancedEnabled),S.yb(1),S.pc("hidden",!t.advancedEnabled),S.yb(11),S.pc("ngForOf",t.objectSizes),S.yb(2),S.pc("ngClass",S.uc(42,to,t.rbdForm.getValue("stripingCount"))),S.yb(4),S.pc("ngValue",null),S.yb(2),S.pc("ngForOf",t.objectSizes),S.yb(1),S.pc("ngIf",t.rbdForm.showError("stripingUnit",e,"required")),S.yb(1),S.pc("ngIf",t.rbdForm.showError("stripingUnit",e,"invalidStripingUnit")),S.yb(2),S.pc("ngClass",S.uc(44,to,t.rbdForm.getValue("stripingUnit"))),S.yb(4),S.pc("ngIf",t.rbdForm.showError("stripingCount",e,"required")),S.yb(1),S.pc("ngIf",t.rbdForm.showError("stripingCount",e,"min")),S.yb(1),S.pc("form",t.rbdForm)("initializeData",t.initializeConfigData),S.yb(2),S.pc("form",e)("submitText",S.kc(82,36,t.action)+" "+S.kc(83,38,t.resource))}}let ho=(()=>{class e extends I.a{constructor(e,t,a,i,o,s,n,r,c){super(),this.authStorageService=e,this.route=t,this.poolService=a,this.rbdService=i,this.formatter=o,this.taskWrapper=s,this.dimlessBinaryPipe=n,this.actionLabels=r,this.router=c,this.namespaces=[],this.namespacesByPoolCache={},this.pools=null,this.allPools=null,this.dataPools=null,this.allDataPools=[],this.featuresList=[],this.initializeConfigData=new di.a(1),this.advancedEnabled=!1,this.rbdFormMode=ki,this.defaultObjectSize="4 MiB",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.rbdImage=new di.a(1),this.icons=N.a,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},journaling:{desc:"Journaling (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(e){return m.a.map(e,(e,t)=>Object.assign(e,{key:t}))}createForm(){this.rbdForm=new $.a({parent:new o.h(""),name:new o.h("",{validators:[o.A.required,o.A.pattern(/^[^@/]+?$/)]}),pool:new o.h(null,{validators:[o.A.required]}),namespace:new o.h(null),useDataPool:new o.h(!1),dataPool:new o.h(null),size:new o.h(null,{updateOn:"blur"}),obj_size:new o.h(this.defaultObjectSize),features:new $.a(this.featuresList.reduce((e,t)=>(e[t.key]=new o.h({value:!1,disabled:!!t.initDisabled}),e),{})),stripingUnit:new o.h(null),stripingCount:new o.h(null,{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(e=>{e.image_format===vi.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))}prepareFormForAction(){const e=this.routerUrl;e.startsWith("/block/rbd/edit")?(this.mode=this.rbdFormMode.editing,this.action=this.actionLabels.EDIT,this.disableForEdit()):e.startsWith("/block/rbd/clone")?(this.mode=this.rbdFormMode.cloning,this.disableForClone(),this.action=this.actionLabels.CLONE):e.startsWith("/block/rbd/copy")?(this.mode=this.rbdFormMode.copying,this.action=this.actionLabels.COPY,this.disableForCopy()):this.action=this.actionLabels.CREATE,m.a.each(this.features,e=>{this.rbdForm.get("features").get(e.key).valueChanges.subscribe(t=>this.featureFormUpdate(e.key,t))})}gatherNeededData(){const e={};return this.mode?this.route.params.subscribe(t=>{const a=R.a.fromString(decodeURIComponent(t.image_spec));t.snap&&(this.snapName=decodeURIComponent(t.snap)),e.rbd=this.rbdService.get(a)}):e.defaultFeatures=this.rbdService.defaultFeatures(),this.mode!==this.rbdFormMode.editing&&this.poolPermission.read&&(e.pools=this.poolService.list(["pool_name","type","flags_names","application_metadata"])),Object(u.a)(e)}handleExternalData(e){if(this.handlePoolData(e.pools),e.defaultFeatures&&this.setFeatures(e.defaultFeatures),e.rbd){const t=e.rbd;this.setResponse(t,this.snapName),this.rbdImage.next(t)}this.loadingReady()}handlePoolData(e){if(!e)return;const t=[],a=[];for(const i of e)this.rbdService.isRBDPool(i)&&("replicated"===i.type?(t.push(i),a.push(i)):"erasure"===i.type&&-1!==i.flags_names.indexOf("ec_overwrites")&&a.push(i));if(this.pools=t,this.allPools=t,this.dataPools=a,this.allDataPools=a,1===this.pools.length){const e=this.pools[0].pool_name;this.rbdForm.get("pool").setValue(e),this.onPoolChange(e)}this.allDataPools.length<=1&&this.rbdForm.get("useDataPool").disable()}onPoolChange(e){const t=this.rbdForm.get("dataPool");t.value===e&&t.setValue(null),this.dataPools=this.allDataPools?this.allDataPools.filter(t=>t.pool_name!==e):[],this.namespaces=null,e in this.namespacesByPoolCache?this.namespaces=this.namespacesByPoolCache[e]:this.rbdService.listNamespaces(e).subscribe(t=>{t=t.map(e=>e.namespace),this.namespacesByPoolCache[e]=t,this.namespaces=t}),this.rbdForm.get("namespace").setValue(null)}onUseDataPoolChange(){this.rbdForm.getValue("useDataPool")||(this.rbdForm.get("dataPool").setValue(null),this.onDataPoolChange(null))}onDataPoolChange(e){const t=this.allPools.filter(t=>t.pool_name!==e);this.rbdForm.getValue("pool")===e&&this.rbdForm.get("pool").setValue(null),this.pools=t}validateRbdForm(e){return t=>{const a=t.get("useDataPool"),i=t.get("dataPool");let o=null;a.value&&null==i.value&&(o={required:!0}),i.setErrors(o);const s=t.get("size"),n=t.get("obj_size"),r=e.toBytes(null!=n.value?n.value:this.defaultObjectSize),c=t.get("stripingCount"),l=null!=c.value?c.value:1;let b=null;null===s.value?b={required:!0}:l*r>e.toBytes(s.value)&&(b={invalidSizeObject:!0}),s.setErrors(b);const d=t.get("stripingUnit");let p=null;null===d.value&&null!==c.value?p={required:!0}:null!==d.value&&e.toBytes(d.value)>r&&(p={invalidStripingUnit:!0}),d.setErrors(p);let m=null;return null===c.value&&null!==d.value?m={required:!0}:l<1&&(m={min:!0}),c.setErrors(m),null}}deepBoxCheck(e,t){this.getDependentChildFeatures(e).forEach(e=>{const a=this.rbdForm.get(e.key);t?a.enable({emitEvent:!1}):(a.disable({emitEvent:!1}),a.setValue(!1,{emitEvent:!1}),this.deepBoxCheck(e.key,t));const i=this.rbdForm.get("features");this.mode===this.rbdFormMode.editing&&i.get(e.key).enabled&&((-1===this.response.features_name.indexOf(e.key)||e.allowDisable)&&(-1!==this.response.features_name.indexOf(e.key)||e.allowEnable)||i.get(e.key).disable())})}getDependentChildFeatures(e){return m.a.filter(this.features,t=>t.requires===e)||[]}interlockCheck(e,t){const a=this.featuresList.find(t=>t.key===e);if(this.response){const e=null!=a.interlockedWith,t=this.featuresList.find(e=>e.interlockedWith===a.key),i=!!this.response.features_name.find(e=>e===a.key);if(e){if(i!==!!this.response.features_name.find(e=>e===a.interlockedWith))return}else if(t&&!!this.response.features_name.find(e=>e===t.key)!==i)return}t?m.a.filter(this.features,t=>t.interlockedWith===e).forEach(e=>this.rbdForm.get(e.key).setValue(!0,{emitEvent:!1})):a.interlockedWith&&this.rbdForm.get("features").get(a.interlockedWith).setValue(!1)}featureFormUpdate(e,t){if(t){const t=this.features[e].requires;if(t&&!this.rbdForm.getValue(t))return void this.rbdForm.get("features."+e).setValue(!1)}this.deepBoxCheck(e,t),this.interlockCheck(e,t)}setFeatures(e){const t=this.rbdForm.get("features");m.a.forIn(this.features,a=>{-1!==e.indexOf(a.key)&&t.get(a.key).setValue(!0),this.featureFormUpdate(a.key,t.get(a.key).value)})}setResponse(e,t){this.response=e;const a=new R.a(e.pool_name,e.namespace,e.name).toString();if(this.mode===this.rbdFormMode.cloning)this.rbdForm.get("parent").setValue(`${a}@${t}`);else if(this.mode===this.rbdFormMode.copying)t?this.rbdForm.get("parent").setValue(`${a}@${t}`):this.rbdForm.get("parent").setValue(""+a);else if(e.parent){const t=e.parent;this.rbdForm.get("parent").setValue(`${t.pool_name}/${t.image_name}@${t.snap_name}`)}this.mode===this.rbdFormMode.editing&&this.rbdForm.get("name").setValue(e.name),this.rbdForm.get("pool").setValue(e.pool_name),this.onPoolChange(e.pool_name),this.rbdForm.get("namespace").setValue(e.namespace),e.data_pool&&(this.rbdForm.get("useDataPool").setValue(!0),this.rbdForm.get("dataPool").setValue(e.data_pool)),this.rbdForm.get("size").setValue(this.dimlessBinaryPipe.transform(e.size)),this.rbdForm.get("obj_size").setValue(this.dimlessBinaryPipe.transform(e.obj_size)),this.setFeatures(e.features_name),this.rbdForm.get("stripingUnit").setValue(this.dimlessBinaryPipe.transform(e.stripe_unit)),this.rbdForm.get("stripingCount").setValue(e.stripe_count),this.initializeConfigData.next({initialData:this.response.configuration,sourceType:fi.a.image})}createRequest(){const e=new wi;return e.pool_name=this.rbdForm.getValue("pool"),e.namespace=this.rbdForm.getValue("namespace"),e.name=this.rbdForm.getValue("name"),e.size=this.formatter.toBytes(this.rbdForm.getValue("size")),this.addObjectSizeAndStripingToRequest(e),e.configuration=this.getDirtyConfigurationValues(),e}addObjectSizeAndStripingToRequest(e){e.obj_size=this.formatter.toBytes(this.rbdForm.getValue("obj_size")),m.a.forIn(this.features,t=>{this.rbdForm.getValue(t.key)&&e.features.push(t.key)}),e.stripe_unit=this.formatter.toBytes(this.rbdForm.getValue("stripingUnit")),e.stripe_count=this.rbdForm.getValue("stripingCount"),e.data_pool=this.rbdForm.getValue("dataPool")}createAction(){const e=this.createRequest();return this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/create",{pool_name:e.pool_name,namespace:e.namespace,image_name:e.name}),call:this.rbdService.create(e)})}editRequest(){const e=new _i;return e.name=this.rbdForm.getValue("name"),e.size=this.formatter.toBytes(this.rbdForm.getValue("size")),m.a.forIn(this.features,t=>{this.rbdForm.getValue(t.key)&&e.features.push(t.key)}),e.configuration=this.getDirtyConfigurationValues(),e}cloneRequest(){const e=new yi;return e.child_pool_name=this.rbdForm.getValue("pool"),e.child_namespace=this.rbdForm.getValue("namespace"),e.child_image_name=this.rbdForm.getValue("name"),this.addObjectSizeAndStripingToRequest(e),e.configuration=this.getDirtyConfigurationValues(!0,fi.a.image),e}editAction(){const e=new R.a(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/edit",{image_spec:e.toString()}),call:this.rbdService.update(e,this.editRequest())})}cloneAction(){const e=this.cloneRequest(),t=new R.a(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/clone",{parent_image_spec:t.toString(),parent_snap_name:this.snapName,child_pool_name:e.child_pool_name,child_namespace:e.child_namespace,child_image_name:e.child_image_name}),call:this.rbdService.cloneSnapshot(t,this.snapName,e)})}copyRequest(){const e=new Ri;return this.snapName&&(e.snapshot_name=this.snapName),e.dest_pool_name=this.rbdForm.getValue("pool"),e.dest_namespace=this.rbdForm.getValue("namespace"),e.dest_image_name=this.rbdForm.getValue("name"),this.addObjectSizeAndStripingToRequest(e),e.configuration=this.getDirtyConfigurationValues(!0,fi.a.image),e}copyAction(){const e=this.copyRequest(),t=new R.a(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/copy",{src_image_spec:t.toString(),dest_pool_name:e.dest_pool_name,dest_namespace:e.dest_namespace,dest_image_name:e.dest_image_name}),call:this.rbdService.copy(t,e)})}submit(){this.mode||this.rbdImage.next("create"),this.rbdImage.pipe(Object(pi.a)(),Object(mi.a)(()=>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 e.\u0275fac=function(t){return new(t||e)(S.Mb(lt.a),S.Mb(s.a),S.Mb(ui.a),S.Mb(_),S.Mb(gi.a),S.Mb(z.a),S.Mb(hi.a),S.Mb(l.b),S.Mb(s.e))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-form"]],features:[S.vb],decls:1,vars:1,consts:function(){return[["class","cd-col-form",4,"cdFormLoading"],[1,"cd-col-form"],["name","rbdForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"card"],[1,"card-header"],"" + "\ufffd0\ufffd" + " " + "\ufffd1\ufffd" + "",[1,"card-body"],["class","form-group row",4,"ngIf"],[1,"form-group","row"],["for","name",1,"cd-col-form-label","required"],"Name",[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"],"Pool",["class","form-control","type","text","placeholder","Pool name...","id","pool","name","pool","formControlName","pool",4,"ngIf"],["id","pool","name","pool","class","form-control custom-select","formControlName","pool",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"],"Use a dedicated data pool",[4,"ngIf"],["for","size",1,"cd-col-form-label","required"],"Size",["id","size","name","size","type","text","formControlName","size","defaultUnit","GiB","cdDimlessBinary","",1,"form-control",6,"placeholder"],["placeholder","e.g., 10GiB"],["formGroupName","features",1,"form-group","row"],["for","features",1,"cd-col-form-label"],"Features",["class","custom-control custom-checkbox",4,"ngFor","ngForOf"],[1,"row"],[1,"col-sm-12"],["class","float-right margin-right-md","href","",3,"click",4,"ngIf"],[3,"hidden"],[1,"cd-header"],"Advanced",[1,"col-md-12"],"Striping",["for","size",1,"cd-col-form-label"],"Object size",["id","obj_size","name","obj_size","formControlName","obj_size",1,"form-control","custom-select"],[3,"value",4,"ngFor","ngForOf"],["for","stripingUnit",1,"cd-col-form-label",3,"ngClass"],"Stripe unit",["id","stripingUnit","name","stripingUnit","formControlName","stripingUnit",1,"form-control","custom-select"],[3,"ngValue"],"-- Select stripe unit --",["for","stripingCount",1,"cd-col-form-label",3,"ngClass"],"Stripe count",["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"],"" + "\ufffd0\ufffd" + " from",["type","text","id","parent","name","parent","formControlName","parent",1,"form-control"],[1,"invalid-feedback"],"This field is required.","'/' and '@' are not allowed.",["type","text","placeholder","Pool name...","id","pool","name","pool","formControlName","pool",1,"form-control"],["id","pool","name","pool","formControlName","pool",1,"form-control","custom-select"],[3,"ngValue",4,"ngIf"],"Loading...","-- No rbd pools available --","-- Select a pool --",[3,"value"],"This field is required.",[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 custom-select","formControlName","namespace",4,"ngIf"],["type","text","placeholder","Namespace...","id","namespace","name","namespace","formControlName","namespace",1,"form-control"],["id","namespace","name","namespace","formControlName","namespace",1,"form-control","custom-select"],"Loading...","-- No namespaces available --","-- Select a namespace --","You need more than one pool with the rbd application label use to use a dedicated data pool.",["for","dataPool",1,"cd-col-form-label"],"Data pool",[6,"html"],["html","Dedicated pool that stores the object-data of the RBD."],["class","form-control","type","text","placeholder","Data pool name...","id","dataPool","name","dataPool","formControlName","dataPool",4,"ngIf"],["id","dataPool","name","dataPool","class","form-control custom-select","formControlName","dataPool",3,"change",4,"ngIf"],["type","text","placeholder","Data pool name...","id","dataPool","name","dataPool","formControlName","dataPool",1,"form-control"],["id","dataPool","name","dataPool","formControlName","dataPool",1,"form-control","custom-select",3,"change"],"Loading...","-- No data pools available --","This field is required.","This field is required.","You have to increase the size.",["type","checkbox",1,"custom-control-input",3,"id","name","formControlName"],[1,"custom-control-label",3,"for"],[3,"html",4,"ngIf"],[3,"html"],["href","",1,"float-right","margin-right-md",3,"click"],"Advanced...","This field is required because stripe count is defined!","Stripe unit is greater than object size.","This field is required because stripe unit is defined!","Stripe count must be greater than 0."]},template:function(e,t){1&e&&S.Mc(0,fo,84,46,"div",0),2&e&&S.pc("cdFormLoading",t.loading)},directives:[oe.a,o.C,o.r,o.k,C.a,i.r,D.a,O.a,o.d,A.a,o.q,o.i,ha.a,i.p,o.b,Mi.a,o.l,i.q,o.z,o.u,o.B,o.v,Ni.a,x.a,Ii.a],pipes:[i.A,le.a],styles:[""]}),e})();var go=a("OLbh"),So=a("yJti"),vo=a("EgGo"),yo=a("wd/R"),Ro=a.n(yo),wo=a("2EZI"),_o=a("MAOJ");function ko(e,t){1&e&&(S.Sb(0,"div",19),S.Sb(1,"span"),S.Wb(2,20),S.Rb(),S.Rb())}function Mo(e,t){1&e&&(S.Sb(0,"span",21),S.Wb(1,22),S.Rb())}function No(e,t){1&e&&(S.Sb(0,"span",21),S.Wb(1,23),S.Rb())}function Io(e,t){if(1&e&&S.Nb(0,"cd-date-time-picker",24),2&e){const e=S.ic();S.pc("control",e.moveForm.get("expiresAt"))}}let $o=(()=>{class e{constructor(e,t,a,i,o){this.rbdService=e,this.activeModal=t,this.actionLabels=a,this.fb=i,this.taskWrapper=o,this.createForm()}createForm(){this.moveForm=this.fb.group({expiresAt:["",[T.a.custom("format",e=>!(""===e||Ro()(e,"YYYY-MM-DD HH:mm:ss").isValid())),T.a.custom("expired",e=>Ro()().isAfter(e))]]})}ngOnInit(){this.imageSpec=new R.a(this.poolName,this.namespace,this.imageName),this.imageSpecStr=this.imageSpec.toString(),this.pattern=`${this.poolName}/${this.imageName}`}moveImage(){let e=0;const t=this.moveForm.getValue("expiresAt");t&&(e=Ro()(t,"YYYY-MM-DD HH:mm:ss").diff(Ro()(),"seconds",!0)),e<0&&(e=0),this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/trash/move",{image_spec:this.imageSpecStr}),call:this.rbdService.moveTrash(this.imageSpec,e)}).subscribe({complete:()=>{this.activeModal.close()}})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(_),S.Mb(r.a),S.Mb(l.b),S.Mb(wo.a),S.Mb(z.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-trash-move-modal"]],decls:24,vars:9,consts:function(){var e,t;return e="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.",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","moveForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],["class","alert alert-warning","role","alert",4,"ngIf"],t=S.bc(t),[1,"form-group"],["for","expiresAt",1,"col-form-label"],"Protection expires at",["type","text","formControlName","expiresAt","triggers","manual",1,"form-control",3,"ngbPopover","click","keypress",6,"placeholder"],["p","ngbPopover"],["placeholder","NOT PROTECTED"],["class","invalid-feedback",4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],["popContent",""],["role","alert",1,"alert","alert-warning"],"This image contains snapshot(s), which will prevent it from being removed after moved to trash.",[1,"invalid-feedback"],"Wrong date format. Please use \"YYYY-MM-DD HH:mm:ss\".","Protection has already expired. Please pick a future date or leave it empty.",[3,"control"]]},template:function(e,t){if(1&e){const e=S.Tb();S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Wb(2,2),S.Pb(),S.Qb(3,3),S.Sb(4,"form",4,5),S.Sb(6,"div",6),S.Mc(7,ko,3,0,"div",7),S.Sb(8,"p"),S.cc(9,8),S.Nb(10,"kbd"),S.Nb(11,"kbd"),S.Zb(),S.Rb(),S.Sb(12,"div",9),S.Sb(13,"label",10),S.Wb(14,11),S.Rb(),S.Sb(15,"input",12,13),S.Yb(17,14),S.gc("click",(function(){return S.Dc(e),S.Ac(16).open()}))("keypress",(function(){return S.Dc(e),S.Ac(16).close()})),S.Rb(),S.Mc(18,Mo,2,0,"span",15),S.Mc(19,No,2,0,"span",15),S.Rb(),S.Rb(),S.Sb(20,"div",16),S.Sb(21,"cd-form-button-panel",17),S.gc("submitActionEvent",(function(){return t.moveImage()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb(),S.Mc(22,Io,1,1,"ng-template",null,18,S.Nc)}if(2&e){const e=S.Ac(5),a=S.Ac(23);S.pc("modalRef",t.activeModal),S.yb(4),S.pc("formGroup",t.moveForm),S.yb(3),S.pc("ngIf",t.hasSnapshots),S.yb(4),S.ac(t.imageSpecStr),S.Xb(9),S.yb(4),S.pc("ngbPopover",a),S.yb(3),S.pc("ngIf",t.moveForm.showError("expiresAt",e,"format")),S.yb(1),S.pc("ngIf",t.moveForm.showError("expiresAt",e,"expired")),S.yb(2),S.pc("form",t.moveForm)("submitText",t.actionLabels.MOVE)}},directives:[E.a,o.C,o.r,o.k,C.a,i.r,D.a,O.a,o.d,A.a,o.q,o.i,r.w,x.a,_o.a],styles:[""]}),e})();function To(e,t){1&e&&(S.Sb(0,"li",10),S.Sb(1,"a",3),S.Wb(2,11),S.Rb(),S.Rb())}let Fo=(()=>{class e{constructor(e,t){this.authStorageService=e,this.router=t,this.grafanaPermission=this.authStorageService.getPermissions().grafana}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(lt.a),S.Mb(s.e))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-tabs"]],decls:12,vars:2,consts:function(){return[["ngbNav","",1,"nav-tabs",3,"activeId","navChange"],["nav","ngbNav"],["ngbNavItem","/block/rbd"],["ngbNavLink",""],"Images",["ngbNavItem","/block/rbd/namespaces"],"Namespaces",["ngbNavItem","/block/rbd/trash"],"Trash",["ngbNavItem","/block/rbd/performance",4,"ngIf"],["ngbNavItem","/block/rbd/performance"],"Overall Performance"]},template:function(e,t){1&e&&(S.Sb(0,"ul",0,1),S.gc("navChange",(function(e){return t.router.navigate([e.nextId])})),S.Sb(2,"li",2),S.Sb(3,"a",3),S.Wb(4,4),S.Rb(),S.Rb(),S.Sb(5,"li",5),S.Sb(6,"a",3),S.Wb(7,6),S.Rb(),S.Rb(),S.Sb(8,"li",7),S.Sb(9,"a",3),S.Wb(10,8),S.Rb(),S.Rb(),S.Mc(11,To,3,0,"li",9),S.Rb()),2&e&&(S.pc("activeId",t.router.url),S.yb(11),S.pc("ngIf",t.grafanaPermission.read))},directives:[r.p,r.r,r.s,i.r],styles:[""]}),e})();var Po=a("LRne"),zo=a("nQ07"),Eo=a("QTAa"),Co=a("a0VL"),Do=a("mSOc"),Oo=a("VXsX"),Ao=a("XNiG");function xo(e,t){1&e&&(S.Sb(0,"span",15),S.Wb(1,16),S.Rb())}let Vo=(()=>{class e{constructor(e,t,a,i,o){this.activeModal=e,this.rbdService=t,this.taskManagerService=a,this.notificationService=i,this.actionLabels=o,this.editing=!1,this.onSubmit=new Ao.a,this.action=this.actionLabels.CREATE,this.resource="RBD Snapshot",this.createForm()}createForm(){this.snapshotForm=new $.a({snapshotName:new o.h("",{validators:[o.A.required]})})}setSnapName(e){this.snapName=e,this.snapshotForm.get("snapshotName").setValue(e)}setEditing(e=!0){this.editing=e,this.action=this.editing?this.actionLabels.RENAME:this.actionLabels.CREATE}editAction(){const e=this.snapshotForm.getValue("snapshotName"),t=new R.a(this.poolName,this.namespace,this.imageName),a=new F.a;a.name="rbd/snap/edit",a.metadata={image_spec:t.toString(),snapshot_name:e},this.rbdService.renameSnapshot(t,this.snapName,e).toPromise().then(()=>{this.taskManagerService.subscribe(a.name,a.metadata,e=>{this.notificationService.notifyTask(e)}),this.activeModal.close(),this.onSubmit.next(this.snapName)}).catch(()=>{this.snapshotForm.setErrors({cdSubmitButton:!0})})}createAction(){const e=this.snapshotForm.getValue("snapshotName"),t=new R.a(this.poolName,this.namespace,this.imageName),a=new F.a;a.name="rbd/snap/create",a.metadata={image_spec:t.toString(),snapshot_name:e},this.rbdService.createSnapshot(t,e).toPromise().then(()=>{this.taskManagerService.subscribe(a.name,a.metadata,e=>{this.notificationService.notifyTask(e)}),this.activeModal.close(),this.onSubmit.next(e)}).catch(()=>{this.snapshotForm.setErrors({cdSubmitButton:!0})})}submit(){this.editing?this.editAction():this.createAction()}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(r.a),S.Mb(_),S.Mb(Oo.a),S.Mb(pt.a),S.Mb(l.b))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-snapshot-form-modal"]],decls:19,vars:15,consts:function(){return[[3,"modalRef"],[1,"modal-title"],"" + "\ufffd0\ufffd" + " " + "\ufffd1\ufffd" + "",[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"],"Name",[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"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],"This field is required."]},template:function(e,t){if(1&e&&(S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Wb(2,2),S.jc(3,"titlecase"),S.jc(4,"upperFirst"),S.Pb(),S.Qb(5,3),S.Sb(6,"form",4,5),S.Sb(8,"div",6),S.Sb(9,"div",7),S.Sb(10,"label",8),S.Wb(11,9),S.Rb(),S.Sb(12,"div",10),S.Nb(13,"input",11),S.Mc(14,xo,2,0,"span",12),S.Rb(),S.Rb(),S.Rb(),S.Sb(15,"div",13),S.Sb(16,"cd-form-button-panel",14),S.gc("submitActionEvent",(function(){return t.submit()})),S.jc(17,"titlecase"),S.jc(18,"upperFirst"),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e){const e=S.Ac(7);S.pc("modalRef",t.activeModal),S.yb(4),S.ac(S.kc(3,7,t.action))(S.kc(4,9,t.resource)),S.Xb(2),S.yb(2),S.pc("formGroup",t.snapshotForm),S.yb(8),S.pc("ngIf",t.snapshotForm.showError("snapshotName",e,"required")),S.yb(2),S.pc("form",t.snapshotForm)("submitText",S.kc(17,11,t.action)+" "+S.kc(18,13,t.resource))}},directives:[E.a,o.C,o.r,o.k,C.a,D.a,O.a,o.d,A.a,o.q,o.i,ha.a,i.r,x.a],pipes:[i.A,le.a],styles:[""]}),e})();class Wo{constructor(e,t,a){this.featuresName=t,this.cloneFormatVersion=1,a.cloneFormatVersion().subscribe(e=>{this.cloneFormatVersion=e}),this.create={permission:"create",icon:N.a.add,name:e.CREATE},this.rename={permission:"update",icon:N.a.edit,name:e.RENAME},this.protect={permission:"update",icon:N.a.lock,visible:e=>e.hasSingleSelection&&!e.first().is_protected,name:e.PROTECT},this.unprotect={permission:"update",icon:N.a.unlock,visible:e=>e.hasSingleSelection&&e.first().is_protected,name:e.UNPROTECT},this.clone={permission:"create",canBePrimary:e=>e.hasSingleSelection,disable:e=>this.getCloneDisableDesc(e,this.featuresName),icon:N.a.clone,name:e.CLONE},this.copy={permission:"create",canBePrimary:e=>e.hasSingleSelection,disable:e=>!e.hasSingleSelection||e.first().cdExecuting,icon:N.a.copy,name:e.COPY},this.rollback={permission:"update",icon:N.a.undo,name:e.ROLLBACK},this.deleteSnap={permission:"delete",icon:N.a.destroy,disable:e=>{const t=e.first();return!e.hasSingleSelection||t.cdExecuting||t.is_protected},name:e.DELETE},this.ordering=[this.create,this.rename,this.protect,this.unprotect,this.clone,this.copy,this.rollback,this.deleteSnap]}getCloneDisableDesc(e,t){return!(e.hasSingleSelection&&!e.first().cdExecuting)||((null==t?void 0:t.includes("layering"))?1===this.cloneFormatVersion&&!e.first().is_protected&&"Snapshot must be protected in order to clone.":"Parent image must support Layering")}}class qo{}const Bo=["nameTpl"],Go=["rollbackTpl"];function Lo(e,t){if(1&e&&(S.Qb(0),S.Wb(1,3),S.Pb(),S.Sb(2,"strong"),S.Oc(3),S.Rb(),S.Oc(4,".\n")),2&e){const e=t.$implicit;S.yb(3),S.Qc(" ",e.snapName,"")}}let jo=(()=>{class e{constructor(e,t,a,i,o,s,n,r,c,l,b){this.authStorageService=e,this.modalService=t,this.dimlessBinaryPipe=a,this.cdDatePipe=i,this.rbdService=o,this.taskManagerService=s,this.notificationService=n,this.summaryService=r,this.taskListService=c,this.actionLabels=l,this.cdr=b,this.snapshots=[],this.selection=new nt.a,this.builders={"rbd/snap/create":e=>{const t=new qo;return t.name=e.snapshot_name,t}},this.permission=this.authStorageService.getPermissions().rbdImage}ngOnInit(){this.columns=[{name:"Name",prop:"name",cellTransformation:st.a.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:st.a.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 R.a(this.poolName,this.namespace,this.rbdName),this.rbdTableActions=new Wo(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 e=()=>this.selection.first()&&`${this.imageSpec.toStringEncoded()}/${encodeURIComponent(this.selection.first().name)}`;this.rbdTableActions.clone.routerLink=()=>"/block/rbd/clone/"+e(),this.rbdTableActions.copy.routerLink=()=>"/block/rbd/copy/"+e(),this.rbdTableActions.rollback.click=()=>this.rollbackModal(),this.rbdTableActions.deleteSnap.click=()=>this.deleteSnapshotModal(),this.tableActions=this.rbdTableActions.ordering,this.taskListService.init(()=>Object(Po.a)(this.snapshots),null,e=>{zo.a.updateChanged(this,{data:e})&&(this.cdr.detectChanges(),this.data=[...this.data])},()=>{zo.a.updateChanged(this,{data:this.snapshots})&&(this.cdr.detectChanges(),this.data=[...this.data])},e=>["rbd/snap/create","rbd/snap/delete","rbd/snap/edit","rbd/snap/rollback"].includes(e.name)&&this.imageSpec.toString()===e.metadata.image_spec,(e,t)=>e.name===t.metadata.snapshot_name,this.builders)}ngOnChanges(){this.columns&&(this.imageSpec=new R.a(this.poolName,this.namespace,this.rbdName),this.rbdTableActions&&(this.rbdTableActions.featuresName=this.featuresName),this.taskListService.fetch())}openSnapshotModal(e,t=null){this.modalRef=this.modalService.show(Vo),this.modalRef.componentInstance.poolName=this.poolName,this.modalRef.componentInstance.imageName=this.rbdName,this.modalRef.componentInstance.namespace=this.namespace,t?this.modalRef.componentInstance.setEditing():t=`${this.rbdName}_${Ro()().toISOString(!0)}`,this.modalRef.componentInstance.setSnapName(t),this.modalRef.componentInstance.onSubmit.subscribe(t=>{const a=new Eo.a;a.name=e,a.metadata={image_spec:this.imageSpec.toString(),snapshot_name:t},this.summaryService.addRunningTask(a)})}openCreateSnapshotModal(){this.openSnapshotModal("rbd/snap/create")}openEditSnapshotModal(){this.openSnapshotModal("rbd/snap/edit",this.selection.first().name)}toggleProtection(){const e=this.selection.first().name,t=this.selection.first().is_protected,a=new F.a;a.name="rbd/snap/edit";const i=new R.a(this.poolName,this.namespace,this.rbdName);a.metadata={image_spec:i.toString(),snapshot_name:e},this.rbdService.protectSnapshot(i,e,!t).toPromise().then(()=>{const e=new Eo.a;e.name=a.name,e.metadata=a.metadata,this.summaryService.addRunningTask(e),this.taskManagerService.subscribe(a.name,a.metadata,e=>{this.notificationService.notifyTask(e)})})}_asyncTask(e,t,a){const i=new F.a;i.name=t,i.metadata={image_spec:new R.a(this.poolName,this.namespace,this.rbdName).toString(),snapshot_name:a};const o=new R.a(this.poolName,this.namespace,this.rbdName);this.rbdService[e](o,a).toPromise().then(()=>{const e=new Eo.a;e.name=i.name,e.metadata=i.metadata,this.summaryService.addRunningTask(e),this.modalRef.close(),this.taskManagerService.subscribe(e.name,e.metadata,e=>{this.notificationService.notifyTask(e)})}).catch(()=>{this.modalRef.componentInstance.stopLoadingSpinner()})}rollbackModal(){const e=this.selection.selected[0].name,t=new R.a(this.poolName,this.namespace,this.rbdName).toString(),a={titleText:"RBD snapshot rollback",buttonText:"Rollback",bodyTpl:this.rollbackTpl,bodyData:{snapName:`${t}@${e}`},onSubmit:()=>{this._asyncTask("rollbackSnapshot","rbd/snap/rollback",e)}};this.modalRef=this.modalService.show(go.a,a)}deleteSnapshotModal(){const e=this.selection.selected[0].name;this.modalRef=this.modalService.show(it.a,{itemDescription:"RBD snapshot",itemNames:[e],submitAction:()=>this._asyncTask("deleteSnapshot","rbd/snap/delete",e)})}updateSelection(e){this.selection=e}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(lt.a),S.Mb(P.a),S.Mb(hi.a),S.Mb(Co.a),S.Mb(_),S.Mb(Oo.a),S.Mb(pt.a),S.Mb(Do.a),S.Mb(bt.a),S.Mb(l.b),S.Mb(S.h))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-snapshot-list"]],viewQuery:function(e,t){var a;1&e&&(S.Tc(Bo,!0),S.Jc(Go,!0)),2&e&&(S.zc(a=S.hc())&&(t.nameTpl=a.first),S.zc(a=S.hc())&&(t.rollbackTpl=a.first))},inputs:{snapshots:"snapshots",featuresName:"featuresName",poolName:"poolName",namespace:"namespace",rbdName:"rbdName"},features:[S.xb([bt.a]),S.wb],decls:4,vars:5,consts:function(){return[["columnMode","flex","selectionType","single",3,"data","columns","updateSelection"],[1,"table-actions",3,"permission","selection","tableActions"],["rollbackTpl",""],"You are about to rollback"]},template:function(e,t){1&e&&(S.Sb(0,"cd-table",0),S.gc("updateSelection",(function(e){return t.updateSelection(e)})),S.Nb(1,"cd-table-actions",1),S.Rb(),S.Mc(2,Lo,5,1,"ng-template",null,2,S.Nc)),2&e&&(S.pc("data",t.data)("columns",t.columns),S.yb(1),S.pc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions))},directives:[ot.a,Mt.a],styles:[""],changeDetection:0}),e})();var Qo=a("aAWM"),Uo=a("insk"),Yo=a("nSDx");const Ko=["poolConfigurationSourceTpl"];function Jo(e,t){1&e&&(S.Qb(0),S.cc(1,3),S.Nb(2,"strong"),S.Zb(),S.Pb())}function Xo(e,t){if(1&e&&(S.Sb(0,"span"),S.Sb(1,"span",38),S.Oc(2),S.Rb(),S.Rb()),2&e){const e=t.$implicit;S.yb(2),S.Pc(e)}}function Ho(e,t){if(1&e&&(S.Sb(0,"span"),S.Sb(1,"span",39),S.Wb(2,40),S.Rb(),S.Rb()),2&e){S.ic(3);const e=S.Ac(1);S.yb(1),S.pc("ngbTooltip",e)}}function Zo(e,t){if(1&e&&(S.Sb(0,"span"),S.Oc(1),S.jc(2,"dimlessBinary"),S.Rb()),2&e){const e=S.ic(3);S.yb(1),S.Qc(" ",S.kc(2,1,e.selection.disk_usage)," ")}}function es(e,t){if(1&e&&(S.Sb(0,"span"),S.Sb(1,"span",39),S.Wb(2,41),S.Rb(),S.Rb()),2&e){S.ic(3);const e=S.Ac(1);S.yb(1),S.pc("ngbTooltip",e)}}function ts(e,t){if(1&e&&(S.Sb(0,"span"),S.Oc(1),S.jc(2,"dimlessBinary"),S.Rb()),2&e){const e=S.ic(3);S.yb(1),S.Qc(" ",S.kc(2,1,e.selection.total_disk_usage)," ")}}function as(e,t){if(1&e&&(S.Sb(0,"span"),S.Oc(1),S.Rb()),2&e){const e=S.ic(4);S.yb(1),S.Qc("/",e.selection.parent.pool_namespace,"")}}function is(e,t){if(1&e&&(S.Sb(0,"span"),S.Oc(1),S.Mc(2,as,2,1,"span",1),S.Oc(3),S.Rb()),2&e){const e=S.ic(3);S.yb(1),S.Pc(e.selection.parent.pool_name),S.yb(1),S.pc("ngIf",e.selection.parent.pool_namespace),S.yb(1),S.Rc("/",e.selection.parent.image_name,"@",e.selection.parent.snap_name,"")}}function os(e,t){1&e&&(S.Sb(0,"span"),S.Oc(1,"-"),S.Rb())}function ss(e,t){if(1&e&&(S.Sb(0,"table",17),S.Sb(1,"tbody"),S.Sb(2,"tr"),S.Sb(3,"td",18),S.Wb(4,19),S.Rb(),S.Sb(5,"td",20),S.Oc(6),S.Rb(),S.Rb(),S.Sb(7,"tr"),S.Sb(8,"td",21),S.Wb(9,22),S.Rb(),S.Sb(10,"td"),S.Oc(11),S.Rb(),S.Rb(),S.Sb(12,"tr"),S.Sb(13,"td",21),S.Wb(14,23),S.Rb(),S.Sb(15,"td"),S.Oc(16),S.jc(17,"empty"),S.Rb(),S.Rb(),S.Sb(18,"tr"),S.Sb(19,"td",21),S.Wb(20,24),S.Rb(),S.Sb(21,"td"),S.Oc(22),S.jc(23,"cdDate"),S.Rb(),S.Rb(),S.Sb(24,"tr"),S.Sb(25,"td",21),S.Wb(26,25),S.Rb(),S.Sb(27,"td"),S.Oc(28),S.jc(29,"dimlessBinary"),S.Rb(),S.Rb(),S.Sb(30,"tr"),S.Sb(31,"td",21),S.Wb(32,26),S.Rb(),S.Sb(33,"td"),S.Oc(34),S.jc(35,"dimless"),S.Rb(),S.Rb(),S.Sb(36,"tr"),S.Sb(37,"td",21),S.Wb(38,27),S.Rb(),S.Sb(39,"td"),S.Oc(40),S.jc(41,"dimlessBinary"),S.Rb(),S.Rb(),S.Sb(42,"tr"),S.Sb(43,"td",21),S.Wb(44,28),S.Rb(),S.Sb(45,"td"),S.Mc(46,Xo,3,1,"span",29),S.Rb(),S.Rb(),S.Sb(47,"tr"),S.Sb(48,"td",21),S.Wb(49,30),S.Rb(),S.Sb(50,"td"),S.Mc(51,Ho,3,1,"span",1),S.Mc(52,Zo,3,3,"span",1),S.Rb(),S.Rb(),S.Sb(53,"tr"),S.Sb(54,"td",21),S.Wb(55,31),S.Rb(),S.Sb(56,"td"),S.Mc(57,es,3,1,"span",1),S.Mc(58,ts,3,3,"span",1),S.Rb(),S.Rb(),S.Sb(59,"tr"),S.Sb(60,"td",21),S.Wb(61,32),S.Rb(),S.Sb(62,"td"),S.Oc(63),S.jc(64,"dimlessBinary"),S.Rb(),S.Rb(),S.Sb(65,"tr"),S.Sb(66,"td",21),S.Wb(67,33),S.Rb(),S.Sb(68,"td"),S.Oc(69),S.Rb(),S.Rb(),S.Sb(70,"tr"),S.Sb(71,"td",21),S.Wb(72,34),S.Rb(),S.Sb(73,"td"),S.Mc(74,is,4,4,"span",1),S.Mc(75,os,2,0,"span",1),S.Rb(),S.Rb(),S.Sb(76,"tr"),S.Sb(77,"td",21),S.Wb(78,35),S.Rb(),S.Sb(79,"td"),S.Oc(80),S.Rb(),S.Rb(),S.Sb(81,"tr"),S.Sb(82,"td",21),S.Wb(83,36),S.Rb(),S.Sb(84,"td"),S.Oc(85),S.Rb(),S.Rb(),S.Sb(86,"tr"),S.Sb(87,"td",21),S.Wb(88,37),S.Rb(),S.Sb(89,"td"),S.Oc(90),S.Rb(),S.Rb(),S.Rb(),S.Rb()),2&e){const e=S.ic(2);S.yb(6),S.Pc(e.selection.name),S.yb(5),S.Pc(e.selection.pool_name),S.yb(5),S.Pc(S.kc(17,19,e.selection.data_pool)),S.yb(6),S.Pc(S.kc(23,21,e.selection.timestamp)),S.yb(6),S.Pc(S.kc(29,23,e.selection.size)),S.yb(6),S.Pc(S.kc(35,25,e.selection.num_objs)),S.yb(6),S.Pc(S.kc(41,27,e.selection.obj_size)),S.yb(6),S.pc("ngForOf",e.selection.features_name),S.yb(5),S.pc("ngIf",-1===(null==e.selection.features_name?null:e.selection.features_name.indexOf("fast-diff"))),S.yb(1),S.pc("ngIf",-1!==(null==e.selection.features_name?null:e.selection.features_name.indexOf("fast-diff"))),S.yb(5),S.pc("ngIf",-1===(null==e.selection.features_name?null:e.selection.features_name.indexOf("fast-diff"))),S.yb(1),S.pc("ngIf",-1!==(null==e.selection.features_name?null:e.selection.features_name.indexOf("fast-diff"))),S.yb(5),S.Pc(S.kc(64,29,e.selection.stripe_unit)),S.yb(6),S.Pc(e.selection.stripe_count),S.yb(5),S.pc("ngIf",e.selection.parent),S.yb(1),S.pc("ngIf",!e.selection.parent),S.yb(5),S.Pc(e.selection.block_name_prefix),S.yb(5),S.Pc(e.selection.order),S.yb(5),S.Pc(e.selection.image_format)}}function ns(e,t){if(1&e&&S.Nb(0,"cd-rbd-snapshot-list",42),2&e){const e=S.ic(2);S.pc("snapshots",e.selection.snapshots)("featuresName",e.selection.features_name)("poolName",e.selection.pool_name)("namespace",e.selection.namespace)("rbdName",e.selection.name)}}function rs(e,t){if(1&e&&S.Nb(0,"cd-rbd-configuration-table",43),2&e){const e=S.ic(2);S.pc("data",e.selection.configuration)}}function cs(e,t){if(1&e&&S.Nb(0,"cd-grafana",44),2&e){const e=S.ic(2);S.pc("grafanaPath",e.rbdDashboardUrl)}}function ls(e,t){if(1&e&&(S.Qb(0),S.Sb(1,"ul",4,5),S.Sb(3,"li",6),S.Sb(4,"a",7),S.Wb(5,8),S.Rb(),S.Mc(6,ss,91,31,"ng-template",9),S.Rb(),S.Sb(7,"li",10),S.Sb(8,"a",7),S.Wb(9,11),S.Rb(),S.Mc(10,ns,1,5,"ng-template",9),S.Rb(),S.Sb(11,"li",12),S.Sb(12,"a",7),S.Wb(13,13),S.Rb(),S.Mc(14,rs,1,1,"ng-template",9),S.Rb(),S.Sb(15,"li",14),S.Sb(16,"a",7),S.Wb(17,15),S.Rb(),S.Mc(18,cs,1,1,"ng-template",9),S.Rb(),S.Rb(),S.Nb(19,"div",16),S.Pb()),2&e){const e=S.Ac(2);S.yb(19),S.pc("ngbNavOutlet",e)}}function bs(e,t){1&e&&(S.Qb(0),S.Sb(1,"strong",47),S.Yb(2,48),S.Wb(3,49),S.Rb(),S.Pb())}function ds(e,t){1&e&&(S.Sb(0,"span",47),S.Yb(1,50),S.Wb(2,51),S.Rb())}function ps(e,t){if(1&e&&(S.Mc(0,bs,4,0,"ng-container",45),S.Mc(1,ds,3,0,"ng-template",null,46,S.Nc)),2&e){const e=t.value,a=S.Ac(2);S.pc("ngIf",+e)("ngIfElse",a)}}let ms=(()=>{class e{ngOnChanges(){this.selection&&(this.rbdDashboardUrl=`rbd-details?var-Pool=${this.selection.pool_name}&var-Image=${this.selection.name}`)}}return e.\u0275fac=function(t){return new(t||e)},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-details"]],viewQuery:function(e,t){var a;1&e&&(S.Jc(Ko,!0),S.Jc(r.p,!0)),2&e&&(S.zc(a=S.hc())&&(t.poolConfigurationSourceTpl=a.first),S.zc(a=S.hc())&&(t.nav=a.first))},inputs:{selection:"selection",images:"images"},features:[S.wb],decls:5,vars:1,consts:function(){return[["usageNotAvailableTooltipTpl",""],[4,"ngIf"],["poolConfigurationSourceTpl",""],"Only available for RBD images with " + "\ufffd#2\ufffd" + "fast-diff" + "\ufffd/#2\ufffd" + " enabled",["ngbNav","","cdStatefulTab","rbd-details",1,"nav-tabs"],["nav","ngbNav"],["ngbNavItem","details"],["ngbNavLink",""],"Details",["ngbNavContent",""],["ngbNavItem","snapshots"],"Snapshots",["ngbNavItem","configuration"],"Configuration",["ngbNavItem","performance"],"Performance",[3,"ngbNavOutlet"],[1,"table","table-striped","table-bordered"],[1,"bold","w-25"],"Name",[1,"w-75"],[1,"bold"],"Pool","Data Pool","Created","Size","Objects","Object size","Features",[4,"ngFor","ngForOf"],"Provisioned","Total provisioned","Striping unit","Striping count","Parent","Block name prefix","Order","Format Version",[1,"badge","badge-dark","mr-2"],["placement","top",1,"form-text","text-muted",3,"ngbTooltip"],"N/A","N/A",[3,"snapshots","featuresName","poolName","namespace","rbdName"],[3,"data"],["uid","YhCYGcuZz","grafanaStyle","one",3,"grafanaPath"],[4,"ngIf","ngIfElse"],["global",""],[6,"ngbTooltip"],["ngbTooltip","This setting overrides the global value"],"Image",["ngbTooltip","This is the global value. No value for this option has been set for this image."],"Global"]},template:function(e,t){1&e&&(S.Mc(0,Jo,3,0,"ng-template",null,0,S.Nc),S.Mc(2,ls,20,1,"ng-container",1),S.Mc(3,ps,3,2,"ng-template",null,2,S.Nc)),2&e&&(S.yb(2),S.pc("ngIf",t.selection))},directives:[i.r,r.p,Za.a,r.r,r.s,r.q,r.u,i.q,r.D,jo,Qo.a,Uo.a],pipes:[Yo.a,Co.a,hi.a,jt.a],styles:[""]}),e})();const us=["usageTpl"],fs=["parentTpl"],hs=["nameTpl"],gs=["flattenTpl"],Ss=["deleteTpl"];function vs(e,t){1&e&&S.Nb(0,"div",8),2&e&&S.pc("innerHtml","Only available for RBD images with <strong>fast-diff</strong> enabled",S.Ec)}function ys(e,t){if(1&e&&(S.Sb(0,"span"),S.Oc(1),S.Rb()),2&e){const e=S.ic(2).value;S.yb(1),S.Qc("/",e.pool_namespace,"")}}function Rs(e,t){if(1&e&&(S.Sb(0,"span"),S.Oc(1),S.Mc(2,ys,2,1,"span",9),S.Oc(3),S.Rb()),2&e){const e=S.ic().value;S.yb(1),S.Pc(e.pool_name),S.yb(1),S.pc("ngIf",e.pool_namespace),S.yb(1),S.Rc("/",e.image_name,"@",e.snap_name,"")}}function ws(e,t){1&e&&(S.Sb(0,"span"),S.Oc(1,"-"),S.Rb())}function _s(e,t){if(1&e&&(S.Mc(0,Rs,4,4,"span",9),S.Mc(1,ws,2,0,"span",9)),2&e){const e=t.value;S.pc("ngIf",e),S.yb(1),S.pc("ngIf",!e)}}function ks(e,t){if(1&e&&(S.Oc(0," You are about to flatten "),S.Sb(1,"strong"),S.Oc(2),S.Rb(),S.Oc(3,". "),S.Nb(4,"br"),S.Nb(5,"br"),S.Oc(6," All blocks will be copied from parent "),S.Sb(7,"strong"),S.Oc(8),S.Rb(),S.Oc(9," to child "),S.Sb(10,"strong"),S.Oc(11),S.Rb(),S.Oc(12,".\n")),2&e){const e=t.$implicit;S.yb(2),S.Pc(e.child),S.yb(6),S.Pc(e.parent),S.yb(3),S.Pc(e.child)}}function Ms(e,t){if(1&e&&(S.Sb(0,"li"),S.Oc(1),S.Rb()),2&e){const e=t.$implicit;S.yb(1),S.Pc(e)}}function Ns(e,t){if(1&e&&(S.Qb(0),S.Sb(1,"span"),S.Wb(2,13),S.Rb(),S.Sb(3,"ul"),S.Mc(4,Ms,2,1,"li",14),S.Rb(),S.Pb()),2&e){const e=S.ic(2).snapshots;S.yb(4),S.pc("ngForOf",e)}}function Is(e,t){if(1&e&&(S.Sb(0,"div",11),S.Sb(1,"span"),S.Wb(2,12),S.Rb(),S.Nb(3,"br"),S.Mc(4,Ns,5,1,"ng-container",9),S.Rb()),2&e){const e=S.ic().snapshots;S.yb(4),S.pc("ngIf",e.length>0)}}function $s(e,t){1&e&&S.Mc(0,Is,5,1,"div",10),2&e&&S.pc("ngIf",t.hasSnapshots)}let Ts=(()=>{class e extends at.a{constructor(e,t,a,i,o,s,n,r,c){super(),this.authStorageService=e,this.rbdService=t,this.dimlessBinaryPipe=a,this.dimlessPipe=i,this.modalService=o,this.taskWrapper=s,this.taskListService=n,this.urlBuilder=r,this.actionLabels=c,this.tableStatus=new Pa.a,this.selection=new nt.a,this.builders={"rbd/create":e=>this.createRbdFromTask(e.pool_name,e.namespace,e.image_name),"rbd/delete":e=>this.createRbdFromTaskImageSpec(e.image_spec),"rbd/clone":e=>this.createRbdFromTask(e.child_pool_name,e.child_namespace,e.child_image_name),"rbd/copy":e=>this.createRbdFromTask(e.dest_pool_name,e.dest_namespace,e.dest_image_name)},this.permission=this.authStorageService.getPermissions().rbdImage;const l=()=>this.selection.first()&&new R.a(this.selection.first().pool_name,this.selection.first().namespace,this.selection.first().name).toStringEncoded();this.tableActions=[{permission:"create",icon:N.a.add,routerLink:()=>this.urlBuilder.getCreate(),canBePrimary:e=>!e.hasSingleSelection,name:this.actionLabels.CREATE},{permission:"update",icon:N.a.edit,routerLink:()=>this.urlBuilder.getEdit(l()),name:this.actionLabels.EDIT,disable:this.getInvalidNameDisable},{permission:"create",canBePrimary:e=>e.hasSingleSelection,disable:e=>this.getInvalidNameDisable(e)||!!e.first().cdExecuting,icon:N.a.copy,routerLink:()=>"/block/rbd/copy/"+l(),name:this.actionLabels.COPY},{permission:"update",disable:e=>this.getInvalidNameDisable(e)||e.first().cdExecuting||!e.first().parent,icon:N.a.flatten,click:()=>this.flattenRbdModal(),name:this.actionLabels.FLATTEN},{permission:"delete",icon:N.a.destroy,click:()=>this.deleteRbdModal(),name:this.actionLabels.DELETE,disable:e=>this.getDeleteDisableDesc(e)},{permission:"delete",icon:N.a.trash,click:()=>this.trashRbdModal(),name:this.actionLabels.TRASH,disable:e=>this.getInvalidNameDisable(e)||e.first().image_format===vi.V1}]}createRbdFromTaskImageSpec(e){const t=R.a.fromString(e);return this.createRbdFromTask(t.poolName,t.namespace,t.imageName)}createRbdFromTask(e,t,a){const i=new Si;return i.id="-1",i.unique_id="-1",i.name=a,i.namespace=t,i.pool_name=e,i.image_format=vi.V2,i}ngOnInit(){this.columns=[{name:"Name",prop:"name",flexGrow:2,cellTransformation:st.a.executing},{name:"Pool",prop:"pool_name",flexGrow:2},{name:"Namespace",prop:"namespace",flexGrow:2},{name:"Size",prop:"size",flexGrow:1,cellClass:"text-right",pipe:this.dimlessBinaryPipe},{name:"Objects",prop:"num_objs",flexGrow:1,cellClass:"text-right",pipe:this.dimlessPipe},{name:"Object size",prop:"obj_size",flexGrow:1,cellClass:"text-right",pipe:this.dimlessBinaryPipe},{name:"Provisioned",prop:"disk_usage",cellClass:"text-center",flexGrow:1,pipe:this.dimlessBinaryPipe},{name:"Total provisioned",prop:"total_disk_usage",cellClass:"text-center",flexGrow:1,pipe:this.dimlessBinaryPipe},{name:"Parent",prop:"parent",flexGrow:2,cellTemplate:this.parentTpl}],this.taskListService.init(()=>this.rbdService.list(),e=>this.prepareResponse(e),e=>this.images=e,()=>this.onFetchError(),e=>["rbd/clone","rbd/copy","rbd/create","rbd/delete","rbd/edit","rbd/flatten","rbd/trash/move"].includes(e.name),(e,t)=>{let a;switch(t.name){case"rbd/copy":a=new R.a(t.metadata.dest_pool_name,t.metadata.dest_namespace,t.metadata.dest_image_name).toString();break;case"rbd/clone":a=new R.a(t.metadata.child_pool_name,t.metadata.child_namespace,t.metadata.child_image_name).toString();break;case"rbd/create":a=new R.a(t.metadata.pool_name,t.metadata.namespace,t.metadata.image_name).toString();break;default:a=t.metadata.image_spec}return a===new R.a(e.pool_name,e.namespace,e.name).toString()},this.builders)}onFetchError(){this.table.reset(),this.tableStatus=new Pa.a(So.a.ValueException)}prepareResponse(e){let t=[];const a={};let i;if(e.forEach(e=>{m.a.isUndefined(a[e.status])&&(a[e.status]=[]),a[e.status].push(e.pool_name),t=t.concat(e.value)}),a[So.a.ValueException]?i=So.a.ValueException:a[So.a.ValueStale]?i=So.a.ValueStale:a[So.a.ValueNone]&&(i=So.a.ValueNone),i){const e=(a[i].length>1?"pools ":"pool ")+a[i].join();this.tableStatus=new Pa.a(i,e)}else this.tableStatus=new Pa.a;return t}updateSelection(e){this.selection=e}deleteRbdModal(){const e=this.selection.first().pool_name,t=this.selection.first().namespace,a=this.selection.first().name,i=new R.a(e,t,a);this.modalRef=this.modalService.show(it.a,{itemDescription:"RBD",itemNames:[i],bodyTemplate:this.deleteTpl,bodyContext:{hasSnapshots:this.hasSnapshots(),snapshots:this.listProtectedSnapshots()},submitActionObservable:()=>this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/delete",{image_spec:i.toString()}),call:this.rbdService.delete(i)})})}trashRbdModal(){const e={poolName:this.selection.first().pool_name,namespace:this.selection.first().namespace,imageName:this.selection.first().name,hasSnapshots:this.hasSnapshots()};this.modalRef=this.modalService.show($o,e)}flattenRbd(e){this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/flatten",{image_spec:e.toString()}),call:this.rbdService.flatten(e)}).subscribe({complete:()=>{this.modalRef.close()}})}flattenRbdModal(){const e=this.selection.first().pool_name,t=this.selection.first().namespace,a=this.selection.first().name,i=this.selection.first().parent,o=new R.a(i.pool_name,i.pool_namespace,i.image_name),s=new R.a(e,t,a),n={titleText:"RBD flatten",buttonText:"Flatten",bodyTpl:this.flattenTpl,bodyData:{parent:`${o}@${i.snap_name}`,child:s.toString()},onSubmit:()=>{this.flattenRbd(s)}};this.modalRef=this.modalService.show(go.a,n)}hasSnapshots(){return(this.selection.first().snapshots||[]).length>0}hasClonedSnapshots(e){return(e.snapshots||[]).some(e=>e.children&&e.children.length>0)}listProtectedSnapshots(){return this.selection.first().snapshots.reduce((e,t)=>(t.is_protected&&e.push(t.name),e),[])}getDeleteDisableDesc(e){const t=e.first();return t&&this.hasClonedSnapshots(t)?"This RBD has cloned snapshots. Please delete related RBDs before deleting this RBD.":this.getInvalidNameDisable(e)||this.hasClonedSnapshots(e.first())}getInvalidNameDisable(e){var t;const a=e.first();return(null===(t=null==a?void 0:a.name)||void 0===t?void 0:t.match(/[@/]/))?"This RBD image has an invalid name and can't be managed by ceph.":!e.first()||!e.hasSingleSelection}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(lt.a),S.Mb(_),S.Mb(hi.a),S.Mb(jt.a),S.Mb(P.a),S.Mb(z.a),S.Mb(bt.a),S.Mb(vo.a),S.Mb(l.b))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-list"]],viewQuery:function(e,t){var a;1&e&&(S.Jc(ot.a,!0),S.Tc(us,!0),S.Jc(fs,!0),S.Tc(hs,!0),S.Jc(gs,!0),S.Jc(Ss,!0)),2&e&&(S.zc(a=S.hc())&&(t.table=a.first),S.zc(a=S.hc())&&(t.usageTpl=a.first),S.zc(a=S.hc())&&(t.parentTpl=a.first),S.zc(a=S.hc())&&(t.nameTpl=a.first),S.zc(a=S.hc())&&(t.flattenTpl=a.first),S.zc(a=S.hc())&&(t.deleteTpl=a.first))},features:[S.xb([bt.a,{provide:vo.a,useValue:new vo.a("block/rbd")}]),S.vb],decls:13,vars:10,consts:function(){return[["columnMode","flex","identifier","unique_id","forceIdentifier","true","selectionType","single",3,"data","columns","searchableObjects","hasDetails","status","autoReload","fetchData","setExpandedRow","updateSelection"],["table",""],[1,"table-actions",3,"permission","selection","tableActions"],["cdTableDetail","",3,"selection"],["usageNotAvailableTooltipTpl",""],["parentTpl",""],["flattenTpl",""],["deleteTpl",""],[3,"innerHtml"],[4,"ngIf"],["class","alert alert-warning","role","alert",4,"ngIf"],["role","alert",1,"alert","alert-warning"],"Deleting this image will also delete all its snapshots.","The following snapshots are currently protected and will be removed:",[4,"ngFor","ngForOf"]]},template:function(e,t){1&e&&(S.Nb(0,"cd-rbd-tabs"),S.Sb(1,"cd-table",0,1),S.gc("fetchData",(function(){return t.taskListService.fetch()}))("setExpandedRow",(function(e){return t.setExpandedRow(e)}))("updateSelection",(function(e){return t.updateSelection(e)})),S.Nb(3,"cd-table-actions",2),S.Nb(4,"cd-rbd-details",3),S.Rb(),S.Mc(5,vs,1,1,"ng-template",null,4,S.Nc),S.Mc(7,_s,2,2,"ng-template",null,5,S.Nc),S.Mc(9,ks,13,3,"ng-template",null,6,S.Nc),S.Mc(11,$s,1,1,"ng-template",null,7,S.Nc)),2&e&&(S.yb(1),S.pc("data",t.images)("columns",t.columns)("searchableObjects",!0)("hasDetails",!0)("status",t.tableStatus)("autoReload",-1),S.yb(2),S.pc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions),S.yb(1),S.pc("selection",t.expandedRow))},directives:[Fo,ot.a,Mt.a,ms,i.r,i.q],styles:[""]}),e})();function Fs(e,t){1&e&&S.Nb(0,"input",19)}function Ps(e,t){1&e&&(S.Sb(0,"option",23),S.Wb(1,24),S.Rb()),2&e&&S.pc("ngValue",null)}function zs(e,t){1&e&&(S.Sb(0,"option",23),S.Wb(1,25),S.Rb()),2&e&&S.pc("ngValue",null)}function Es(e,t){1&e&&(S.Sb(0,"option",23),S.Wb(1,26),S.Rb()),2&e&&S.pc("ngValue",null)}function Cs(e,t){if(1&e&&(S.Sb(0,"option",27),S.Oc(1),S.Rb()),2&e){const e=t.$implicit;S.pc("value",e.pool_name),S.yb(1),S.Pc(e.pool_name)}}function Ds(e,t){if(1&e&&(S.Sb(0,"select",20),S.Mc(1,Ps,2,1,"option",21),S.Mc(2,zs,2,1,"option",21),S.Mc(3,Es,2,1,"option",21),S.Mc(4,Cs,2,2,"option",22),S.Rb()),2&e){const e=S.ic();S.yb(1),S.pc("ngIf",null===e.pools),S.yb(1),S.pc("ngIf",null!==e.pools&&0===e.pools.length),S.yb(1),S.pc("ngIf",null!==e.pools&&e.pools.length>0),S.yb(1),S.pc("ngForOf",e.pools)}}function Os(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,29),S.Rb())}function As(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,30),S.Rb())}function xs(e,t){1&e&&(S.Sb(0,"span",28),S.Wb(1,31),S.Rb())}let Vs=(()=>{class e{constructor(e,t,a,i,o,s){this.activeModal=e,this.actionLabels=t,this.authStorageService=a,this.notificationService=i,this.poolService=o,this.rbdService=s,this.pools=null,this.editing=!1,this.poolPermission=this.authStorageService.getPermissions().pool,this.createForm()}createForm(){this.namespaceForm=new $.a({pool:new o.h(""),namespace:new o.h("")},this.validator(),this.asyncValidator())}validator(){return e=>{const t=e.get("pool"),a=e.get("namespace");let i=null;t.value||(i={required:!0}),t.setErrors(i);let o=null;return a.value||(o={required:!0}),a.setErrors(o),null}}asyncValidator(){return e=>new Promise(t=>{const a=e.get("pool"),i=e.get("namespace");this.rbdService.listNamespaces(a.value).subscribe(e=>{if(e.some(e=>e.namespace===i.value)){const e={namespaceExists:!0};i.setErrors(e),t(e)}else t(null)})})}ngOnInit(){this.onSubmit=new Ao.a,this.poolPermission.read&&this.poolService.list(["pool_name","type","application_metadata"]).then(e=>{const t=[];for(const a of e)this.rbdService.isRBDPool(a)&&"replicated"===a.type&&t.push(a);if(this.pools=t,1===this.pools.length){const e=this.pools[0].pool_name;this.namespaceForm.get("pool").setValue(e)}})}submit(){const e=this.namespaceForm.getValue("pool"),t=this.namespaceForm.getValue("namespace"),a=new F.a;a.name="rbd/namespace/create",a.metadata={pool:e,namespace:t},this.rbdService.createNamespace(e,t).toPromise().then(()=>{this.notificationService.show(dt.a.success,"Created namespace '" + e + "/" + t + "'"),this.activeModal.close(),this.onSubmit.next()}).catch(()=>{this.namespaceForm.setErrors({cdSubmitButton:!0})})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(r.a),S.Mb(l.b),S.Mb(lt.a),S.Mb(pt.a),S.Mb(ui.a),S.Mb(_))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-namespace-form-modal"]],decls:23,vars:9,consts:function(){return[[3,"modalRef"],[1,"modal-title"],"Create Namespace",[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"],"Pool",[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 custom-select","formControlName","pool",4,"ngIf"],["class","invalid-feedback",4,"ngIf"],["for","namespace",1,"cd-col-form-label","required"],"Name",["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","custom-select"],[3,"ngValue",4,"ngIf"],[3,"value",4,"ngFor","ngForOf"],[3,"ngValue"],"Loading...","-- No rbd pools available --","-- Select a pool --",[3,"value"],[1,"invalid-feedback"],"This field is required.","This field is required.","Namespace already exists."]},template:function(e,t){if(1&e&&(S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Wb(2,2),S.Pb(),S.Qb(3,3),S.Sb(4,"form",4,5),S.Sb(6,"div",6),S.Sb(7,"div",7),S.Sb(8,"label",8),S.Wb(9,9),S.Rb(),S.Sb(10,"div",10),S.Mc(11,Fs,1,0,"input",11),S.Mc(12,Ds,5,4,"select",12),S.Mc(13,Os,2,0,"span",13),S.Rb(),S.Rb(),S.Sb(14,"div",7),S.Sb(15,"label",14),S.Wb(16,15),S.Rb(),S.Sb(17,"div",10),S.Nb(18,"input",16),S.Mc(19,As,2,0,"span",13),S.Mc(20,xs,2,0,"span",13),S.Rb(),S.Rb(),S.Rb(),S.Sb(21,"div",17),S.Sb(22,"cd-form-button-panel",18),S.gc("submitActionEvent",(function(){return t.submit()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e){const e=S.Ac(5);S.pc("modalRef",t.activeModal),S.yb(4),S.pc("formGroup",t.namespaceForm),S.yb(7),S.pc("ngIf",!t.poolPermission.read),S.yb(1),S.pc("ngIf",t.poolPermission.read),S.yb(1),S.pc("ngIf",t.namespaceForm.showError("pool",e,"required")),S.yb(6),S.pc("ngIf",t.namespaceForm.showError("namespace",e,"required")),S.yb(1),S.pc("ngIf",t.namespaceForm.showError("namespace",e,"namespaceExists")),S.yb(2),S.pc("form",t.namespaceForm)("submitText",t.actionLabels.CREATE)}},directives:[E.a,o.C,o.r,o.k,C.a,D.a,i.r,O.a,o.d,A.a,o.q,o.i,ha.a,x.a,o.z,i.q,o.u,o.B],styles:[""]}),e})(),Ws=(()=>{class e{constructor(e,t,a,i,o,s){this.authStorageService=e,this.rbdService=t,this.poolService=a,this.modalService=i,this.notificationService=o,this.actionLabels=s,this.selection=new nt.a,this.permission=this.authStorageService.getPermissions().rbdImage,this.tableActions=[{permission:"create",icon:N.a.add,click:()=>this.createModal(),name:this.actionLabels.CREATE},{permission:"delete",icon:N.a.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(e=>{e=e.filter(e=>this.rbdService.isRBDPool(e)&&"replicated"===e.type);const t=[];e.forEach(e=>{t.push(this.rbdService.listNamespaces(e.pool_name))}),t.length>0?Object(u.a)(t).subscribe(t=>{const a=[];for(let i=0;i<t.length;i++){const o=e[i].pool_name;t[i].forEach(e=>{a.push({id:`${o}/${e.namespace}`,pool:o,namespace:e.namespace,num_images:e.num_images})})}this.namespaces=a}):this.namespaces=[]})}updateSelection(e){this.selection=e}createModal(){this.modalRef=this.modalService.show(Vs),this.modalRef.componentInstance.onSubmit.subscribe(()=>{this.refresh()})}deleteModal(){const e=this.selection.first().pool,t=this.selection.first().namespace;this.modalRef=this.modalService.show(it.a,{itemDescription:"Namespace",itemNames:[`${e}/${t}`],submitAction:()=>this.rbdService.deleteNamespace(e,t).subscribe(()=>{this.notificationService.show(dt.a.success,"Deleted namespace '" + e + "/" + t + "'"),this.modalRef.close(),this.refresh()},()=>{this.modalRef.componentInstance.stopLoadingSpinner()})})}getDeleteDisableDesc(){var e;const t=this.selection.first();return(null==t?void 0:t.num_images)>0?"Namespace contains images":!(null===(e=this.selection)||void 0===e?void 0:e.first())}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(lt.a),S.Mb(_),S.Mb(ui.a),S.Mb(P.a),S.Mb(pt.a),S.Mb(l.b))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-namespace-list"]],features:[S.xb([bt.a])],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(e,t){1&e&&(S.Nb(0,"cd-rbd-tabs"),S.Sb(1,"cd-table",0),S.gc("fetchData",(function(){return t.refresh()}))("updateSelection",(function(e){return t.updateSelection(e)})),S.Sb(2,"div",1),S.Nb(3,"cd-table-actions",2),S.Rb(),S.Rb()),2&e&&(S.yb(1),S.pc("data",t.namespaces)("columns",t.columns),S.yb(2),S.pc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions))},directives:[Fo,ot.a,Mt.a],styles:[""]}),e})(),qs=(()=>{class e{}return e.\u0275fac=function(t){return new(t||e)},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-performance"]],decls:2,vars:1,consts:[["uid","41FrpeUiz","grafanaStyle","two",3,"grafanaPath"]],template:function(e,t){1&e&&(S.Nb(0,"cd-rbd-tabs"),S.Nb(1,"cd-grafana",0)),2&e&&(S.yb(1),S.pc("grafanaPath","rbd-overview?"))},directives:[Fo,Uo.a],styles:[""]}),e})();function Bs(e,t){1&e&&(S.Sb(0,"input",15),S.Yb(1,16),S.Rb())}function Gs(e,t){if(1&e&&(S.Sb(0,"option",21),S.Oc(1),S.Rb()),2&e){const e=t.$implicit;S.pc("value",e),S.yb(1),S.Pc(e)}}function Ls(e,t){if(1&e&&(S.Sb(0,"select",17),S.Sb(1,"option",18),S.Wb(2,19),S.Rb(),S.Mc(3,Gs,2,2,"option",20),S.Rb()),2&e){const e=S.ic();S.yb(3),S.pc("ngForOf",e.pools)}}let js=(()=>{class e{constructor(e,t,a,i,o,s,n){this.authStorageService=e,this.rbdService=t,this.activeModal=a,this.actionLabels=i,this.fb=o,this.poolService=s,this.taskWrapper=n,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(e=>{this.pools=e.filter(e=>e.application_metadata.includes("rbd")).map(e=>e.pool_name)}),this.createForm()}purge(){const e=this.purgeForm.getValue("poolName")||"";this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/trash/purge",{pool_name:e}),call:this.rbdService.purgeTrash(e)}).subscribe({error:()=>{this.purgeForm.setErrors({cdSubmitButton:!0})},complete:()=>{this.activeModal.close()}})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(lt.a),S.Mb(_),S.Mb(r.a),S.Mb(l.b),S.Mb(wo.a),S.Mb(ui.a),S.Mb(z.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-trash-purge-modal"]],decls:18,vars:6,consts:function(){var e,t;return e="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",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","purgeForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t=S.bc(t),[1,"form-group"],[1,"col-form-label","mx-auto"],"Pool:",["class","form-control","type","text","formControlName","poolName",4,"ngIf",6,"placeholder"],["id","poolName","name","poolName","class","form-control custom-select","formControlName","poolName",4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],["type","text","formControlName","poolName",1,"form-control",6,"placeholder"],["placeholder","Pool name..."],["id","poolName","name","poolName","formControlName","poolName",1,"form-control","custom-select"],["value",""],"All",[3,"value",4,"ngFor","ngForOf"],[3,"value"]]},template:function(e,t){1&e&&(S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Wb(2,2),S.Pb(),S.Qb(3,3),S.Sb(4,"form",4,5),S.Sb(6,"div",6),S.Sb(7,"p"),S.cc(8,7),S.Nb(9,"kbd"),S.Nb(10,"kbd"),S.Zb(),S.Rb(),S.Sb(11,"div",8),S.Sb(12,"label",9),S.Wb(13,10),S.Rb(),S.Mc(14,Bs,2,0,"input",11),S.Mc(15,Ls,4,1,"select",12),S.Rb(),S.Rb(),S.Sb(16,"div",13),S.Sb(17,"cd-form-button-panel",14),S.gc("submitActionEvent",(function(){return t.purge()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e&&(S.pc("modalRef",t.activeModal),S.yb(4),S.pc("formGroup",t.purgeForm),S.yb(10),S.pc("ngIf",!t.poolPermission.read),S.yb(1),S.pc("ngIf",t.poolPermission.read),S.yb(2),S.pc("form",t.purgeForm)("submitText",t.actionLabels.PURGE))},directives:[E.a,o.C,o.r,o.k,C.a,D.a,i.r,x.a,O.a,o.d,A.a,o.q,o.i,o.z,o.u,o.B,i.q],styles:[""]}),e})();function Qs(e,t){1&e&&(S.Sb(0,"span",15),S.Wb(1,16),S.Rb())}let Us=(()=>{class e{constructor(e,t,a,i,o){this.rbdService=e,this.activeModal=t,this.actionLabels=a,this.fb=i,this.taskWrapper=o}ngOnInit(){this.imageSpec=new R.a(this.poolName,this.namespace,this.imageName).toString(),this.restoreForm=this.fb.group({name:this.imageName})}restore(){const e=this.restoreForm.getValue("name"),t=new R.a(this.poolName,this.namespace,this.imageId);this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/trash/restore",{image_id_spec:t.toString(),new_image_name:e}),call:this.rbdService.restoreTrash(t,e)}).subscribe({error:()=>{this.restoreForm.setErrors({cdSubmitButton:!0})},complete:()=>{this.activeModal.close()}})}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(_),S.Mb(r.a),S.Mb(l.b),S.Mb(wo.a),S.Mb(z.a))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-trash-restore-modal"]],decls:18,vars:7,consts:function(){var e,t;return e="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]" + ".",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","restoreForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t=S.bc(t),[1,"form-group"],["for","name",1,"col-form-label"],"New Name",["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"],"This field is required."]},template:function(e,t){if(1&e&&(S.Sb(0,"cd-modal",0),S.Qb(1,1),S.Wb(2,2),S.Pb(),S.Qb(3,3),S.Sb(4,"form",4,5),S.Sb(6,"div",6),S.Sb(7,"p"),S.cc(8,7),S.Nb(9,"kbd"),S.Nb(10,"kbd"),S.Zb(),S.Rb(),S.Sb(11,"div",8),S.Sb(12,"label",9),S.Wb(13,10),S.Rb(),S.Nb(14,"input",11),S.Mc(15,Qs,2,0,"span",12),S.Rb(),S.Rb(),S.Sb(16,"div",13),S.Sb(17,"cd-form-button-panel",14),S.gc("submitActionEvent",(function(){return t.restore()})),S.Rb(),S.Rb(),S.Rb(),S.Pb(),S.Rb()),2&e){const e=S.Ac(5);S.pc("modalRef",t.activeModal),S.yb(4),S.pc("formGroup",t.restoreForm),S.yb(6),S.ac(t.imageSpec)(t.imageId),S.Xb(8),S.yb(5),S.pc("ngIf",t.restoreForm.showError("name",e,"required")),S.yb(2),S.pc("form",t.restoreForm)("submitText",t.actionLabels.RESTORE)}},directives:[E.a,o.C,o.r,o.k,C.a,D.a,O.a,o.d,A.a,o.q,o.i,ha.a,i.r,x.a],styles:[""]}),e})();const Ys=["expiresTpl"],Ks=["deleteTpl"],Js=function(e){return[e]};function Xs(e,t){if(1&e){const e=S.Tb();S.Sb(0,"button",6),S.gc("click",(function(){return S.Dc(e),S.ic().purgeModal()})),S.Nb(1,"i",7),S.Qb(2),S.Wb(3,8),S.Pb(),S.Rb()}if(2&e){const e=S.ic();S.pc("disabled",e.disablePurgeBtn),S.yb(1),S.pc("ngClass",S.uc(2,Js,e.icons.destroy))}}function Hs(e,t){1&e&&(S.Qb(0),S.Wb(1,10),S.Pb())}function Zs(e,t){1&e&&(S.Qb(0),S.Wb(1,11),S.Pb())}function en(e,t){if(1&e&&(S.Mc(0,Hs,2,0,"ng-container",9),S.Mc(1,Zs,2,0,"ng-container",9),S.Oc(2),S.jc(3,"cdDate")),2&e){const e=t.row,a=t.value;S.pc("ngIf",e.cdIsExpired),S.yb(1),S.pc("ngIf",!e.cdIsExpired),S.yb(1),S.Qc(" ",S.kc(3,3,a),"\n")}}function tn(e,t){if(1&e&&(S.Sb(0,"p",13),S.Sb(1,"strong"),S.Qb(2),S.Wb(3,14),S.jc(4,"cdDate"),S.Pb(),S.Rb(),S.Rb()),2&e){const e=S.ic().expiresAt;S.yb(4),S.ac(S.kc(4,1,e)),S.Xb(3)}}function an(e,t){1&e&&S.Mc(0,tn,5,3,"p",12),2&e&&S.pc("ngIf",!t.isExpired)}let on=(()=>{class e{constructor(e,t,a,i,o,s,n){this.authStorageService=e,this.rbdService=t,this.modalService=a,this.cdDatePipe=i,this.taskListService=o,this.taskWrapper=s,this.actionLabels=n,this.icons=N.a,this.executingTasks=[],this.selection=new nt.a,this.tableStatus=new Pa.a,this.disablePurgeBtn=!0,this.permission=this.authStorageService.getPermissions().rbdImage,this.tableActions=[{permission:"update",icon:N.a.undo,click:()=>this.restoreModal(),name:this.actionLabels.RESTORE},{permission:"delete",icon:N.a.destroy,click:()=>this.deleteModal(),name:this.actionLabels.DELETE}]}ngOnInit(){this.columns=[{name:"ID",prop:"id",flexGrow:1,cellTransformation:st.a.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(),e=>this.prepareResponse(e),e=>this.images=e,()=>this.onFetchError(),e=>["rbd/trash/remove","rbd/trash/restore"].includes(e.name),(e,t)=>new R.a(e.pool_name,e.namespace,e.id).toString()===t.metadata.image_id_spec,void 0)}prepareResponse(e){let t=[];const a={};let i;if(e.forEach(e=>{m.a.isUndefined(a[e.status])&&(a[e.status]=[]),a[e.status].push(e.pool_name),t=t.concat(e.value),this.disablePurgeBtn=!t.length}),a[3]?i=3:a[1]?i=1:a[2]&&(i=2),i){const e=(a[i].length>1?"pools ":"pool ")+a[i].join();this.tableStatus=new Pa.a(i,e)}else this.tableStatus=new Pa.a;return t.forEach(e=>{e.cdIsExpired=Ro()().isAfter(e.deferment_end_time)}),t}onFetchError(){this.table.reset(),this.tableStatus=new Pa.a(So.a.ValueException)}updateSelection(e){this.selection=e}restoreModal(){const e={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(Us,e)}deleteModal(){const e=this.selection.first().pool_name,t=this.selection.first().namespace,a=this.selection.first().id,i=this.selection.first().deferment_end_time,o=Ro()().isAfter(i),s=new R.a(e,t,a);this.modalRef=this.modalService.show(it.a,{itemDescription:"RBD",itemNames:[s],bodyTemplate:this.deleteTpl,bodyContext:{expiresAt:i,isExpired:o},submitActionObservable:()=>this.taskWrapper.wrapTaskAroundCall({task:new F.a("rbd/trash/remove",{image_id_spec:s.toString()}),call:this.rbdService.removeTrash(s,!0)})})}purgeModal(){this.modalService.show(js)}}return e.\u0275fac=function(t){return new(t||e)(S.Mb(lt.a),S.Mb(_),S.Mb(P.a),S.Mb(Co.a),S.Mb(bt.a),S.Mb(z.a),S.Mb(l.b))},e.\u0275cmp=S.Gb({type:e,selectors:[["cd-rbd-trash-list"]],viewQuery:function(e,t){var a;1&e&&(S.Jc(ot.a,!0),S.Jc(Ys,!0),S.Jc(Ks,!0)),2&e&&(S.zc(a=S.hc())&&(t.table=a.first),S.zc(a=S.hc())&&(t.expiresTpl=a.first),S.zc(a=S.hc())&&(t.deleteTpl=a.first))},features:[S.xb([bt.a])],decls:9,vars:8,consts:function(){return[["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"],"Purge Trash",[4,"ngIf"],"Expired at","Protected until",["class","text-danger",4,"ngIf"],[1,"text-danger"],"This image is protected until " + "\ufffd0\ufffd" + "."]},template:function(e,t){1&e&&(S.Nb(0,"cd-rbd-tabs"),S.Sb(1,"cd-table",0),S.gc("fetchData",(function(){return t.taskListService.fetch()}))("updateSelection",(function(e){return t.updateSelection(e)})),S.Sb(2,"div",1),S.Nb(3,"cd-table-actions",2),S.Mc(4,Xs,4,4,"button",3),S.Rb(),S.Rb(),S.Mc(5,en,4,5,"ng-template",null,4,S.Nc),S.Mc(7,an,1,1,"ng-template",null,5,S.Nc)),2&e&&(S.yb(1),S.pc("data",t.images)("columns",t.columns)("status",t.tableStatus)("autoReload",-1),S.yb(2),S.pc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions),S.yb(1),S.pc("ngIf",t.permission.delete))},directives:[Fo,ot.a,Mt.a,i.r,O.a,i.p],pipes:[Co.a],styles:[""]}),e})(),sn=(()=>{class e{}return e.\u0275mod=S.Kb({type:e}),e.\u0275inj=S.Jb({factory:function(t){return new(t||e)},imports:[[i.c,ra,o.m,o.x,r.t,r.y,r.F,c.a,d.a,s.i,n.c]]}),e})();const nn=[{path:"",redirectTo:"rbd",pathMatch:"full"},{path:"rbd",canActivate:[b.a],data:{breadcrumbs:"Images"},children:[{path:"",component:Ts},{path:"namespaces",component:Ws,data:{breadcrumbs:"Namespaces"}},{path:"trash",component:on,data:{breadcrumbs:"Trash"}},{path:"performance",component:qs,data:{breadcrumbs:"Overall Performance"}},{path:l.e.CREATE,component:ho,data:{breadcrumbs:l.a.CREATE}},{path:l.e.EDIT+"/:image_spec",component:ho,data:{breadcrumbs:l.a.EDIT}},{path:l.e.CLONE+"/:image_spec/:snap",component:ho,data:{breadcrumbs:l.a.CLONE}},{path:l.e.COPY+"/:image_spec",component:ho,data:{breadcrumbs:l.a.COPY}},{path:l.e.COPY+"/:image_spec/:snap",component:ho,data:{breadcrumbs:l.a.COPY}}]},{path:"mirroring",component:bi,canActivate:[b.a],data:{breadcrumbs:"Mirroring"}},{path:"iscsi",canActivate:[b.a],data:{breadcrumbs:"iSCSI"},children:[{path:"",redirectTo:"overview",pathMatch:"full"},{path:"overview",component:na,data:{breadcrumbs:"Overview"}},{path:"targets",data:{breadcrumbs:"Targets"},children:[{path:"",component:Lt},{path:l.e.CREATE,component:tt,data:{breadcrumbs:l.a.CREATE}},{path:l.e.EDIT+"/:target_iqn",component:tt,data:{breadcrumbs:l.a.EDIT}}]}]}];let rn=(()=>{class e{}return e.\u0275mod=S.Kb({type:e}),e.\u0275inj=S.Jb({factory:function(t){return new(t||e)},imports:[[sn,s.i.forChild(nn)]]}),e})()},nQ07:function(e,t,a){"use strict";a.d(t,"a",(function(){return o}));var i=a("LvDl");class o{static updateChanged(e,t){let a=!1;return Object.keys(t).forEach(o=>{const s=t[o];i.isEqual(s,e[o])||(e[o]=s,a=!0)}),a}}},rFfW:function(e,t,a){"use strict";a.d(t,"a",(function(){return P}));var i=a("8Y7J"),o=a("s7LF"),s=a("LvDl"),n=a.n(s),r=a("jtHE"),c=a("oxzT"),l=a("QFaf"),b=a("PhyI"),d=a("aXbf"),p=a("o8EM"),m=a("NwgZ"),u=a("SVse"),f=a("ocLN"),h=a("p4Cf"),g=a("ANnk"),S=a("f69J");let v=(()=>{class e{constructor(e,t){this.control=e,this.formatter=t}setValue(e){const t=this.formatter.toMilliseconds(e);this.control.control.setValue(t+" ms")}ngOnInit(){this.setValue(this.control.value),this.ngDataReady&&this.ngDataReady.subscribe(()=>this.setValue(this.control.value))}onUpdate(e){this.setValue(e)}}return e.\u0275fac=function(t){return new(t||e)(i.Mb(o.p),i.Mb(d.a))},e.\u0275dir=i.Hb({type:e,selectors:[["","cdMilliseconds",""]],hostBindings:function(e,t){1&e&&i.gc("blur",(function(e){return t.onUpdate(e.target.value)}))},inputs:{ngDataReady:"ngDataReady"}}),e})();var y=a("IzCI");let R=(()=>{class e{constructor(e,t,a,o){this.elementRef=e,this.control=t,this.dimlessBinaryPerSecondPipe=a,this.formatter=o,this.ngModelChange=new i.o,this.el=this.elementRef.nativeElement}ngOnInit(){this.setValue(this.el.value),this.ngDataReady&&this.ngDataReady.subscribe(()=>this.setValue(this.el.value))}setValue(e){/^[\d.]+$/.test(e)&&(e+=this.defaultUnit||"m");const t=this.formatter.toBytes(e,0),a=this.round(t);this.el.value=this.dimlessBinaryPerSecondPipe.transform(a),null!==t?(this.ngModelChange.emit(this.el.value),this.control.control.setValue(this.el.value)):(this.ngModelChange.emit(null),this.control.control.setValue(null))}round(e){if(null!==e&&0!==e){if(!n.a.isUndefined(this.minBytes)&&e<this.minBytes)return this.minBytes;if(!n.a.isUndefined(this.maxBytes)&&e>this.maxBytes)return this.maxBytes;if(!n.a.isUndefined(this.roundPower)){const t=Math.round(Math.log(e)/Math.log(this.roundPower));return Math.pow(this.roundPower,t)}}return e}onBlur(e){this.setValue(e)}}return e.\u0275fac=function(t){return new(t||e)(i.Mb(i.m),i.Mb(o.p),i.Mb(y.a),i.Mb(d.a))},e.\u0275dir=i.Hb({type:e,selectors:[["","cdDimlessBinaryPerSecond",""]],hostBindings:function(e,t){1&e&&i.gc("blur",(function(e){return t.onBlur(e.target.value)}))},inputs:{ngDataReady:"ngDataReady",minBytes:"minBytes",maxBytes:"maxBytes",roundPower:"roundPower",defaultUnit:"defaultUnit"},outputs:{ngModelChange:"ngModelChange"}}),e})(),w=(()=>{class e{constructor(e,t){this.formatter=e,this.ngControl=t}setValue(e){const t=this.formatter.toIops(e);this.ngControl.control.setValue(t+" IOPS")}ngOnInit(){this.setValue(this.ngControl.value),this.ngDataReady&&this.ngDataReady.subscribe(()=>this.setValue(this.ngControl.value))}onUpdate(e){this.setValue(e)}}return e.\u0275fac=function(t){return new(t||e)(i.Mb(d.a),i.Mb(o.p))},e.\u0275dir=i.Hb({type:e,selectors:[["","cdIops",""]],hostBindings:function(e,t){1&e&&i.gc("blur",(function(e){return t.onUpdate(e.target.value)}))},inputs:{ngDataReady:"ngDataReady"}}),e})();function _(e,t){if(1&e&&(i.Qb(0),i.Nb(1,"input",19),i.Pb()),2&e){const e=i.ic().$implicit,t=i.ic(2);i.yb(1),i.pc("id",e.name)("name",e.name)("formControlName",e.name)("ngDataReady",t.ngDataReady)}}function k(e,t){if(1&e&&(i.Qb(0),i.Nb(1,"input",20),i.Pb()),2&e){const e=i.ic().$implicit,t=i.ic(2);i.yb(1),i.pc("id",e.name)("name",e.name)("formControlName",e.name)("ngDataReady",t.ngDataReady)}}function M(e,t){if(1&e&&(i.Qb(0),i.Nb(1,"input",21),i.Pb()),2&e){const e=i.ic().$implicit,t=i.ic(2);i.yb(1),i.pc("id",e.name)("name",e.name)("formControlName",e.name)("ngDataReady",t.ngDataReady)}}function N(e,t){1&e&&(i.Sb(0,"span",22),i.Wb(1,23),i.Rb())}const I=function(e){return{active:e}},$=function(e){return[e]};function T(e,t){if(1&e){const e=i.Tb();i.Sb(0,"div",10),i.Sb(1,"label",11),i.Oc(2),i.Sb(3,"cd-helper"),i.Oc(4),i.Rb(),i.Rb(),i.Sb(5,"div"),i.Sb(6,"div",12),i.Qb(7,13),i.Mc(8,_,2,4,"ng-container",14),i.Mc(9,k,2,4,"ng-container",14),i.Mc(10,M,2,4,"ng-container",14),i.Pb(),i.Sb(11,"span",15),i.Sb(12,"button",16),i.Yb(13,17),i.gc("click",(function(){i.Dc(e);const a=t.$implicit;return i.ic(2).reset(a.name)})),i.Nb(14,"i",7),i.Rb(),i.Rb(),i.Rb(),i.Mc(15,N,2,0,"span",18),i.Rb(),i.Rb()}if(2&e){const e=t.$implicit,a=i.ic().$implicit,o=i.ic(),s=i.Ac(1);i.yb(1),i.pc("for",e.name),i.yb(1),i.Pc(e.displayName),i.yb(2),i.Pc(e.description),i.yb(1),i.Bb("cd-col-form-input ",a.heading,""),i.yb(2),i.pc("ngSwitch",e.type),i.yb(1),i.pc("ngSwitchCase",o.configurationType.milliseconds),i.yb(1),i.pc("ngSwitchCase",o.configurationType.bps),i.yb(1),i.pc("ngSwitchCase",o.configurationType.iops),i.yb(2),i.pc("ngClass",i.uc(13,I,o.isDisabled(e.name))),i.yb(2),i.pc("ngClass",i.uc(15,$,o.icons.erase)),i.yb(1),i.pc("ngIf",o.form.showError("configuration."+e.name,s,"min"))}}function F(e,t){if(1&e){const e=i.Tb();i.Sb(0,"div",4),i.Sb(1,"h4",5),i.Sb(2,"span",6),i.gc("click",(function(){i.Dc(e);const a=t.$implicit;return i.ic().toggleSectionVisibility(a.class)})),i.Oc(3),i.Nb(4,"i",7),i.Rb(),i.Rb(),i.Sb(5,"div",8),i.Mc(6,T,16,17,"div",9),i.Rb(),i.Rb()}if(2&e){const e=t.$implicit,a=i.ic();i.yb(3),i.Qc(" ",e.heading," "),i.yb(1),i.pc("ngClass",a.sectionVisibility[e.class]?a.icons.minusCircle:a.icons.addCircle),i.yb(1),i.Ab(e.class),i.pc("hidden",!a.sectionVisibility[e.class]),i.yb(1),i.pc("ngForOf",e.options)}}let P=(()=>{class e{constructor(e,t){this.formatterService=e,this.rbdConfigurationService=t,this.initializeData=new r.a(1),this.changes=new i.o,this.icons=c.a,this.ngDataReady=new i.o,this.configurationType=b.b,this.sectionVisibility={}}ngOnInit(){const e=this.createConfigurationFormGroup();this.form.addControl("configuration",e),e.valueChanges.subscribe(()=>{this.changes.emit(this.getDirtyValues.bind(this))}),this.initializeData&&this.initializeData.subscribe(e=>{this.initialData=e.initialData;const t=e.sourceType;this.rbdConfigurationService.getWritableOptionFields().forEach(a=>{const i=e.initialData.filter(e=>e.name===a.name).pop();i&&i.source===t&&this.form.get("configuration."+a.name).setValue(i.value)}),this.ngDataReady.emit()}),this.rbdConfigurationService.getWritableSections().forEach(e=>this.sectionVisibility[e.class]=!1)}getDirtyValues(e=!1,t){if(e&&!t)throw new Error("ProgrammingError: If local values shall be included, a proper localFieldType argument has to be provided, too");const a={};return this.rbdConfigurationService.getWritableOptionFields().forEach(i=>{const o=this.form.get("configuration").get(i.name);this.initialData&&this.initialData[i.name]===o.value||(o.dirty||e&&o.source===t)&&(a[i.name]=null===o.value?o.value:i.type===b.b.bps?this.formatterService.toBytes(o.value):i.type===b.b.milliseconds?this.formatterService.toMilliseconds(o.value):i.type===b.b.iops?this.formatterService.toIops(o.value):o.value)}),a}createConfigurationFormGroup(){const e=new l.a({});return this.rbdConfigurationService.getWritableOptionFields().forEach(t=>{let a;if(t.type!==b.b.milliseconds&&t.type!==b.b.iops&&t.type!==b.b.bps)throw new Error(`Type ${t.type} is unknown, you may need to add it to RbdConfiguration class`);{let e=0;n.a.forEach(this.initialData,a=>{a.name===t.name&&(e=a.value)}),a=new o.h(e,o.A.min(0))}e.addControl(t.name,a)}),e}reset(e){const t=this.form.get("configuration").get(e);t.disabled?(t.setValue(t.previousValue||0),t.enable(),t.previousValue||t.markAsPristine()):(t.previousValue=t.value,t.setValue(null),t.markAsDirty(),t.disable())}isDisabled(e){return this.form.get("configuration").get(e).disabled}toggleSectionVisibility(e){this.sectionVisibility[e]=!this.sectionVisibility[e]}}return e.\u0275fac=function(t){return new(t||e)(i.Mb(d.a),i.Mb(p.a))},e.\u0275cmp=i.Gb({type:e,selectors:[["cd-rbd-configuration-form"]],inputs:{form:"form",initializeData:"initializeData"},outputs:{changes:"changes"},decls:5,vars:2,consts:function(){return[[3,"formGroup"],["cfgFormGroup",""],"RBD Configuration",["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",1,"btn","btn-light",3,"ngClass","click",6,"title"],["title","Remove the local configuration value. The parent configuration value will be inherited and used instead."],["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"],"The minimum value is 0"]},template:function(e,t){1&e&&(i.Sb(0,"fieldset",0,1),i.Sb(2,"legend"),i.Wb(3,2),i.Rb(),i.Mc(4,F,7,7,"div",3),i.Rb()),2&e&&(i.pc("formGroup",t.form.get("configuration")),i.yb(4),i.pc("ngForOf",t.rbdConfigurationService.sections))},directives:[o.r,o.k,m.a,u.q,u.p,f.a,h.a,u.t,u.u,g.a,u.r,o.d,S.a,v,o.q,o.i,R,w],styles:[".collapsible[_ngcontent-%COMP%]{cursor:pointer;user-select:none}"]}),e})()}}]);