"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[4620],{78014:(p,u,t)=>{t.d(u,{Z:()=>o});var n=t(68404),e=t(14747),c=t(31403),d=t(79979);class o extends n.PureComponent{render(){const{searchQuery:l,linkButton:r,setSearchQuery:g,target:v,placeholder:a="Search by name or type",sortPicker:s}=this.props,A={href:r?.href,disabled:r?.disabled};return v&&(A.target=v),n.createElement("div",{className:"page-action-bar"},n.createElement("div",{className:"gf-form gf-form--grow"},n.createElement(e.H,{value:l,onChange:g,placeholder:a})),s&&n.createElement(d.P,{onChange:s.onChange,value:s.value,getSortOptions:s.getSortOptions}),r&&n.createElement(c.Qj,{...A},r.title))}}},43137:(p,u,t)=>{t.d(u,{l:()=>v,S:()=>r});var n=t(52423),e=t(68404),c=t(72648),d=t(45253),o=t(31403),m=t(86475);const l=a=>({alertContent:n.css`
    display: flex;
    flex-direction: row;
    padding: 0;
    justify-content: space-between;
    align-items: center;
  `,alertParagraph:n.css`
    margin: 0 ${a.spacing(1)} 0 0;
    line-height: ${a.spacing(a.components.height.sm)};
    color: ${a.colors.text.primary};
  `});var r=(a=>(a.dataSources="dataSources",a.connectData="connectData",a))(r||{});const g={dataSources:m.Z.DataSources,connectData:m.Z.ConnectData};function v({destinationPage:a}){const s=(0,c.wW)(l);return e.createElement(d.b,{severity:"warning",title:""},e.createElement("div",{className:s.alertContent},e.createElement("p",{className:s.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."),e.createElement(o.Qj,{"aria-label":"Link to Connections",icon:"adjust-circle",href:g[a]},"See data sources in Connections")))}},19703:(p,u,t)=>{t.d(u,{G:()=>l});var n=t(68404),e=t(35645),c=t(31403),d=t(77582),o=t(81168),m=t(25e3);function l(){const r=d.Vt.hasPermission(o.AccessControlAction.DataSourcesCreate),g=(0,m.d7)();return r?n.createElement(c.Qj,{icon:"plus",href:e.v.appSubUrl+g.New},"Add new data source"):null}},81955:(p,u,t)=>{t.d(u,{c:()=>U});var n=t(52423),e=t(68404),c=t(35645),d=t(72648),o=t(72948),m=t(34719),l=t(31403),r=t(69142),g=t(2555),v=t(77582),a=t(81168),s=t(25e3),A=t(85597),B=t(78014);const L="alpha-asc",y="alpha-desc",R=[{label:"Sort by A\u2013Z",value:L},{label:"Sort by Z\u2013A",value:y}];function I(){const E=(0,a.useDispatch)(),P=(0,e.useCallback)(D=>E((0,s.zT)(D)),[E]),f=(0,a.useSelector)(({dataSources:D})=>(0,s.IO)(D)),C=v.Vt.hasPermission(a.AccessControlAction.DataSourcesCreate),S=(0,s.d7)(),h=!c.v.featureToggles.topnav&&C?{href:S.New,title:"Add new data source"}:void 0,T=(0,e.useCallback)(D=>E((0,s.Nu)(D.value===L)),[E]),i=(0,a.useSelector)(({dataSources:D})=>(0,s.IA)(D)),M={onChange:T,value:i?L:y,getSortOptions:()=>Promise.resolve(R)};return e.createElement(B.Z,{searchQuery:f,setSearchQuery:P,key:"action-bar",sortPicker:M,linkButton:h})}function U(){const{isLoading:E}=(0,s.zJ)(),P=(0,a.useSelector)(h=>(0,s.mt)(h.dataSources)),f=(0,a.useSelector)(({dataSources:h})=>(0,s.r7)(h)),C=v.Vt.hasPermission(a.AccessControlAction.DataSourcesCreate),S=v.Vt.hasPermission(a.AccessControlAction.DataSourcesWrite),O=v.Vt.hasPermission(a.AccessControlAction.DataSourcesExplore);return e.createElement(W,{dataSources:P,dataSourcesCount:f,isLoading:E,hasCreateRights:C,hasWriteRights:S,hasExploreRights:O})}function W({dataSources:E,dataSourcesCount:P,isLoading:f,hasCreateRights:C,hasWriteRights:S,hasExploreRights:O}){const h=(0,d.wW)(K),T=(0,s.d7)();return f?e.createElement(g.Z,null):P===0?e.createElement(r.Z,{buttonDisabled:!C,title:"No data sources defined",buttonIcon:"database",buttonLink:T.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(I,null),e.createElement("ul",{className:h.list},E.map(i=>{const M=c.v.appSubUrl+T.Edit.replace(/:uid/gi,i.uid);return e.createElement("li",{key:i.uid},e.createElement(o.Z,{href:S?M:void 0},e.createElement(o.Z.Heading,null,i.name),e.createElement(o.Z.Figure,null,e.createElement("img",{src:i.typeLogoUrl,alt:"",height:"40px",width:"40px",className:h.logo})),e.createElement(o.Z.Meta,null,[i.typeName,i.url,i.isDefault&&e.createElement(m.V,{key:"default-tag",name:"default",colorIndex:1})]),e.createElement(o.Z.Tags,null,e.createElement(l.Qj,{icon:"apps",fill:"outline",variant:"secondary",href:`dashboard/new-with-ds/${i.uid}`},"Build a dashboard"),O&&e.createElement(l.Qj,{icon:"compass",fill:"outline",variant:"secondary",className:h.button,href:(0,A.iU)(i)},"Explore"))))})))}const K=E=>({list:(0,n.css)({listStyle:"none",display:"grid"}),logo:(0,n.css)({objectFit:"contain"}),button:(0,n.css)({marginLeft:E.spacing(2)})})},85292:(p,u,t)=>{t.r(u),t.d(u,{DataSourcesListPage:()=>l,default:()=>r});var n=t(68404),e=t(35645),c=t(79396),d=t(43137),o=t(19703),m=t(81955);function l(){const g=e.v.featureToggles.topnav?n.createElement(o.G,null):void 0;return n.createElement(c.T,{navId:"datasources",actions:g},n.createElement(c.T.Contents,null,e.v.featureToggles.dataConnectionsConsole&&n.createElement(d.l,{destinationPage:d.S.dataSources}),n.createElement(m.c,null)))}const r=l}}]);

//# sourceMappingURL=DataSourcesListPage.53c4d1c0a7655d18bd99.js.map