Skip to content

Commit

Permalink
adjust types
Browse files Browse the repository at this point in the history
  • Loading branch information
dominiqueclarke committed Apr 20, 2023
1 parent f3cb08a commit d9c33dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ export const CUSTOM_LABEL = i18n.translate('xpack.synthetics.connectionProfile.c
defaultMessage: 'Custom',
});

export const DEFAULT_THROTTLING_VALUE = { download: '5', upload: '3', latency: '20' };

export const PROFILE_VALUES: ThrottlingConfig[] = [
{
value: { download: '5', upload: '3', latency: '20' },
value: DEFAULT_THROTTLING_VALUE,
id: PROFILE_VALUES_ENUM.DEFAULT,
label: i18n.translate('xpack.synthetics.connectionProfile.default', {
defaultMessage: 'Default',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
objectToJsonFormatter,
stringToJsonFormatter,
} from '../formatting_utils';
import { DEFAULT_THROTTLING_VALUE } from '../../constants/monitor_defaults';

import { tlsFormatters } from '../tls/formatters';

Expand All @@ -21,9 +22,9 @@ export const throttlingFormatter: Formatter = (fields) => {
const throttling = fields[ConfigKey.THROTTLING_CONFIG];

return JSON.stringify({
download: Number(throttling.value.download),
upload: Number(throttling.value.upload),
latency: Number(throttling.value.latency),
download: Number(throttling?.value?.download || DEFAULT_THROTTLING_VALUE.download),
upload: Number(throttling?.value?.upload || DEFAULT_THROTTLING_VALUE.upload),
latency: Number(throttling?.value?.latency || DEFAULT_THROTTLING_VALUE),
});
};

Expand Down

0 comments on commit d9c33dc

Please sign in to comment.