3
0
mirror of https://github.com/grafana/grafana.git synced 2025-02-25 18:55:37 -06:00
grafana/public/app/features/datasources/DashboardsTable.tsx
Patrick O'Carroll d040e336c1 UI: Remove old icons ()
* removed unsused grafana-icon classes, replaced grafana-icons with gicons

* replaced old dashboard and datasource icons with gicon, fixed so icons on plugin list are shown

* removed unsused grafana-icon classes, replaced grafana-icons with gicons

* replaced old dashboard and datasource icons with gicon, fixed so icons on plugin list are shown

* replaced fontawesome cog, eye, link and edit with gicons

* updated snapshot

* fixed color of cog in dashboard nav, removed icons from buttons, ran preitterier on some files

* changed opacity on getting started icons and fixed getting started button

* .5 -> 0.5 fix for prettier
2019-04-17 15:18:32 +02:00

56 lines
1.8 KiB
TypeScript

import React, { FC } from 'react';
import { PluginDashboard } from '../../types';
export interface Props {
dashboards: PluginDashboard[];
onImport: (dashboard, overwrite) => void;
onRemove: (dashboard) => void;
}
const DashboardsTable: FC<Props> = ({ dashboards, onImport, onRemove }) => {
function buttonText(dashboard: PluginDashboard) {
return dashboard.revision !== dashboard.importedRevision ? 'Update' : 'Re-import';
}
return (
<table className="filter-table">
<tbody>
{dashboards.map((dashboard, index) => {
return (
<tr key={`${dashboard.dashboardId}-${index}`}>
<td className="width-1">
<i className="gicon gicon-dashboard" />
</td>
<td>
{dashboard.imported ? (
<a href={dashboard.importedUrl}>{dashboard.title}</a>
) : (
<span>{dashboard.title}</span>
)}
</td>
<td style={{ textAlign: 'right' }}>
{!dashboard.imported ? (
<button className="btn btn-secondary btn-small" onClick={() => onImport(dashboard, false)}>
Import
</button>
) : (
<button className="btn btn-secondary btn-small" onClick={() => onImport(dashboard, true)}>
{buttonText(dashboard)}
</button>
)}
{dashboard.imported && (
<button className="btn btn-danger btn-small" onClick={() => onRemove(dashboard)}>
<i className="fa fa-trash" />
</button>
)}
</td>
</tr>
);
})}
</tbody>
</table>
);
};
export default DashboardsTable;