DataSourceDashboards.5a3cd174db3226094ea8.js 2.4 KB

12
  1. "use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2929],{53149:(a,s,e)=>{e.d(s,{Z:()=>n});e(68404);var t,o=e(69783),r=e(45916);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}`)))})})}},33518:(a,s,e)=>{e.r(s),e.d(s,{DataSourceDashboards:()=>v,default:()=>g});var t=e(68404),o=e(18745),r=e(33801),n=e(8674),d=e(62736),i=e(72192),c=e(53149),l=e(87993),h=e(77197),p=e(45916);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)}}]);
  2. //# sourceMappingURL=DataSourceDashboards.5a3cd174db3226094ea8.js.map