Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] [NP] Removing ui imports #56358

Merged
merged 30 commits into from
Feb 11, 2020
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5c6e77c
[ML] [NP] Removing ui imports
jgowdyelastic Jan 30, 2020
c8ab315
replacing timefilter and ui context
jgowdyelastic Jan 30, 2020
0fc0cb0
replacing ui/i18n and ui/metadata
jgowdyelastic Jan 31, 2020
1c2f55e
removing ui/system_api
jgowdyelastic Jan 31, 2020
a77c900
removing ui/notify
jgowdyelastic Jan 31, 2020
2e1e62a
removing most ui/new_platform
jgowdyelastic Feb 1, 2020
0b59bd7
fix explorer date format loading
jgowdyelastic Feb 1, 2020
d755475
removing ui/chrome
jgowdyelastic Feb 3, 2020
e7ff021
fixing timebuckets test
jgowdyelastic Feb 3, 2020
a130312
fixing jest tests
jgowdyelastic Feb 3, 2020
20a1fbc
adding http
jgowdyelastic Feb 3, 2020
6243432
testing odd CI type failure
jgowdyelastic Feb 4, 2020
dd332f5
revrting type test changes
jgowdyelastic Feb 4, 2020
424b35d
fixing odd test type error
jgowdyelastic Feb 4, 2020
88fca3a
refactoring dependencies
jgowdyelastic Feb 4, 2020
3f8a4d6
removing injectI18n and using withKibana for context
jgowdyelastic Feb 6, 2020
6f76501
updating components to use kibana context
jgowdyelastic Feb 6, 2020
d0a56e4
re-enabling some tests
jgowdyelastic Feb 6, 2020
d150430
fixing translation strings
jgowdyelastic Feb 6, 2020
ed51a2f
adding comments
jgowdyelastic Feb 6, 2020
3244480
removing commented out code
jgowdyelastic Feb 6, 2020
f0f2786
missing i18n
jgowdyelastic Feb 6, 2020
87af784
fixing rebase conflicts
jgowdyelastic Feb 6, 2020
0689e3f
removing unused ui contexts
jgowdyelastic Feb 7, 2020
e301751
changes based on review
jgowdyelastic Feb 7, 2020
2c76e01
adding text to errors
jgowdyelastic Feb 9, 2020
eed8c87
fixing management plugin
jgowdyelastic Feb 10, 2020
8464f2a
changes based on review
jgowdyelastic Feb 11, 2020
864d199
refeactor after rebase
jgowdyelastic Feb 11, 2020
7f0ae9e
fixing test
jgowdyelastic Feb 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revrting type test changes
  • Loading branch information
jgowdyelastic committed Feb 11, 2020
commit dd332f54792405e95295b0f6ba6347a5b13c4d97
Original file line number Diff line number Diff line change
@@ -16,11 +16,11 @@ import {

import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import numeral from '@elastic/numeral';

import { FieldDataCardProps } from '../field_data_card';
import { DisplayValue } from '../../../../../components/display_value';
import { kibanaFieldFormat } from '../../../../../formatters/kibana_field_format';
import { numberAsOrdinal } from '../../../../../formatters/number_as_ordinal';
import { roundToDecimalPlace } from '../../../../../formatters/round_to_decimal_place';
import {
MetricDistributionChart,
@@ -38,11 +38,6 @@ const METRIC_DISTRIBUTION_CHART_WIDTH = 325;
const METRIC_DISTRIBUTION_CHART_HEIGHT = 210;
const DEFAULT_TOP_VALUES_THRESHOLD = 100;

function numberAsOrdinal(num: number) {
const int = Math.floor(num);
return `${numeral(int).format('0o')}`;
}

export const NumberContent: FC<FieldDataCardProps> = ({ config }) => {
const { stats, fieldFormat } = config;

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { numberAsOrdinal } from './number_as_ordinal';

describe('ML - numberAsOrdinal formatter', () => {
const tests = [
{ number: 0, asOrdinal: '0th' },
{ number: 1, asOrdinal: '1st' },
{ number: 2.2, asOrdinal: '2nd' },
{ number: 3, asOrdinal: '3rd' },
{ number: 5, asOrdinal: '5th' },
{ number: 10, asOrdinal: '10th' },
{ number: 11, asOrdinal: '11th' },
{ number: 22, asOrdinal: '22nd' },
{ number: 33, asOrdinal: '33rd' },
{ number: 44.4, asOrdinal: '44th' },
{ number: 100, asOrdinal: '100th' },
];
test('returns the expected numeral format', () => {
tests.forEach(test => {
expect(numberAsOrdinal(test.number)).toBe(test.asOrdinal);
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import numeral from '@elastic/numeral';

/**
* Formats the supplied number as ordinal e.g. 15 as 15th.
* Formatting first converts the supplied number to an integer by flooring.
* @param {number} value to format as an ordinal
* @return {string} number formatted as an ordinal e.g. 15th
*/
export function numberAsOrdinal(num: number) {
const int = Math.floor(num);
return `${numeral(int).format('0o')}`;
}