Minor UI updates to make numbers and dates a bit more human friendly

Signed-off-by: Jeremy Guarini <jguarini@paloaltonetworks.com>
This commit is contained in:
Jeremy Guarini
2021-11-04 09:52:59 -07:00
parent a62bca43f8
commit ab27aa313c
2 changed files with 8 additions and 3 deletions
@@ -69,6 +69,11 @@ const getTrendIcon = (trend: number, classes: ClassNameMap) => {
}
};
// convert timestamp to human friendly form
function formatDateToHuman(timeStamp: string | number) {
return new Date(timeStamp).toUTCString();
}
export const CoverageHistoryChart = () => {
const { entity } = useEntity();
const codeCoverageApi = useApi(codeCoverageApiRef);
@@ -149,10 +154,10 @@ export const CoverageHistoryChart = () => {
margin={{ right: 48, top: 32 }}
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="timestamp" />
<XAxis dataKey="timestamp" tickFormatter={formatDateToHuman} />
<YAxis dataKey="line.percentage" />
<YAxis dataKey="branch.percentage" />
<Tooltip />
<Tooltip labelFormatter={formatDateToHuman} />
<Legend />
<Line
type="monotone"
@@ -232,7 +232,7 @@ export const FileExplorer = () => {
title: 'Coverage',
type: 'numeric',
field: 'coverage',
render: (row: CoverageTableRow) => `${row.coverage}%`,
render: (row: CoverageTableRow) => `${row.coverage.toFixed(2)}%`,
},
{
title: 'Missing lines',