"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1515],{74410(A,_,e){e.d(_,{l:()=>s});var t=e(14553),M=e(22803),u=e(55501),o=e(49785);function s({defaultValues:d,onSubmit:O,validateOnMount:c=!1,validateFieldsOnMount:E,children:D,validateOn:p="onSubmit",maxWidth:n=600,...r}){const{handleSubmit:i,trigger:B,formState:f,...C}=(0,o.mN)({mode:p,defaultValues:d});return(0,u.useEffect)(()=>{c&&B(E)},[B,E,c]),(0,t.jsx)("form",{className:(0,M.css)({maxWidth:n!=="none"?n+"px":n,width:"100%"}),onSubmit:i(O),...r,children:D({errors:f.errors,formState:f,trigger:B,...C})})}},26484(A,_,e){e.r(_),e.d(_,{SupportBundlesCreateUnconnected:()=>f,default:()=>C});var t=e(14553),M=e(55501),u=e(71468),o=e(92745),s=e(34999),d=e(45861),O=e(41654),c=e(37386),E=e(32635),D=e(74410),p=e(13791),n=e(65075);const r=l=>({collectors:l.supportBundles.supportBundleCollectors,isLoading:l.supportBundles.createBundlePageLoading,loadCollectorsError:l.supportBundles.loadBundlesError,createBundleError:l.supportBundles.createBundleError}),i={loadSupportBundleCollectors:n.OS,createSupportBundle:n.iO},B=(0,u.connect)(r,i),f=({collectors:l,isLoading:I,loadCollectorsError:m,createBundleError:v,loadSupportBundleCollectors:T,createSupportBundle:y})=>{const g=P=>{const a=Object.keys(P).filter(h=>P[h]);y({collectors:a})};(0,M.useEffect)(()=>{T()},[T]);const K=l.reduce((P,a)=>({...P,[a.uid]:a.default}),{}),L=(0,t.jsx)("span",{children:(0,t.jsx)(o.x6,{i18nKey:"support-bundles.support-bundles-create-unconnected.sub-title",children:"Choose the components for the support bundle. The support bundle will be available for 3 days after creation."})});return(0,t.jsx)(p.Y,{navId:"support-bundles",pageNav:{text:(0,o.t)("support-bundles.support-bundles-create-unconnected.text.create-support-bundle","Create support bundle")},subTitle:L,children:(0,t.jsxs)(p.Y.Contents,{isLoading:I,children:[m&&(0,t.jsx)(s.F,{title:m,severity:"error"}),v&&(0,t.jsx)(s.F,{title:v,severity:"error"}),!!l.length&&(0,t.jsx)(D.l,{defaultValues:K,onSubmit:g,validateOn:"onSubmit",children:({register:P})=>(0,t.jsxs)(t.Fragment,{children:[[...l].sort((a,h)=>a.displayName.localeCompare(h.displayName)).map(a=>(0,t.jsx)(c.D,{children:(0,t.jsx)(E.S,{...P(a.uid),label:a.displayName,id:a.uid,description:a.description,defaultChecked:a.default,disabled:a.includedByDefault})},a.uid)),(0,t.jsxs)(O.B,{children:[(0,t.jsx)(d.$n,{type:"submit",children:(0,t.jsx)(o.x6,{i18nKey:"support-bundles.support-bundles-create-unconnected.create",children:"Create"})}),(0,t.jsx)(d.z9,{href:"/support-bundles",variant:"secondary",children:(0,t.jsx)(o.x6,{i18nKey:"support-bundles.support-bundles-create-unconnected.cancel",children:"Cancel"})})]})]})})]})})},C=B(f)},65075(A,_,e){e.d(_,{Hb:()=>E,OS:()=>D,WJ:()=>d,ac:()=>c,iO:()=>p});var t=e(2543),M=e.n(t),u=e(68143),o=e(36490),s=e(69807);function d(n=!1){return async r=>{try{n||r((0,s.sF)());const i=await(0,u.AI)().get("/api/support-bundles");r((0,s.sJ)(i))}finally{r((0,s.kH)())}}}const O=(0,t.throttle)(async n=>{const r=await(0,u.AI)().get("/api/support-bundles");n((0,s.sJ)(r))},1e3);function c(){return async n=>{n(O)}}function E(n){return async r=>{await(0,u.AI)().delete(`/api/support-bundles/${n}`),r(d(!0))}}function D(){return async n=>{try{n((0,s.Y1)());const r=await(0,u.AI)().get("/api/support-bundles/collectors");n((0,s.j7)(r))}catch{n((0,s.pB)("Error loading support bundles data collectors"))}finally{n((0,s.s7)())}}}function p(n){return async r=>{try{await(0,u.AI)().post("/api/support-bundles",n),o.Ny.push("/support-bundles")}catch{r((0,s.NV)("Error creating support bundle"))}}}}}]);

//# sourceMappingURL=SupportBundlesCreate-react19.6c071ba1406d752cf3c7.js.map