"use strict";(("undefined"!==typeof self?self:this)["webpackChunkharvester_1_0_4"]=("undefined"!==typeof self?self:this)["webpackChunkharvester_1_0_4"]||[]).push([[973],{29799:function(e,t,r){r.r(t),r.d(t,{default:function(){return D}});var l=r(9274);const o={class:"mt-10"},a={class:"mt-10"},n={key:0},c={class:"checkbox-container mr-15"},s=["label","value"],i=(0,l.createElementVNode)("span",{class:"checkbox-custom mr-5",role:"checkbox"},null,-1),m={key:1},p={class:"checkbox-container mr-15"},h=(0,l.createElementVNode)("span",{class:"checkbox-custom mr-5",role:"checkbox"},null,-1),u={class:"text-warning mb-10 mt-10"},d={class:"text-info mt-20"};function v(e,t,r,v,k,f){const y=(0,l.resolveDirective)("clean-html");return(0,l.openBlock)(),(0,l.createElementBlock)("div",null,[(0,l.createElementVNode)("div",o,[(0,l.createTextVNode)((0,l.toDisplayString)(e.t("promptRemove.attemptingToRemove",{type:r.type}))+" ",1),(0,l.withDirectives)((0,l.createElementVNode)("span",null,null,512),[[y,f.resourceNames(r.names,f.plusMore,e.t)]]),(0,l.createElementVNode)("div",a,(0,l.toDisplayString)(e.t("harvester.virtualMachine.promptRemove.title")),1),1===r.value.length?((0,l.openBlock)(),(0,l.createElementBlock)("div",n,[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(f.removeNameArr[r.value[0].id],((e,r)=>((0,l.openBlock)(),(0,l.createElementBlock)("span",{key:r},[(0,l.createElementVNode)("label",c,[(0,l.withDirectives)((0,l.createElementVNode)("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>k.checkedList=e),type:"checkbox",label:e,value:e},null,8,s),[[l.vModelCheckbox,k.checkedList]]),i,(0,l.createTextVNode)(" "+(0,l.toDisplayString)(e),1)])])))),128))])):((0,l.openBlock)(),(0,l.createElementBlock)("div",m,[(0,l.createElementVNode)("label",p,[(0,l.withDirectives)((0,l.createElementVNode)("input",{"onUpdate:modelValue":t[1]||(t[1]=e=>k.checkedList=e),type:"checkbox"},null,512),[[l.vModelCheckbox,k.checkedList]]),h,(0,l.createTextVNode)(" "+(0,l.toDisplayString)(e.t("harvester.virtualMachine.promptRemove.deleteAll")),1)])]))]),(0,l.createElementVNode)("div",u,(0,l.toDisplayString)(e.t("harvester.virtualMachine.promptRemove.tips")),1),(0,l.createElementVNode)("div",d,(0,l.toDisplayString)(e.t("promptRemove.protip",{alternateLabel:k.alternateLabel})),1)])}var k=r(65359),f=r(76978),y=r(52225),b=r.n(y),N=r(92043),V=r(32766),E=r(35881),g={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,alternateLabel:E.ZA}},computed:{...(0,k.aH)("action-menu",["toRemove"]),...(0,k.L8)({t:"i18n/t"}),removeNameArr(){const e={};return this.value.forEach((t=>{if(t.type!==V.rk.VM)return;const r=t.spec.template.spec?.volumes||[],l=r.filter((e=>e.persistentVolumeClaim)).map((e=>{if(e.persistentVolumeClaim)return e.name}));e[t.id]=l})),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:N.Nr,remove(){let e;this.doneLocation&&(e={...this.doneLocation}),Promise.all(this.value.map((e=>{if(e.type!==V.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=b()(e.links.self);e.remove({url:`${r.pathname}?${t}propagationPolicy=Foreground`})}))).then((t=>{e&&!(0,f.Im)(e)&&this.value?.[0]?.currentRouter().push(e),this.close()})).catch((e=>{this.$emit("errors",e)}))}}},x=r(47433);const L=(0,x.A)(g,[["render",v]]);var D=L}}]);
//# sourceMappingURL=harvester-1.0.4.umd.min.promptRemove.js.map