"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[4738],{30436:(W,f,n)=>{n.r(f),n.d(f,{DataSourcePermissionsPage:()=>D,default:()=>v});var d=n(74848),s=n(54148),i=n(21780),o=n(31152),r=n(61217);const D=()=>{const{uid:m=""}=(0,s.g)(),{navId:I,pageNav:p}=(0,o.n)("permissions");return(0,d.jsx)(i.YW,{navId:I,pageNav:p,children:(0,d.jsx)(i.YW.Contents,{children:(0,d.jsx)(r.A,{uid:m})})})},v=D},31152:(W,f,n)=>{n.d(f,{n:()=>m});var d=n(24180),s=n(19347),i=n(17422),o=n(11084),r=n(74984),D=n(83391),v=n(31678);function m(I){const{uid:p}=(0,d.g)(),A=(0,d.zy)(),h=(0,o.xw)(p),L=(0,o.S4)(h.type),R=(0,D.ob)(h.type),x=new URLSearchParams(A.search),E=I||x.get("page"),{plugin:l,loadError:g,loading:O}=(0,o._e)(),M=(0,s.l)()?.getInstanceSettings(p),C=!!(M?.meta?.alerting??!1),U=M?.type==="alertmanager",B=C||U,y=(0,v.useSelector)(P=>P.navIndex),_=E?`datasource-${E}-${p}`:`datasource-settings-${p}`;let S={node:{text:"Data Source Nav Node"},main:{text:"Data Source Nav Node"}};if(g){const P={text:g,subTitle:"Data Source Error",icon:"exclamation-triangle"};S={node:P,main:P}}return(O||!l)&&(S=(0,i.tc)(y,_,(0,r.$m)("settings"))),l&&(S=(0,i.tc)(y,_,(0,r.Vh)((0,r.R4)(h,l),E||"settings"))),{navId:"connections-datasources",pageNav:{...S.main,dataSourcePluginName:R?.name||l?.meta.name||"",active:!0,text:h.name,subTitle:`Type: ${L.name}`,children:(S.main.children||[]).map(P=>({...P,url:P.url?.replace("datasources/edit/","/connections/datasources/edit/")}))},dataSourceHeader:{alertingSupported:B}}}},83391:(W,f,n)=>{n.d(f,{A5:()=>Y,wr:()=>z,m5:()=>K,PW:()=>M,F9:()=>y,ob:()=>U,sM:()=>C,xX:()=>_,XN:()=>G,pw:()=>P,Gp:()=>F,qG:()=>J,SQ:()=>S});var d=n(96540),s=n(31678),i=n(5129),o=n(20701),r=n(25508),D=n(54479),v=n(14110),m=n(66253),I=n(31326);const p=e=>e.plugins,A=(0,r.Mz)(p,({items:e})=>e),{selectAll:h,selectById:L}=I.AI.getSelectors(A),R=e=>(0,r.Mz)(h,t=>{const a=e.keyword?(0,D.xb)(e.keyword.toLowerCase()):"",c=a!==""?(0,i.TD)(t,a):null;return a&&(0,v.rR)("plugins_search",{resultsCount:c?.length}),t.filter(u=>!(a&&c==null||a&&!c?.includes(u.id)||e.type&&u.type!==e.type||e.isInstalled!==void 0&&u.isInstalled!==e.isInstalled||e.isEnterprise!==void 0&&u.isEnterprise!==e.isEnterprise||e.hasUpdate!==void 0&&(u.hasUpdate!==e.hasUpdate||!(0,i.R7)(u))))}),x=e=>(0,r.Mz)(h,t=>{const a=[];for(const c of t)c.error&&(!e||c.type===e)&&a.push({pluginId:c.id,errorCode:c.error,pluginType:c.type});return a}),E=e=>(0,r.Mz)(p,({requests:t={}})=>t[e]),l=e=>(0,r.Mz)(E(e),t=>t?.status===m.IZ.Pending),g=e=>(0,r.Mz)(E(e),t=>t?.status===m.IZ.Rejected?t?.error:null),O=e=>(0,r.Mz)(E(e),t=>t===void 0),M=(e,t=i.by.nameAsc)=>{N();const a=(0,d.useMemo)(()=>R(e),[e]),c=(0,s.useSelector)(a),{isLoading:u,error:T}=j(),Z=(0,i.Xc)(c,t);return{isLoading:u,error:T,plugins:Z}},C=()=>{const{isLoading:e}=K(),{plugins:t}=M({isInstalled:!0}),a=t.filter(i.R7);return{isLoading:e,updatablePlugins:a}},U=e=>(N(),X(e),(0,s.useSelector)(t=>L(t,e))),B=e=>($(),useSelector(t=>selectById(t,e))),y=e=>(N(),(0,s.useSelector)(x(e))),_=()=>{const e=(0,s.useDispatch)();return(t,a,c)=>e((0,o.ai)({id:t,version:a,isUpdating:c}))},S=()=>{const e=(0,s.useDispatch)();return()=>e((0,o.nT)())},F=()=>{const e=(0,s.useDispatch)();return t=>e((0,o.JC)(t))},P=()=>(0,s.useSelector)(g(o.JJ.typePrefix))===null,j=()=>{const e=(0,s.useSelector)(l("plugins/fetchLocal")),t=(0,s.useSelector)(g("plugins/fetchLocal"));return{isLoading:e,error:t}},K=()=>{const e=(0,s.useSelector)(l(o.mj.typePrefix)),t=(0,s.useSelector)(l("plugins/fetchLocal")),a=(0,s.useSelector)(l("plugins/fetchRemote")),c=e||t||a,u=(0,s.useSelector)(g(o.mj.typePrefix));return{isLoading:c,error:u}},z=()=>{const e=(0,s.useSelector)(l(o.t5.typePrefix)),t=(0,s.useSelector)(g(o.t5.typePrefix));return{isLoading:e,error:t}},G=()=>{const e=(0,s.useSelector)(l(o.ai.typePrefix)),t=(0,s.useSelector)(g(o.ai.typePrefix));return{isInstalling:e,error:t}},J=()=>{const e=(0,s.useSelector)(l(o.JC.typePrefix)),t=(0,s.useSelector)(g(o.JC.typePrefix));return{isUninstalling:e,error:t}},N=()=>{const e=(0,s.useDispatch)(),t=(0,s.useSelector)(O(o.mj.typePrefix));(0,d.useEffect)(()=>{t&&e((0,o.mj)())},[])},$=()=>{const e=useDispatch(),t=useSelector(selectIsRequestNotFetched(fetchAllLocal.typePrefix));useEffect(()=>{t&&e(fetchAllLocal())},[])},X=e=>{const t=(0,s.useDispatch)(),a=(0,s.useSelector)(T=>L(T,e)),u=!(0,s.useSelector)(l(o.t5.typePrefix))&&a&&!a.details;(0,d.useEffect)(()=>{u&&t((0,o.t5)(e))},[a])},Y=()=>{const e=(0,s.useDispatch)();return t=>e((0,o.t5)(t))}}}]);

//# sourceMappingURL=ConnectionsDataSourcePermissionsPage.6e3d9571cf1665ddea2a.js.map