"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[539],{90745:(g,E,e)=>{e.r(E),e.d(E,{SupportBundlesCreateUnconnected:()=>C,default:()=>m});var t=e(39953),O=e(89772),u=e(33155),f=e(85830),n=e(96227),c=e(13026),B=e(12223),_=e(4919),p=e(13253),i=e(4267);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)},4267:(g,E,e)=>{e.d(E,{Ch:()=>c,Jp:()=>D,ob:()=>_,od:()=>p,vc:()=>i});var t=e(86832),O=e.n(t),u=e(4148),f=e(13601),n=e(92258);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.166e805e1729fb34453f.js.map