Skip to content

Commit

Permalink
Adds a configuration option to customize the standard datetime format…
Browse files Browse the repository at this point in the history
… used.

Signed-off-by: Leonardo FREITAS GOMES <leonardo.gomes@amadeus.com>
  • Loading branch information
leogomes-1a committed Jul 2, 2019
1 parent fdea0f7 commit e0e19aa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/jaeger-ui/src/constants/default-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import deepFreeze from 'deep-freeze';

import { FALLBACK_DAG_MAX_NUM_SERVICES } from './index';
import { FALLBACK_DAG_MAX_NUM_SERVICES, FALLBACK_STANDARD_DATETIME_FORMAT } from './index';

export default deepFreeze(
Object.defineProperty(
Expand Down Expand Up @@ -66,6 +66,7 @@ export default deepFreeze(
gaID: null,
trackErrors: true,
},
standardDatetimeFormat: FALLBACK_STANDARD_DATETIME_FORMAT,
},
// fields that should be individually merged vs wholesale replaced
'__mergeFields',
Expand Down
1 change: 1 addition & 0 deletions packages/jaeger-ui/src/constants/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const TOP_NAV_HEIGHT = 47 as 47;

export const FALLBACK_DAG_MAX_NUM_SERVICES = 100 as 100;
export const FALLBACK_TRACE_NAME = '<trace-without-root-span>' as '<trace-without-root-span>';
export const FALLBACK_STANDARD_DATETIME_FORMAT = 'LLL';

export const FETCH_DONE = 'FETCH_DONE' as 'FETCH_DONE';
export const FETCH_ERROR = 'FETCH_ERROR' as 'FETCH_ERROR';
Expand Down
5 changes: 4 additions & 1 deletion packages/jaeger-ui/src/utils/date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ import moment from 'moment';
import _round from 'lodash/round';

import { toFloatPrecision } from './number';
import { getConfigValue } from './config/get-config';
import { FALLBACK_STANDARD_DATETIME_FORMAT } from '../constants';

const TODAY = 'Today';
const YESTERDAY = 'Yesterday';

export const STANDARD_DATE_FORMAT = 'YYYY-MM-DD';
export const STANDARD_TIME_FORMAT = 'HH:mm';
export const STANDARD_DATETIME_FORMAT = 'LLL';
export const STANDARD_DATETIME_FORMAT =
getConfigValue('standardDatetimeFormat') || FALLBACK_STANDARD_DATETIME_FORMAT;
export const ONE_MILLISECOND = 1000;
export const ONE_SECOND = 1000 * ONE_MILLISECOND;
export const DEFAULT_MS_PRECISION = Math.log10(ONE_MILLISECOND);
Expand Down

0 comments on commit e0e19aa

Please sign in to comment.