"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1477],{72443:(S,E,t)=>{t.r(E),t.d(E,{EditDataSourcePage:()=>e,default:()=>A});var n=t(66111),D=t(8412),o=t(77632),M=t(3515),_=t(25e3);function e(P){const c=P.match.params.uid,d=new URLSearchParams(P.location.search).get("page"),I=(0,_.MF)(c,d);return n.createElement(D.T,{navId:"datasources",pageNav:I.main,actions:n.createElement(M.K,{uid:c})},n.createElement(D.T.Contents,null,n.createElement(o.H,{uid:c,pageId:d})))}const A=e},59332:(S,E,t)=>{t.d(E,{V:()=>o});var n=t(66111),D=t(3597);const o=(0,n.createContext)(D.n)},24231:(S,E,t)=>{t.d(E,{E:()=>L,IA:()=>x,MF:()=>J,OU:()=>g,Qs:()=>y,YY:()=>V,_l:()=>R,d7:()=>v,hw:()=>B,nH:()=>m,q6:()=>f,qj:()=>p,wi:()=>W,wl:()=>l,zJ:()=>K});var n=t(66111),D=t(70431),o=t(18271),M=t(77582),_=t(86245),e=t(27876),A=t(45984),P=t(85597),c=t(96488),h=t(59332),d=t(79508),I=t(41632),C=t(93769);const L=s=>{const a=(0,e.useDispatch)();(0,n.useEffect)(()=>(a((0,c.M9)(s)),function(){a((0,D.e)({cleanupAction:u=>u.dataSourceSettings=I.fk}))}),[s,a])},B=s=>{const a=(0,e.useDispatch)(),r=v();return()=>a((0,c.kY)(s,r.Edit))},K=()=>{const s=(0,e.useDispatch)(),a=(0,e.useSelector)(u=>u.dataSources.isLoadingDataSources),r=(0,e.useSelector)(u=>u.dataSources.dataSources);return(0,n.useEffect)(()=>{s((0,c.bZ)())},[s]),{isLoading:a,dataSources:r}},W=s=>{const a=(0,e.useDispatch)();(0,n.useEffect)(()=>{a((0,c.gv)(s))},[a,s])},g=()=>{const s=(0,e.useDispatch)();(0,n.useEffect)(()=>{s((0,c.Kj)())},[s])},m=()=>{const s=(0,e.useDispatch)(),a=v();return r=>{s((0,c.J_)(r,a.Edit))}},p=()=>{const s=(0,e.useDispatch)();return async a=>s((0,c.oe)(a))},f=()=>{const s=(0,e.useDispatch)(),{name:a}=(0,e.useSelector)(r=>r.dataSources.dataSource);return()=>{o.Z.publish(new A.VJ({title:"Delete",text:`Are you sure you want to delete the "${a}" data source?`,yesText:"Delete",icon:"trash-alt",onConfirm:()=>s((0,c.F5)())}))}},l=s=>(0,e.useSelector)(a=>(0,C.f6)(a.dataSources,s)),x=s=>{const a=l(s);return(0,P.iU)(a)},y=s=>(0,e.useSelector)(a=>(0,C.G4)(a.dataSources,s)),R=()=>(0,e.useSelector)(s=>s.dataSourceSettings),J=(s,a)=>{const r=l(s),{plugin:u,loadError:O,loading:Y}=R(),U=(0,e.useSelector)(i=>i.navIndex),T=a?`datasource-${a}-${s}`:`datasource-settings-${s}`;if(O){const i={text:O,subTitle:"Data Source Error",icon:"exclamation-triangle"};return{node:i,main:i}}return Y||!u?(0,_.ht)(U,T,(0,d.xG)("settings")):(0,_.ht)(U,T,(0,d.nI)((0,d.B1)(r,u),a||"settings"))},V=s=>{const a=l(s),r=a.readOnly===!0,u=M.Vt.hasPermissionInMetadata(e.AccessControlAction.DataSourcesWrite,a),O=M.Vt.hasPermissionInMetadata(e.AccessControlAction.DataSourcesDelete,a);return{readOnly:r,hasWriteRights:u,hasDeleteRights:O}},v=()=>(0,n.useContext)(h.V)},25e3:(S,E,t)=>{t.d(E,{BX:()=>_.BX,E:()=>o.E,Ht:()=>_.Ht,I5:()=>e.I5,IA:()=>e.IA,IO:()=>e.IO,J_:()=>n.J_,MF:()=>o.MF,Nu:()=>_.Nu,OU:()=>o.OU,Qs:()=>o.Qs,Rz:()=>o.IA,Vj:()=>D.V,YY:()=>o.YY,_l:()=>o._l,d7:()=>o.d7,hw:()=>o.hw,mt:()=>e.mt,nH:()=>o.nH,q6:()=>o.q6,qj:()=>o.qj,r7:()=>e.r7,rl:()=>_.rl,wi:()=>o.wi,wl:()=>o.wl,yr:()=>_.yr,zJ:()=>o.zJ,zT:()=>_.zT});var n=t(96488),D=t(59332),o=t(24231),M=t(79508),_=t(41632),e=t(93769)}}]);

//# sourceMappingURL=EditDataSourcePage.32971942d187cbe153f9.js.map