"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[4620],{67694:(I,m,t)=>{t.d(m,{Z:()=>h});var a=t(65237),e=t(27496),v=t(48389),l=t(66624);class h extends a.PureComponent{render(){const{searchQuery:f,linkButton:c,setSearchQuery:C,target:p,placeholder:E="Search by name or type",sortPicker:n}=this.props,o={href:c?.href,disabled:c?.disabled};return p&&(o.target=p),a.createElement("div",{className:"page-action-bar"},a.createElement("div",{className:"gf-form gf-form--grow"},a.createElement(e.H,{value:f,onChange:C,placeholder:E})),n&&a.createElement(l.P,{onChange:n.onChange,value:n.value,getSortOptions:n.getSortOptions}),c&&a.createElement(v.Qj,{...o},c.title))}}},28606:(I,m,t)=>{t.d(m,{G:()=>f});var a=t(65237),e=t(49784),v=t(48389),l=t(63969),h=t(3315),i=t(66116);function f(){const c=l.Vt.hasPermission(h.AccessControlAction.DataSourcesCreate),C=(0,i.d7)();return c?a.createElement(v.Qj,{icon:"plus",href:e.v.appSubUrl+C.New},"Add new data source"):null}},82986:(I,m,t)=>{t.d(m,{c:()=>W});var a=t(60234),e=t(65237),v=t(60894),l=t(49784),h=t(93048),i=t(60631),f=t(69784),c=t(48389),C=t(76044),p=t(42702),E=t(63969),n=t(3315),o=t(66116),P=t(57786),L=t(77393),R=t(67694);const r="alpha-asc",O="alpha-desc",N=[{label:"Sort by A\u2013Z",value:r},{label:"Sort by Z\u2013A",value:O}];function U(){const u=(0,n.useDispatch)(),S=(0,e.useCallback)(g=>u((0,o.zT)(g)),[u]),A=(0,n.useSelector)(({dataSources:g})=>(0,o.IO)(g)),y=E.Vt.hasPermission(n.AccessControlAction.DataSourcesCreate),T=(0,o.d7)(),d=!l.v.featureToggles.topnav&&y?{href:T.New,title:"Add new data source"}:void 0,B=(0,e.useCallback)(g=>u((0,o.Nu)(g.value===r)),[u]),D=(0,n.useSelector)(({dataSources:g})=>(0,o.IA)(g)),s={onChange:B,value:D?r:O,getSortOptions:()=>Promise.resolve(N)};return e.createElement(R.Z,{searchQuery:A,setSearchQuery:S,key:"action-bar",sortPicker:s,linkButton:d})}function W(){const{isLoading:u}=(0,o.zJ)(),S=(0,n.useSelector)(d=>(0,o.mt)(d.dataSources)),A=(0,n.useSelector)(({dataSources:d})=>(0,o.r7)(d)),y=E.Vt.hasPermission(n.AccessControlAction.DataSourcesCreate),T=E.Vt.hasPermission(n.AccessControlAction.DataSourcesWrite),M=E.Vt.hasPermission(n.AccessControlAction.DataSourcesExplore);return e.createElement(x,{dataSources:S,dataSourcesCount:A,isLoading:u,hasCreateRights:y,hasWriteRights:T,hasExploreRights:M})}function x({dataSources:u,dataSourcesCount:S,isLoading:A,hasCreateRights:y,hasWriteRights:T,hasExploreRights:M}){const d=(0,h.wW)(Z),B=(0,o.d7)(),D=(0,v.TH)();return(0,e.useEffect)(()=>{(0,P.dF)({grafana_version:l.v.buildInfo.version,path:D.pathname})},[D]),A?e.createElement(p.Z,null):S===0?e.createElement(C.Z,{buttonDisabled:!y,title:"No data sources defined",buttonIcon:"database",buttonLink:B.New,buttonTitle:"Add data source",proTip:"You can also define data sources through configuration files.",proTipLink:"http://docs.grafana.org/administration/provisioning/#datasources?utm_source=grafana_ds_list",proTipLinkTitle:"Learn more",proTipTarget:"_blank"}):e.createElement(e.Fragment,null,e.createElement(U,null),e.createElement("ul",{className:d.list},u.map(s=>{const g=l.v.appSubUrl+B.Edit.replace(/:uid/gi,s.uid);return e.createElement("li",{key:s.uid},e.createElement(i.Z,{href:T?g:void 0},e.createElement(i.Z.Heading,null,s.name),e.createElement(i.Z.Figure,null,e.createElement("img",{src:s.typeLogoUrl,alt:"",height:"40px",width:"40px",className:d.logo})),e.createElement(i.Z.Meta,null,[s.typeName,s.url,s.isDefault&&e.createElement(f.V,{key:"default-tag",name:"default",colorIndex:1})]),e.createElement(i.Z.Tags,null,e.createElement(c.Qj,{icon:"apps",fill:"outline",variant:"secondary",href:`dashboard/new-with-ds/${s.uid}`,onClick:()=>{(0,P.hJ)({grafana_version:l.v.buildInfo.version,datasource_uid:s.uid,plugin_name:s.typeName,path:D.pathname})}},"Build a dashboard"),M&&e.createElement(c.Qj,{icon:"compass",fill:"outline",variant:"secondary",className:d.button,href:(0,L.iU)(s),onClick:()=>{(0,P.U4)({grafana_version:l.v.buildInfo.version,datasource_uid:s.uid,plugin_name:s.typeName,path:D.pathname})}},"Explore"))))})))}const Z=u=>({list:(0,a.css)({listStyle:"none",display:"grid"}),logo:(0,a.css)({objectFit:"contain"}),button:(0,a.css)({marginLeft:u.spacing(2)})})},17378:(I,m,t)=>{t.r(m),t.d(m,{DataSourcesListPage:()=>L,default:()=>R});var a=t(65237),e=t(49784),v=t(38992),l=t(60234),h=t(93048),i=t(88347),f=t(48389),c=t(50160);const C=r=>({alertContent:l.css`
    display: flex;
    flex-direction: row;
    padding: 0;
    justify-content: space-between;
    align-items: center;
  `,alertParagraph:l.css`
    margin: 0 ${r.spacing(1)} 0 0;
    line-height: ${r.spacing(r.components.height.sm)};
    color: ${r.colors.text.primary};
  `});function p(){const r=(0,h.wW)(C);return a.createElement(i.b,{severity:"warning",title:""},a.createElement("div",{className:r.alertContent},a.createElement("p",{className:r.alertParagraph},"Data sources have a new home! You can discover new data sources or manage existing ones in the new Connections page, accessible from the lefthand nav."),a.createElement(f.Qj,{"aria-label":"Link to Connections",icon:"adjust-circle",href:c.Z.DataSources},"See data sources in Connections")))}var E=t(3315),n=t(28606),o=t(82986),P=t(66116);function L(){const r=(0,E.useSelector)(({dataSources:N})=>(0,P.r7)(N)),O=e.v.featureToggles.topnav&&r>0?a.createElement(n.G,null):void 0;return a.createElement(v.T,{navId:"datasources",actions:O},a.createElement(v.T.Contents,null,e.v.featureToggles.dataConnectionsConsole&&a.createElement(p,null),a.createElement(o.c,null)))}const R=L}}]);

//# sourceMappingURL=DataSourcesListPage.30648a11679e3a30daf0.js.map