mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-16 11:37:04 +02:00
* add timestamp to attribution * create usage stat component * updates stat text boxes * remove flex-header css * remove comment * add empty state if no data * update monthly serializer * remove empty state - unnecessary * change tab to 'history' * add usage stats to history view * change css styling for upcased grey subtitle * correctly exports namespace and auth data * close modal on download * test making a service? * fix monthly attrs * update csv content format * remove component and make downloadCsv a service * update function name * wip//add warning labels, fixing up current and history tabs * wip//clean up serializer fix with real data * fix link styling: * add conditionals for no data, add warning for 1.9 counting changes * naming comment * fix tooltip formatting * fix number format and consolidate actions * remove outdated test * add revokeObjectURL and rename variable * fix errors and empty state views when no activity data at all * fix end time error * fix comment * return truncating to serializer * PR review cleanup * return new object
25 lines
729 B
JavaScript
25 lines
729 B
JavaScript
import { format } from 'd3-format';
|
|
|
|
// COLOR THEME:
|
|
export const LIGHT_AND_DARK_BLUE = ['#BFD4FF', '#1563FF'];
|
|
export const BAR_COLOR_HOVER = ['#1563FF', '#0F4FD1'];
|
|
export const GREY = '#EBEEF2';
|
|
|
|
// TRANSLATIONS:
|
|
export const TRANSLATE = { left: -11 };
|
|
export const SVG_DIMENSIONS = { height: 190, width: 500 };
|
|
|
|
// Reference for tickFormat https://www.youtube.com/watch?v=c3MCROTNN8g
|
|
export function formatNumbers(number) {
|
|
// replace SI prefix of 'G' for billions to 'B'
|
|
return format('.1s')(number).replace('G', 'B');
|
|
}
|
|
|
|
export function formatTooltipNumber(value) {
|
|
if (typeof value !== 'number') {
|
|
return value;
|
|
}
|
|
// formats a number according to the locale
|
|
return new Intl.NumberFormat().format(value);
|
|
}
|