"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2929],{61183:(a,s,e)=>{e.d(s,{Z:()=>n});e(76687);var t,o=e(70534),r=e(52010);const n=a=>{let{dashboards:s,onImport:e,onRemove:n}=a;function d(a){return a.revision!==a.importedRevision?"Update":"Re-import"}return(0,r.jsx)("table",{className:"filter-table",children:(0,r.jsx)("tbody",{children:s.map(((a,s)=>(0,r.jsxs)("tr",{children:[t||(t=(0,r.jsx)("td",{className:"width-1",children:(0,r.jsx)(o.Icon,{name:"apps"})})),(0,r.jsx)("td",{children:a.imported?(0,r.jsx)("a",{href:a.importedUrl,children:a.title}):(0,r.jsx)("span",{children:a.title})}),(0,r.jsxs)("td",{style:{textAlign:"right"},children:[a.imported?(0,r.jsx)(o.Button,{variant:"secondary",size:"sm",onClick:()=>e(a,!0),children:d(a)}):(0,r.jsx)(o.Button,{variant:"secondary",size:"sm",onClick:()=>e(a,!1),children:"Import"}),a.imported&&(0,r.jsx)(o.Button,{icon:"trash-alt",variant:"destructive",size:"sm",onClick:()=>n(a)})]})]},`${a.dashboardId}-${s}`)))})})}},40585:(a,s,e)=>{e.r(s),e.d(s,{DataSourceDashboards:()=>v,default:()=>g});var t=e(76687),o=e(46958),r=e(36131),n=e(3276),d=e(32732),i=e(82458),c=e(61183),l=e(63110),h=e(77863),p=e(52010);function u(a,s,e){return s in a?Object.defineProperty(a,s,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[s]=e,a}const m={importDashboard:d.$j,loadDataSource:l.gv,loadPluginDashboards:i.m3,removeDashboard:d.fG},b=(0,o.connect)((function(a,s){const e=s.match.params.uid;return{navModel:(0,n.h)(a.navIndex,`datasource-dashboards-${e}`),dashboards:a.plugins.dashboards,dataSource:(0,h.f6)(a.dataSources,e),isLoading:a.plugins.isLoadingPluginDashboards,dataSourceId:e}}),m);class v extends t.PureComponent{constructor(){super(...arguments),u(this,"onImport",((a,s)=>{const{dataSource:e,importDashboard:t}=this.props,o={pluginId:a.pluginId,path:a.path,overwrite:s,inputs:[]};e&&o.inputs.push({name:"*",type:"datasource",pluginId:e.type,value:e.name}),t(o,a.title)})),u(this,"onRemove",(a=>{this.props.removeDashboard(a.uid)}))}async componentDidMount(){const{loadDataSource:a,dataSourceId:s}=this.props;await a(s),this.props.loadPluginDashboards()}render(){const{dashboards:a,navModel:s,isLoading:e}=this.props;return(0,p.jsx)(r.Z,{navModel:s,children:(0,p.jsx)(r.Z.Contents,{isLoading:e,children:(0,p.jsx)(c.Z,{dashboards:a,onImport:(a,s)=>this.onImport(a,s),onRemove:a=>this.onRemove(a)})})})}}const g=b(v)}}]);
//# sourceMappingURL=DataSourceDashboards.afd9a179012b1202eec5.js.map