grafana/public/app/features/plugins/admin/components/VersionList.tsx
Jack Westbrook 1d37d675d7
Plugins: Render app plugin config pages in catalog (#37063)
* feat(catalog): introduce PluginDetailsBody component and useLoadPluginConfig hook

* feat(catalog): use PluginDetailsBody and useLoadPluginConfig hook in PluginDetails

* feat(catalog): introduce usePluginDetails hook to handle PluginDetails state

* feat(catalog): wire usePluginDetails hook to PluginDetails and InstallControls

* refactor(catalog): fix typescript errors related to usePluginDetails hook

* chore(catalog): update types for PluginDetailsActions
2021-07-21 19:44:43 +02:00

56 lines
1.1 KiB
TypeScript

import React from 'react';
import { css } from '@emotion/css';
import { dateTimeFormatTimeAgo, GrafanaTheme2 } from '@grafana/data';
import { useStyles2 } from '@grafana/ui';
import { Version } from '../types';
interface Props {
versions: Version[];
}
export const VersionList = ({ versions }: Props) => {
const styles = useStyles2(getStyles);
if (versions.length === 0) {
return <p>No version history was found.</p>;
}
return (
<table className={styles.table}>
<thead>
<tr>
<th>Version</th>
<th>Last updated</th>
</tr>
</thead>
<tbody>
{versions.map((version) => {
return (
<tr key={version.version}>
<td>{version.version}</td>
<td>{dateTimeFormatTimeAgo(version.createdAt)}</td>
</tr>
);
})}
</tbody>
</table>
);
};
const getStyles = (theme: GrafanaTheme2) => ({
container: css`
padding: ${theme.spacing(2, 4, 3)};
`,
table: css`
width: 100%;
td,
th {
padding: ${theme.spacing()} 0;
}
th {
font-size: ${theme.typography.h5.fontSize};
}
`,
});