]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/dist/en-US/1.e0a29c1d4fcf893cf11d.js
buildsys: switch source download to quincy
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / dist / en-US / 1.e0a29c1d4fcf893cf11d.js
1 (window.webpackJsonp=window.webpackJsonp||[]).push([[1],{aAWM:function(e,t,a){"use strict";a.d(t,"a",function(){return X});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.Qb({name:"rbdConfigurationSource",type:e,pure:!0}),e})();var c=a("aXbf"),r=a("o8EM"),l=a("SVse"),b=a("IzCI"),d=a("dEH0"),u=a("BQkM");const m=["configurationSourceTpl"],p=["configurationValueTpl"],f=["poolConfTable"];function h(e,t){1&e&&(s.Xb(0,"span"),s.bc(1,6),s.Wb())}function g(e,t){1&e&&(s.Xb(0,"strong"),s.bc(1,7),s.Wb())}function v(e,t){1&e&&(s.Xb(0,"strong"),s.bc(1,8),s.Wb())}function S(e,t){1&e&&(s.Xb(0,"div",4),s.Pc(1,h,2,0,"span",5),s.Pc(2,g,2,0,"strong",5),s.Pc(3,v,2,0,"strong",5),s.Wb()),2&e&&(s.uc("ngSwitch",t.value),s.Db(1),s.uc("ngSwitchCase","global"),s.Db(1),s.uc("ngSwitchCase","image"),s.Db(1),s.uc("ngSwitchCase","pool"))}function D(e,t){if(1&e&&(s.Xb(0,"span"),s.Rc(1),s.oc(2,"dimlessBinaryPerSecond"),s.Wb()),2&e){const e=s.nc().value;s.Db(1),s.Sc(s.pc(2,1,e))}}function w(e,t){if(1&e&&(s.Xb(0,"span"),s.Rc(1),s.oc(2,"milliseconds"),s.Wb()),2&e){const e=s.nc().value;s.Db(1),s.Sc(s.pc(2,1,e))}}function _(e,t){if(1&e&&(s.Xb(0,"span"),s.Rc(1),s.oc(2,"iops"),s.Wb()),2&e){const e=s.nc().value;s.Db(1),s.Sc(s.pc(2,1,e))}}function W(e,t){if(1&e&&(s.Xb(0,"span"),s.Rc(1),s.Wb()),2&e){const e=s.nc().value;s.Db(1),s.Sc(e)}}function y(e,t){if(1&e&&(s.Xb(0,"div",4),s.Pc(1,D,3,3,"span",5),s.Pc(2,w,3,3,"span",5),s.Pc(3,_,3,3,"span",5),s.Pc(4,W,2,1,"span",9),s.Wb()),2&e){const e=t.row,a=s.nc();s.uc("ngSwitch",e.type),s.Db(1),s.uc("ngSwitchCase",a.typeField.bps),s.Db(1),s.uc("ngSwitchCase",a.typeField.milliseconds),s.Db(1),s.uc("ngSwitchCase",a.typeField.iops)}}let X=(()=>{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.Rb(c.a),s.Rb(r.a))},e.\u0275cmp=s.Lb({type:e,selectors:[["cd-rbd-configuration-table"]],viewQuery:function(e,t){if(1&e&&(s.Wc(m,3),s.Wc(p,3),s.Wc(f,3)),2&e){let e;s.Ec(e=s.mc())&&(t.configurationSourceTpl=e.first),s.Ec(e=s.mc())&&(t.configurationValueTpl=e.first),s.Ec(e=s.mc())&&(t.poolConfTable=e.first)}},inputs:{data:"data"},features:[s.Bb],decls:6,vars:2,consts:function(){let e,t,a;return e="Global",t="Image",a="Pool",[["identifier","name",3,"data","columns"],["poolConfTable",""],["configurationSourceTpl",""],["configurationValueTpl",""],[3,"ngSwitch"],[4,"ngSwitchCase"],e,t,a,[4,"ngSwitchDefault"]]},template:function(e,t){1&e&&(s.Sb(0,"cd-table",0,1),s.Pc(2,S,4,4,"ng-template",null,2,s.Qc),s.Pc(4,y,5,4,"ng-template",null,3,s.Qc)),2&e&&s.uc("data",t.data)("columns",t.poolConfigurationColumns)},directives:[i.a,l.t,l.u,l.v],pipes:[b.a,d.a,u.a],styles:[""]}),e})()},"k/xb":function(e,t,a){"use strict";a.r(t),a.d(t,"BlockModule",function(){return Dn}),a.d(t,"RoutedBlockModule",function(){return _n});var i=a("SVse"),o=a("s7LF"),s=a("iInd"),n=a("ohO+"),c=a("G0yt"),r=a("zWsK"),l=a("sne2"),b=a("Vhfg"),d=a("PCNd"),u=a("LvDl"),m=a.n(u),p=a("cp0P"),f=a("mrSG"),h=a("IheW"),g=a("xTzq"),v=a("8Y7J");let S=(()=>{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)(v.ic(h.b))},e.\u0275prov=v.Nb({token:e,factory:e.\u0275fac,providedIn:"root"}),e=Object(f.b)([g.a,Object(f.d)("design:paramtypes",[h.b])],e),e})();var D=a("lJxs"),w=a("jVDg"),_=a("o8EM");let W=(()=>{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(D.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)(v.ic(h.b),v.ic(_.a))},e.\u0275prov=v.Nb({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",[w.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",[w.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",[w.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",[w.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,_.a])],e),e})();var y=a("DNAf"),X=a("a96k"),I=a("oxzT"),k=a("spCT"),P=a("QFaf"),$=a("1Ni5"),T=a("kvvV"),F=a("JK/P"),R=a("kn/O"),E=a("ajRT"),z=a("NwgZ"),N=a("ocLN"),C=a("ANnk"),V=a("f69J"),A=a("6+kj");function x(e,t){if(1&e&&(v.Xb(0,"option",6),v.Rc(1),v.Wb()),2&e){const e=t.$implicit;v.uc("ngValue",e),v.Db(1),v.Sc(e)}}function O(e,t){if(1&e&&(v.Xb(0,"select",5),v.Sb(1,"option",6),v.Pc(2,x,2,2,"option",7),v.Wb()),2&e){const e=v.nc();v.vc("id",e.setting),v.vc("name",e.setting),v.uc("formControlName",e.setting),v.Db(1),v.uc("ngValue",null),v.Db(1),v.uc("ngForOf",e.limits.values)}}function M(e,t){if(1&e&&v.Sb(0,"input",10),2&e){const e=v.nc(2);v.uc("formControlName",e.setting)}}function B(e,t){if(1&e&&v.Sb(0,"input",11),2&e){const e=v.nc(2);v.uc("formControlName",e.setting)}}function q(e,t){if(1&e&&(v.Vb(0),v.Sb(1,"br"),v.Xb(2,"div",12),v.Sb(3,"input",13),v.Xb(4,"label",14),v.Rc(5,"Yes"),v.Wb(),v.Wb(),v.Xb(6,"div",12),v.Sb(7,"input",13),v.Xb(8,"label",14),v.Rc(9,"No"),v.Wb(),v.Wb(),v.Ub()),2&e){const e=v.nc(2);v.Db(3),v.uc("id",e.setting+"True")("value",!0)("formControlName",e.setting),v.Db(1),v.uc("for",e.setting+"True"),v.Db(3),v.uc("id",e.setting+"False")("value",!1)("formControlName",e.setting),v.Db(1),v.uc("for",e.setting+"False")}}function L(e,t){if(1&e&&(v.Xb(0,"span"),v.Pc(1,M,1,1,"input",8),v.Pc(2,B,1,1,"input",9),v.Pc(3,q,10,8,"ng-container",3),v.Wb()),2&e){const e=v.nc();v.Db(1),v.uc("ngIf","int"===e.limits.type),v.Db(1),v.uc("ngIf","str"===e.limits.type),v.Db(1),v.uc("ngIf","bool"===e.limits.type)}}function G(e,t){if(1&e&&(v.Xb(0,"span",15),v.Vb(1),v.bc(2,16),v.Ub(),v.Wb()),2&e){const e=v.nc();v.Db(2),v.fc(e.limits.min),v.cc(2)}}function U(e,t){if(1&e&&(v.Xb(0,"span",15),v.Vb(1),v.bc(2,17),v.Ub(),v.Wb()),2&e){const e=v.nc();v.Db(2),v.fc(e.limits.max),v.cc(2)}}let j=(()=>{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=v.Lb({type:e,selectors:[["cd-iscsi-setting"]],inputs:{settingsForm:"settingsForm",formDir:"formDir",setting:"setting",limits:"limits"},decls:7,vars:7,consts:function(){let e,t;return e="Must be greater than or equal to " + "\ufffd0\ufffd" + ".",t="Must be less than or equal to " + "\ufffd0\ufffd" + ".",[[1,"form-group",3,"formGroup"],[1,"col-form-label",3,"for"],["class","form-control 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"],e,t]},template:function(e,t){1&e&&(v.Xb(0,"div",0),v.Xb(1,"label",1),v.Rc(2),v.Wb(),v.Pc(3,O,3,5,"select",2),v.Pc(4,L,4,3,"span",3),v.Pc(5,G,3,1,"span",4),v.Pc(6,U,3,1,"span",4),v.Wb()),2&e&&(v.uc("formGroup",t.settingsForm),v.Db(1),v.vc("for",t.setting),v.Db(1),v.Sc(t.setting),v.Db(1),v.uc("ngIf","enum"===t.limits.type),v.Db(1),v.uc("ngIf","enum"!==t.limits.type),v.Db(1),v.uc("ngIf",t.settingsForm.showError(t.setting,t.formDir,"min")),v.Db(1),v.uc("ngIf",t.settingsForm.showError(t.setting,t.formDir,"max")))},directives:[N.a,o.r,o.k,z.a,i.r,C.a,o.z,V.a,o.q,o.i,o.u,o.C,i.q,o.v,o.d,o.w],styles:[""]}),e})();var Q=a("uYzU");function Y(e,t){1&e&&(v.Xb(0,"span",29),v.bc(1,30),v.Wb())}function K(e,t){if(1&e&&(v.Xb(0,"span"),v.Xb(1,"legend",10),v.bc(2,21),v.Wb(),v.Xb(3,"div",12),v.Xb(4,"div",13),v.Xb(5,"label",22),v.bc(6,23),v.Wb(),v.Sb(7,"input",24),v.Pc(8,Y,2,0,"span",25),v.Wb(),v.Wb(),v.Xb(9,"div",12),v.Xb(10,"div",13),v.Xb(11,"label",26),v.bc(12,27),v.Wb(),v.Sb(13,"input",28),v.Wb(),v.Wb(),v.Wb()),2&e){const e=v.nc(),t=v.Fc(9);v.Db(8),v.uc("ngIf",e.settingsForm.showError("lun",t,"required"))}}function H(e,t){if(1&e&&(v.Xb(0,"option",31),v.Rc(1),v.oc(2,"iscsiBackstore"),v.Wb()),2&e){const e=t.$implicit;v.uc("value",e),v.Db(1),v.Sc(v.pc(2,2,e))}}function J(e,t){if(1&e&&(v.Xb(0,"div",12),v.Xb(1,"div",13),v.Sb(2,"cd-iscsi-setting",33),v.Wb(),v.Wb()),2&e){const e=t.$implicit,a=v.nc(2).$implicit,i=v.nc(),o=v.Fc(9);v.Db(2),v.uc("settingsForm",i.settingsForm)("formDir",o)("setting",e.key)("limits",i.getDiskControlLimits(a,e.key))}}function Z(e,t){if(1&e&&(v.Vb(0),v.Pc(1,J,3,4,"div",32),v.oc(2,"keyvalue"),v.Ub()),2&e){const e=v.nc().$implicit,t=v.nc();v.Db(1),v.uc("ngForOf",v.pc(2,1,t.disk_default_controls[e]))}}function ee(e,t){if(1&e&&(v.Vb(0),v.Pc(1,Z,3,3,"ng-container",9),v.Ub()),2&e){const e=t.$implicit,a=v.nc();v.Db(1),v.uc("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 P.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)(v.Rb(c.a),v.Rb(S),v.Rb(l.b))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-iscsi-target-image-settings-modal"]],decls:25,vars:8,consts:function(){let e,t,a,i,o,s,n,c;return e="Configure",t="Changing these parameters from their default values is usually not necessary.",a="Settings",i="Backstore",o="Identifier",s="lun",n="wwn",c="This field is required.",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","settingsForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"alert-warning"],t,[4,"ngIf"],[1,"cd-header"],a,[1,"form-group","row"],[1,"col-sm-12"],[1,"col-form-label"],i,["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"],o,["for","lun",1,"col-form-label","required"],s,["type","number","id","lun","name","lun","formControlName","lun",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["for","wwn",1,"col-form-label"],n,["type","text","id","wwn","name","wwn","formControlName","wwn",1,"form-control"],[1,"invalid-feedback"],c,[3,"value"],["class","form-group row",4,"ngFor","ngForOf"],[3,"settingsForm","formDir","setting","limits"]]},template:function(e,t){1&e&&(v.Xb(0,"cd-modal",0),v.Vb(1,1),v.Vb(2),v.bc(3,2),v.Ub(),v.Rc(4,"\xa0 "),v.Xb(5,"small"),v.Rc(6),v.Wb(),v.Ub(),v.Vb(7,3),v.Xb(8,"form",4,5),v.Xb(10,"div",6),v.Xb(11,"p",7),v.bc(12,8),v.Wb(),v.Pc(13,K,14,1,"span",9),v.Xb(14,"legend",10),v.bc(15,11),v.Wb(),v.Xb(16,"div",12),v.Xb(17,"div",13),v.Xb(18,"label",14),v.bc(19,15),v.Wb(),v.Xb(20,"select",16),v.Pc(21,H,3,4,"option",17),v.Wb(),v.Wb(),v.Wb(),v.Pc(22,ee,2,1,"ng-container",18),v.Wb(),v.Xb(23,"div",19),v.Xb(24,"cd-form-button-panel",20),v.lc("submitActionEvent",function(){return t.save()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e&&(v.uc("modalRef",t.activeModal),v.Db(6),v.Sc(t.image),v.Db(2),v.uc("formGroup",t.settingsForm),v.Db(5),v.uc("ngIf",t.api_version>=1),v.Db(8),v.uc("ngForOf",t.backstores),v.Db(1),v.uc("ngForOf",t.backstores),v.Db(2),v.uc("form",t.settingsForm)("submitText",t.actionLabels.UPDATE))},directives:[E.a,o.B,o.r,o.k,z.a,i.r,N.a,C.a,o.z,V.a,o.q,o.i,i.q,A.a,o.v,o.d,o.u,o.C,j],pipes:[Q.a,i.k],styles:[""]}),e})();function ae(e,t){if(1&e&&(v.Xb(0,"div",12),v.Xb(1,"div",13),v.Sb(2,"cd-iscsi-setting",14),v.Wb(),v.Wb()),2&e){const e=t.$implicit,a=v.nc(),i=v.Fc(5);v.Db(2),v.uc("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 P.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)(v.Rb(c.a),v.Rb(S),v.Rb(l.b))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-iscsi-target-iqn-settings-modal"]],decls:13,vars:7,consts:function(){let e,t;return e="Advanced Settings",t="Changing these parameters from their default values is usually not necessary.",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","settingsForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"alert-warning"],t,["class","form-group row",4,"ngFor","ngForOf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"form-group","row"],[1,"col-sm-12"],[3,"settingsForm","formDir","setting","limits"]]},template:function(e,t){1&e&&(v.Xb(0,"cd-modal",0),v.Vb(1,1),v.bc(2,2),v.Ub(),v.Vb(3,3),v.Xb(4,"form",4,5),v.Xb(6,"div",6),v.Xb(7,"p",7),v.bc(8,8),v.Wb(),v.Pc(9,ae,3,4,"div",9),v.oc(10,"keyvalue"),v.Wb(),v.Xb(11,"div",10),v.Xb(12,"cd-form-button-panel",11),v.lc("submitActionEvent",function(){return t.save()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e&&(v.uc("modalRef",t.activeModal),v.Db(4),v.uc("formGroup",t.settingsForm),v.Db(5),v.uc("ngForOf",v.pc(10,5,t.settingsForm.controls)),v.Db(3),v.uc("form",t.settingsForm)("submitText",t.actionLabels.UPDATE))},directives:[E.a,o.B,o.r,o.k,z.a,i.q,A.a,N.a,j],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)(v.Rb(o.p))},e.\u0275dir=v.Mb({type:e,selectors:[["","cdTrim",""]],hostBindings:function(e,t){1&e&&v.lc("input",function(e){return t.onInput(e.target.value)})}}),e})();var ne=a("wnGv"),ce=a("D4zM"),re=a("cEzo"),le=a("8xTl");function be(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,42),v.Wb())}function de(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,43),v.Wb())}function ue(e,t){1&e&&(v.Xb(0,"span",41),v.Vb(1),v.bc(2,44),v.Ub(),v.Sb(3,"br"),v.Vb(4),v.bc(5,45),v.Ub(),v.Sb(6,"br"),v.Xb(7,"a",46),v.bc(8,47),v.Wb(),v.Wb())}function me(e,t){1&e&&(v.Xb(0,"span",48),v.bc(1,49),v.Wb())}const pe=function(e){return[e]};function fe(e,t){if(1&e){const e=v.Yb();v.Vb(0),v.Xb(1,"div",50),v.Sb(2,"input",51),v.Xb(3,"span",14),v.Xb(4,"button",52),v.lc("click",function(){v.Ic(e);const a=t.index,i=t.$implicit;return v.nc(2).removePortal(a,i)}),v.Sb(5,"i",16),v.Wb(),v.Wb(),v.Wb(),v.Ub()}if(2&e){const e=t.$implicit,a=v.nc(2);v.Db(2),v.uc("value",e),v.Db(3),v.uc("ngClass",v.zc(2,pe,a.icons.destroy))}}function he(e,t){if(1&e&&(v.Xb(0,"span",41),v.bc(1,53),v.Wb()),2&e){const e=v.nc(2);v.Db(1),v.fc(e.minimum_gateways),v.cc(1)}}function ge(e,t){if(1&e&&(v.Xb(0,"div",56),v.Rc(1),v.Wb()),2&e){const e=v.nc().$implicit,t=v.nc(2);v.Db(1),v.Tc("lun: ",t.imagesSettings[e].lun,"")}}function ve(e,t){if(1&e&&(v.Vb(0),v.bc(1,57),v.oc(2,"iscsiBackstore"),v.Ub()),2&e){const e=v.nc().$implicit,t=v.nc(2);v.Db(2),v.fc(v.pc(2,1,t.imagesSettings[e].backstore)),v.cc(1)}}function Se(e,t){1&e&&(v.Vb(0),v.bc(1,58),v.Ub())}function De(e,t){if(1&e){const e=v.Yb();v.Vb(0),v.Xb(1,"div",50),v.Sb(2,"input",51),v.Xb(3,"span",14),v.Pc(4,ge,2,1,"div",54),v.Xb(5,"button",52),v.lc("click",function(){v.Ic(e);const a=t.$implicit;return v.nc(2).imageSettingsModal(a)}),v.Sb(6,"i",16),v.Wb(),v.Xb(7,"button",52),v.lc("click",function(){v.Ic(e);const a=t.index,i=t.$implicit;return v.nc(2).removeImage(a,i)}),v.Sb(8,"i",16),v.Wb(),v.Wb(),v.Wb(),v.Xb(9,"span",48),v.Pc(10,ve,3,3,"ng-container",55),v.Pc(11,Se,2,0,"ng-container",55),v.Wb(),v.Ub()}if(2&e){const e=t.$implicit,a=v.nc(2);v.Db(2),v.uc("value",e),v.Db(2),v.uc("ngIf",a.api_version>=1),v.Db(2),v.uc("ngClass",v.zc(6,pe,a.icons.deepCheck)),v.Db(2),v.uc("ngClass",v.zc(8,pe,a.icons.destroy)),v.Db(2),v.uc("ngIf",a.backstores.length>1),v.Db(1),v.uc("ngIf",a.hasAdvancedSettings(a.imagesSettings[e][a.imagesSettings[e].backstore]))}}function we(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,59),v.Wb())}function _e(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,60),v.Wb())}function We(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,78),v.Wb())}function ye(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,79),v.Wb())}function Xe(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,80),v.Wb())}function Ie(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,81),v.Wb())}function ke(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,82),v.Wb())}function Pe(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,83),v.Wb())}function $e(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,84),v.Wb())}function Te(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,85),v.Wb())}function Fe(e,t){if(1&e&&(v.Xb(0,"div",61),v.Xb(1,"div",8),v.Xb(2,"label",62),v.Vb(3),v.bc(4,63),v.Ub(),v.Wb(),v.Xb(5,"div",11),v.Sb(6,"input",64),v.Pc(7,We,2,0,"span",17),v.Pc(8,ye,2,0,"span",17),v.Wb(),v.Wb(),v.Xb(9,"div",8),v.Xb(10,"label",65),v.Vb(11),v.bc(12,66),v.Ub(),v.Wb(),v.Xb(13,"div",11),v.Xb(14,"div",12),v.Sb(15,"input",67),v.Xb(16,"span",14),v.Sb(17,"button",68),v.Sb(18,"cd-copy-2-clipboard-button",69),v.Wb(),v.Wb(),v.Pc(19,Xe,2,0,"span",17),v.Pc(20,Ie,2,0,"span",17),v.Wb(),v.Wb(),v.Xb(21,"div",8),v.Xb(22,"label",70),v.Vb(23),v.bc(24,71),v.Ub(),v.Wb(),v.Xb(25,"div",11),v.Sb(26,"input",72),v.Pc(27,ke,2,0,"span",17),v.Pc(28,Pe,2,0,"span",17),v.Wb(),v.Wb(),v.Xb(29,"div",8),v.Xb(30,"label",73),v.Vb(31),v.bc(32,74),v.Ub(),v.Wb(),v.Xb(33,"div",11),v.Xb(34,"div",12),v.Sb(35,"input",75),v.Xb(36,"span",14),v.Sb(37,"button",76),v.Sb(38,"cd-copy-2-clipboard-button",77),v.Wb(),v.Wb(),v.Pc(39,$e,2,0,"span",17),v.Pc(40,Te,2,0,"span",17),v.Wb(),v.Wb(),v.Wb()),2&e){v.nc();const e=v.Fc(2),t=v.nc();v.Db(7),v.uc("ngIf",t.targetForm.showError("user",e,"required")),v.Db(1),v.uc("ngIf",t.targetForm.showError("user",e,"pattern")),v.Db(11),v.uc("ngIf",t.targetForm.showError("password",e,"required")),v.Db(1),v.uc("ngIf",t.targetForm.showError("password",e,"pattern")),v.Db(7),v.uc("ngIf",t.targetForm.showError("mutual_user",e,"required")),v.Db(1),v.uc("ngIf",t.targetForm.showError("mutual_user",e,"pattern")),v.Db(11),v.uc("ngIf",t.targetForm.showError("mutual_password",e,"required")),v.Db(1),v.uc("ngIf",t.targetForm.showError("mutual_password",e,"pattern"))}}function Re(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,115),v.Wb())}function Ee(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,116),v.Wb())}function ze(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,117),v.Wb())}function Ne(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,118),v.Wb())}function Ce(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,119),v.Wb())}function Ve(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,120),v.Wb())}function Ae(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,121),v.Wb())}function xe(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,122),v.Wb())}function Oe(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,123),v.Wb())}function Me(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,124),v.Wb())}function Be(e,t){1&e&&(v.Xb(0,"span",41),v.bc(1,125),v.Wb())}function qe(e,t){if(1&e){const e=v.Yb();v.Vb(0),v.Xb(1,"div",50),v.Sb(2,"input",51),v.Xb(3,"span",14),v.Xb(4,"button",52),v.lc("click",function(){v.Ic(e);const a=t.index,i=t.$implicit,o=v.nc(),s=o.$implicit,n=o.index;return v.nc(3).removeInitiatorImage(s,a,n,i)}),v.Sb(5,"i",16),v.Wb(),v.Wb(),v.Wb(),v.Ub()}if(2&e){const e=t.$implicit,a=v.nc(4);v.Db(2),v.uc("value",e),v.Db(3),v.uc("ngClass",v.zc(2,pe,a.icons.destroy))}}function Le(e,t){1&e&&(v.Xb(0,"span"),v.bc(1,126),v.Wb())}function Ge(e,t){if(1&e&&(v.Xb(0,"div",22),v.Xb(1,"div",23),v.Xb(2,"cd-select",127),v.Sb(3,"i",25),v.Vb(4),v.bc(5,128),v.Ub(),v.Wb(),v.Wb(),v.Wb()),2&e){const e=v.nc(),t=e.$implicit,a=e.index,i=v.nc(3);v.Db(2),v.uc("data",t.getValue("luns"))("options",i.imagesInitiatorSelections[a])("messages",i.messages.initiatorImage),v.Db(1),v.uc("ngClass",v.zc(4,pe,i.icons.add))}}function Ue(e,t){if(1&e){const e=v.Yb();v.Xb(0,"div",92),v.Xb(1,"div",5),v.Vb(2),v.bc(3,93),v.Ub(),v.Rc(4),v.Xb(5,"button",94),v.lc("click",function(){v.Ic(e);const a=t.index;return v.nc(3).removeInitiator(a)}),v.Sb(6,"i",25),v.Wb(),v.Wb(),v.Xb(7,"div",7),v.Xb(8,"div",8),v.Xb(9,"label",95),v.bc(10,96),v.Wb(),v.Xb(11,"div",11),v.Xb(12,"input",97),v.lc("blur",function(){return v.Ic(e),v.nc(3).updatedInitiatorSelector()}),v.Wb(),v.Pc(13,Re,2,0,"span",17),v.Pc(14,Ee,2,0,"span",17),v.Pc(15,ze,2,0,"span",17),v.Wb(),v.Wb(),v.Vb(16,61),v.Xb(17,"div",8),v.Xb(18,"label",98),v.bc(19,99),v.Wb(),v.Xb(20,"div",11),v.Sb(21,"input",100),v.Pc(22,Ne,2,0,"span",17),v.Pc(23,Ce,2,0,"span",17),v.Wb(),v.Wb(),v.Xb(24,"div",8),v.Xb(25,"label",101),v.bc(26,102),v.Wb(),v.Xb(27,"div",11),v.Xb(28,"div",12),v.Sb(29,"input",103),v.Xb(30,"span",14),v.Sb(31,"button",104),v.Sb(32,"cd-copy-2-clipboard-button",105),v.Wb(),v.Wb(),v.Pc(33,Ve,2,0,"span",17),v.Pc(34,Ae,2,0,"span",17),v.Wb(),v.Wb(),v.Xb(35,"div",8),v.Xb(36,"label",106),v.Vb(37),v.bc(38,107),v.Ub(),v.Wb(),v.Xb(39,"div",11),v.Sb(40,"input",108),v.Pc(41,xe,2,0,"span",17),v.Pc(42,Oe,2,0,"span",17),v.Wb(),v.Wb(),v.Xb(43,"div",8),v.Xb(44,"label",109),v.bc(45,110),v.Wb(),v.Xb(46,"div",11),v.Xb(47,"div",12),v.Sb(48,"input",111),v.Xb(49,"span",14),v.Sb(50,"button",104),v.Sb(51,"cd-copy-2-clipboard-button",105),v.Wb(),v.Wb(),v.Pc(52,Me,2,0,"span",17),v.Pc(53,Be,2,0,"span",17),v.Wb(),v.Wb(),v.Ub(),v.Xb(54,"div",8),v.Xb(55,"label",112),v.bc(56,113),v.Wb(),v.Xb(57,"div",11),v.Pc(58,qe,6,4,"ng-container",21),v.Pc(59,Le,2,0,"span",55),v.Pc(60,Ge,6,6,"div",114),v.Wb(),v.Wb(),v.Wb(),v.Wb()}if(2&e){const e=t.$implicit,a=t.index;v.nc(2);const i=v.Fc(2),o=v.nc();v.uc("formGroup",e),v.Db(4),v.Tc(": ",e.getValue("client_iqn")," "),v.Db(2),v.uc("ngClass",v.zc(25,pe,o.icons.destroy)),v.Db(7),v.uc("ngIf",e.showError("client_iqn",i,"notUnique")),v.Db(1),v.uc("ngIf",e.showError("client_iqn",i,"required")),v.Db(1),v.uc("ngIf",e.showError("client_iqn",i,"pattern")),v.Db(6),v.uc("id","user"+a),v.Db(1),v.uc("ngIf",e.showError("user",i,"required")),v.Db(1),v.uc("ngIf",e.showError("user",i,"pattern")),v.Db(6),v.uc("id","password"+a),v.Db(2),v.uc("cdPasswordButton","password"+a),v.Db(1),v.uc("source","password"+a),v.Db(1),v.uc("ngIf",e.showError("password",i,"required")),v.Db(1),v.uc("ngIf",e.showError("password",i,"pattern")),v.Db(6),v.uc("id","mutual_user"+a),v.Db(1),v.uc("ngIf",e.showError("mutual_user",i,"required")),v.Db(1),v.uc("ngIf",e.showError("mutual_user",i,"pattern")),v.Db(6),v.uc("id","mutual_password"+a),v.Db(2),v.uc("cdPasswordButton","mutual_password"+a),v.Db(1),v.uc("source","mutual_password"+a),v.Db(1),v.uc("ngIf",e.showError("mutual_password",i,"required")),v.Db(1),v.uc("ngIf",e.showError("mutual_password",i,"pattern")),v.Db(5),v.uc("ngForOf",e.getValue("luns")),v.Db(1),v.uc("ngIf",e.getValue("cdIsInGroup")),v.Db(1),v.uc("ngIf",!e.getValue("cdIsInGroup"))}}function je(e,t){1&e&&(v.Xb(0,"span",48),v.bc(1,129),v.Wb())}function Qe(e,t){if(1&e){const e=v.Yb();v.Xb(0,"div",8),v.Xb(1,"label",86),v.bc(2,87),v.Wb(),v.Xb(3,"div",88),v.Pc(4,Ue,61,27,"div",89),v.Xb(5,"div",22),v.Xb(6,"div",23),v.Pc(7,je,2,0,"span",18),v.Xb(8,"button",90),v.lc("click",function(){return v.Ic(e),v.nc(2).addInitiator(),!1}),v.Sb(9,"i",25),v.Vb(10),v.bc(11,91),v.Ub(),v.Wb(),v.Wb(),v.Wb(),v.Sb(12,"hr"),v.Wb(),v.Wb()}if(2&e){const e=v.nc(2);v.Db(4),v.uc("ngForOf",e.initiators.controls),v.Db(3),v.uc("ngIf",0===e.initiators.controls.length),v.Db(2),v.uc("ngClass",v.zc(3,pe,e.icons.add))}}function Ye(e,t){if(1&e){const e=v.Yb();v.Vb(0),v.Xb(1,"div",50),v.Sb(2,"input",51),v.Xb(3,"span",14),v.Xb(4,"button",52),v.lc("click",function(){v.Ic(e);const a=t.index,i=v.nc(),o=i.$implicit,s=i.index;return v.nc(3).removeGroupInitiator(o,a,s)}),v.Sb(5,"i",16),v.Wb(),v.Wb(),v.Wb(),v.Ub()}if(2&e){const e=t.$implicit,a=v.nc(4);v.Db(2),v.uc("value",e),v.Db(3),v.uc("ngClass",v.zc(2,pe,a.icons.destroy))}}function Ke(e,t){if(1&e){const e=v.Yb();v.Vb(0),v.Xb(1,"div",50),v.Sb(2,"input",51),v.Xb(3,"span",14),v.Xb(4,"button",52),v.lc("click",function(){v.Ic(e);const a=t.index,i=v.nc(),o=i.$implicit,s=i.index;return v.nc(3).removeGroupDisk(o,a,s)}),v.Sb(5,"i",16),v.Wb(),v.Wb(),v.Wb(),v.Ub()}if(2&e){const e=t.$implicit,a=v.nc(4);v.Db(2),v.uc("value",e),v.Db(3),v.uc("ngClass",v.zc(2,pe,a.icons.destroy))}}function He(e,t){if(1&e){const e=v.Yb();v.Xb(0,"div",92),v.Xb(1,"div",5),v.Vb(2),v.bc(3,133),v.Ub(),v.Rc(4),v.Xb(5,"button",94),v.lc("click",function(){v.Ic(e);const a=t.index;return v.nc(3).removeGroup(a)}),v.Sb(6,"i",25),v.Wb(),v.Wb(),v.Xb(7,"div",7),v.Xb(8,"div",8),v.Xb(9,"label",134),v.bc(10,135),v.Wb(),v.Xb(11,"div",11),v.Sb(12,"input",136),v.Wb(),v.Wb(),v.Xb(13,"div",8),v.Xb(14,"label",137),v.Vb(15),v.bc(16,138),v.Ub(),v.Wb(),v.Xb(17,"div",11),v.Pc(18,Ye,6,4,"ng-container",21),v.Xb(19,"div",22),v.Xb(20,"div",23),v.Xb(21,"cd-select",24),v.lc("selection",function(a){v.Ic(e);const i=t.index;return v.nc(3).onGroupMemberSelection(a,i)}),v.Sb(22,"i",25),v.Vb(23),v.bc(24,139),v.Ub(),v.Wb(),v.Wb(),v.Wb(),v.Sb(25,"hr"),v.Wb(),v.Wb(),v.Xb(26,"div",8),v.Xb(27,"label",28),v.Vb(28),v.bc(29,140),v.Ub(),v.Wb(),v.Xb(30,"div",11),v.Pc(31,Ke,6,4,"ng-container",21),v.Xb(32,"div",22),v.Xb(33,"div",23),v.Xb(34,"cd-select",127),v.Sb(35,"i",25),v.Vb(36),v.bc(37,141),v.Ub(),v.Wb(),v.Wb(),v.Wb(),v.Sb(38,"hr"),v.Wb(),v.Wb(),v.Wb(),v.Wb()}if(2&e){const e=t.$implicit,a=t.index,i=v.nc(3);v.uc("formGroup",e),v.Db(4),v.Tc(": ",e.getValue("group_id")," "),v.Db(2),v.uc("ngClass",v.zc(13,pe,i.icons.destroy)),v.Db(12),v.uc("ngForOf",e.getValue("members")),v.Db(3),v.uc("data",e.getValue("members"))("options",i.groupMembersSelections[a])("messages",i.messages.groupInitiator),v.Db(1),v.uc("ngClass",v.zc(15,pe,i.icons.add)),v.Db(9),v.uc("ngForOf",e.getValue("disks")),v.Db(3),v.uc("data",e.getValue("disks"))("options",i.groupDiskSelections[a])("messages",i.messages.initiatorImage),v.Db(1),v.uc("ngClass",v.zc(17,pe,i.icons.add))}}function Je(e,t){1&e&&(v.Xb(0,"span",48),v.bc(1,142),v.Wb())}function Ze(e,t){if(1&e){const e=v.Yb();v.Xb(0,"div",8),v.Xb(1,"label",86),v.bc(2,130),v.Wb(),v.Xb(3,"div",131),v.Pc(4,He,39,19,"div",89),v.Xb(5,"div",22),v.Xb(6,"div",23),v.Pc(7,Je,2,0,"span",18),v.Xb(8,"button",90),v.lc("click",function(){return v.Ic(e),v.nc(2).addGroup(),!1}),v.Sb(9,"i",25),v.Vb(10),v.bc(11,132),v.Ub(),v.Wb(),v.Wb(),v.Wb(),v.Wb(),v.Wb()}if(2&e){const e=v.nc(2);v.Db(4),v.uc("ngForOf",e.groups.controls),v.Db(3),v.uc("ngIf",0===e.groups.controls.length),v.Db(2),v.uc("ngClass",v.zc(3,pe,e.icons.add))}}function et(e,t){if(1&e){const e=v.Yb();v.Xb(0,"div",1),v.Xb(1,"form",2,3),v.Xb(3,"div",4),v.Xb(4,"div",5),v.bc(5,6),v.oc(6,"titlecase"),v.oc(7,"upperFirst"),v.Wb(),v.Xb(8,"div",7),v.Xb(9,"div",8),v.Xb(10,"label",9),v.bc(11,10),v.Wb(),v.Xb(12,"div",11),v.Xb(13,"div",12),v.Sb(14,"input",13),v.Xb(15,"span",14),v.Xb(16,"button",15),v.lc("click",function(){return v.Ic(e),v.nc().targetSettingsModal()}),v.Sb(17,"i",16),v.Wb(),v.Wb(),v.Wb(),v.Pc(18,be,2,0,"span",17),v.Pc(19,de,2,0,"span",17),v.Pc(20,ue,9,0,"span",17),v.Pc(21,me,2,0,"span",18),v.Sb(22,"hr"),v.Wb(),v.Wb(),v.Xb(23,"div",8),v.Xb(24,"label",19),v.bc(25,20),v.Wb(),v.Xb(26,"div",11),v.Pc(27,fe,6,4,"ng-container",21),v.Xb(28,"div",22),v.Xb(29,"div",23),v.Xb(30,"cd-select",24),v.lc("selection",function(t){return v.Ic(e),v.nc().onPortalSelection(t)}),v.Sb(31,"i",25),v.Vb(32),v.bc(33,26),v.Ub(),v.Wb(),v.Wb(),v.Wb(),v.Sb(34,"input",27),v.Pc(35,he,2,1,"span",17),v.Sb(36,"hr"),v.Wb(),v.Wb(),v.Xb(37,"div",8),v.Xb(38,"label",28),v.bc(39,29),v.Wb(),v.Xb(40,"div",11),v.Pc(41,De,12,10,"ng-container",21),v.Sb(42,"input",30),v.Pc(43,we,2,0,"span",17),v.Pc(44,_e,2,0,"span",17),v.Xb(45,"div",22),v.Xb(46,"div",23),v.Xb(47,"cd-select",24),v.lc("selection",function(t){return v.Ic(e),v.nc().onImageSelection(t)}),v.Sb(48,"i",25),v.Vb(49),v.bc(50,31),v.Ub(),v.Wb(),v.Wb(),v.Wb(),v.Sb(51,"hr"),v.Wb(),v.Wb(),v.Xb(52,"div",8),v.Xb(53,"div",32),v.Xb(54,"div",33),v.Sb(55,"input",34),v.Xb(56,"label",35),v.bc(57,36),v.Wb(),v.Wb(),v.Sb(58,"hr"),v.Wb(),v.Wb(),v.Pc(59,Fe,41,8,"div",37),v.Pc(60,Qe,13,5,"div",38),v.Pc(61,Ze,12,5,"div",38),v.Wb(),v.Xb(62,"div",39),v.Xb(63,"cd-form-button-panel",40),v.lc("submitActionEvent",function(){return v.Ic(e),v.nc().submit()}),v.oc(64,"titlecase"),v.oc(65,"upperFirst"),v.Wb(),v.Wb(),v.Wb(),v.Wb(),v.Wb()}if(2&e){const e=v.Fc(2),t=v.nc();v.Db(1),v.uc("formGroup",t.targetForm),v.Db(6),v.fc(v.pc(6,26,t.action))(v.pc(7,28,t.resource)),v.cc(5),v.Db(10),v.uc("ngClass",v.zc(34,pe,t.icons.deepCheck)),v.Db(1),v.uc("ngIf",t.targetForm.showError("target_iqn",e,"required")),v.Db(1),v.uc("ngIf",t.targetForm.showError("target_iqn",e,"pattern")),v.Db(1),v.uc("ngIf",t.targetForm.showError("target_iqn",e,"iqn")),v.Db(1),v.uc("ngIf",t.hasAdvancedSettings(t.targetForm.getValue("target_controls"))),v.Db(6),v.uc("ngForOf",t.portals.value),v.Db(3),v.uc("data",t.portals.value)("options",t.portalsSelections)("messages",t.messages.portals),v.Db(1),v.uc("ngClass",v.zc(36,pe,t.icons.add)),v.Db(4),v.uc("ngIf",t.targetForm.showError("portals",e,"minGateways")),v.Db(6),v.uc("ngForOf",t.targetForm.getValue("disks")),v.Db(2),v.uc("ngIf",t.targetForm.showError("disks",e,"dupLunId")),v.Db(1),v.uc("ngIf",t.targetForm.showError("disks",e,"dupWwn")),v.Db(3),v.uc("data",t.disks.value)("options",t.imagesSelections)("messages",t.messages.images),v.Db(1),v.uc("ngClass",v.zc(38,pe,t.icons.add)),v.Db(11),v.uc("ngIf",t.cephIscsiConfigVersion>10&&!t.targetForm.getValue("acl_enabled")),v.Db(1),v.uc("ngIf",t.targetForm.getValue("acl_enabled")),v.Db(1),v.uc("ngIf",t.targetForm.getValue("acl_enabled")),v.Db(2),v.uc("form",t.targetForm)("submitText",v.pc(64,30,t.action)+" "+v.pc(65,32,t.resource))}}let tt=(()=>{class e extends k.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=I.a,this.isEdit=!1,this.portalsSelections=[],this.imagesInitiatorSelections=[],this.groupDiskSelections=[],this.groupMembersSelections=[],this.imagesSettings={},this.messages={portals:new y.a({noOptions:"There are no portals available."}),images:new y.a({noOptions:"There are no images available."}),initiatorImage:new y.a({noOptions:"There are no images available. Please make sure you add an image to the target."}),groupInitiator:new y.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(p.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 X.a(!1,`${e.pool_name}/${e.name}`,""));const a=[];e[2].forEach(e=>{e.ip_addresses.forEach(t=>{a.push(new X.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 P.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:[$.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:[$.a.custom("dupLunId",e=>{const t=this.getLunIds(e);return t.length!==m.a.uniq(t).length}),$.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 P.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 X.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 X.a(!1,t.name,"")),this.imagesInitiatorSelections[a]=[...e]}),m.a.forEach(this.groupDiskSelections,(e,a)=>{e.push(new X.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 P.a({client_iqn:new o.h("",{validators:[o.A.required,$.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 P.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 X.a(!1,"","")),this.groupMembersSelections[t]=[...e]});const t=m.a.map(this.targetForm.getValue("disks"),e=>new X.a(!1,e,""));return this.imagesInitiatorSelections.push(t),e}setAuthValidator(e){$.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")]),$.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")]),$.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")]),$.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 P.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 X.a(!1,e,""));this.groupDiskSelections.push(t);const a=m.a.map(this.initiators.value,e=>new X.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 X.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 T.a("iscsi/target/edit",{target_iqn:t.target_iqn}),call:this.iscsiService.updateTarget(this.target_iqn,t)})):a=this.taskWrapper.wrapTaskAroundCall({task:new T.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)(v.Rb(S),v.Rb(F.a),v.Rb(W),v.Rb(s.e),v.Rb(s.a),v.Rb(R.a),v.Rb(l.b))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-iscsi-target-form"]],features:[v.Ab],decls:1,vars:1,consts:function(){let e,t,a,i,o,s,n,c,r,l,b,d,u,m,p,f,h,g,v,S,D,w,_,W,y,X,I,k,P,$,T,F,R,E,z,N,C,V,A,x,O,M,B,q,L,G,U,j,Q,Y,K,H,J,Z,ee,te,ae,ie,oe,se,ne,ce;return e="" + "\ufffd0\ufffd" + " " + "\ufffd1\ufffd" + "",t="Target IQN",a="Portals",i="Add portal",o="Images",s="Add image",n="ACL authentication",c="This field is required.",r="IQN has wrong pattern.",l="An IQN has the following notation 'iqn.$year-$month.$reversedAddress:$definedName'",b="For example: iqn.2016-06.org.dashboard:storage:disk.sn-a8675309",d="More information",u="This target has modified advanced settings.",m="At least " + "\ufffd0\ufffd" + " gateways are required.",p="Backstore: " + "\ufffd0\ufffd" + ".\xA0",f="This image has modified settings.",h="Duplicated LUN numbers.",g="Duplicated WWN.",v="User",S="Password",D="Mutual User",w="Mutual Password",_="This field is required.",W="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",y="This field is required.",X="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",I="This field is required.",k="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",P="This field is required.",$="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",T="Initiators",F="Add initiator",R="Initiator",E="Client IQN",z="User",N="Password",C="Mutual User",V="Mutual Password",A="Images",x="Initiator IQN needs to be unique.",O="This field is required.",M="IQN has wrong pattern.",B="This field is required.",q="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",L="This field is required.",G="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",U="This field is required.",j="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",Q="This field is required.",Y="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",K="Initiator belongs to a group. Images will be configure in the group.",H="Add image",J="No items added.",Z="Groups",ee="Add group",te="Group",ae="Name",ie="Initiators",oe="Add initiator",se="Images",ne="Add image",ce="No items added.",[["class","cd-col-form",4,"cdFormLoading"],[1,"cd-col-form"],["name","targetForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"card"],[1,"card-header"],e,[1,"card-body"],[1,"form-group","row"],["for","target_iqn",1,"cd-col-form-label","required"],t,[1,"cd-col-form-input"],[1,"input-group"],["type","text","id","target_iqn","name","target_iqn","formControlName","target_iqn","cdTrim","",1,"form-control"],[1,"input-group-append"],["id","ecp-info-button","type","button",1,"btn","btn-light",3,"click"],["aria-hidden","true",3,"ngClass"],["class","invalid-feedback",4,"ngIf"],["class","form-text text-muted",4,"ngIf"],["for","portals",1,"cd-col-form-label","required"],a,[4,"ngFor","ngForOf"],[1,"row"],[1,"col-md-12"],["elemClass","btn btn-light float-right",3,"data","options","messages","selection"],[3,"ngClass"],i,["type","hidden","id","portals","name","portals","formControlName","portals",1,"form-control"],["for","disks",1,"cd-col-form-label"],o,["type","hidden","id","disks","name","disks","formControlName","disks",1,"form-control"],s,[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"],n,["formGroupName","auth",4,"ngIf"],["class","form-group row",4,"ngIf"],[1,"card-footer"],["wrappingClass","text-right",3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],c,r,l,b,["target","_blank","href","https://en.wikipedia.org/wiki/ISCSI#Addressing"],d,[1,"form-text","text-muted"],u,[1,"input-group","cd-mb"],["type","text","disabled","",1,"cd-form-control",3,"value"],["type","button",1,"btn","btn-light",3,"click"],m,["class","input-group-text",4,"ngIf"],[4,"ngIf"],[1,"input-group-text"],p,f,h,g,["formGroupName","auth"],["for","target_user",1,"cd-col-form-label"],v,["type","text","autocomplete","off","id","target_user","name","target_user","formControlName","user",1,"form-control"],["for","target_password",1,"cd-col-form-label"],S,["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"],D,["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"],w,["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"],_,W,y,X,I,k,P,$,["for","initiators",1,"cd-col-form-label"],T,["formArrayName","initiators",1,"cd-col-form-input"],["class","card mb-2",3,"formGroup",4,"ngFor","ngForOf"],[1,"btn","btn-light","float-right",3,"click"],F,[1,"card","mb-2",3,"formGroup"],R,["type","button",1,"close",3,"click"],["for","client_iqn",1,"cd-col-form-label","required"],E,["type","text","formControlName","client_iqn","cdTrim","",1,"form-control",3,"blur"],["for","user",1,"cd-col-form-label"],z,["formControlName","user","autocomplete","off","type","text",1,"form-control",3,"id"],["for","password",1,"cd-col-form-label"],N,["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"],C,["formControlName","mutual_user","autocomplete","off","type","text",1,"form-control",3,"id"],["for","mutual_password",1,"cd-col-form-label"],V,["formControlName","mutual_password","autocomplete","new-password","type","password",1,"form-control",3,"id"],["for","luns",1,"cd-col-form-label"],A,["class","row",4,"ngIf"],x,O,M,B,q,L,G,U,j,Q,Y,K,["elemClass","btn btn-light float-right",3,"data","options","messages"],H,J,Z,["formArrayName","groups",1,"cd-col-form-input"],ee,te,["for","group_id",1,"cd-col-form-label","required"],ae,["type","text","formControlName","group_id",1,"form-control"],["for","members",1,"cd-col-form-label"],ie,oe,se,ne,ce]},template:function(e,t){1&e&&v.Pc(0,et,66,40,"div",0),2&e&&v.uc("cdFormLoading",t.loading)},directives:[oe.a,o.B,o.r,o.k,z.a,N.a,C.a,o.d,V.a,o.q,o.i,se,i.p,i.r,i.q,ne.a,o.b,A.a,o.l,ce.a,re.a,o.f],pipes:[i.A,le.a,Q.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"),ct=a("FFMq"),rt=a("G1/K"),lt=a("aexS"),bt=a("VTlA"),dt=a("mtw6"),ut=a("9nlD");function mt(e,t){1&e&&(v.Xb(0,"span",30),v.bc(1,31),v.Wb())}function pt(e,t){1&e&&(v.Xb(0,"span",30),v.bc(1,32),v.Wb())}function ft(e,t){1&e&&(v.Xb(0,"span",30),v.bc(1,33),v.Wb())}function ht(e,t){1&e&&(v.Xb(0,"span",30),v.bc(1,34),v.Wb())}function gt(e,t){1&e&&(v.Xb(0,"span",30),v.bc(1,35),v.Wb())}function vt(e,t){1&e&&(v.Xb(0,"span",30),v.bc(1,36),v.Wb())}function St(e,t){1&e&&(v.Xb(0,"span",30),v.bc(1,37),v.Wb())}function Dt(e,t){1&e&&(v.Xb(0,"span",30),v.bc(1,38),v.Wb())}let wt=(()=>{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 P.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})}),$.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")]),$.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")]),$.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")]),$.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)(v.Rb(lt.a),v.Rb(c.a),v.Rb(l.b),v.Rb(S),v.Rb(ut.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-iscsi-target-discovery-modal"]],decls:46,vars:13,consts:function(){let e,t,a,i,o,s,n,c,r,l,b,d,u;return e="Discovery Authentication",t="User",a="Password",i="Mutual User",o="Mutual Password",s="This field is required.",n="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",c="This field is required.",r="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",l="This field is required.",b="User names must have a length of 8 to 64 characters and can contain alphanumeric characters, '.', '@', '-', '_' or ':'.",d="This field is required.",u="Passwords must have a length of 12 to 16 characters and can contain alphanumeric characters, '@', '-', '_' or '/'.",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","discoveryForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"form-group","row"],["for","user",1,"cd-col-form-label"],t,[1,"cd-col-form-input"],["id","user","formControlName","user","type","text","autocomplete","off",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["for","password",1,"cd-col-form-label"],a,[1,"input-group"],["id","password","formControlName","password","type","password","autocomplete","new-password",1,"form-control"],[1,"input-group-append"],["type","button","cdPasswordButton","password",1,"btn","btn-light"],["source","password"],["for","mutual_user",1,"cd-col-form-label"],i,["id","mutual_user","formControlName","mutual_user","type","text","autocomplete","off",1,"form-control"],["for","mutual_password",1,"cd-col-form-label"],o,["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"],s,n,c,r,l,b,d,u]},template:function(e,t){if(1&e&&(v.Xb(0,"cd-modal",0),v.Vb(1,1),v.bc(2,2),v.Ub(),v.Vb(3,3),v.Xb(4,"form",4,5),v.Xb(6,"div",6),v.Xb(7,"div",7),v.Xb(8,"label",8),v.bc(9,9),v.Wb(),v.Xb(10,"div",10),v.Sb(11,"input",11),v.Pc(12,mt,2,0,"span",12),v.Pc(13,pt,2,0,"span",12),v.Wb(),v.Wb(),v.Xb(14,"div",7),v.Xb(15,"label",13),v.bc(16,14),v.Wb(),v.Xb(17,"div",10),v.Xb(18,"div",15),v.Sb(19,"input",16),v.Xb(20,"span",17),v.Sb(21,"button",18),v.Sb(22,"cd-copy-2-clipboard-button",19),v.Wb(),v.Wb(),v.Pc(23,ft,2,0,"span",12),v.Pc(24,ht,2,0,"span",12),v.Wb(),v.Wb(),v.Xb(25,"div",7),v.Xb(26,"label",20),v.Vb(27),v.bc(28,21),v.Ub(),v.Wb(),v.Xb(29,"div",10),v.Sb(30,"input",22),v.Pc(31,gt,2,0,"span",12),v.Pc(32,vt,2,0,"span",12),v.Wb(),v.Wb(),v.Xb(33,"div",7),v.Xb(34,"label",23),v.bc(35,24),v.Wb(),v.Xb(36,"div",10),v.Xb(37,"div",15),v.Sb(38,"input",25),v.Xb(39,"span",17),v.Sb(40,"button",26),v.Sb(41,"cd-copy-2-clipboard-button",27),v.Wb(),v.Wb(),v.Pc(42,St,2,0,"span",12),v.Pc(43,Dt,2,0,"span",12),v.Wb(),v.Wb(),v.Wb(),v.Xb(44,"div",28),v.Xb(45,"cd-form-button-panel",29),v.lc("submitActionEvent",function(){return t.submitAction()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e){const e=v.Fc(5);v.uc("modalRef",t.activeModal),v.Db(4),v.uc("formGroup",t.discoveryForm),v.Db(8),v.uc("ngIf",t.discoveryForm.showError("user",e,"required")),v.Db(1),v.uc("ngIf",t.discoveryForm.showError("user",e,"pattern")),v.Db(10),v.uc("ngIf",t.discoveryForm.showError("password",e,"required")),v.Db(1),v.uc("ngIf",t.discoveryForm.showError("password",e,"pattern")),v.Db(7),v.uc("ngIf",t.discoveryForm.showError("mutual_user",e,"required")),v.Db(1),v.uc("ngIf",t.discoveryForm.showError("mutual_user",e,"pattern")),v.Db(10),v.uc("ngIf",t.discoveryForm.showError("mutual_password",e,"required")),v.Db(1),v.uc("ngIf",t.discoveryForm.showError("mutual_password",e,"pattern")),v.Db(2),v.uc("form",t.discoveryForm)("showSubmit",t.hasPermission)("submitText",t.actionLabels.SUBMIT)}},directives:[E.a,o.B,o.r,o.k,z.a,N.a,C.a,o.d,V.a,o.q,o.i,i.r,ce.a,re.a,A.a],styles:[""]}),e})(),_t=(()=>{class e{constructor(e){this.router=e}}return e.\u0275fac=function(t){return new(t||e)(v.Rb(s.e))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-iscsi-tabs"]],decls:8,vars:1,consts:function(){let e,t;return e="Overview",t="Targets",[["ngbNav","",1,"nav-tabs",3,"activeId","navChange"],["nav","ngbNav"],["ngbNavItem","/block/iscsi/overview"],["ngbNavLink",""],e,["ngbNavItem","/block/iscsi/targets"],t]},template:function(e,t){1&e&&(v.Xb(0,"ul",0,1),v.lc("navChange",function(e){return t.router.navigate([e.nextId])}),v.Xb(2,"li",2),v.Xb(3,"a",3),v.bc(4,4),v.Wb(),v.Wb(),v.Xb(5,"li",5),v.Xb(6,"a",3),v.bc(7,6),v.Wb(),v.Wb(),v.Wb()),2&e&&v.uc("activeId",t.router.url)},directives:[c.p,c.r,c.s],styles:[""]}),e})();var Wt=a("/NlG"),yt=a("6qls"),Xt=a("S7zO"),It=a("iExv");const kt=["highlightTpl"],Pt=["detailTable"],$t=["tree"],Tt=function(){return["logged_in"]},Ft=function(){return["logged_out"]},Rt=function(e,t){return{"badge-success":e,"badge-danger":t}};function Et(e,t){if(1&e&&(v.Sb(0,"i"),v.Xb(1,"span"),v.Rc(2),v.Wb(),v.Rc(3," \xa0 "),v.Xb(4,"span",8),v.Rc(5),v.Wb()),2&e){const e=t.$implicit;v.Fb(e.data.cdIcon),v.Db(2),v.Sc(e.data.name),v.Db(2),v.uc("ngClass",v.Ac(7,Rt,v.yc(5,Tt).includes(e.data.status),v.yc(6,Ft).includes(e.data.status))),v.Db(1),v.Tc(" ",e.data.status," ")}}function zt(e,t){if(1&e&&(v.Xb(0,"div",9),v.Xb(1,"legend"),v.Rc(2),v.Wb(),v.Sb(3,"cd-table",10,11),v.Wb()),2&e){const e=v.nc();v.Db(2),v.Sc(e.title),v.Db(1),v.uc("data",e.data)("columns",e.columns)("limit",0)}}function Nt(e,t){if(1&e&&(v.Xb(0,"span"),v.Rc(1),v.Wb()),2&e){const e=v.nc().value;v.Db(1),v.Sc(e)}}function Ct(e,t){if(1&e&&(v.Xb(0,"strong"),v.Rc(1),v.Wb()),2&e){const e=v.nc().value;v.Db(1),v.Sc(e)}}function Vt(e,t){if(1&e&&(v.Pc(0,Nt,2,1,"span",12),v.Pc(1,Ct,2,1,"strong",12)),2&e){const e=t.row;v.uc("ngIf",void 0===e.default||e.default===e.current),v.Db(1),v.uc("ngIf",void 0!==e.default&&e.default!==e.current)}}let At=(()=>{class e{constructor(e,t){this.iscsiBackstorePipe=e,this.booleanTextPipe=t,this.icons=I.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?[I.a.large,I.a.spinner,I.a.spin]:[I.a.large,I.a.bullseye]," ")},initiators:{expanded:m.a.join([I.a.large,I.a.user]," "),leaf:m.a.join([I.a.user]," ")},groups:{expanded:m.a.join([I.a.large,I.a.users]," "),leaf:m.a.join([I.a.users]," ")},disks:{expanded:m.a.join([I.a.large,I.a.disk]," "),leaf:m.a.join([I.a.disk]," ")},portals:{expanded:m.a.join([I.a.large,I.a.server]," "),leaf:m.a.join([I.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)(v.Rb(Q.a),v.Rb(It.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-iscsi-target-details"]],viewQuery:function(e,t){if(1&e&&(v.Wc(kt,3),v.Wc(Pt,1),v.Wc($t,1)),2&e){let e;v.Ec(e=v.mc())&&(t.highlightTpl=e.first),v.Ec(e=v.mc())&&(t.content=e.first),v.Ec(e=v.mc())&&(t.tree=e.first)}},inputs:{selection:"selection",settings:"settings",cephIscsiConfigVersion:"cephIscsiConfigVersion"},features:[v.Bb],decls:11,vars:3,consts:function(){let e;return e="iSCSI Topology",[[1,"row"],[1,"col-6"],e,[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&&(v.Xb(0,"div",0),v.Xb(1,"div",1),v.Xb(2,"legend"),v.bc(3,2),v.Wb(),v.Xb(4,"tree-root",3,4),v.lc("updateData",function(){return t.onUpdateData()}),v.Pc(6,Et,6,10,"ng-template",null,5,v.Qc),v.Wb(),v.Wb(),v.Pc(8,zt,5,4,"div",6),v.Wb(),v.Pc(9,Vt,2,2,"ng-template",null,7,v.Qc)),2&e&&(v.Db(4),v.uc("nodes",t.nodes)("options",t.treeOptions),v.Db(4),v.uc("ngIf",t.data))},directives:[n.b,i.r,i.p,ot.a],styles:[""]}),e})();function xt(e,t){if(1&e&&(v.Vb(0),v.Sb(1,"br"),v.Xb(2,"span"),v.bc(3,6),v.Wb(),v.Xb(4,"pre"),v.Rc(5),v.Wb(),v.Ub()),2&e){const e=v.nc(2);v.Db(5),v.Sc(e.status)}}function Ot(e,t){if(1&e&&(v.Xb(0,"cd-alert-panel",2),v.Vb(1),v.hc(2,3),v.Sb(3,"cd-doc",4),v.ec(),v.Ub(),v.Pc(4,xt,6,1,"ng-container",5),v.Wb()),2&e){const e=v.nc();v.Db(4),v.uc("ngIf",e.status)}}function Mt(e,t){if(1&e&&v.Sb(0,"cd-iscsi-target-details",15),2&e){const e=v.nc(2);v.uc("cephIscsiConfigVersion",e.cephIscsiConfigVersion)("selection",e.expandedRow)("settings",e.settings)}}const Bt=function(e){return[e]};function qt(e,t){if(1&e){const e=v.Yb();v.Xb(0,"cd-table",7,8),v.lc("fetchData",function(){return v.Ic(e),v.nc().getTargets()})("setExpandedRow",function(t){return v.Ic(e),v.nc().setExpandedRow(t)})("updateSelection",function(t){return v.Ic(e),v.nc().updateSelection(t)}),v.Xb(2,"div",9),v.Sb(3,"cd-table-actions",10),v.Xb(4,"button",11),v.lc("click",function(){return v.Ic(e),v.nc().configureDiscoveryAuth()}),v.Sb(5,"i",12),v.Vb(6),v.bc(7,13),v.Ub(),v.Wb(),v.Wb(),v.Pc(8,Mt,1,3,"cd-iscsi-target-details",14),v.Wb()}if(2&e){const e=v.nc();v.uc("data",e.targets)("columns",e.columns)("hasDetails",!0)("autoReload",!1)("status",e.tableStatus),v.Db(3),v.uc("permission",e.permission)("selection",e.selection)("tableActions",e.tableActions),v.Db(2),v.uc("ngClass",v.zc(10,Bt,e.icons.key)),v.Db(3),v.uc("ngIf",e.expandedRow)}}let Lt=(()=>{class e extends at.a{constructor(e,t,a,i,o,s,n,c,r){super(r),this.authStorageService=e,this.iscsiService=t,this.joinPipe=a,this.taskListService=i,this.notAvailablePipe=o,this.modalService=s,this.taskWrapper=n,this.actionLabels=c,this.ngZone=r,this.available=void 0,this.selection=new nt.a,this.targets=[],this.icons=I.a,this.builders={"iscsi/target/create":e=>({target_iqn:e.target_iqn})},this.permission=this.authStorageService.getPermissions().iscsi,this.tableActions=[{permission:"create",icon:I.a.add,routerLink:()=>"/block/iscsi/targets/create",name:this.actionLabels.CREATE},{permission:"update",icon:I.a.edit,routerLink:()=>`/block/iscsi/targets/edit/${this.selection.first().target_iqn}`,name:this.actionLabels.EDIT,disable:()=>this.getEditDisableDesc()},{permission:"delete",icon:I.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.status=e.message)})}getTargets(){this.available&&(this.setTableRefreshTimeout(),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}))}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 T.a("iscsi/target/delete",{target_iqn:e}),call:this.iscsiService.deleteTarget(e)})})}configureDiscoveryAuth(){this.modalService.show(wt)}}return e.\u0275fac=function(t){return new(t||e)(v.Rb(lt.a),v.Rb(S),v.Rb(ct.a),v.Rb(bt.a),v.Rb(rt.a),v.Rb(F.a),v.Rb(R.a),v.Rb(l.b),v.Rb(v.D))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-iscsi-target-list"]],viewQuery:function(e,t){if(1&e&&v.Wc(ot.a,1),2&e){let e;v.Ec(e=v.mc())&&(t.table=e.first)}},features:[v.Cb([bt.a]),v.Ab],decls:3,vars:2,consts:function(){let e,t,a,i;return e="iSCSI Targets not available",t="Please consult the " + "\ufffd#3\ufffd" + "" + "\ufffd/#3\ufffd" + " on how to configure and enable the iSCSI Targets management functionality.",a="Available information:",i="Discovery authentication",[["type","info","title",e,4,"ngIf"],["columnMode","flex","identifier","target_iqn","forceIdentifier","true","selectionType","single",3,"data","columns","hasDetails","autoReload","status","fetchData","setExpandedRow","updateSelection",4,"ngIf"],["type","info","title",e],t,["section","iscsi"],[4,"ngIf"],a,["columnMode","flex","identifier","target_iqn","forceIdentifier","true","selectionType","single",3,"data","columns","hasDetails","autoReload","status","fetchData","setExpandedRow","updateSelection"],["table",""],[1,"table-actions","btn-toolbar"],[1,"btn-group",3,"permission","selection","tableActions"],["type","button",1,"btn","btn-light",3,"click"],["aria-hidden","true",3,"ngClass"],i,["cdTableDetail","",3,"cephIscsiConfigVersion","selection","settings",4,"ngIf"],["cdTableDetail","",3,"cephIscsiConfigVersion","selection","settings"]]},template:function(e,t){1&e&&(v.Sb(0,"cd-iscsi-tabs"),v.Pc(1,Ot,5,1,"cd-alert-panel",0),v.Pc(2,qt,9,12,"cd-table",1)),2&e&&(v.Db(1),v.uc("ngIf",!1===t.available),v.Db(1),v.uc("ngIf",!0===t.available))},directives:[_t,i.r,Wt.a,yt.a,ot.a,Xt.a,C.a,i.p,At],styles:[""]}),e})();var Gt=a("o4+5"),Ut=a("dgut"),jt=a("Dwqy");const Qt=["iscsiSparklineTpl"],Yt=["iscsiPerSecondTpl"],Kt=["iscsiRelativeDateTpl"];function Ht(e,t){if(1&e&&(v.Xb(0,"span"),v.Sb(1,"cd-sparkline",9),v.Wb()),2&e){const e=v.nc(),t=e.value,a=e.row;v.Db(1),v.uc("data",t)("isBinary",a.cdIsBinary)}}function Jt(e,t){1&e&&(v.Xb(0,"span",10),v.Rc(1," n/a "),v.Wb())}function Zt(e,t){if(1&e&&(v.Pc(0,Ht,2,2,"span",7),v.Pc(1,Jt,2,0,"span",8)),2&e){const e=t.row;v.uc("ngIf","user:rbd"===e.backstore),v.Db(1),v.uc("ngIf","user:rbd"!==e.backstore)}}function ea(e,t){if(1&e&&(v.Xb(0,"span"),v.Rc(1),v.Wb()),2&e){const e=v.nc().value;v.Db(1),v.Tc(" ",e," /s ")}}function ta(e,t){1&e&&(v.Xb(0,"span",10),v.Rc(1," n/a "),v.Wb())}function aa(e,t){if(1&e&&(v.Pc(0,ea,2,1,"span",7),v.Pc(1,ta,2,0,"span",8)),2&e){const e=t.row;v.uc("ngIf","user:rbd"===e.backstore),v.Db(1),v.uc("ngIf","user:rbd"!==e.backstore)}}function ia(e,t){if(1&e&&(v.Xb(0,"span"),v.Rc(1),v.oc(2,"notAvailable"),v.oc(3,"relativeDate"),v.Wb()),2&e){const e=v.nc().value;v.Db(1),v.Tc(" ",v.pc(2,1,v.pc(3,3,e))," ")}}function oa(e,t){1&e&&(v.Xb(0,"span",10),v.Rc(1," n/a "),v.Wb())}function sa(e,t){if(1&e&&(v.Pc(0,ia,4,5,"span",7),v.Pc(1,oa,2,0,"span",8)),2&e){const e=t.row;v.uc("ngIf","user:rbd"===e.backstore),v.Db(1),v.uc("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)(v.Rb(S),v.Rb(Gt.a),v.Rb(Q.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-iscsi"]],viewQuery:function(e,t){if(1&e&&(v.Wc(Qt,3),v.Wc(Yt,3),v.Wc(Kt,3)),2&e){let e;v.Ec(e=v.mc())&&(t.iscsiSparklineTpl=e.first),v.Ec(e=v.mc())&&(t.iscsiPerSecondTpl=e.first),v.Ec(e=v.mc())&&(t.iscsiRelativeDateTpl=e.first)}},decls:13,vars:4,consts:function(){let e,t;return e="Gateways",t="Images",[e,[3,"data","columns","fetchData"],t,[3,"data","columns"],["iscsiSparklineTpl",""],["iscsiPerSecondTpl",""],["iscsiRelativeDateTpl",""],[4,"ngIf"],["class","text-muted",4,"ngIf"],[3,"data","isBinary"],[1,"text-muted"]]},template:function(e,t){1&e&&(v.Sb(0,"cd-iscsi-tabs"),v.Xb(1,"legend"),v.bc(2,0),v.Wb(),v.Xb(3,"cd-table",1),v.lc("fetchData",function(){return t.refresh()}),v.Wb(),v.Xb(4,"legend"),v.bc(5,2),v.Wb(),v.Sb(6,"cd-table",3),v.Pc(7,Zt,2,2,"ng-template",null,4,v.Qc),v.Pc(9,aa,2,2,"ng-template",null,5,v.Qc),v.Pc(11,sa,2,2,"ng-template",null,6,v.Qc)),2&e&&(v.Db(3),v.uc("data",t.gateways)("columns",t.gatewaysColumns),v.Db(3),v.uc("data",t.images)("columns",t.imagesColumns))},directives:[_t,ot.a,i.r,Ut.a],pipes:[rt.a,jt.a],styles:[""]}),e})(),ca=(()=>{class e{}return e.\u0275fac=function(t){return new(t||e)},e.\u0275mod=v.Pb({type:e}),e.\u0275inj=v.Ob({imports:[[i.c,d.a,c.t,s.i,o.m,o.x,c.A]]}),e})();var ra=a("quSY"),la=a("2Vo4"),ba=a("pLZG"),da=a("lOp/");let ua=(()=>{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)(v.ic(h.b),v.ic(da.a))},e.\u0275prov=v.Nb({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"),pa=a("vkgz"),fa=a("NJ9Y"),ha=a("IZUe"),ga=a("sb0X"),va=a("Z21x");function Sa(e,t){1&e&&(v.Xb(0,"span",25),v.bc(1,26),v.Wb())}function Da(e,t){if(1&e&&(v.Xb(0,"div",27),v.Sb(1,"input",28),v.Xb(2,"label",29),v.Rc(3),v.Wb(),v.Wb()),2&e){const e=t.$implicit;v.Db(1),v.vc("id",e.name),v.vc("name",e.name),v.vc("formControlName",e.name),v.Db(1),v.vc("for",e.name),v.Db(1),v.Sc(e.name)}}function wa(e,t){1&e&&(v.Xb(0,"span",25),v.bc(1,30),v.Wb())}let _a=(()=>{class e{constructor(e,t,a){this.activeModal=e,this.rbdMirroringService=t,this.taskWrapper=a,this.pools=[],this.createForm()}createForm(){this.createBootstrapForm=new P.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(p.a)(t.map(e=>this.rbdMirroringService.updatePool(e,i))),this.rbdMirroringService.createBootstrapToken(e).pipe(Object(pa.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 T.a("rbd/mirroring/bootstrap/create",{}),call:o}).subscribe({error:s,complete:s})}}return e.\u0275fac=function(t){return new(t||e)(v.Rb(c.a),v.Rb(ua),v.Rb(R.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-bootstrap-create-modal"]],decls:32,vars:6,consts:function(){let e,t,a,i,o,s,n,c,r,l,b;return e="Create Bootstrap Token",t="To create a bootstrap token which can be imported by a peer site cluster, provide the local site's name, select which pools will have mirroring enabled, and click\xA0 " + "\ufffd#10\ufffd" + "Generate" + "\ufffd/#10\ufffd" + ".",a="Site Name",i="Name...",o="Pools",s="Generate",n="Token",c="Generated token...",r="Close",l="This field is required.",b="At least one pool is required.",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","createBootstrapForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t,[1,"form-group"],["for","siteName",1,"col-form-label","required"],a,["type","text","placeholder",i,"id","siteName","name","siteName","formControlName","siteName","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["formGroupName","pools",1,"form-group"],["for","pools",1,"col-form-label","required"],o,["class","custom-control custom-checkbox",4,"ngFor","ngForOf"],[1,"mb-4","float-right",3,"form","submitAction"],s,["for","token",1,"col-form-label"],n,["placeholder",c,"id","token","formControlName","token","readonly","",1,"form-control","resize-vertical"],["source","token",1,"float-right"],[1,"modal-footer"],["name",r,3,"backAction"],[1,"invalid-feedback"],l,[1,"custom-control","custom-checkbox"],["type","checkbox",1,"custom-control-input",3,"id","name","formControlName"],[1,"custom-control-label",3,"for"],b]},template:function(e,t){if(1&e&&(v.Xb(0,"cd-modal",0),v.Vb(1,1),v.bc(2,2),v.Ub(),v.Vb(3,3),v.Xb(4,"form",4,5),v.Xb(6,"div",6),v.Xb(7,"p"),v.Vb(8),v.hc(9,7),v.Sb(10,"kbd"),v.ec(),v.Ub(),v.Wb(),v.Xb(11,"div",8),v.Xb(12,"label",9),v.bc(13,10),v.Wb(),v.Sb(14,"input",11),v.Pc(15,Sa,2,0,"span",12),v.Wb(),v.Xb(16,"div",13),v.Xb(17,"label",14),v.bc(18,15),v.Wb(),v.Pc(19,Da,4,5,"div",16),v.Pc(20,wa,2,0,"span",12),v.Wb(),v.Xb(21,"cd-submit-button",17),v.lc("submitAction",function(){return t.generate()}),v.bc(22,18),v.Wb(),v.Xb(23,"div",8),v.Xb(24,"label",19),v.Xb(25,"span"),v.bc(26,20),v.Wb(),v.Wb(),v.Xb(27,"textarea",21),v.Rc(28," "),v.Wb(),v.Wb(),v.Sb(29,"cd-copy-2-clipboard-button",22),v.Wb(),v.Xb(30,"div",23),v.Xb(31,"cd-back-button",24),v.lc("backAction",function(){return t.activeModal.close()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e){const e=v.Fc(5);v.uc("modalRef",t.activeModal),v.Db(4),v.uc("formGroup",t.createBootstrapForm),v.Db(11),v.uc("ngIf",t.createBootstrapForm.showError("siteName",e,"required")),v.Db(4),v.uc("ngForOf",t.pools),v.Db(1),v.uc("ngIf",t.createBootstrapForm.showError("pools",e,"requirePool")),v.Db(1),v.uc("form",t.createBootstrapForm)}},directives:[E.a,o.B,o.r,z.a,o.k,N.a,C.a,o.d,V.a,o.q,o.i,ha.a,i.r,o.l,i.q,ga.a,re.a,va.a,o.b],styles:[".form-group.ng-invalid[_ngcontent-%COMP%] .invalid-feedback[_ngcontent-%COMP%]{display:block}"]}),e})();function Wa(e,t){1&e&&(v.Xb(0,"span",26),v.bc(1,27),v.Wb())}function ya(e,t){if(1&e&&(v.Xb(0,"option",28),v.Rc(1),v.Wb()),2&e){const e=t.$implicit;v.uc("value",e.key),v.Db(1),v.Sc(e.desc)}}function Xa(e,t){if(1&e&&(v.Xb(0,"div",29),v.Sb(1,"input",30),v.Xb(2,"label",31),v.Rc(3),v.Wb(),v.Wb()),2&e){const e=t.$implicit;v.Db(1),v.vc("id",e.name),v.vc("name",e.name),v.vc("formControlName",e.name),v.Db(1),v.vc("for",e.name),v.Db(1),v.Sc(e.name)}}function Ia(e,t){1&e&&(v.Xb(0,"span",26),v.bc(1,32),v.Wb())}function ka(e,t){1&e&&(v.Xb(0,"span",26),v.bc(1,33),v.Wb())}function Pa(e,t){1&e&&(v.Xb(0,"span",26),v.bc(1,34),v.Wb())}let $a=(()=>{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 P.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(p.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 T.a("rbd/mirroring/bootstrap/import",{}),call:o}).subscribe({error:s,complete:()=>{s(),this.activeModal.close()}})}}return e.\u0275fac=function(t){return new(t||e)(v.Rb(c.a),v.Rb(l.b),v.Rb(ua),v.Rb(R.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-bootstrap-import-modal"]],decls:36,vars:10,consts:function(){let e,t,a,i,o,s,n,c,r,l,b,d;return e="Import Bootstrap Token",t="To import a bootstrap token which was created by a peer site cluster, provide the local site's name, select which pools will have mirroring enabled, provide the generated token, and click\xA0" + "\ufffd#10\ufffd" + "Import" + "\ufffd/#10\ufffd" + ".",a="Site Name",i="Name...",o="Direction",s="Pools",n="Token",c="Generated token...",r="This field is required.",l="At least one pool is required.",b="This field is required.",d="The token is invalid.",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","importBootstrapForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t,[1,"form-group"],["for","siteName",1,"col-form-label","required"],a,["type","text","placeholder",i,"id","siteName","name","siteName","formControlName","siteName","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["for","direction",1,"col-form-label"],o,["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"],s,["class","custom-control custom-checkbox",4,"ngFor","ngForOf"],["for","token",1,"col-form-label","required"],n,["placeholder",c,"id","token","formControlName","token",1,"form-control","resize-vertical"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],r,[3,"value"],[1,"custom-control","custom-checkbox"],["type","checkbox",1,"custom-control-input",3,"id","name","formControlName"],[1,"custom-control-label",3,"for"],l,b,d]},template:function(e,t){if(1&e&&(v.Xb(0,"cd-modal",0),v.Vb(1,1),v.bc(2,2),v.Ub(),v.Vb(3,3),v.Xb(4,"form",4,5),v.Xb(6,"div",6),v.Xb(7,"p"),v.Vb(8),v.hc(9,7),v.Sb(10,"kbd"),v.ec(),v.Ub(),v.Wb(),v.Xb(11,"div",8),v.Xb(12,"label",9),v.bc(13,10),v.Wb(),v.Sb(14,"input",11),v.Pc(15,Wa,2,0,"span",12),v.Wb(),v.Xb(16,"div",8),v.Xb(17,"label",13),v.Xb(18,"span"),v.bc(19,14),v.Wb(),v.Wb(),v.Xb(20,"select",15),v.Pc(21,ya,2,2,"option",16),v.Wb(),v.Wb(),v.Xb(22,"div",17),v.Xb(23,"label",18),v.bc(24,19),v.Wb(),v.Pc(25,Xa,4,5,"div",20),v.Pc(26,Ia,2,0,"span",12),v.Wb(),v.Xb(27,"div",8),v.Xb(28,"label",21),v.bc(29,22),v.Wb(),v.Xb(30,"textarea",23),v.Rc(31," "),v.Wb(),v.Pc(32,ka,2,0,"span",12),v.Pc(33,Pa,2,0,"span",12),v.Wb(),v.Wb(),v.Xb(34,"div",24),v.Xb(35,"cd-form-button-panel",25),v.lc("submitActionEvent",function(){return t.import()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e){const e=v.Fc(5);v.uc("modalRef",t.activeModal),v.Db(4),v.uc("formGroup",t.importBootstrapForm),v.Db(11),v.uc("ngIf",t.importBootstrapForm.showError("siteName",e,"required")),v.Db(6),v.uc("ngForOf",t.directions),v.Db(4),v.uc("ngForOf",t.pools),v.Db(1),v.uc("ngIf",t.importBootstrapForm.showError("pools",e,"requirePool")),v.Db(6),v.uc("ngIf",t.importBootstrapForm.showError("token",e,"required")),v.Db(1),v.uc("ngIf",t.importBootstrapForm.showError("token",e,"invalidToken")),v.Db(2),v.uc("form",t.importBootstrapForm)("submitText",t.actionLabels.SUBMIT)}},directives:[E.a,o.B,o.r,z.a,o.k,N.a,C.a,o.d,V.a,o.q,o.i,ha.a,i.r,o.z,i.q,o.l,A.a,o.u,o.C,o.b],styles:[""]}),e})(),Ta=(()=>{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 P.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 T.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)(v.Rb(c.a),v.Rb(l.b),v.Rb(ua),v.Rb(R.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-edit-site-mode-modal"]],decls:17,vars:4,consts:function(){let e,t,a,i;return e="Edit site name",t="Edit the site name and click\xA0 " + "\ufffd#10\ufffd" + "Update" + "\ufffd/#10\ufffd" + ".",a="Site Name",i="Name...",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","editSiteNameForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t,[1,"form-group"],["for","siteName",1,"col-form-label","required"],a,["type","text","placeholder",i,"id","siteName","name","siteName","formControlName","siteName","autofocus","",1,"form-control"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"]]},template:function(e,t){1&e&&(v.Xb(0,"cd-modal",0),v.Vb(1,1),v.bc(2,2),v.Ub(),v.Vb(3,3),v.Xb(4,"form",4,5),v.Xb(6,"div",6),v.Xb(7,"p"),v.Vb(8),v.hc(9,7),v.Sb(10,"kbd"),v.ec(),v.Ub(),v.Wb(),v.Xb(11,"div",8),v.Xb(12,"label",9),v.bc(13,10),v.Wb(),v.Sb(14,"input",11),v.Wb(),v.Wb(),v.Xb(15,"div",12),v.Xb(16,"cd-form-button-panel",13),v.lc("submitActionEvent",function(){return t.update()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e&&(v.uc("modalRef",t.activeModal),v.Db(4),v.uc("formGroup",t.editSiteNameForm),v.Db(12),v.uc("form",t.editSiteNameForm)("submitText",t.actionLabels.UPDATE))},directives:[E.a,o.B,o.r,z.a,o.k,N.a,C.a,o.d,V.a,o.q,o.i,ha.a,A.a],styles:[""]}),e})();var Fa=a("VxPD"),Ra=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=v.Qb({name:"mirrorHealthColor",type:e,pure:!0}),e})();const za=["healthTmpl"];function Na(e,t){if(1&e&&(v.Xb(0,"span",2),v.oc(1,"mirrorHealthColor"),v.Rc(2),v.Wb()),2&e){const e=t.value;v.uc("ngClass",v.pc(1,2,t.row.health_color)),v.Db(2),v.Sc(e)}}let Ca=(()=>{class e{constructor(e,t){this.rbdMirroringService=e,this.cephShortVersionPipe=t,this.tableStatus=new Fa.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 Fa.a(e.status)})}ngOnDestroy(){this.subs.unsubscribe()}refresh(){this.rbdMirroringService.refresh()}}return e.\u0275fac=function(t){return new(t||e)(v.Rb(ua),v.Rb(Ra.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-mirroring-daemons"]],viewQuery:function(e,t){if(1&e&&v.Wc(za,3),2&e){let e;v.Ec(e=v.mc())&&(t.healthTmpl=e.first)}},decls:3,vars:4,consts:[["columnMode","flex",3,"data","columns","autoReload","status","fetchData"],["healthTmpl",""],[3,"ngClass"]],template:function(e,t){1&e&&(v.Xb(0,"cd-table",0),v.lc("fetchData",function(){return t.refresh()}),v.Wb(),v.Pc(1,Na,3,4,"ng-template",null,1,v.Qc)),2&e&&v.uc("data",t.data)("columns",t.columns)("autoReload",-1)("status",t.tableStatus)},directives:[ot.a,i.p],pipes:[Ea],styles:[""]}),e})();var Va=a("HDdC");class Aa{}function xa(e,t){if(1&e&&(v.Xb(0,"option",16),v.Rc(1),v.Wb()),2&e){const e=t.$implicit;v.uc("value",e.id),v.Db(1),v.Sc(e.name)}}function Oa(e,t){1&e&&(v.Xb(0,"span",17),v.bc(1,18),v.Wb())}let Ma=(()=>{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 P.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 Aa;e.mirror_mode=this.editModeForm.getValue("mirrorMode"),this.taskWrapper.wrapTaskAroundCall({task:new T.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)(v.Rb(c.a),v.Rb(l.b),v.Rb(ua),v.Rb(R.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-pool-edit-mode-modal"]],decls:21,vars:7,consts:function(){let e,t,a,i;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]" + ".",t=v.gc(t),a="Mode",i="Peer clusters must be removed prior to disabling mirror.",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","editModeForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t,[1,"form-group"],["for","mirrorMode",1,"col-form-label"],a,["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"],i]},template:function(e,t){if(1&e&&(v.Xb(0,"cd-modal",0),v.Vb(1,1),v.bc(2,2),v.Ub(),v.Vb(3,3),v.Xb(4,"form",4,5),v.Xb(6,"div",6),v.Xb(7,"p"),v.Vb(8),v.hc(9,7),v.Sb(10,"kbd"),v.Sb(11,"kbd"),v.ec(),v.Ub(),v.Wb(),v.Xb(12,"div",8),v.Xb(13,"label",9),v.Xb(14,"span"),v.bc(15,10),v.Wb(),v.Wb(),v.Xb(16,"select",11),v.Pc(17,xa,2,2,"option",12),v.Wb(),v.Pc(18,Oa,2,0,"span",13),v.Wb(),v.Wb(),v.Xb(19,"div",14),v.Xb(20,"cd-form-button-panel",15),v.lc("submitActionEvent",function(){return t.update()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e){const e=v.Fc(5);v.uc("modalRef",t.activeModal),v.Db(4),v.uc("formGroup",t.editModeForm),v.Db(7),v.fc(t.poolName),v.cc(9),v.Db(6),v.uc("ngForOf",t.mirrorModes),v.Db(1),v.uc("ngIf",t.editModeForm.showError("mirrorMode",e,"cannotDisable")),v.Db(2),v.uc("form",t.editModeForm)("submitText",t.actionLabels.UPDATE)}},directives:[E.a,o.B,o.r,z.a,o.k,N.a,C.a,o.z,V.a,o.q,o.i,i.q,i.r,A.a,o.u,o.C],styles:[""]}),e})();class Ba{}function qa(e,t){1&e&&(v.Xb(0,"span",24),v.bc(1,25),v.Wb())}function La(e,t){1&e&&(v.Xb(0,"span",24),v.bc(1,26),v.Wb())}function Ga(e,t){1&e&&(v.Xb(0,"span",24),v.bc(1,27),v.Wb())}function Ua(e,t){1&e&&(v.Xb(0,"span",24),v.bc(1,28),v.Wb())}function ja(e,t){1&e&&(v.Xb(0,"span",24),v.bc(1,29),v.Wb())}function Qa(e,t){1&e&&(v.Xb(0,"span",24),v.bc(1,30),v.Wb())}let Ya=(()=>{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 P.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 T.a("rbd/mirroring/peer/edit",{pool_name:this.poolName}),call:this.rbdMirroringService.updatePeer(this.poolName,this.peerUUID,e)}:{task:new T.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)(v.Rb(c.a),v.Rb(l.b),v.Rb(ua),v.Rb(R.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-pool-edit-peer-modal"]],decls:38,vars:13,consts:function(){let e,t,a,i,o,s,n,c,r,l,b,d,u,m,p,f,h,g;return e="{VAR_SELECT, select, edit {Edit} other {Add}}",e=v.gc(e,{VAR_SELECT:"\ufffd0\ufffd"}),t="" + e + " pool mirror peer",a="{VAR_SELECT, select, edit {Edit} other {Add}}",a=v.gc(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]" + ".",i=v.gc(i),o="Cluster Name",s="Name...",n="CephX ID",c="CephX ID...",r="Monitor Addresses",l="Comma-delimited addresses...",b="CephX Key",d="Base64-encoded key...",u="This field is required.",m="The cluster name is not valid.",p="This field is required.",f="The CephX ID is not valid.",h="The monitory address is not valid.",g="CephX key must be base64 encoded.",[[3,"modalRef"],[1,"modal-title"],t,[1,"modal-content"],["name","editPeerForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],i,[1,"form-group"],["for","clusterName",1,"col-form-label","required"],o,["type","text","placeholder",s,"id","clusterName","name","clusterName","formControlName","clusterName","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],["for","clientID",1,"col-form-label","required"],n,["type","text","placeholder",c,"id","clientID","name","clientID","formControlName","clientID",1,"form-control"],["for","monAddr",1,"col-form-label"],r,["type","text","placeholder",l,"id","monAddr","name","monAddr","formControlName","monAddr",1,"form-control"],["for","key",1,"col-form-label"],b,["type","text","placeholder",d,"id","key","name","key","formControlName","key",1,"form-control"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],u,m,p,f,h,g]},template:function(e,t){if(1&e&&(v.Xb(0,"cd-modal",0),v.Xb(1,"span",1),v.bc(2,2),v.Wb(),v.Vb(3,3),v.Xb(4,"form",4,5),v.Xb(6,"div",6),v.Xb(7,"p"),v.Xb(8,"span"),v.hc(9,7),v.Sb(10,"kbd"),v.Sb(11,"kbd"),v.ec(),v.Wb(),v.Wb(),v.Xb(12,"div",8),v.Xb(13,"label",9),v.bc(14,10),v.Wb(),v.Sb(15,"input",11),v.Pc(16,qa,2,0,"span",12),v.Pc(17,La,2,0,"span",12),v.Wb(),v.Xb(18,"div",8),v.Xb(19,"label",13),v.bc(20,14),v.Wb(),v.Sb(21,"input",15),v.Pc(22,Ga,2,0,"span",12),v.Pc(23,Ua,2,0,"span",12),v.Wb(),v.Xb(24,"div",8),v.Xb(25,"label",16),v.Xb(26,"span"),v.bc(27,17),v.Wb(),v.Wb(),v.Sb(28,"input",18),v.Pc(29,ja,2,0,"span",12),v.Wb(),v.Xb(30,"div",8),v.Xb(31,"label",19),v.Xb(32,"span"),v.bc(33,20),v.Wb(),v.Wb(),v.Sb(34,"input",21),v.Pc(35,Qa,2,0,"span",12),v.Wb(),v.Wb(),v.Xb(36,"div",22),v.Xb(37,"cd-form-button-panel",23),v.lc("submitActionEvent",function(){return t.update()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e){const e=v.Fc(5);v.uc("modalRef",t.activeModal),v.Db(2),v.fc(t.mode),v.cc(2),v.Db(2),v.uc("formGroup",t.editPeerForm),v.Db(7),v.fc(t.mode)(t.poolName),v.cc(9),v.Db(5),v.uc("ngIf",t.editPeerForm.showError("clusterName",e,"required")),v.Db(1),v.uc("ngIf",t.editPeerForm.showError("clusterName",e,"invalidClusterName")),v.Db(5),v.uc("ngIf",t.editPeerForm.showError("clientID",e,"required")),v.Db(1),v.uc("ngIf",t.editPeerForm.showError("clientID",e,"invalidClientID")),v.Db(6),v.uc("ngIf",t.editPeerForm.showError("monAddr",e,"invalidMonAddr")),v.Db(6),v.uc("ngIf",t.editPeerForm.showError("key",e,"invalidKey")),v.Db(2),v.uc("form",t.editPeerForm)("submitText",t.actionLabels.SUBMIT)}},directives:[E.a,o.B,o.r,z.a,o.k,N.a,C.a,o.d,V.a,o.q,o.i,ha.a,i.r,A.a],styles:[""]}),e})();const Ka=["healthTmpl"];function Ha(e,t){if(1&e&&(v.Xb(0,"span",3),v.oc(1,"mirrorHealthColor"),v.Rc(2),v.Wb()),2&e){const e=t.value;v.uc("ngClass",v.pc(1,2,t.row.health_color)),v.Db(2),v.Sc(e)}}let Ja=(()=>{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 Fa.a,this.data=[],this.permission=this.authStorageService.getPermissions().rbdMirroring;const o={permission:"update",icon:I.a.edit,click:()=>this.editModeModal(),name:"Edit Mode",canBePrimary:()=>!0},s={permission:"create",icon:I.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:I.a.exchange,name:"Edit Peer",click:()=>this.editPeersModal("edit"),visible:()=>!!this.getPeerUUID()},c={permission:"delete",icon:I.a.destroy,name:"Delete Peer",click:()=>this.deletePeersModal(),visible:()=>!!this.getPeerUUID()};this.tableActions=[o,s,n,c]}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 Fa.a(e.status)})}ngOnDestroy(){this.subs.unsubscribe()}refresh(){this.rbdMirroringService.refresh()}editModeModal(){const e={poolName:this.selection.first().name};this.modalRef=this.modalService.show(Ma,e)}editPeersModal(e){const t={poolName:this.selection.first().name,mode:e};"edit"===e&&(t.peerUUID=this.getPeerUUID()),this.modalRef=this.modalService.show(Ya,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 Va.a(a=>{this.taskWrapper.wrapTaskAroundCall({task:new T.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)(v.Rb(lt.a),v.Rb(ua),v.Rb(F.a),v.Rb(R.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-mirroring-pools"]],viewQuery:function(e,t){if(1&e&&v.Wc(Ka,3),2&e){let e;v.Ec(e=v.mc())&&(t.healthTmpl=e.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&&(v.Xb(0,"cd-table",0),v.lc("fetchData",function(){return t.refresh()})("updateSelection",function(e){return t.updateSelection(e)}),v.Sb(1,"cd-table-actions",1),v.Wb(),v.Pc(2,Ha,3,4,"ng-template",null,2,v.Qc)),2&e&&(v.uc("data",t.data)("columns",t.columns)("autoReload",-1)("status",t.tableStatus),v.Db(1),v.uc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions))},directives:[ot.a,Xt.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=v.Yb();v.Xb(0,"cd-table",14),v.lc("fetchData",function(){return v.Ic(e),v.nc().refresh()}),v.Wb()}if(2&e){const e=v.nc();v.uc("data",e.image_error.data)("columns",e.image_error.columns)("autoReload",-1)("status",e.tableStatus)}}function oi(e,t){if(1&e){const e=v.Yb();v.Xb(0,"cd-table",14),v.lc("fetchData",function(){return v.Ic(e),v.nc().refresh()}),v.Wb()}if(2&e){const e=v.nc();v.uc("data",e.image_syncing.data)("columns",e.image_syncing.columns)("autoReload",-1)("status",e.tableStatus)}}function si(e,t){if(1&e){const e=v.Yb();v.Xb(0,"cd-table",14),v.lc("fetchData",function(){return v.Ic(e),v.nc().refresh()}),v.Wb()}if(2&e){const e=v.nc();v.uc("data",e.image_ready.data)("columns",e.image_ready.columns)("autoReload",-1)("status",e.tableStatus)}}function ni(e,t){if(1&e&&(v.Xb(0,"span",15),v.oc(1,"mirrorHealthColor"),v.Rc(2),v.Wb()),2&e){const e=t.value;v.uc("ngClass",v.pc(1,2,t.row.state_color)),v.Db(2),v.Sc(e)}}function ci(e,t){1&e&&(v.Xb(0,"span",16),v.bc(1,17),v.Wb())}function ri(e,t){1&e&&v.Sb(0,"ngb-progressbar",18),2&e&&v.uc("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 Fa.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 Fa.a(e.status)})}ngOnDestroy(){this.subs.unsubscribe()}refresh(){this.rbdMirroringService.refresh()}}return e.\u0275fac=function(t){return new(t||e)(v.Rb(ua))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-mirroring-images"]],viewQuery:function(e,t){if(1&e&&(v.Wc(ei,3),v.Wc(ti,3),v.Wc(ai,3)),2&e){let e;v.Ec(e=v.mc())&&(t.stateTmpl=e.first),v.Ec(e=v.mc())&&(t.syncTmpl=e.first),v.Ec(e=v.mc())&&(t.progressTmpl=e.first)}},decls:21,vars:1,consts:function(){let e,t,a,i;return e="Issues",t="Syncing",a="Ready",i="Syncing",[["ngbNav","","cdStatefulTab","image-list",1,"nav-tabs"],["nav","ngbNav"],["ngbNavItem","issues"],["ngbNavLink",""],e,["ngbNavContent",""],["ngbNavItem","syncing"],t,["ngbNavItem","ready"],a,[3,"ngbNavOutlet"],["stateTmpl",""],["syncTmpl",""],["progressTmpl",""],["columnMode","flex",3,"data","columns","autoReload","status","fetchData"],[3,"ngClass"],[1,"badge","badge-info"],i,["type","info",3,"value","showValue"]]},template:function(e,t){if(1&e&&(v.Xb(0,"ul",0,1),v.Xb(2,"li",2),v.Xb(3,"a",3),v.bc(4,4),v.Wb(),v.Pc(5,ii,1,4,"ng-template",5),v.Wb(),v.Xb(6,"li",6),v.Xb(7,"a",3),v.bc(8,7),v.Wb(),v.Pc(9,oi,1,4,"ng-template",5),v.Wb(),v.Xb(10,"li",8),v.Xb(11,"a",3),v.bc(12,9),v.Wb(),v.Pc(13,si,1,4,"ng-template",5),v.Wb(),v.Wb(),v.Sb(14,"div",10),v.Pc(15,ni,3,4,"ng-template",null,11,v.Qc),v.Pc(17,ci,2,0,"ng-template",null,12,v.Qc),v.Pc(19,ri,1,2,"ng-template",null,13,v.Qc)),2&e){const e=v.Fc(1);v.Db(14),v.uc("ngbNavOutlet",e)}},directives:[c.p,Za.a,c.r,c.s,c.q,c.u,ot.a,i.p,c.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 ra.a,this.permission=this.authStorageService.getPermissions().rbdMirroring;const i={permission:"update",icon:I.a.edit,click:()=>this.editSiteNameModal(),name:"Edit Site Name",canBePrimary:()=>!0,disable:()=>!1},o={permission:"update",icon:I.a.upload,click:()=>this.createBootstrapModal(),name:"Create Bootstrap Token",disable:()=>!1},s={permission:"update",icon:I.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(Ta,{siteName:this.siteName})}createBootstrapModal(){this.modalRef=this.modalService.show(_a,{siteName:this.siteName})}importBootstrapModal(){this.modalRef=this.modalService.show($a,{siteName:this.siteName})}}return e.\u0275fac=function(t){return new(t||e)(v.Rb(lt.a),v.Rb(ua),v.Rb(F.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-mirroring"]],decls:21,vars:4,consts:function(){let e,t,a,i;return e="Site Name:",t="Daemons",a="Pools",i="Images",[[1,"row"],[1,"col-md-12"],e,[1,"table-actions","float-right",3,"permission","selection","tableActions"],[1,"col-sm-6"],t,a,i]},template:function(e,t){1&e&&(v.Xb(0,"div",0),v.Xb(1,"div",1),v.Xb(2,"span"),v.Xb(3,"strong"),v.bc(4,2),v.Wb(),v.Rc(5),v.Wb(),v.Sb(6,"cd-table-actions",3),v.Wb(),v.Wb(),v.Xb(7,"div",0),v.Xb(8,"div",4),v.Xb(9,"legend"),v.bc(10,5),v.Wb(),v.Sb(11,"cd-mirroring-daemons"),v.Wb(),v.Xb(12,"div",4),v.Xb(13,"legend"),v.bc(14,6),v.Wb(),v.Sb(15,"cd-mirroring-pools"),v.Wb(),v.Wb(),v.Xb(16,"div",0),v.Xb(17,"div",1),v.Xb(18,"legend"),v.bc(19,7),v.Wb(),v.Sb(20,"cd-mirroring-images"),v.Wb(),v.Wb()),2&e&&(v.Db(5),v.Tc(" ",t.siteName,""),v.Db(1),v.uc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions))},directives:[Xt.a,Ca,Ja,li],styles:[""]}),e})();var di=a("jtHE"),ui=a("SxV6"),mi=a("eIep"),pi=a("Ekvf"),fi=a("PhyI"),hi=a("Fgil"),gi=a("aXbf");class vi{}var Si=function(e){return e[e.V1=1]="V1",e[e.V2=2]="V2",e}({});class Di{constructor(){this.features=[]}}class wi{constructor(){this.features=[]}}class _i extends class{}{constructor(){super(...arguments),this.features=[]}}class Wi{constructor(){this.features=[]}}var yi=function(e){return e.editing="editing",e.cloning="cloning",e.copying="copying",e}({}),Xi=a("EmSq"),Ii=a("rFfW"),ki=a("p4Cf");function Pi(e,t){if(1&e&&(v.Xb(0,"div",9),v.Xb(1,"label",56),v.bc(2,57),v.oc(3,"titlecase"),v.Wb(),v.Xb(4,"div",12),v.Sb(5,"input",58),v.Sb(6,"hr"),v.Wb(),v.Wb()),2&e){const e=v.nc(2);v.Db(3),v.fc(v.pc(3,1,e.action)),v.cc(2)}}function $i(e,t){1&e&&(v.Xb(0,"span",59),v.Vb(1),v.bc(2,60),v.Ub(),v.Wb())}function Ti(e,t){1&e&&(v.Xb(0,"span",59),v.Vb(1),v.bc(2,61),v.Ub(),v.Wb())}function Fi(e,t){1&e&&v.Sb(0,"input",62)}function Ri(e,t){1&e&&(v.Xb(0,"option",48),v.bc(1,65),v.Wb()),2&e&&v.uc("ngValue",null)}function Ei(e,t){1&e&&(v.Xb(0,"option",48),v.bc(1,66),v.Wb()),2&e&&v.uc("ngValue",null)}function zi(e,t){1&e&&(v.Xb(0,"option",48),v.bc(1,67),v.Wb()),2&e&&v.uc("ngValue",null)}function Ni(e,t){if(1&e&&(v.Xb(0,"option",68),v.Rc(1),v.Wb()),2&e){const e=t.$implicit;v.uc("value",e.pool_name),v.Db(1),v.Sc(e.pool_name)}}function Ci(e,t){if(1&e&&(v.Xb(0,"select",63),v.Pc(1,Ri,2,1,"option",64),v.Pc(2,Ei,2,1,"option",64),v.Pc(3,zi,2,1,"option",64),v.Pc(4,Ni,2,2,"option",44),v.Wb()),2&e){const e=v.nc(2);v.Db(1),v.uc("ngIf",null===e.pools),v.Db(1),v.uc("ngIf",null!==e.pools&&0===e.pools.length),v.Db(1),v.uc("ngIf",null!==e.pools&&e.pools.length>0),v.Db(1),v.uc("ngForOf",e.pools)}}function Vi(e,t){1&e&&(v.Xb(0,"span",59),v.bc(1,69),v.Wb())}const Ai=function(e,t){return[e,t]};function xi(e,t){if(1&e&&(v.Xb(0,"div",9),v.Xb(1,"div",20),v.Sb(2,"i",70),v.Wb(),v.Wb()),2&e){const e=v.nc(2);v.Db(2),v.uc("ngClass",v.Ac(1,Ai,e.icons.spinner,e.icons.spin))}}function Oi(e,t){1&e&&v.Sb(0,"input",74)}function Mi(e,t){1&e&&(v.Xb(0,"option",48),v.bc(1,76),v.Wb()),2&e&&v.uc("ngValue",null)}function Bi(e,t){1&e&&(v.Xb(0,"option",48),v.bc(1,77),v.Wb()),2&e&&v.uc("ngValue",null)}function qi(e,t){1&e&&(v.Xb(0,"option",48),v.bc(1,78),v.Wb()),2&e&&v.uc("ngValue",null)}function Li(e,t){if(1&e&&(v.Xb(0,"option",68),v.Rc(1),v.Wb()),2&e){const e=t.$implicit;v.uc("value",e),v.Db(1),v.Sc(e)}}function Gi(e,t){if(1&e&&(v.Xb(0,"select",75),v.Pc(1,Mi,2,1,"option",64),v.Pc(2,Bi,2,1,"option",64),v.Pc(3,qi,2,1,"option",64),v.Pc(4,Li,2,2,"option",44),v.Wb()),2&e){const e=v.nc(3);v.Db(1),v.uc("ngIf",null===e.pools),v.Db(1),v.uc("ngIf",null!==e.pools&&0===e.pools.length),v.Db(1),v.uc("ngIf",null!==e.pools&&e.pools.length>0),v.Db(1),v.uc("ngForOf",e.namespaces)}}function Ui(e,t){if(1&e&&(v.Xb(0,"div",9),v.Xb(1,"label",71),v.Rc(2," Namespace "),v.Wb(),v.Xb(3,"div",12),v.Pc(4,Oi,1,0,"input",72),v.Pc(5,Gi,5,4,"select",73),v.Wb(),v.Wb()),2&e){const e=v.nc(2);v.Db(4),v.uc("ngIf","editing"===e.mode||!e.poolPermission.read),v.Db(1),v.uc("ngIf","editing"!==e.mode&&e.poolPermission.read)}}function ji(e,t){1&e&&(v.Xb(0,"cd-helper"),v.Xb(1,"span"),v.bc(2,79),v.Wb(),v.Wb())}function Qi(e,t){1&e&&v.Sb(0,"input",85)}function Yi(e,t){1&e&&(v.Xb(0,"option",48),v.bc(1,87),v.Wb()),2&e&&v.uc("ngValue",null)}function Ki(e,t){1&e&&(v.Xb(0,"option",48),v.bc(1,88),v.Wb()),2&e&&v.uc("ngValue",null)}function Hi(e,t){1&e&&(v.Xb(0,"option",48),v.Rc(1,"-- Select a data pool -- "),v.Wb()),2&e&&v.uc("ngValue",null)}function Ji(e,t){if(1&e&&(v.Xb(0,"option",68),v.Rc(1),v.Wb()),2&e){const e=t.$implicit;v.uc("value",e.pool_name),v.Db(1),v.Sc(e.pool_name)}}function Zi(e,t){if(1&e){const e=v.Yb();v.Xb(0,"select",86),v.lc("change",function(t){return v.Ic(e),v.nc(3).onDataPoolChange(t.target.value)}),v.Pc(1,Yi,2,1,"option",64),v.Pc(2,Ki,2,1,"option",64),v.Pc(3,Hi,2,1,"option",64),v.Pc(4,Ji,2,2,"option",44),v.Wb()}if(2&e){const e=v.nc(3);v.Db(1),v.uc("ngIf",null===e.dataPools),v.Db(1),v.uc("ngIf",null!==e.dataPools&&0===e.dataPools.length),v.Db(1),v.uc("ngIf",null!==e.dataPools&&e.dataPools.length>0),v.Db(1),v.uc("ngForOf",e.dataPools)}}function eo(e,t){1&e&&(v.Xb(0,"span",59),v.bc(1,89),v.Wb())}const to=function(e){return{required:e}};function ao(e,t){if(1&e&&(v.Xb(0,"div",9),v.Xb(1,"label",80),v.Xb(2,"span",70),v.bc(3,81),v.Wb(),v.Sb(4,"cd-helper",82),v.Wb(),v.Xb(5,"div",12),v.Pc(6,Qi,1,0,"input",83),v.Pc(7,Zi,5,4,"select",84),v.Pc(8,eo,2,0,"span",14),v.Wb(),v.Wb()),2&e){v.nc();const e=v.Fc(2),t=v.nc();v.Db(2),v.uc("ngClass",v.zc(4,to,"editing"!==t.mode)),v.Db(4),v.uc("ngIf","editing"===t.mode||!t.poolPermission.read),v.Db(1),v.uc("ngIf","editing"!==t.mode&&t.poolPermission.read),v.Db(1),v.uc("ngIf",t.rbdForm.showError("dataPool",e,"required"))}}function io(e,t){1&e&&(v.Xb(0,"span",59),v.bc(1,90),v.Wb())}function oo(e,t){1&e&&(v.Xb(0,"span",59),v.bc(1,91),v.Wb())}function so(e,t){if(1&e&&v.Sb(0,"cd-helper",95),2&e){const e=v.nc().$implicit;v.vc("html",e.helperHtml)}}function no(e,t){if(1&e&&(v.Xb(0,"div",21),v.Sb(1,"input",92),v.Xb(2,"label",93),v.Rc(3),v.Wb(),v.Pc(4,so,1,1,"cd-helper",94),v.Wb()),2&e){const e=t.$implicit;v.Db(1),v.vc("id",e.key),v.vc("name",e.key),v.vc("formControlName",e.key),v.Db(1),v.vc("for",e.key),v.Db(1),v.Sc(e.desc),v.Db(1),v.uc("ngIf",e.helperHtml)}}function co(e,t){if(1&e){const e=v.Yb();v.Xb(0,"a",96),v.lc("click",function(){return v.Ic(e),v.nc(2).advancedEnabled=!0,!1}),v.bc(1,97),v.Wb()}}function ro(e,t){if(1&e&&(v.Xb(0,"option",68),v.Rc(1),v.Wb()),2&e){const e=t.$implicit;v.uc("value",e),v.Db(1),v.Sc(e)}}function lo(e,t){if(1&e&&(v.Xb(0,"option",68),v.Rc(1),v.Wb()),2&e){const e=t.$implicit;v.uc("value",e),v.Db(1),v.Sc(e)}}function bo(e,t){1&e&&(v.Xb(0,"span",59),v.bc(1,98),v.Wb())}function uo(e,t){1&e&&(v.Xb(0,"span",59),v.bc(1,99),v.Wb())}function mo(e,t){1&e&&(v.Xb(0,"span",59),v.bc(1,100),v.Wb())}function po(e,t){1&e&&(v.Xb(0,"span",59),v.bc(1,101),v.Wb())}function fo(e,t){if(1&e){const e=v.Yb();v.Xb(0,"div",1),v.Xb(1,"form",2,3),v.Xb(3,"div",4),v.Xb(4,"div",5),v.bc(5,6),v.oc(6,"titlecase"),v.oc(7,"upperFirst"),v.Wb(),v.Xb(8,"div",7),v.Pc(9,Pi,7,3,"div",8),v.Xb(10,"div",9),v.Xb(11,"label",10),v.bc(12,11),v.Wb(),v.Xb(13,"div",12),v.Sb(14,"input",13),v.Pc(15,$i,3,0,"span",14),v.Pc(16,Ti,3,0,"span",14),v.Wb(),v.Wb(),v.Xb(17,"div",15),v.lc("change",function(t){return v.Ic(e),v.nc().onPoolChange(t.target.value)}),v.Xb(18,"label",16),v.bc(19,17),v.Wb(),v.Xb(20,"div",12),v.Pc(21,Fi,1,0,"input",18),v.Pc(22,Ci,5,4,"select",19),v.Pc(23,Vi,2,0,"span",14),v.Wb(),v.Wb(),v.Pc(24,xi,3,4,"div",8),v.Pc(25,Ui,6,2,"div",8),v.Xb(26,"div",9),v.Xb(27,"div",20),v.Xb(28,"div",21),v.Xb(29,"input",22),v.lc("change",function(){return v.Ic(e),v.nc().onUseDataPoolChange()}),v.Wb(),v.Xb(30,"label",23),v.bc(31,24),v.Wb(),v.Pc(32,ji,3,0,"cd-helper",25),v.Wb(),v.Wb(),v.Wb(),v.Pc(33,ao,9,6,"div",8),v.Xb(34,"div",9),v.Xb(35,"label",26),v.bc(36,27),v.Wb(),v.Xb(37,"div",12),v.Sb(38,"input",28),v.Pc(39,io,2,0,"span",14),v.Pc(40,oo,2,0,"span",14),v.Wb(),v.Wb(),v.Xb(41,"div",29),v.Xb(42,"label",30),v.bc(43,31),v.Wb(),v.Xb(44,"div",12),v.Pc(45,no,5,6,"div",32),v.Wb(),v.Wb(),v.Xb(46,"div",33),v.Xb(47,"div",34),v.Pc(48,co,2,0,"a",35),v.Wb(),v.Wb(),v.Xb(49,"div",36),v.Xb(50,"legend",37),v.bc(51,38),v.Wb(),v.Xb(52,"div",39),v.Xb(53,"h4",37),v.bc(54,40),v.Wb(),v.Xb(55,"div",9),v.Xb(56,"label",41),v.bc(57,42),v.Wb(),v.Xb(58,"div",12),v.Xb(59,"select",43),v.Pc(60,ro,2,2,"option",44),v.Wb(),v.Wb(),v.Wb(),v.Xb(61,"div",9),v.Xb(62,"label",45),v.bc(63,46),v.Wb(),v.Xb(64,"div",12),v.Xb(65,"select",47),v.Xb(66,"option",48),v.bc(67,49),v.Wb(),v.Pc(68,lo,2,2,"option",44),v.Wb(),v.Pc(69,bo,2,0,"span",14),v.Pc(70,uo,2,0,"span",14),v.Wb(),v.Wb(),v.Xb(71,"div",9),v.Xb(72,"label",50),v.bc(73,51),v.Wb(),v.Xb(74,"div",12),v.Sb(75,"input",52),v.Pc(76,mo,2,0,"span",14),v.Pc(77,po,2,0,"span",14),v.Wb(),v.Wb(),v.Wb(),v.Xb(78,"cd-rbd-configuration-form",53),v.lc("changes",function(t){return v.Ic(e),v.nc().getDirtyConfigurationValues=t}),v.Wb(),v.Wb(),v.Wb(),v.Xb(79,"div",54),v.Xb(80,"cd-form-button-panel",55),v.lc("submitActionEvent",function(){return v.Ic(e),v.nc().submit()}),v.oc(81,"titlecase"),v.oc(82,"upperFirst"),v.Wb(),v.Wb(),v.Wb(),v.Wb(),v.Wb()}if(2&e){const e=v.Fc(2),t=v.nc();v.Db(1),v.uc("formGroup",t.rbdForm),v.Db(6),v.fc(v.pc(6,32,t.action))(v.pc(7,34,t.resource)),v.cc(5),v.Db(2),v.uc("ngIf",t.rbdForm.getValue("parent")),v.Db(6),v.uc("ngIf",t.rbdForm.showError("name",e,"required")),v.Db(1),v.uc("ngIf",t.rbdForm.showError("name",e,"pattern")),v.Db(2),v.uc("ngClass",v.zc(40,to,"editing"!==t.mode)),v.Db(3),v.uc("ngIf","editing"===t.mode||!t.poolPermission.read),v.Db(1),v.uc("ngIf","editing"!==t.mode&&t.poolPermission.read),v.Db(1),v.uc("ngIf",t.rbdForm.showError("pool",e,"required")),v.Db(1),v.uc("ngIf","editing"!==t.mode&&t.rbdForm.getValue("pool")&&null===t.namespaces),v.Db(1),v.uc("ngIf","editing"===t.mode&&t.rbdForm.getValue("namespace")||"editing"!==t.mode&&(t.namespaces&&t.namespaces.length>0||!t.poolPermission.read)),v.Db(7),v.uc("ngIf",t.allDataPools.length<=1),v.Db(1),v.uc("ngIf",t.rbdForm.getValue("useDataPool")),v.Db(6),v.uc("ngIf",t.rbdForm.showError("size",e,"required")),v.Db(1),v.uc("ngIf",t.rbdForm.showError("size",e,"invalidSizeObject")),v.Db(5),v.uc("ngForOf",t.featuresList),v.Db(3),v.uc("ngIf",!t.advancedEnabled),v.Db(1),v.uc("hidden",!t.advancedEnabled),v.Db(11),v.uc("ngForOf",t.objectSizes),v.Db(2),v.uc("ngClass",v.zc(42,to,t.rbdForm.getValue("stripingCount"))),v.Db(4),v.uc("ngValue",null),v.Db(2),v.uc("ngForOf",t.objectSizes),v.Db(1),v.uc("ngIf",t.rbdForm.showError("stripingUnit",e,"required")),v.Db(1),v.uc("ngIf",t.rbdForm.showError("stripingUnit",e,"invalidStripingUnit")),v.Db(2),v.uc("ngClass",v.zc(44,to,t.rbdForm.getValue("stripingUnit"))),v.Db(4),v.uc("ngIf",t.rbdForm.showError("stripingCount",e,"required")),v.Db(1),v.uc("ngIf",t.rbdForm.showError("stripingCount",e,"min")),v.Db(1),v.uc("form",t.rbdForm)("initializeData",t.initializeConfigData),v.Db(2),v.uc("form",e)("submitText",v.pc(81,36,t.action)+" "+v.pc(82,38,t.resource))}}let ho=(()=>{class e extends k.a{constructor(e,t,a,i,o,s,n,c,r){super(),this.authStorageService=e,this.route=t,this.poolService=a,this.rbdService=i,this.formatter=o,this.taskWrapper=s,this.dimlessBinaryPipe=n,this.actionLabels=c,this.router=r,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=yi,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=I.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 P.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 P.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===Si.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=w.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(p.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"),c=e.toBytes(null!=n.value?n.value:this.defaultObjectSize),r=t.get("stripingCount"),l=null!=r.value?r.value:1;let b=null;null===s.value?b={required:!0}:l*c>e.toBytes(s.value)&&(b={invalidSizeObject:!0}),s.setErrors(b);const d=t.get("stripingUnit");let u=null;null===d.value&&null!==r.value?u={required:!0}:null!==d.value&&e.toBytes(d.value)>c&&(u={invalidStripingUnit:!0}),d.setErrors(u);let m=null;return null===r.value&&null!==d.value?m={required:!0}:l<1&&(m={min:!0}),r.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 w.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 _i;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 T.a("rbd/create",{pool_name:e.pool_name,namespace:e.namespace,image_name:e.name}),call:this.rbdService.create(e)})}editRequest(){const e=new Wi;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 Di;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 w.a(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new T.a("rbd/edit",{image_spec:e.toString()}),call:this.rbdService.update(e,this.editRequest())})}cloneAction(){const e=this.cloneRequest(),t=new w.a(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new T.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 wi;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 w.a(this.response.pool_name,this.response.namespace,this.response.name);return this.taskWrapper.wrapTaskAroundCall({task:new T.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(ui.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)(v.Rb(lt.a),v.Rb(s.a),v.Rb(pi.a),v.Rb(W),v.Rb(gi.a),v.Rb(R.a),v.Rb(hi.a),v.Rb(l.b),v.Rb(s.e))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-form"]],features:[v.Ab],decls:1,vars:1,consts:function(){let e,t,a,i,o,s,n,c,r,l,b,d,u,m,p,f,h,g,v,S,D,w,_,W,y,X,I,k,P,$,T,F,R,E,z,N;return e="" + "\ufffd0\ufffd" + " " + "\ufffd1\ufffd" + "",t="Name",a="Pool",i="Use a dedicated data pool",o="Size",s="e.g., 10GiB",n="Features",c="Advanced",r="Striping",l="Object size",b="Stripe unit",d="-- Select stripe unit --",u="Stripe count",m="" + "\ufffd0\ufffd" + " from",p="This field is required.",f="'/' and '@' are not allowed.",h="Loading...",g="-- No rbd pools available --",v="-- Select a pool --",S="This field is required.",D="Loading...",w="-- No namespaces available --",_="-- Select a namespace --",W="You need more than one pool with the rbd application label use to use a dedicated data pool.",y="Data pool",X="Dedicated pool that stores the object-data of the RBD.",I="Loading...",k="-- No data pools available --",P="This field is required.",$="This field is required.",T="You have to increase the size.",F="Advanced...",R="This field is required because stripe count is defined!",E="Stripe unit is greater than object size.",z="This field is required because stripe unit is defined!",N="Stripe count must be greater than 0.",[["class","cd-col-form",4,"cdFormLoading"],[1,"cd-col-form"],["name","rbdForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"card"],[1,"card-header"],e,[1,"card-body"],["class","form-group row",4,"ngIf"],[1,"form-group","row"],["for","name",1,"cd-col-form-label","required"],t,[1,"cd-col-form-input"],["type","text","placeholder","Name...","id","name","name","name","formControlName","name","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],[1,"form-group","row",3,"change"],["for","pool",1,"cd-col-form-label",3,"ngClass"],a,["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"],i,[4,"ngIf"],["for","size",1,"cd-col-form-label","required"],o,["id","size","name","size","type","text","formControlName","size","placeholder",s,"defaultUnit","GiB","cdDimlessBinary","",1,"form-control"],["formGroupName","features",1,"form-group","row"],["for","features",1,"cd-col-form-label"],n,["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"],c,[1,"col-md-12"],r,["for","size",1,"cd-col-form-label"],l,["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"],b,["id","stripingUnit","name","stripingUnit","formControlName","stripingUnit",1,"form-control","custom-select"],[3,"ngValue"],d,["for","stripingCount",1,"cd-col-form-label",3,"ngClass"],u,["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"],m,["type","text","id","parent","name","parent","formControlName","parent",1,"form-control"],[1,"invalid-feedback"],p,f,["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"],h,g,v,[3,"value"],S,[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"],D,w,_,W,["for","dataPool",1,"cd-col-form-label"],y,["html",X],["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"],I,k,P,$,T,["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"],F,R,E,z,N]},template:function(e,t){1&e&&v.Pc(0,fo,83,46,"div",0),2&e&&v.uc("cdFormLoading",t.loading)},directives:[oe.a,o.B,o.r,o.k,z.a,i.r,N.a,C.a,o.d,V.a,o.q,o.i,ha.a,i.p,o.b,Xi.a,o.l,i.q,o.z,o.u,o.C,o.v,Ii.a,A.a,ki.a],pipes:[i.A,le.a],styles:[""]}),e})();var go=a("OLbh"),vo=a("yJti"),So=a("EgGo"),Do=a("wd/R"),wo=a.n(Do),_o=a("2EZI"),Wo=a("MAOJ");function yo(e,t){1&e&&(v.Xb(0,"div",18),v.Xb(1,"span"),v.bc(2,19),v.Wb(),v.Wb())}function Xo(e,t){1&e&&(v.Xb(0,"span",20),v.bc(1,21),v.Wb())}function Io(e,t){1&e&&(v.Xb(0,"span",20),v.bc(1,22),v.Wb())}function ko(e,t){if(1&e&&v.Sb(0,"cd-date-time-picker",23),2&e){const e=v.nc();v.uc("control",e.moveForm.get("expiresAt"))}}let Po=(()=>{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:["",[$.a.custom("format",e=>!(""===e||wo()(e,"YYYY-MM-DD HH:mm:ss").isValid())),$.a.custom("expired",e=>wo()().isAfter(e))]]})}ngOnInit(){this.imageSpec=new w.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=wo()(t,"YYYY-MM-DD HH:mm:ss").diff(wo()(),"seconds",!0)),e<0&&(e=0),this.taskWrapper.wrapTaskAroundCall({task:new T.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)(v.Rb(W),v.Rb(c.a),v.Rb(l.b),v.Rb(_o.a),v.Rb(R.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-trash-move-modal"]],decls:23,vars:9,consts:function(){let e,t,a,i,o,s,n;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.",t=v.gc(t),a="Protection expires at",i="NOT PROTECTED",o="This image contains snapshot(s), which will prevent it from being removed after moved to trash.",s="Wrong date format. Please use \"YYYY-MM-DD HH:mm:ss\".",n="Protection has already expired. Please pick a future date or leave it empty.",[[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,[1,"form-group"],["for","expiresAt",1,"col-form-label"],a,["type","text","placeholder",i,"formControlName","expiresAt","triggers","manual",1,"form-control",3,"ngbPopover","click","keypress"],["p","ngbPopover"],["class","invalid-feedback",4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],["popContent",""],["role","alert",1,"alert","alert-warning"],o,[1,"invalid-feedback"],s,n,[3,"control"]]},template:function(e,t){if(1&e){const e=v.Yb();v.Xb(0,"cd-modal",0),v.Vb(1,1),v.bc(2,2),v.Ub(),v.Vb(3,3),v.Xb(4,"form",4,5),v.Xb(6,"div",6),v.Pc(7,yo,3,0,"div",7),v.Xb(8,"p"),v.hc(9,8),v.Sb(10,"kbd"),v.Sb(11,"kbd"),v.ec(),v.Wb(),v.Xb(12,"div",9),v.Xb(13,"label",10),v.bc(14,11),v.Wb(),v.Xb(15,"input",12,13),v.lc("click",function(){return v.Ic(e),v.Fc(16).open()})("keypress",function(){return v.Ic(e),v.Fc(16).close()}),v.Wb(),v.Pc(17,Xo,2,0,"span",14),v.Pc(18,Io,2,0,"span",14),v.Wb(),v.Wb(),v.Xb(19,"div",15),v.Xb(20,"cd-form-button-panel",16),v.lc("submitActionEvent",function(){return t.moveImage()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb(),v.Pc(21,ko,1,1,"ng-template",null,17,v.Qc)}if(2&e){const e=v.Fc(5),a=v.Fc(22);v.uc("modalRef",t.activeModal),v.Db(4),v.uc("formGroup",t.moveForm),v.Db(3),v.uc("ngIf",t.hasSnapshots),v.Db(4),v.fc(t.imageSpecStr),v.cc(9),v.Db(4),v.uc("ngbPopover",a),v.Db(2),v.uc("ngIf",t.moveForm.showError("expiresAt",e,"format")),v.Db(1),v.uc("ngIf",t.moveForm.showError("expiresAt",e,"expired")),v.Db(2),v.uc("form",t.moveForm)("submitText",t.actionLabels.MOVE)}},directives:[E.a,o.B,o.r,o.k,z.a,i.r,N.a,C.a,o.d,V.a,o.q,o.i,c.w,A.a,Wo.a],styles:[""]}),e})();function $o(e,t){1&e&&(v.Xb(0,"li",10),v.Xb(1,"a",3),v.bc(2,11),v.Wb(),v.Wb())}let To=(()=>{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)(v.Rb(lt.a),v.Rb(s.e))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-tabs"]],decls:12,vars:2,consts:function(){let e,t,a,i;return e="Images",t="Namespaces",a="Trash",i="Overall Performance",[["ngbNav","",1,"nav-tabs",3,"activeId","navChange"],["nav","ngbNav"],["ngbNavItem","/block/rbd"],["ngbNavLink",""],e,["ngbNavItem","/block/rbd/namespaces"],t,["ngbNavItem","/block/rbd/trash"],a,["ngbNavItem","/block/rbd/performance",4,"ngIf"],["ngbNavItem","/block/rbd/performance"],i]},template:function(e,t){1&e&&(v.Xb(0,"ul",0,1),v.lc("navChange",function(e){return t.router.navigate([e.nextId])}),v.Xb(2,"li",2),v.Xb(3,"a",3),v.bc(4,4),v.Wb(),v.Wb(),v.Xb(5,"li",5),v.Xb(6,"a",3),v.bc(7,6),v.Wb(),v.Wb(),v.Xb(8,"li",7),v.Xb(9,"a",3),v.bc(10,8),v.Wb(),v.Wb(),v.Pc(11,$o,3,0,"li",9),v.Wb()),2&e&&(v.uc("activeId",t.router.url),v.Db(11),v.uc("ngIf",t.grafanaPermission.read))},directives:[c.p,c.r,c.s,i.r],styles:[""]}),e})();var Fo=a("LRne"),Ro=a("nQ07"),Eo=a("QTAa"),zo=a("a0VL"),No=a("mSOc"),Co=a("VXsX"),Vo=a("XNiG");function Ao(e,t){1&e&&(v.Xb(0,"span",15),v.bc(1,16),v.Wb())}let xo=(()=>{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 Vo.a,this.action=this.actionLabels.CREATE,this.resource="RBD Snapshot",this.createForm()}createForm(){this.snapshotForm=new P.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 w.a(this.poolName,this.namespace,this.imageName),a=new T.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 w.a(this.poolName,this.namespace,this.imageName),a=new T.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)(v.Rb(c.a),v.Rb(W),v.Rb(Co.a),v.Rb(ut.a),v.Rb(l.b))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-snapshot-form-modal"]],decls:19,vars:15,consts:function(){let e,t,a;return e="" + "\ufffd0\ufffd" + " " + "\ufffd1\ufffd" + "",t="Name",a="This field is required.",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","snapshotForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"form-group","row"],["for","snapshotName",1,"cd-col-form-label","required"],t,[1,"cd-col-form-input"],["type","text","placeholder","Snapshot name...","id","snapshotName","name","snapshotName","formControlName","snapshotName","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],a]},template:function(e,t){if(1&e&&(v.Xb(0,"cd-modal",0),v.Vb(1,1),v.bc(2,2),v.oc(3,"titlecase"),v.oc(4,"upperFirst"),v.Ub(),v.Vb(5,3),v.Xb(6,"form",4,5),v.Xb(8,"div",6),v.Xb(9,"div",7),v.Xb(10,"label",8),v.bc(11,9),v.Wb(),v.Xb(12,"div",10),v.Sb(13,"input",11),v.Pc(14,Ao,2,0,"span",12),v.Wb(),v.Wb(),v.Wb(),v.Xb(15,"div",13),v.Xb(16,"cd-form-button-panel",14),v.lc("submitActionEvent",function(){return t.submit()}),v.oc(17,"titlecase"),v.oc(18,"upperFirst"),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e){const e=v.Fc(7);v.uc("modalRef",t.activeModal),v.Db(4),v.fc(v.pc(3,7,t.action))(v.pc(4,9,t.resource)),v.cc(2),v.Db(2),v.uc("formGroup",t.snapshotForm),v.Db(8),v.uc("ngIf",t.snapshotForm.showError("snapshotName",e,"required")),v.Db(2),v.uc("form",t.snapshotForm)("submitText",v.pc(17,11,t.action)+" "+v.pc(18,13,t.resource))}},directives:[E.a,o.B,o.r,o.k,z.a,N.a,C.a,o.d,V.a,o.q,o.i,ha.a,i.r,A.a],pipes:[i.A,le.a],styles:[""]}),e})();class Oo{constructor(e,t,a){this.featuresName=t,this.cloneFormatVersion=1,a.cloneFormatVersion().subscribe(e=>{this.cloneFormatVersion=e}),this.create={permission:"create",icon:I.a.add,name:e.CREATE},this.rename={permission:"update",icon:I.a.edit,name:e.RENAME},this.protect={permission:"update",icon:I.a.lock,visible:e=>e.hasSingleSelection&&!e.first().is_protected,name:e.PROTECT},this.unprotect={permission:"update",icon:I.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:I.a.clone,name:e.CLONE},this.copy={permission:"create",canBePrimary:e=>e.hasSingleSelection,disable:e=>!e.hasSingleSelection||e.first().cdExecuting,icon:I.a.copy,name:e.COPY},this.rollback={permission:"update",icon:I.a.undo,name:e.ROLLBACK},this.deleteSnap={permission:"delete",icon:I.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 Mo{}const Bo=["nameTpl"],qo=["rollbackTpl"];function Lo(e,t){if(1&e&&(v.Vb(0),v.bc(1,3),v.Ub(),v.Xb(2,"strong"),v.Rc(3),v.Wb(),v.Rc(4,".\n")),2&e){const e=t.$implicit;v.Db(3),v.Tc(" ",e.snapName,"")}}let Go=(()=>{class e{constructor(e,t,a,i,o,s,n,c,r,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=c,this.taskListService=r,this.actionLabels=l,this.cdr=b,this.snapshots=[],this.selection=new nt.a,this.builders={"rbd/snap/create":e=>{const t=new Mo;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 w.a(this.poolName,this.namespace,this.rbdName),this.rbdTableActions=new Oo(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(Fo.a)(this.snapshots),null,e=>{Ro.a.updateChanged(this,{data:e})&&(this.cdr.detectChanges(),this.data=[...this.data])},()=>{Ro.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 w.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(xo),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}_${wo()().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 T.a;a.name="rbd/snap/edit";const i=new w.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 T.a;i.name=t,i.metadata={image_spec:new w.a(this.poolName,this.namespace,this.rbdName).toString(),snapshot_name:a};const o=new w.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 w.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)(v.Rb(lt.a),v.Rb(F.a),v.Rb(hi.a),v.Rb(zo.a),v.Rb(W),v.Rb(Co.a),v.Rb(ut.a),v.Rb(No.a),v.Rb(bt.a),v.Rb(l.b),v.Rb(v.i))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-snapshot-list"]],viewQuery:function(e,t){if(1&e&&(v.Wc(Bo,1),v.Wc(qo,3)),2&e){let e;v.Ec(e=v.mc())&&(t.nameTpl=e.first),v.Ec(e=v.mc())&&(t.rollbackTpl=e.first)}},inputs:{snapshots:"snapshots",featuresName:"featuresName",poolName:"poolName",namespace:"namespace",rbdName:"rbdName"},features:[v.Cb([bt.a]),v.Bb],decls:4,vars:5,consts:function(){let e;return e="You are about to rollback",[["columnMode","flex","selectionType","single",3,"data","columns","updateSelection"],[1,"table-actions",3,"permission","selection","tableActions"],["rollbackTpl",""],e]},template:function(e,t){1&e&&(v.Xb(0,"cd-table",0),v.lc("updateSelection",function(e){return t.updateSelection(e)}),v.Sb(1,"cd-table-actions",1),v.Wb(),v.Pc(2,Lo,5,1,"ng-template",null,2,v.Qc)),2&e&&(v.uc("data",t.data)("columns",t.columns),v.Db(1),v.uc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions))},directives:[ot.a,Xt.a],styles:[""],changeDetection:0}),e})();var Uo=a("aAWM"),jo=a("insk"),Qo=a("nSDx");const Yo=["poolConfigurationSourceTpl"];function Ko(e,t){1&e&&(v.Vb(0),v.hc(1,3),v.Sb(2,"strong"),v.ec(),v.Ub())}function Ho(e,t){if(1&e&&(v.Xb(0,"span"),v.Xb(1,"span",38),v.Rc(2),v.Wb(),v.Wb()),2&e){const e=t.$implicit;v.Db(2),v.Sc(e)}}function Jo(e,t){if(1&e&&(v.Xb(0,"span"),v.Xb(1,"span",39),v.bc(2,40),v.Wb(),v.Wb()),2&e){v.nc(3);const e=v.Fc(1);v.Db(1),v.uc("ngbTooltip",e)}}function Zo(e,t){if(1&e&&(v.Xb(0,"span"),v.Rc(1),v.oc(2,"dimlessBinary"),v.Wb()),2&e){const e=v.nc(3);v.Db(1),v.Tc(" ",v.pc(2,1,e.selection.disk_usage)," ")}}function es(e,t){if(1&e&&(v.Xb(0,"span"),v.Xb(1,"span",39),v.bc(2,41),v.Wb(),v.Wb()),2&e){v.nc(3);const e=v.Fc(1);v.Db(1),v.uc("ngbTooltip",e)}}function ts(e,t){if(1&e&&(v.Xb(0,"span"),v.Rc(1),v.oc(2,"dimlessBinary"),v.Wb()),2&e){const e=v.nc(3);v.Db(1),v.Tc(" ",v.pc(2,1,e.selection.total_disk_usage)," ")}}function as(e,t){if(1&e&&(v.Xb(0,"span"),v.Rc(1),v.Wb()),2&e){const e=v.nc(4);v.Db(1),v.Tc("/",e.selection.parent.pool_namespace,"")}}function is(e,t){if(1&e&&(v.Xb(0,"span"),v.Rc(1),v.Pc(2,as,2,1,"span",1),v.Rc(3),v.Wb()),2&e){const e=v.nc(3);v.Db(1),v.Sc(e.selection.parent.pool_name),v.Db(1),v.uc("ngIf",e.selection.parent.pool_namespace),v.Db(1),v.Uc("/",e.selection.parent.image_name,"@",e.selection.parent.snap_name,"")}}function os(e,t){1&e&&(v.Xb(0,"span"),v.Rc(1,"-"),v.Wb())}function ss(e,t){if(1&e&&(v.Xb(0,"table",17),v.Xb(1,"tbody"),v.Xb(2,"tr"),v.Xb(3,"td",18),v.bc(4,19),v.Wb(),v.Xb(5,"td",20),v.Rc(6),v.Wb(),v.Wb(),v.Xb(7,"tr"),v.Xb(8,"td",21),v.bc(9,22),v.Wb(),v.Xb(10,"td"),v.Rc(11),v.Wb(),v.Wb(),v.Xb(12,"tr"),v.Xb(13,"td",21),v.bc(14,23),v.Wb(),v.Xb(15,"td"),v.Rc(16),v.oc(17,"empty"),v.Wb(),v.Wb(),v.Xb(18,"tr"),v.Xb(19,"td",21),v.bc(20,24),v.Wb(),v.Xb(21,"td"),v.Rc(22),v.oc(23,"cdDate"),v.Wb(),v.Wb(),v.Xb(24,"tr"),v.Xb(25,"td",21),v.bc(26,25),v.Wb(),v.Xb(27,"td"),v.Rc(28),v.oc(29,"dimlessBinary"),v.Wb(),v.Wb(),v.Xb(30,"tr"),v.Xb(31,"td",21),v.bc(32,26),v.Wb(),v.Xb(33,"td"),v.Rc(34),v.oc(35,"dimless"),v.Wb(),v.Wb(),v.Xb(36,"tr"),v.Xb(37,"td",21),v.bc(38,27),v.Wb(),v.Xb(39,"td"),v.Rc(40),v.oc(41,"dimlessBinary"),v.Wb(),v.Wb(),v.Xb(42,"tr"),v.Xb(43,"td",21),v.bc(44,28),v.Wb(),v.Xb(45,"td"),v.Pc(46,Ho,3,1,"span",29),v.Wb(),v.Wb(),v.Xb(47,"tr"),v.Xb(48,"td",21),v.bc(49,30),v.Wb(),v.Xb(50,"td"),v.Pc(51,Jo,3,1,"span",1),v.Pc(52,Zo,3,3,"span",1),v.Wb(),v.Wb(),v.Xb(53,"tr"),v.Xb(54,"td",21),v.bc(55,31),v.Wb(),v.Xb(56,"td"),v.Pc(57,es,3,1,"span",1),v.Pc(58,ts,3,3,"span",1),v.Wb(),v.Wb(),v.Xb(59,"tr"),v.Xb(60,"td",21),v.bc(61,32),v.Wb(),v.Xb(62,"td"),v.Rc(63),v.oc(64,"dimlessBinary"),v.Wb(),v.Wb(),v.Xb(65,"tr"),v.Xb(66,"td",21),v.bc(67,33),v.Wb(),v.Xb(68,"td"),v.Rc(69),v.Wb(),v.Wb(),v.Xb(70,"tr"),v.Xb(71,"td",21),v.bc(72,34),v.Wb(),v.Xb(73,"td"),v.Pc(74,is,4,4,"span",1),v.Pc(75,os,2,0,"span",1),v.Wb(),v.Wb(),v.Xb(76,"tr"),v.Xb(77,"td",21),v.bc(78,35),v.Wb(),v.Xb(79,"td"),v.Rc(80),v.Wb(),v.Wb(),v.Xb(81,"tr"),v.Xb(82,"td",21),v.bc(83,36),v.Wb(),v.Xb(84,"td"),v.Rc(85),v.Wb(),v.Wb(),v.Xb(86,"tr"),v.Xb(87,"td",21),v.bc(88,37),v.Wb(),v.Xb(89,"td"),v.Rc(90),v.Wb(),v.Wb(),v.Wb(),v.Wb()),2&e){const e=v.nc(2);v.Db(6),v.Sc(e.selection.name),v.Db(5),v.Sc(e.selection.pool_name),v.Db(5),v.Sc(v.pc(17,19,e.selection.data_pool)),v.Db(6),v.Sc(v.pc(23,21,e.selection.timestamp)),v.Db(6),v.Sc(v.pc(29,23,e.selection.size)),v.Db(6),v.Sc(v.pc(35,25,e.selection.num_objs)),v.Db(6),v.Sc(v.pc(41,27,e.selection.obj_size)),v.Db(6),v.uc("ngForOf",e.selection.features_name),v.Db(5),v.uc("ngIf",-1===(null==e.selection.features_name?null:e.selection.features_name.indexOf("fast-diff"))),v.Db(1),v.uc("ngIf",-1!==(null==e.selection.features_name?null:e.selection.features_name.indexOf("fast-diff"))),v.Db(5),v.uc("ngIf",-1===(null==e.selection.features_name?null:e.selection.features_name.indexOf("fast-diff"))),v.Db(1),v.uc("ngIf",-1!==(null==e.selection.features_name?null:e.selection.features_name.indexOf("fast-diff"))),v.Db(5),v.Sc(v.pc(64,29,e.selection.stripe_unit)),v.Db(6),v.Sc(e.selection.stripe_count),v.Db(5),v.uc("ngIf",e.selection.parent),v.Db(1),v.uc("ngIf",!e.selection.parent),v.Db(5),v.Sc(e.selection.block_name_prefix),v.Db(5),v.Sc(e.selection.order),v.Db(5),v.Sc(e.selection.image_format)}}function ns(e,t){if(1&e&&v.Sb(0,"cd-rbd-snapshot-list",42),2&e){const e=v.nc(2);v.uc("snapshots",e.selection.snapshots)("featuresName",e.selection.features_name)("poolName",e.selection.pool_name)("namespace",e.selection.namespace)("rbdName",e.selection.name)}}function cs(e,t){if(1&e&&v.Sb(0,"cd-rbd-configuration-table",43),2&e){const e=v.nc(2);v.uc("data",e.selection.configuration)}}function rs(e,t){if(1&e&&v.Sb(0,"cd-grafana",44),2&e){const e=v.nc(2);v.uc("grafanaPath",e.rbdDashboardUrl)}}function ls(e,t){if(1&e&&(v.Vb(0),v.Xb(1,"ul",4,5),v.Xb(3,"li",6),v.Xb(4,"a",7),v.bc(5,8),v.Wb(),v.Pc(6,ss,91,31,"ng-template",9),v.Wb(),v.Xb(7,"li",10),v.Xb(8,"a",7),v.bc(9,11),v.Wb(),v.Pc(10,ns,1,5,"ng-template",9),v.Wb(),v.Xb(11,"li",12),v.Xb(12,"a",7),v.bc(13,13),v.Wb(),v.Pc(14,cs,1,1,"ng-template",9),v.Wb(),v.Xb(15,"li",14),v.Xb(16,"a",7),v.bc(17,15),v.Wb(),v.Pc(18,rs,1,1,"ng-template",9),v.Wb(),v.Wb(),v.Sb(19,"div",16),v.Ub()),2&e){const e=v.Fc(2);v.Db(19),v.uc("ngbNavOutlet",e)}}function bs(e,t){1&e&&(v.Vb(0),v.Xb(1,"cd-alert-panel",45),v.bc(2,46),v.Wb(),v.Ub())}function ds(e,t){1&e&&(v.Vb(0),v.Xb(1,"strong",49),v.bc(2,50),v.Wb(),v.Ub())}function us(e,t){1&e&&(v.Xb(0,"span",51),v.bc(1,52),v.Wb())}function ms(e,t){if(1&e&&(v.Pc(0,ds,3,0,"ng-container",47),v.Pc(1,us,2,0,"ng-template",null,48,v.Qc)),2&e){const e=t.value,a=v.Fc(2);v.uc("ngIf",+e)("ngIfElse",a)}}let ps=(()=>{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=v.Lb({type:e,selectors:[["cd-rbd-details"]],viewQuery:function(e,t){if(1&e&&(v.Wc(Yo,3),v.Wc(c.p,3)),2&e){let e;v.Ec(e=v.mc())&&(t.poolConfigurationSourceTpl=e.first),v.Ec(e=v.mc())&&(t.nav=e.first)}},inputs:{selection:"selection",images:"images"},features:[v.Bb],decls:6,vars:2,consts:function(){let e,t,a,i,o,s,n,c,r,l,b,d,u,m,p,f,h,g,v,S,D,w,_,W,y,X,I,k;return e="Only available for RBD images with " + "\ufffd#2\ufffd" + "fast-diff" + "\ufffd/#2\ufffd" + " enabled",t="Details",a="Snapshots",i="Configuration",o="Performance",s="Name",n="Pool",c="Data Pool",r="Created",l="Size",b="Objects",d="Object size",u="Features",m="Provisioned",p="Total provisioned",f="Striping unit",h="Striping count",g="Parent",v="Block name prefix",S="Order",D="Format Version",w="N/A",_="N/A",W="Information can not be displayed for RBD in status 'Removing'.",y="This setting overrides the global value",X="Image",I="This is the global value. No value for this option has been set for this image.",k="Global",[["usageNotAvailableTooltipTpl",""],[4,"ngIf"],["poolConfigurationSourceTpl",""],e,["ngbNav","","cdStatefulTab","rbd-details",1,"nav-tabs"],["nav","ngbNav"],["ngbNavItem","details"],["ngbNavLink",""],t,["ngbNavContent",""],["ngbNavItem","snapshots"],a,["ngbNavItem","configuration"],i,["ngbNavItem","performance"],o,[3,"ngbNavOutlet"],[1,"table","table-striped","table-bordered"],[1,"bold","w-25"],s,[1,"w-75"],[1,"bold"],n,c,r,l,b,d,u,[4,"ngFor","ngForOf"],m,p,f,h,g,v,S,D,[1,"badge","badge-dark","mr-2"],["placement","top",1,"form-text","text-muted",3,"ngbTooltip"],w,_,[3,"snapshots","featuresName","poolName","namespace","rbdName"],[3,"data"],["uid","YhCYGcuZz","grafanaStyle","one",3,"grafanaPath"],["type","warning"],W,[4,"ngIf","ngIfElse"],["global",""],["ngbTooltip",y],X,["ngbTooltip",I],k]},template:function(e,t){1&e&&(v.Pc(0,Ko,3,0,"ng-template",null,0,v.Qc),v.Pc(2,ls,20,1,"ng-container",1),v.Pc(3,bs,3,0,"ng-container",1),v.Pc(4,ms,3,2,"ng-template",null,2,v.Qc)),2&e&&(v.Db(2),v.uc("ngIf",t.selection&&"REMOVING"!==t.selection.source),v.Db(1),v.uc("ngIf",t.selection&&"REMOVING"===t.selection.source))},directives:[i.r,c.p,Za.a,c.r,c.s,c.q,c.u,i.q,c.D,Go,Uo.a,jo.a,Wt.a],pipes:[Qo.a,zo.a,hi.a,Gt.a],styles:[""]}),e})();const fs=["usageTpl"],hs=["parentTpl"],gs=["nameTpl"],vs=["flattenTpl"],Ss=["deleteTpl"],Ds=["removingStatTpl"],ws=["provisionedNotAvailableTooltipTpl"],_s=["totalProvisionedNotAvailableTooltipTpl"];function Ws(e,t){1&e&&v.Sb(0,"div",11),2&e&&v.uc("innerHtml","Only available for RBD images with <strong>fast-diff</strong> enabled",v.Jc)}function ys(e,t){if(1&e&&(v.Xb(0,"span",14),v.bc(1,15),v.Wb()),2&e){v.nc(2);const e=v.Fc(6);v.uc("ngbTooltip",e)}}function Xs(e,t){if(1&e&&(v.bc(0,16),v.oc(1,"dimlessBinary")),2&e){const e=v.nc().row;v.Db(1),v.fc(v.pc(1,1,e.disk_usage)),v.cc(0)}}function Is(e,t){if(1&e&&(v.Pc(0,ys,2,1,"span",12),v.Pc(1,Xs,2,3,"ng-template",null,13,v.Qc)),2&e){const e=t.row,a=v.Fc(2);v.uc("ngIf",null===e.disk_usage)("ngIfElse",a)}}function ks(e,t){if(1&e&&(v.Xb(0,"span",14),v.bc(1,18),v.Wb()),2&e){v.nc(2);const e=v.Fc(6);v.uc("ngbTooltip",e)}}function Ps(e,t){if(1&e&&(v.bc(0,19),v.oc(1,"dimlessBinary")),2&e){const e=v.nc().row;v.Db(1),v.fc(v.pc(1,1,e.total_disk_usage)),v.cc(0)}}function $s(e,t){if(1&e&&(v.Pc(0,ks,2,1,"span",12),v.Pc(1,Ps,2,3,"ng-template",null,17,v.Qc)),2&e){const e=t.row,a=v.Fc(2);v.uc("ngIf",null===e.total_disk_usage)("ngIfElse",a)}}function Ts(e,t){if(1&e&&(v.Xb(0,"span"),v.Rc(1),v.Wb()),2&e){const e=v.nc(2).value;v.Db(1),v.Tc("/",e.pool_namespace,"")}}function Fs(e,t){if(1&e&&(v.Xb(0,"span"),v.Rc(1),v.Pc(2,Ts,2,1,"span",20),v.Rc(3),v.Wb()),2&e){const e=v.nc().value;v.Db(1),v.Sc(e.pool_name),v.Db(1),v.uc("ngIf",e.pool_namespace),v.Db(1),v.Uc("/",e.image_name,"@",e.snap_name,"")}}function Rs(e,t){1&e&&(v.Xb(0,"span"),v.Rc(1,"-"),v.Wb())}function Es(e,t){if(1&e&&(v.Pc(0,Fs,4,4,"span",20),v.Pc(1,Rs,2,0,"span",20)),2&e){const e=t.value;v.uc("ngIf",e),v.Db(1),v.uc("ngIf",!e)}}function zs(e,t){if(1&e&&(v.Rc(0," You are about to flatten "),v.Xb(1,"strong"),v.Rc(2),v.Wb(),v.Rc(3,". "),v.Sb(4,"br"),v.Sb(5,"br"),v.Rc(6," All blocks will be copied from parent "),v.Xb(7,"strong"),v.Rc(8),v.Wb(),v.Rc(9," to child "),v.Xb(10,"strong"),v.Rc(11),v.Wb(),v.Rc(12,".\n")),2&e){const e=t.$implicit;v.Db(2),v.Sc(e.child),v.Db(6),v.Sc(e.parent),v.Db(3),v.Sc(e.child)}}function Ns(e,t){if(1&e&&(v.Xb(0,"li"),v.Rc(1),v.Wb()),2&e){const e=t.$implicit;v.Db(1),v.Sc(e)}}function Cs(e,t){if(1&e&&(v.Vb(0),v.Xb(1,"span"),v.bc(2,24),v.Wb(),v.Xb(3,"ul"),v.Pc(4,Ns,2,1,"li",25),v.Wb(),v.Ub()),2&e){const e=v.nc(2).snapshots;v.Db(4),v.uc("ngForOf",e)}}function Vs(e,t){if(1&e&&(v.Xb(0,"div",22),v.Xb(1,"span"),v.bc(2,23),v.Wb(),v.Sb(3,"br"),v.Pc(4,Cs,5,1,"ng-container",20),v.Wb()),2&e){const e=v.nc().snapshots;v.Db(4),v.uc("ngIf",e.length>0)}}function As(e,t){1&e&&v.Pc(0,Vs,5,1,"div",21),2&e&&v.uc("ngIf",t.hasSnapshots)}const xs=function(e,t){return[e,t]};function Os(e,t){if(1&e&&v.Sb(0,"i",27),2&e){const e=v.nc(2);v.uc("ngClass",v.Ac(1,xs,e.icons.spinner,e.icons.spin))}}function Ms(e,t){if(1&e&&(v.Xb(0,"span",27),v.Rc(1),v.Wb()),2&e){const e=v.nc(),t=e.column,a=e.row;v.uc("ngClass",null!=t&&null!=t.customTemplateConfig&&t.customTemplateConfig.executingClass?t.customTemplateConfig.executingClass:"text-muted italic"),v.Db(1),v.Tc(" (",a.cdExecuting,") ")}}function Bs(e,t){if(1&e&&v.Sb(0,"i",29),2&e){const e=v.nc(2);v.Gb("",e.icons.warning," warn")}}function qs(e,t){if(1&e&&(v.Pc(0,Os,1,4,"i",26),v.Xb(1,"span",27),v.Rc(2),v.Wb(),v.Pc(3,Ms,2,2,"span",26),v.Pc(4,Bs,1,3,"i",28)),2&e){const e=t.column,a=t.value,i=t.row;v.uc("ngIf",i.cdExecuting),v.Db(1),v.uc("ngClass",null==e||null==e.customTemplateConfig?null:e.customTemplateConfig.valueClass),v.Db(1),v.Tc(" ",a," "),v.Db(1),v.uc("ngIf",i.cdExecuting),v.Db(1),v.uc("ngIf",i.source&&"REMOVING"===i.source)}}let Ls=(()=>{class e extends at.a{constructor(e,t,a,i,o,s,n,c,r){super(),this.authStorageService=e,this.rbdService=t,this.dimlessBinaryPipe=a,this.dimlessPipe=i,this.modalService=o,this.taskWrapper=s,this.taskListService=n,this.urlBuilder=c,this.actionLabels=r,this.tableStatus=new Fa.a,this.selection=new nt.a,this.icons=I.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 w.a(this.selection.first().pool_name,this.selection.first().namespace,this.selection.first().name).toStringEncoded();this.tableActions=[{permission:"create",icon:I.a.add,routerLink:()=>this.urlBuilder.getCreate(),canBePrimary:e=>!e.hasSingleSelection,name:this.actionLabels.CREATE},{permission:"update",icon:I.a.edit,routerLink:()=>this.urlBuilder.getEdit(l()),name:this.actionLabels.EDIT,disable:e=>this.getRemovingStatusDesc(e)||this.getInvalidNameDisable(e)},{permission:"create",canBePrimary:e=>e.hasSingleSelection,disable:e=>this.getRemovingStatusDesc(e)||this.getInvalidNameDisable(e)||!!e.first().cdExecuting,icon:I.a.copy,routerLink:()=>`/block/rbd/copy/${l()}`,name:this.actionLabels.COPY},{permission:"update",disable:e=>this.getRemovingStatusDesc(e)||this.getInvalidNameDisable(e)||e.first().cdExecuting||!e.first().parent,icon:I.a.flatten,click:()=>this.flattenRbdModal(),name:this.actionLabels.FLATTEN},{permission:"delete",icon:I.a.destroy,click:()=>this.deleteRbdModal(),name:this.actionLabels.DELETE,disable:e=>this.getDeleteDisableDesc(e)},{permission:"delete",icon:I.a.trash,click:()=>this.trashRbdModal(),name:this.actionLabels.TRASH,disable:e=>this.getRemovingStatusDesc(e)||this.getInvalidNameDisable(e)||e.first().image_format===Si.V1}]}createRbdFromTaskImageSpec(e){const t=w.a.fromString(e);return this.createRbdFromTask(t.poolName,t.namespace,t.imageName)}createRbdFromTask(e,t,a){const i=new vi;return i.id="-1",i.unique_id="-1",i.name=a,i.namespace=t,i.pool_name=e,i.image_format=Si.V2,i}ngOnInit(){this.columns=[{name:"Name",prop:"name",flexGrow:2,cellTemplate:this.removingStatTpl},{name:"Pool",prop:"pool_name",flexGrow:2},{name:"Namespace",prop:"namespace",flexGrow:2},{name:"Size",prop:"size",flexGrow:1,cellClass:"text-right",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,cellTemplate:this.provisionedNotAvailableTooltipTpl},{name:"Total provisioned",prop:"total_disk_usage",cellClass:"text-center",flexGrow:1,pipe:this.dimlessBinaryPipe,cellTemplate:this.totalProvisionedNotAvailableTooltipTpl},{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 w.a(t.metadata.dest_pool_name,t.metadata.dest_namespace,t.metadata.dest_image_name).toString();break;case"rbd/clone":a=new w.a(t.metadata.child_pool_name,t.metadata.child_namespace,t.metadata.child_image_name).toString();break;case"rbd/create":a=new w.a(t.metadata.pool_name,t.metadata.namespace,t.metadata.image_name).toString();break;default:a=t.metadata.image_spec}return a===new w.a(e.pool_name,e.namespace,e.name).toString()},this.builders)}onFetchError(){this.table.reset(),this.tableStatus=new Fa.a(vo.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[vo.a.ValueException]?i=vo.a.ValueException:a[vo.a.ValueStale]?i=vo.a.ValueStale:a[vo.a.ValueNone]&&(i=vo.a.ValueNone),i){const e=(a[i].length>1?"pools ":"pool ")+a[i].join();this.tableStatus=new Fa.a(i,e)}else this.tableStatus=new Fa.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 w.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 T.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(Po,e)}flattenRbd(e){this.taskWrapper.wrapTaskAroundCall({task:new T.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 w.a(i.pool_name,i.pool_namespace,i.image_name),s=new w.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}getRemovingStatusDesc(e){const t=e.first();return"REMOVING"===(null==t?void 0:t.source)&&"Action not possible for an RBD in status 'Removing'"}}return e.\u0275fac=function(t){return new(t||e)(v.Rb(lt.a),v.Rb(W),v.Rb(hi.a),v.Rb(Gt.a),v.Rb(F.a),v.Rb(R.a),v.Rb(bt.a),v.Rb(So.a),v.Rb(l.b))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-list"]],viewQuery:function(e,t){if(1&e&&(v.Wc(ot.a,3),v.Wc(fs,1),v.Wc(hs,3),v.Wc(gs,1),v.Wc(vs,3),v.Wc(Ss,3),v.Wc(Ds,3),v.Wc(ws,3),v.Wc(_s,3)),2&e){let e;v.Ec(e=v.mc())&&(t.table=e.first),v.Ec(e=v.mc())&&(t.usageTpl=e.first),v.Ec(e=v.mc())&&(t.parentTpl=e.first),v.Ec(e=v.mc())&&(t.nameTpl=e.first),v.Ec(e=v.mc())&&(t.flattenTpl=e.first),v.Ec(e=v.mc())&&(t.deleteTpl=e.first),v.Ec(e=v.mc())&&(t.removingStatTpl=e.first),v.Ec(e=v.mc())&&(t.provisionedNotAvailableTooltipTpl=e.first),v.Ec(e=v.mc())&&(t.totalProvisionedNotAvailableTooltipTpl=e.first)}},features:[v.Cb([bt.a,{provide:So.a,useValue:new So.a("block/rbd")}]),v.Ab],decls:19,vars:10,consts:function(){let e,t,a,i,o,s,n;return e="N/A",t="" + "\ufffd0\ufffd" + "",a="N/A",i="" + "\ufffd0\ufffd" + "",o="Deleting this image will also delete all its snapshots.",s="The following snapshots are currently protected and will be removed:",n="RBD in status 'Removing'",[["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",""],["provisionedNotAvailableTooltipTpl",""],["totalProvisionedNotAvailableTooltipTpl",""],["parentTpl",""],["flattenTpl",""],["deleteTpl",""],["removingStatTpl",""],[3,"innerHtml"],["placement","top",3,"ngbTooltip",4,"ngIf","ngIfElse"],["provisioned",""],["placement","top",3,"ngbTooltip"],e,t,["totalProvisioned",""],a,i,[4,"ngIf"],["class","alert alert-warning","role","alert",4,"ngIf"],["role","alert",1,"alert","alert-warning"],o,s,[4,"ngFor","ngForOf"],[3,"ngClass",4,"ngIf"],[3,"ngClass"],["title",n,3,"class",4,"ngIf"],["title",n]]},template:function(e,t){1&e&&(v.Sb(0,"cd-rbd-tabs"),v.Xb(1,"cd-table",0,1),v.lc("fetchData",function(){return t.taskListService.fetch()})("setExpandedRow",function(e){return t.setExpandedRow(e)})("updateSelection",function(e){return t.updateSelection(e)}),v.Sb(3,"cd-table-actions",2),v.Sb(4,"cd-rbd-details",3),v.Wb(),v.Pc(5,Ws,1,1,"ng-template",null,4,v.Qc),v.Pc(7,Is,3,2,"ng-template",null,5,v.Qc),v.Pc(9,$s,3,2,"ng-template",null,6,v.Qc),v.Pc(11,Es,2,2,"ng-template",null,7,v.Qc),v.Pc(13,zs,13,3,"ng-template",null,8,v.Qc),v.Pc(15,As,1,1,"ng-template",null,9,v.Qc),v.Pc(17,qs,5,5,"ng-template",null,10,v.Qc)),2&e&&(v.Db(1),v.uc("data",t.images)("columns",t.columns)("searchableObjects",!0)("hasDetails",!0)("status",t.tableStatus)("autoReload",-1),v.Db(2),v.uc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions),v.Db(1),v.uc("selection",t.expandedRow))},directives:[To,ot.a,Xt.a,ps,i.r,c.D,i.q,i.p],pipes:[hi.a],styles:[".warn[_ngcontent-%COMP%]{color:#ffc200}"]}),e})();function Gs(e,t){1&e&&v.Sb(0,"input",19)}function Us(e,t){1&e&&(v.Xb(0,"option",23),v.bc(1,24),v.Wb()),2&e&&v.uc("ngValue",null)}function js(e,t){1&e&&(v.Xb(0,"option",23),v.bc(1,25),v.Wb()),2&e&&v.uc("ngValue",null)}function Qs(e,t){1&e&&(v.Xb(0,"option",23),v.bc(1,26),v.Wb()),2&e&&v.uc("ngValue",null)}function Ys(e,t){if(1&e&&(v.Xb(0,"option",27),v.Rc(1),v.Wb()),2&e){const e=t.$implicit;v.uc("value",e.pool_name),v.Db(1),v.Sc(e.pool_name)}}function Ks(e,t){if(1&e&&(v.Xb(0,"select",20),v.Pc(1,Us,2,1,"option",21),v.Pc(2,js,2,1,"option",21),v.Pc(3,Qs,2,1,"option",21),v.Pc(4,Ys,2,2,"option",22),v.Wb()),2&e){const e=v.nc();v.Db(1),v.uc("ngIf",null===e.pools),v.Db(1),v.uc("ngIf",null!==e.pools&&0===e.pools.length),v.Db(1),v.uc("ngIf",null!==e.pools&&e.pools.length>0),v.Db(1),v.uc("ngForOf",e.pools)}}function Hs(e,t){1&e&&(v.Xb(0,"span",28),v.bc(1,29),v.Wb())}function Js(e,t){1&e&&(v.Xb(0,"span",28),v.bc(1,30),v.Wb())}function Zs(e,t){1&e&&(v.Xb(0,"span",28),v.bc(1,31),v.Wb())}let en=(()=>{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 P.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 Vo.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 T.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)(v.Rb(c.a),v.Rb(l.b),v.Rb(lt.a),v.Rb(ut.a),v.Rb(pi.a),v.Rb(W))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-namespace-form-modal"]],decls:23,vars:9,consts:function(){let e,t,a,i,o,s,n,c,r;return e="Create Namespace",t="Pool",a="Name",i="Loading...",o="-- No rbd pools available --",s="-- Select a pool --",n="This field is required.",c="This field is required.",r="Namespace already exists.",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","namespaceForm","novalidate","",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],[1,"form-group","row"],["for","pool",1,"cd-col-form-label","required"],t,[1,"cd-col-form-input"],["class","form-control","type","text","placeholder","Pool name...","id","pool","name","pool","formControlName","pool",4,"ngIf"],["id","pool","name","pool","class","form-control custom-select","formControlName","pool",4,"ngIf"],["class","invalid-feedback",4,"ngIf"],["for","namespace",1,"cd-col-form-label","required"],a,["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"],i,o,s,[3,"value"],[1,"invalid-feedback"],n,c,r]},template:function(e,t){if(1&e&&(v.Xb(0,"cd-modal",0),v.Vb(1,1),v.bc(2,2),v.Ub(),v.Vb(3,3),v.Xb(4,"form",4,5),v.Xb(6,"div",6),v.Xb(7,"div",7),v.Xb(8,"label",8),v.bc(9,9),v.Wb(),v.Xb(10,"div",10),v.Pc(11,Gs,1,0,"input",11),v.Pc(12,Ks,5,4,"select",12),v.Pc(13,Hs,2,0,"span",13),v.Wb(),v.Wb(),v.Xb(14,"div",7),v.Xb(15,"label",14),v.bc(16,15),v.Wb(),v.Xb(17,"div",10),v.Sb(18,"input",16),v.Pc(19,Js,2,0,"span",13),v.Pc(20,Zs,2,0,"span",13),v.Wb(),v.Wb(),v.Wb(),v.Xb(21,"div",17),v.Xb(22,"cd-form-button-panel",18),v.lc("submitActionEvent",function(){return t.submit()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e){const e=v.Fc(5);v.uc("modalRef",t.activeModal),v.Db(4),v.uc("formGroup",t.namespaceForm),v.Db(7),v.uc("ngIf",!t.poolPermission.read),v.Db(1),v.uc("ngIf",t.poolPermission.read),v.Db(1),v.uc("ngIf",t.namespaceForm.showError("pool",e,"required")),v.Db(6),v.uc("ngIf",t.namespaceForm.showError("namespace",e,"required")),v.Db(1),v.uc("ngIf",t.namespaceForm.showError("namespace",e,"namespaceExists")),v.Db(2),v.uc("form",t.namespaceForm)("submitText",t.actionLabels.CREATE)}},directives:[E.a,o.B,o.r,o.k,z.a,N.a,i.r,C.a,o.d,V.a,o.q,o.i,ha.a,A.a,o.z,i.q,o.u,o.C],styles:[""]}),e})(),tn=(()=>{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:I.a.add,click:()=>this.createModal(),name:this.actionLabels.CREATE},{permission:"delete",icon:I.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(p.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(en),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)(v.Rb(lt.a),v.Rb(W),v.Rb(pi.a),v.Rb(F.a),v.Rb(ut.a),v.Rb(l.b))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-namespace-list"]],features:[v.Cb([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&&(v.Sb(0,"cd-rbd-tabs"),v.Xb(1,"cd-table",0),v.lc("fetchData",function(){return t.refresh()})("updateSelection",function(e){return t.updateSelection(e)}),v.Xb(2,"div",1),v.Sb(3,"cd-table-actions",2),v.Wb(),v.Wb()),2&e&&(v.Db(1),v.uc("data",t.namespaces)("columns",t.columns),v.Db(2),v.uc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions))},directives:[To,ot.a,Xt.a],styles:[""]}),e})(),an=(()=>{class e{}return e.\u0275fac=function(t){return new(t||e)},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-performance"]],decls:2,vars:1,consts:[["uid","41FrpeUiz","grafanaStyle","two",3,"grafanaPath"]],template:function(e,t){1&e&&(v.Sb(0,"cd-rbd-tabs"),v.Sb(1,"cd-grafana",0)),2&e&&(v.Db(1),v.uc("grafanaPath","rbd-overview?"))},directives:[To,jo.a],styles:[""]}),e})();function on(e,t){1&e&&v.Sb(0,"input",15)}function sn(e,t){if(1&e&&(v.Xb(0,"option",20),v.Rc(1),v.Wb()),2&e){const e=t.$implicit;v.uc("value",e),v.Db(1),v.Sc(e)}}function nn(e,t){if(1&e&&(v.Xb(0,"select",16),v.Xb(1,"option",17),v.bc(2,18),v.Wb(),v.Pc(3,sn,2,2,"option",19),v.Wb()),2&e){const e=v.nc();v.Db(3),v.uc("ngForOf",e.pools)}}let cn=(()=>{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 T.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)(v.Rb(lt.a),v.Rb(W),v.Rb(c.a),v.Rb(l.b),v.Rb(_o.a),v.Rb(pi.a),v.Rb(R.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-trash-purge-modal"]],decls:18,vars:6,consts:function(){let e,t,a,i,o;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",t=v.gc(t),a="Pool:",i="Pool name...",o="All",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","purgeForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t,[1,"form-group"],[1,"col-form-label","mx-auto"],a,["class","form-control","type","text","placeholder",i,"formControlName","poolName",4,"ngIf"],["id","poolName","name","poolName","class","form-control custom-select","formControlName","poolName",4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],["type","text","placeholder",i,"formControlName","poolName",1,"form-control"],["id","poolName","name","poolName","formControlName","poolName",1,"form-control","custom-select"],["value",""],o,[3,"value",4,"ngFor","ngForOf"],[3,"value"]]},template:function(e,t){1&e&&(v.Xb(0,"cd-modal",0),v.Vb(1,1),v.bc(2,2),v.Ub(),v.Vb(3,3),v.Xb(4,"form",4,5),v.Xb(6,"div",6),v.Xb(7,"p"),v.hc(8,7),v.Sb(9,"kbd"),v.Sb(10,"kbd"),v.ec(),v.Wb(),v.Xb(11,"div",8),v.Xb(12,"label",9),v.bc(13,10),v.Wb(),v.Pc(14,on,1,0,"input",11),v.Pc(15,nn,4,1,"select",12),v.Wb(),v.Wb(),v.Xb(16,"div",13),v.Xb(17,"cd-form-button-panel",14),v.lc("submitActionEvent",function(){return t.purge()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e&&(v.uc("modalRef",t.activeModal),v.Db(4),v.uc("formGroup",t.purgeForm),v.Db(10),v.uc("ngIf",!t.poolPermission.read),v.Db(1),v.uc("ngIf",t.poolPermission.read),v.Db(2),v.uc("form",t.purgeForm)("submitText",t.actionLabels.PURGE))},directives:[E.a,o.B,o.r,o.k,z.a,N.a,i.r,A.a,C.a,o.d,V.a,o.q,o.i,o.z,o.u,o.C,i.q],styles:[""]}),e})();function rn(e,t){1&e&&(v.Xb(0,"span",15),v.bc(1,16),v.Wb())}let ln=(()=>{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 w.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 w.a(this.poolName,this.namespace,this.imageId);this.taskWrapper.wrapTaskAroundCall({task:new T.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)(v.Rb(W),v.Rb(c.a),v.Rb(l.b),v.Rb(_o.a),v.Rb(R.a))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-trash-restore-modal"]],decls:18,vars:7,consts:function(){let e,t,a,i;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]" + ".",t=v.gc(t),a="New Name",i="This field is required.",[[3,"modalRef"],[1,"modal-title"],e,[1,"modal-content"],["name","restoreForm","novalidate","",1,"form",3,"formGroup"],["formDir","ngForm"],[1,"modal-body"],t,[1,"form-group"],["for","name",1,"col-form-label"],a,["type","text","name","name","id","name","autocomplete","off","formControlName","name","autofocus","",1,"form-control"],["class","invalid-feedback",4,"ngIf"],[1,"modal-footer"],[3,"form","submitText","submitActionEvent"],[1,"invalid-feedback"],i]},template:function(e,t){if(1&e&&(v.Xb(0,"cd-modal",0),v.Vb(1,1),v.bc(2,2),v.Ub(),v.Vb(3,3),v.Xb(4,"form",4,5),v.Xb(6,"div",6),v.Xb(7,"p"),v.hc(8,7),v.Sb(9,"kbd"),v.Sb(10,"kbd"),v.ec(),v.Wb(),v.Xb(11,"div",8),v.Xb(12,"label",9),v.bc(13,10),v.Wb(),v.Sb(14,"input",11),v.Pc(15,rn,2,0,"span",12),v.Wb(),v.Wb(),v.Xb(16,"div",13),v.Xb(17,"cd-form-button-panel",14),v.lc("submitActionEvent",function(){return t.restore()}),v.Wb(),v.Wb(),v.Wb(),v.Ub(),v.Wb()),2&e){const e=v.Fc(5);v.uc("modalRef",t.activeModal),v.Db(4),v.uc("formGroup",t.restoreForm),v.Db(6),v.fc(t.imageSpec)(t.imageId),v.cc(8),v.Db(5),v.uc("ngIf",t.restoreForm.showError("name",e,"required")),v.Db(2),v.uc("form",t.restoreForm)("submitText",t.actionLabels.RESTORE)}},directives:[E.a,o.B,o.r,o.k,z.a,N.a,C.a,o.d,V.a,o.q,o.i,ha.a,i.r,A.a],styles:[""]}),e})();const bn=["expiresTpl"],dn=["deleteTpl"],un=function(e){return[e]};function mn(e,t){if(1&e){const e=v.Yb();v.Xb(0,"button",6),v.lc("click",function(){return v.Ic(e),v.nc().purgeModal()}),v.Sb(1,"i",7),v.Vb(2),v.bc(3,8),v.Ub(),v.Wb()}if(2&e){const e=v.nc();v.uc("disabled",e.disablePurgeBtn),v.Db(1),v.uc("ngClass",v.zc(2,un,e.icons.destroy))}}function pn(e,t){1&e&&(v.Vb(0),v.bc(1,10),v.Ub())}function fn(e,t){1&e&&(v.Vb(0),v.bc(1,11),v.Ub())}function hn(e,t){if(1&e&&(v.Pc(0,pn,2,0,"ng-container",9),v.Pc(1,fn,2,0,"ng-container",9),v.Rc(2),v.oc(3,"cdDate")),2&e){const e=t.row,a=t.value;v.uc("ngIf",e.cdIsExpired),v.Db(1),v.uc("ngIf",!e.cdIsExpired),v.Db(1),v.Tc(" ",v.pc(3,3,a),"\n")}}function gn(e,t){if(1&e&&(v.Xb(0,"p",13),v.Xb(1,"strong"),v.Vb(2),v.bc(3,14),v.oc(4,"cdDate"),v.Ub(),v.Wb(),v.Wb()),2&e){const e=v.nc().expiresAt;v.Db(4),v.fc(v.pc(4,1,e)),v.cc(3)}}function vn(e,t){1&e&&v.Pc(0,gn,5,3,"p",12),2&e&&v.uc("ngIf",!t.isExpired)}let Sn=(()=>{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=I.a,this.executingTasks=[],this.selection=new nt.a,this.tableStatus=new Fa.a,this.disablePurgeBtn=!0,this.permission=this.authStorageService.getPermissions().rbdImage,this.tableActions=[{permission:"update",icon:I.a.undo,click:()=>this.restoreModal(),name:this.actionLabels.RESTORE},{permission:"delete",icon:I.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 w.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 Fa.a(i,e)}else this.tableStatus=new Fa.a;return t.forEach(e=>{e.cdIsExpired=wo()().isAfter(e.deferment_end_time)}),t}onFetchError(){this.table.reset(),this.tableStatus=new Fa.a(vo.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(ln,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=wo()().isAfter(i),s=new w.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 T.a("rbd/trash/remove",{image_id_spec:s.toString()}),call:this.rbdService.removeTrash(s,!0)})})}purgeModal(){this.modalService.show(cn)}}return e.\u0275fac=function(t){return new(t||e)(v.Rb(lt.a),v.Rb(W),v.Rb(F.a),v.Rb(zo.a),v.Rb(bt.a),v.Rb(R.a),v.Rb(l.b))},e.\u0275cmp=v.Lb({type:e,selectors:[["cd-rbd-trash-list"]],viewQuery:function(e,t){if(1&e&&(v.Wc(ot.a,3),v.Wc(bn,3),v.Wc(dn,3)),2&e){let e;v.Ec(e=v.mc())&&(t.table=e.first),v.Ec(e=v.mc())&&(t.expiresTpl=e.first),v.Ec(e=v.mc())&&(t.deleteTpl=e.first)}},features:[v.Cb([bt.a])],decls:9,vars:8,consts:function(){let e,t,a,i;return e="Purge Trash",t="Expired at",a="Protected until",i="This image is protected until " + "\ufffd0\ufffd" + ".",[["columnMode","flex","identifier","id","forceIdentifier","true","selectionType","single",3,"data","columns","status","autoReload","fetchData","updateSelection"],[1,"table-actions","btn-toolbar"],[1,"btn-group",3,"permission","selection","tableActions"],["class","btn btn-light","type","button",3,"disabled","click",4,"ngIf"],["expiresTpl",""],["deleteTpl",""],["type","button",1,"btn","btn-light",3,"disabled","click"],["aria-hidden","true",3,"ngClass"],e,[4,"ngIf"],t,a,["class","text-danger",4,"ngIf"],[1,"text-danger"],i]},template:function(e,t){1&e&&(v.Sb(0,"cd-rbd-tabs"),v.Xb(1,"cd-table",0),v.lc("fetchData",function(){return t.taskListService.fetch()})("updateSelection",function(e){return t.updateSelection(e)}),v.Xb(2,"div",1),v.Sb(3,"cd-table-actions",2),v.Pc(4,mn,4,4,"button",3),v.Wb(),v.Wb(),v.Pc(5,hn,4,5,"ng-template",null,4,v.Qc),v.Pc(7,vn,1,1,"ng-template",null,5,v.Qc)),2&e&&(v.Db(1),v.uc("data",t.images)("columns",t.columns)("status",t.tableStatus)("autoReload",-1),v.Db(2),v.uc("permission",t.permission)("selection",t.selection)("tableActions",t.tableActions),v.Db(1),v.uc("ngIf",t.permission.delete))},directives:[To,ot.a,Xt.a,i.r,C.a,i.p],pipes:[zo.a],styles:[""]}),e})(),Dn=(()=>{class e{}return e.\u0275fac=function(t){return new(t||e)},e.\u0275mod=v.Pb({type:e}),e.\u0275inj=v.Ob({imports:[[i.c,ca,o.m,o.x,c.t,c.y,c.F,r.a,d.a,s.i,n.c]]}),e})();const wn=[{path:"",redirectTo:"rbd",pathMatch:"full"},{path:"rbd",canActivate:[b.a],data:{breadcrumbs:"Images"},children:[{path:"",component:Ls},{path:"namespaces",component:tn,data:{breadcrumbs:"Namespaces"}},{path:"trash",component:Sn,data:{breadcrumbs:"Trash"}},{path:"performance",component:an,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 _n=(()=>{class e{}return e.\u0275fac=function(t){return new(t||e)},e.\u0275mod=v.Pb({type:e}),e.\u0275inj=v.Ob({imports:[[Dn,s.i.forChild(wn)]]}),e})()},rFfW:function(e,t,a){"use strict";a.d(t,"a",function(){return F});var i=a("8Y7J"),o=a("s7LF"),s=a("LvDl"),n=a.n(s),c=a("jtHE"),r=a("oxzT"),l=a("QFaf"),b=a("PhyI"),d=a("aXbf"),u=a("o8EM"),m=a("NwgZ"),p=a("SVse"),f=a("ocLN"),h=a("p4Cf"),g=a("ANnk"),v=a("f69J");let S=(()=>{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.Rb(o.p),i.Rb(d.a))},e.\u0275dir=i.Mb({type:e,selectors:[["","cdMilliseconds",""]],hostBindings:function(e,t){1&e&&i.lc("blur",function(e){return t.onUpdate(e.target.value)})},inputs:{ngDataReady:"ngDataReady"}}),e})();var D=a("IzCI");let w=(()=>{class e{constructor(e,t,a,o){this.elementRef=e,this.control=t,this.dimlessBinaryPerSecondPipe=a,this.formatter=o,this.ngModelChange=new i.p,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.Rb(i.n),i.Rb(o.p),i.Rb(D.a),i.Rb(d.a))},e.\u0275dir=i.Mb({type:e,selectors:[["","cdDimlessBinaryPerSecond",""]],hostBindings:function(e,t){1&e&&i.lc("blur",function(e){return t.onBlur(e.target.value)})},inputs:{ngDataReady:"ngDataReady",minBytes:"minBytes",maxBytes:"maxBytes",roundPower:"roundPower",defaultUnit:"defaultUnit"},outputs:{ngModelChange:"ngModelChange"}}),e})(),_=(()=>{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.Rb(d.a),i.Rb(o.p))},e.\u0275dir=i.Mb({type:e,selectors:[["","cdIops",""]],hostBindings:function(e,t){1&e&&i.lc("blur",function(e){return t.onUpdate(e.target.value)})},inputs:{ngDataReady:"ngDataReady"}}),e})();function W(e,t){if(1&e&&(i.Vb(0),i.Sb(1,"input",18),i.Ub()),2&e){const e=i.nc().$implicit,t=i.nc(2);i.Db(1),i.uc("id",e.name)("name",e.name)("formControlName",e.name)("ngDataReady",t.ngDataReady)}}function y(e,t){if(1&e&&(i.Vb(0),i.Sb(1,"input",19),i.Ub()),2&e){const e=i.nc().$implicit,t=i.nc(2);i.Db(1),i.uc("id",e.name)("name",e.name)("formControlName",e.name)("ngDataReady",t.ngDataReady)}}function X(e,t){if(1&e&&(i.Vb(0),i.Sb(1,"input",20),i.Ub()),2&e){const e=i.nc().$implicit,t=i.nc(2);i.Db(1),i.uc("id",e.name)("name",e.name)("formControlName",e.name)("ngDataReady",t.ngDataReady)}}function I(e,t){1&e&&(i.Xb(0,"span",21),i.bc(1,22),i.Wb())}const k=function(e){return{active:e}},P=function(e){return[e]};function $(e,t){if(1&e){const e=i.Yb();i.Xb(0,"div",10),i.Xb(1,"label",11),i.Rc(2),i.Xb(3,"cd-helper"),i.Rc(4),i.Wb(),i.Wb(),i.Xb(5,"div"),i.Xb(6,"div",12),i.Vb(7,13),i.Pc(8,W,2,4,"ng-container",14),i.Pc(9,y,2,4,"ng-container",14),i.Pc(10,X,2,4,"ng-container",14),i.Ub(),i.Xb(11,"span",15),i.Xb(12,"button",16),i.lc("click",function(){i.Ic(e);const a=t.$implicit;return i.nc(2).reset(a.name)}),i.Sb(13,"i",7),i.Wb(),i.Wb(),i.Wb(),i.Pc(14,I,2,0,"span",17),i.Wb(),i.Wb()}if(2&e){const e=t.$implicit,a=i.nc().$implicit,o=i.nc(),s=i.Fc(1);i.Db(1),i.uc("for",e.name),i.Db(1),i.Sc(e.displayName),i.Db(2),i.Sc(e.description),i.Db(1),i.Gb("cd-col-form-input ",a.heading,""),i.Db(2),i.uc("ngSwitch",e.type),i.Db(1),i.uc("ngSwitchCase",o.configurationType.milliseconds),i.Db(1),i.uc("ngSwitchCase",o.configurationType.bps),i.Db(1),i.uc("ngSwitchCase",o.configurationType.iops),i.Db(2),i.uc("ngClass",i.zc(13,k,o.isDisabled(e.name))),i.Db(1),i.uc("ngClass",i.zc(15,P,o.icons.erase)),i.Db(1),i.uc("ngIf",o.form.showError("configuration."+e.name,s,"min"))}}function T(e,t){if(1&e){const e=i.Yb();i.Xb(0,"div",4),i.Xb(1,"h4",5),i.Xb(2,"span",6),i.lc("click",function(){i.Ic(e);const a=t.$implicit;return i.nc().toggleSectionVisibility(a.class)}),i.Rc(3),i.Sb(4,"i",7),i.Wb(),i.Wb(),i.Xb(5,"div",8),i.Pc(6,$,15,17,"div",9),i.Wb(),i.Wb()}if(2&e){const e=t.$implicit,a=i.nc();i.Db(3),i.Tc(" ",e.heading," "),i.Db(1),i.uc("ngClass",a.sectionVisibility[e.class]?a.icons.minusCircle:a.icons.addCircle),i.Db(1),i.Fb(e.class),i.uc("hidden",!a.sectionVisibility[e.class]),i.Db(1),i.uc("ngForOf",e.options)}}let F=(()=>{class e{constructor(e,t){this.formatterService=e,this.rbdConfigurationService=t,this.initializeData=new c.a(1),this.changes=new i.p,this.icons=r.a,this.ngDataReady=new i.p,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.Rb(d.a),i.Rb(u.a))},e.\u0275cmp=i.Lb({type:e,selectors:[["cd-rbd-configuration-form"]],inputs:{form:"form",initializeData:"initializeData"},outputs:{changes:"changes"},decls:5,vars:2,consts:function(){let e,t,a;return e="RBD Configuration",t="Remove the local configuration value. The parent configuration value will be inherited and used instead.",a="The minimum value is 0",[[3,"formGroup"],["cfgFormGroup",""],e,["class","col-12",4,"ngFor","ngForOf"],[1,"col-12"],[1,"cd-header"],[1,"collapsible",3,"click"],["aria-hidden","true",3,"ngClass"],[3,"hidden"],["class","form-group row",4,"ngFor","ngForOf"],[1,"form-group","row"],[1,"cd-col-form-label",3,"for"],[1,"input-group"],[3,"ngSwitch"],[4,"ngSwitchCase"],[1,"input-group-append"],["type","button","data-toggle","button","title",t,1,"btn","btn-light",3,"ngClass","click"],["class","invalid-feedback",4,"ngIf"],["type","text","cdMilliseconds","",1,"form-control",3,"id","name","formControlName","ngDataReady"],["type","text","defaultUnit","b","cdDimlessBinaryPerSecond","",1,"form-control",3,"id","name","formControlName","ngDataReady"],["type","text","cdIops","",1,"form-control",3,"id","name","formControlName","ngDataReady"],[1,"invalid-feedback"],a]},template:function(e,t){1&e&&(i.Xb(0,"fieldset",0,1),i.Xb(2,"legend"),i.bc(3,2),i.Wb(),i.Pc(4,T,7,7,"div",3),i.Wb()),2&e&&(i.uc("formGroup",t.form.get("configuration")),i.Db(4),i.uc("ngForOf",t.rbdConfigurationService.sections))},directives:[o.r,o.k,m.a,p.q,p.p,f.a,h.a,p.t,p.u,g.a,p.r,o.d,v.a,S,o.q,o.i,w,_],styles:[".collapsible[_ngcontent-%COMP%]{cursor:pointer;user-select:none}"]}),e})()}}]);