"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[539],{98824:(g,E,e)=>{e.r(E),e.d(E,{SupportBundlesCreateUnconnected:()=>C,default:()=>m});var t=e(27702),O=e(27173),u=e(63439),f=e(23839),n=e(22209),c=e(83967),B=e(64022),_=e(66670),p=e(44644),i=e(59575);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)},59575:(g,E,e)=>{e.d(E,{Ch:()=>c,Jp:()=>D,ob:()=>_,od:()=>p,vc:()=>i});var t=e(89949),O=e.n(t),u=e(73289),f=e(26129),n=e(26271);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.5892ff4be3fd88a27f14.js.map