"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[539],{46190:(g,E,e)=>{e.r(E),e.d(E,{SupportBundlesCreateUnconnected:()=>C,default:()=>m});var t=e(66111),O=e(67948),u=e(45253),f=e(94270),n=e(24799),c=e(58255),B=e(52081),_=e(31403),p=e(8412),i=e(77878);const D=t.createElement("span",null,"Choose the components for the support bundle. The support bundle will be available for 3 days after creation."),a=s=>({collectors:s.supportBundles.supportBundleCollectors,isLoading:s.supportBundles.createBundlePageLoading,loadCollectorsError:s.supportBundles.loadBundlesError,createBundleError:s.supportBundles.createBundleError}),r={loadSupportBundleCollectors:i.vc,createSupportBundle:i.Jp},P=(0,O.connect)(a,r),C=({collectors:s,isLoading:y,loadCollectorsError:M,createBundleError:v,loadSupportBundleCollectors:T,createSupportBundle:L})=>{const U=o=>{const d=Object.keys(o).filter(l=>o[l]);L({collectors:d})};(0,t.useEffect)(()=>{T()},[T]);const W=s.reduce((o,d)=>({...o,[d.uid]:d.default}),{});return t.createElement(p.T,{navId:"support-bundles",pageNav:{text:"Create support bundle"},subTitle:D},t.createElement(p.T.Contents,{isLoading:y},M&&t.createElement(u.b,{title:M,severity:"error"}),v&&t.createElement(u.b,{title:v,severity:"error"}),!!s.length&&t.createElement(f.l,{defaultValues:W,onSubmit:U,validateOn:"onSubmit"},({register:o,errors:d})=>t.createElement(t.Fragment,null,[...s].sort((l,A)=>l.displayName.localeCompare(A.displayName)).map(l=>t.createElement(n.g,{key:l.uid},t.createElement(c.X,{...o(l.uid),label:l.displayName,id:l.uid,description:l.description,defaultChecked:l.default,disabled:l.includedByDefault}))),t.createElement(B.Lh,null,t.createElement(_.zx,{type:"submit"},"Create"),t.createElement(_.Qj,{href:"/support-bundles",variant:"secondary"},"Cancel"))))))},m=P(C)},77878:(g,E,e)=>{e.d(E,{Ch:()=>c,Jp:()=>D,ob:()=>_,od:()=>p,vc:()=>i});var t=e(82897),O=e.n(t),u=e(54899),f=e(37932),n=e(62295);function c(a=!1){return async r=>{try{a||r((0,n.Ii)());const P=await(0,u.i)().get("/api/support-bundles");r((0,n.rW)(P))}finally{r((0,n.ki)())}}}const B=(0,t.throttle)(async a=>{const r=await(0,u.i)().get("/api/support-bundles");a((0,n.rW)(r))},1e3);function _(){return async a=>{a(B)}}function p(a){return async r=>{await(0,u.i)().delete(`/api/support-bundles/${a}`),r(c(!0))}}function i(){return async a=>{try{a((0,n.ik)());const r=await(0,u.i)().get("/api/support-bundles/collectors");a((0,n.cD)(r))}catch{a((0,n.rI)("Error loading support bundles data collectors"))}finally{a((0,n.UW)())}}}function D(a){return async r=>{try{await(0,u.i)().post("/api/support-bundles",a),f.E1.push("/support-bundles")}catch{r((0,n.fT)("Error creating support bundle"))}}}}}]);

//# sourceMappingURL=SupportBundlesCreate.e8b18e03a8f2d8680163.js.map