"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[539],{74666:(g,c,e)=>{e.r(c),e.d(c,{SupportBundlesCreateUnconnected:()=>C,default:()=>T});var t=e(65237),D=e(37149),u=e(88347),f=e(46181),n=e(5263),_=e(58190),B=e(6741),p=e(48389),d=e(38992),i=e(66621);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)},66621:(g,c,e)=>{e.d(c,{Ch:()=>_,Jp:()=>O,ob:()=>p,od:()=>d,vc:()=>i});var t=e(89949),D=e.n(t),u=e(55041),f=e(38002),n=e(61210);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.283031cb492d89cf94cc.js.map