-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert triggers and actions UI to Kibana Platform (#56388)
* Convert triggers and actions UI to Kibana Platform * Copy ui/time_buckets over * Fix i18n * Fix scss * Fix UI from not loading anymore
- Loading branch information
Showing
107 changed files
with
870 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 0 additions & 96 deletions
96
x-pack/legacy/plugins/triggers_actions_ui/public/legacy.ts
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
x-pack/legacy/plugins/triggers_actions_ui/public/manage_angular_lifecycle.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
123 changes: 123 additions & 0 deletions
123
...tion/components/builtin_alert_types/threshold/lib/time_buckets/calc_auto_interval.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/* | ||
* 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 moment from 'moment'; | ||
|
||
import { calcAutoIntervalLessThan, calcAutoIntervalNear } from './calc_auto_interval'; | ||
|
||
describe('calcAutoIntervalNear', () => { | ||
test('1h/0 buckets = 0ms buckets', () => { | ||
const interval = calcAutoIntervalNear(0, Number(moment.duration(1, 'h'))); | ||
expect(interval.asMilliseconds()).toBe(0); | ||
}); | ||
|
||
test('undefined/100 buckets = 0ms buckets', () => { | ||
const interval = calcAutoIntervalNear(0, undefined as any); | ||
expect(interval.asMilliseconds()).toBe(0); | ||
}); | ||
|
||
test('1ms/100 buckets = 1ms buckets', () => { | ||
const interval = calcAutoIntervalNear(100, Number(moment.duration(1, 'ms'))); | ||
expect(interval.asMilliseconds()).toBe(1); | ||
}); | ||
|
||
test('200ms/100 buckets = 2ms buckets', () => { | ||
const interval = calcAutoIntervalNear(100, Number(moment.duration(200, 'ms'))); | ||
expect(interval.asMilliseconds()).toBe(2); | ||
}); | ||
|
||
test('1s/1000 buckets = 1ms buckets', () => { | ||
const interval = calcAutoIntervalNear(1000, Number(moment.duration(1, 's'))); | ||
expect(interval.asMilliseconds()).toBe(1); | ||
}); | ||
|
||
test('1000h/1000 buckets = 1h buckets', () => { | ||
const interval = calcAutoIntervalNear(1000, Number(moment.duration(1000, 'hours'))); | ||
expect(interval.asHours()).toBe(1); | ||
}); | ||
|
||
test('1h/100 buckets = 30s buckets', () => { | ||
const interval = calcAutoIntervalNear(100, Number(moment.duration(1, 'hours'))); | ||
expect(interval.asSeconds()).toBe(30); | ||
}); | ||
|
||
test('1d/25 buckets = 1h buckets', () => { | ||
const interval = calcAutoIntervalNear(25, Number(moment.duration(1, 'day'))); | ||
expect(interval.asHours()).toBe(1); | ||
}); | ||
|
||
test('1y/1000 buckets = 12h buckets', () => { | ||
const interval = calcAutoIntervalNear(1000, Number(moment.duration(1, 'year'))); | ||
expect(interval.asHours()).toBe(12); | ||
}); | ||
|
||
test('1y/10000 buckets = 1h buckets', () => { | ||
const interval = calcAutoIntervalNear(10000, Number(moment.duration(1, 'year'))); | ||
expect(interval.asHours()).toBe(1); | ||
}); | ||
|
||
test('1y/100000 buckets = 5m buckets', () => { | ||
const interval = calcAutoIntervalNear(100000, Number(moment.duration(1, 'year'))); | ||
expect(interval.asMinutes()).toBe(5); | ||
}); | ||
}); | ||
|
||
describe('calcAutoIntervalLessThan', () => { | ||
test('1h/0 buckets = 0ms buckets', () => { | ||
const interval = calcAutoIntervalLessThan(0, Number(moment.duration(1, 'h'))); | ||
expect(interval.asMilliseconds()).toBe(0); | ||
}); | ||
|
||
test('undefined/100 buckets = 0ms buckets', () => { | ||
const interval = calcAutoIntervalLessThan(0, undefined as any); | ||
expect(interval.asMilliseconds()).toBe(0); | ||
}); | ||
|
||
test('1ms/100 buckets = 1ms buckets', () => { | ||
const interval = calcAutoIntervalLessThan(100, Number(moment.duration(1, 'ms'))); | ||
expect(interval.asMilliseconds()).toBe(1); | ||
}); | ||
|
||
test('200ms/100 buckets = 2ms buckets', () => { | ||
const interval = calcAutoIntervalLessThan(100, Number(moment.duration(200, 'ms'))); | ||
expect(interval.asMilliseconds()).toBe(2); | ||
}); | ||
|
||
test('1s/1000 buckets = 1ms buckets', () => { | ||
const interval = calcAutoIntervalLessThan(1000, Number(moment.duration(1, 's'))); | ||
expect(interval.asMilliseconds()).toBe(1); | ||
}); | ||
|
||
test('1000h/1000 buckets = 1h buckets', () => { | ||
const interval = calcAutoIntervalLessThan(1000, Number(moment.duration(1000, 'hours'))); | ||
expect(interval.asHours()).toBe(1); | ||
}); | ||
|
||
test('1h/100 buckets = 30s buckets', () => { | ||
const interval = calcAutoIntervalLessThan(100, Number(moment.duration(1, 'hours'))); | ||
expect(interval.asSeconds()).toBe(30); | ||
}); | ||
|
||
test('1d/25 buckets = 30m buckets', () => { | ||
const interval = calcAutoIntervalLessThan(25, Number(moment.duration(1, 'day'))); | ||
expect(interval.asMinutes()).toBe(30); | ||
}); | ||
|
||
test('1y/1000 buckets = 3h buckets', () => { | ||
const interval = calcAutoIntervalLessThan(1000, Number(moment.duration(1, 'year'))); | ||
expect(interval.asHours()).toBe(3); | ||
}); | ||
|
||
test('1y/10000 buckets = 30m buckets', () => { | ||
const interval = calcAutoIntervalLessThan(10000, Number(moment.duration(1, 'year'))); | ||
expect(interval.asMinutes()).toBe(30); | ||
}); | ||
|
||
test('1y/100000 buckets = 5m buckets', () => { | ||
const interval = calcAutoIntervalLessThan(100000, Number(moment.duration(1, 'year'))); | ||
expect(interval.asMinutes()).toBe(5); | ||
}); | ||
}); |
Oops, something went wrong.