"use strict";(("undefined"!==typeof self?self:this)["webpackChunkharvester_1_5_0"]=("undefined"!==typeof self?self:this)["webpackChunkharvester_1_5_0"]||[]).push([[973],{41959:function(e,t,r){r.r(t),r.d(t,{default:function(){return x}});var l=r(9274);const a={class:"mt-10"},o={class:"mt-10"},c={key:0},n={class:"checkbox-container mr-15"},i=["label","value"],s={key:1},m={class:"checkbox-container mr-15"},p={class:"text-warning mb-10 mt-10"},d={class:"text-info mt-20"};function u(e,t,r,u,h,v){const k=(0,l.resolveDirective)("clean-html");return(0,l.openBlock)(),(0,l.createElementBlock)("div",null,[(0,l.createElementVNode)("div",a,[(0,l.createTextVNode)((0,l.toDisplayString)(e.t("promptRemove.attemptingToRemove",{type:r.type}))+" ",1),(0,l.withDirectives)((0,l.createElementVNode)("span",null,null,512),[[k,v.resourceNames(r.names,e.t)]]),(0,l.createElementVNode)("div",o,(0,l.toDisplayString)(e.t("harvester.virtualMachine.promptRemove.title")),1),1===r.value.length?((0,l.openBlock)(),(0,l.createElementBlock)("div",c,[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(v.removeNameArr[r.value[0].id],((e,r)=>((0,l.openBlock)(),(0,l.createElementBlock)("span",{key:r},[(0,l.createElementVNode)("label",n,[(0,l.withDirectives)((0,l.createElementVNode)("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>h.checkedList=e),type:"checkbox",label:e,value:e},null,8,i),[[l.vModelCheckbox,h.checkedList]]),t[2]||(t[2]=(0,l.createElementVNode)("span",{class:"checkbox-custom mr-5",role:"checkbox"},null,-1)),(0,l.createTextVNode)(" "+(0,l.toDisplayString)(e),1)])])))),128))])):((0,l.openBlock)(),(0,l.createElementBlock)("div",s,[(0,l.createElementVNode)("label",m,[(0,l.withDirectives)((0,l.createElementVNode)("input",{"onUpdate:modelValue":t[1]||(t[1]=e=>h.checkedList=e),type:"checkbox"},null,512),[[l.vModelCheckbox,h.checkedList]]),t[3]||(t[3]=(0,l.createElementVNode)("span",{class:"checkbox-custom mr-5",role:"checkbox"},null,-1)),(0,l.createTextVNode)(" "+(0,l.toDisplayString)(e.t("harvester.virtualMachine.promptRemove.deleteAll")),1)])]))]),(0,l.createElementVNode)("div",p,(0,l.toDisplayString)(e.t("harvester.virtualMachine.promptRemove.tips")),1),(0,l.createElementVNode)("div",d,(0,l.toDisplayString)(e.t("promptRemove.protip",{alternateLabel:h.alternateLabel})),1)])}var h=r(65359),v=r(76978),k=r(52225),f=r.n(k),y=r(92043),b=r(32766),N=r(35881),V={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:N.ZA}},computed:{...(0,h.aH)("action-menu",["toRemove"]),...(0,h.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||[],l=r.filter((e=>e.persistentVolumeClaim)).map((e=>{if(e.persistentVolumeClaim)return e.name}));e[t.id]=l})),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)}))}}},E=r(47433);const g=(0,E.A)(V,[["render",u]]);var x=g}}]);
//# sourceMappingURL=harvester-1.5.0.umd.min.promptRemove.js.map