"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[539],{46190:(g,c,e)=>{e.r(c),e.d(c,{SupportBundlesCreateUnconnected:()=>C,default:()=>T});var t=e(68404),D=e(36635),u=e(45253),f=e(94270),n=e(24799),_=e(58255),B=e(52081),p=e(31403),d=e(79396),i=e(77878);const O=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,D.connect)(a,r),C=({collectors:s,isLoading:y,loadCollectorsError:M,createBundleError:m,loadSupportBundleCollectors:v,createSupportBundle:L})=>{const h=o=>{const E=Object.keys(o).filter(l=>o[l]);L({collectors:E})};(0,t.useEffect)(()=>{v()},[v]);const U=s.reduce((o,E)=>({...o,[E.uid]:E.default}),{});return t.createElement(d.T,{navId:"support-bundles",pageNav:{text:"Create support bundle"},subTitle:O},t.createElement(d.T.Contents,{isLoading:y},t.createElement(d.T.OldNavOnly,null,t.createElement("h3",{className:"page-sub-heading"},"Create support bundle")),M&&t.createElement(u.b,{title:M,severity:"error"}),m&&t.createElement(u.b,{title:m,severity:"error"}),!!s.length&&t.createElement(f.l,{defaultValues:U,onSubmit:h,validateOn:"onSubmit"},({register:o,errors:E})=>t.createElement(t.Fragment,null,[...s].sort((l,W)=>l.displayName.localeCompare(W.displayName)).map(l=>t.createElement(n.g,{key:l.uid},t.createElement(_.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(p.zx,{type:"submit"},"Create"),t.createElement(p.Qj,{href:"/support-bundles",variant:"secondary"},"Cancel"))))))},T=P(C)},77878:(g,c,e)=>{e.d(c,{Ch:()=>_,Jp:()=>O,ob:()=>p,od:()=>d,vc:()=>i});var t=e(82897),D=e.n(t),u=e(54899),f=e(37932),n=e(62295);function _(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 p(){return async a=>{a(B)}}function d(a){return async r=>{await(0,u.i)().delete(`/api/support-bundles/${a}`),r(_(!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 O(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.ad8e589d31861234b071.js.map