"use strict";(("undefined"!==typeof self?self:this)["webpackChunkharvester_1_0_2"]=("undefined"!==typeof self?self:this)["webpackChunkharvester_1_0_2"]||[]).push([[973],{51597:function(e,t,r){r.r(t),r.d(t,{default:function(){return g}});var o=r(9274);const l={class:"mt-10"},c={class:"mt-10"},a={key:0},n={class:"checkbox-container mr-15"},s=["label","value"],i=(0,o.createElementVNode)("span",{class:"checkbox-custom mr-5",role:"checkbox"},null,-1),m={key:1},h={class:"checkbox-container mr-15"},u=(0,o.createElementVNode)("span",{class:"checkbox-custom mr-5",role:"checkbox"},null,-1);function p(e,t,r,p,d,v){const k=(0,o.resolveDirective)("clean-html");return(0,o.openBlock)(),(0,o.createElementBlock)("div",l,[(0,o.createTextVNode)((0,o.toDisplayString)(e.t("promptRemove.attemptingToRemove",{type:r.type}))+" ",1),(0,o.withDirectives)((0,o.createElementVNode)("span",null,null,512),[[k,v.resourceNames(r.names,v.plusMore,e.t)]]),(0,o.createElementVNode)("div",c,(0,o.toDisplayString)(e.t("harvester.virtualMachine.promptRemove.title")),1),1===r.value.length?((0,o.openBlock)(),(0,o.createElementBlock)("div",a,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(v.removeNameArr[r.value[0].id],((e,r)=>((0,o.openBlock)(),(0,o.createElementBlock)("span",{key:r},[(0,o.createElementVNode)("label",n,[(0,o.withDirectives)((0,o.createElementVNode)("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>d.checkedList=e),type:"checkbox",label:e,value:e},null,8,s),[[o.vModelCheckbox,d.checkedList]]),i,(0,o.createTextVNode)(" "+(0,o.toDisplayString)(e),1)])])))),128))])):((0,o.openBlock)(),(0,o.createElementBlock)("div",m,[(0,o.createElementVNode)("label",h,[(0,o.withDirectives)((0,o.createElementVNode)("input",{"onUpdate:modelValue":t[1]||(t[1]=e=>d.checkAll=e),type:"checkbox"},null,512),[[o.vModelCheckbox,d.checkAll]]),u,(0,o.createTextVNode)(" "+(0,o.toDisplayString)(e.t("harvester.virtualMachine.promptRemove.deleteAll")),1)])]))])}var d=r(65359),v=r(65852),k=r(52225),f=r.n(k),y=r(78359),b=r(32766),N={name:"HarvesterPromptRemove",props:{value:{type:Array,default:()=>[]},names:{type:Array,default:()=>[]},type:{type:String,required:!0},close:{type:Function,required:!0},doneLocation:{type:Object,default:()=>{}}},data(){return{checkedList:[],checkAll:!0}},computed:{...(0,d.aH)("action-menu",["toRemove"]),...(0,d.L8)({t:"i18n/t"}),removeNameArr(){const e={};return this.value.forEach((t=>{if(t.type!==b.rk.VM)return;const r=t.spec.template.spec?.volumes||[],o=r.filter((e=>e.persistentVolumeClaim)).map((e=>{if(e.persistentVolumeClaim)return e.name}));e[t.id]=o})),e},plusMore(){const e=this.toRemove.length-this.names.length;return this.t("promptRemove.andOthers",{count:e})}},watch:{removeNameArr:{handler(e){if(1===this.value.length){const t=Object.values(e[this.value[0].id]);this.checkedList.unshift(t[0])}},deep:!0,immediate:!0}},methods:{resourceNames:y.Nr,remove(){let e;this.doneLocation&&(e={...this.doneLocation}),Promise.all(this.value.map((e=>{if(e.type!==b.rk.VM)return void e.remove();let t="";this.value.length>1?this.checkAll&&this.removeNameArr[e.id].forEach((e=>{t+=`removedDisks=${e}&`})):(this.checkedList.forEach((e=>{t+=`removedDisks=${e}&`})),t.replace(/&$/,""));const r=f()(e.links.self);e.remove({url:`${r.pathname}?${t}propagationPolicy=Foreground`})}))).then((t=>{e&&!(0,v.Im)(e)&&this.value?.[0]?.currentRouter().push(e),this.close()})).catch((e=>{this.$emit("errors",e)}))}}},V=r(47433);const E=(0,V.A)(N,[["render",p]]);var g=E}}]);
//# sourceMappingURL=harvester-1.0.2.umd.min.promptRemove.js.map