-
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.
[ML] Stats bar for data frame analytics (#49464)
* [ML] stats for analytics jobs * [ML] alight stats position * [ML] refactor getAnalyticFactory, remove analytics stats bar component * [ML] align layout for anomaly detection * [ML] align layout * [ML] show failed jobs count * [ML] Anomaly detection jobs header * [ML] test * [ML] fix action columns * [ML] add type for createAnalyticsForm * [ML] move page title, prettier formatting
- Loading branch information
Showing
17 changed files
with
422 additions
and
328 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
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
92 changes: 92 additions & 0 deletions
92
...ame_analytics/pages/analytics_management/services/analytics_service/get_analytics.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,92 @@ | ||
/* | ||
* 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 { GetDataFrameAnalyticsStatsResponseOk } from '../../../../../services/ml_api_service'; | ||
import { getAnalyticsJobsStats } from './get_analytics'; | ||
import { DATA_FRAME_TASK_STATE } from '../../components/analytics_list/common'; | ||
|
||
jest.mock('ui/index_patterns', () => ({ | ||
validateIndexPattern: () => true, | ||
})); | ||
|
||
describe('get_analytics', () => { | ||
test('should get analytics jobs stats', () => { | ||
// arrange | ||
const mockResponse: GetDataFrameAnalyticsStatsResponseOk = { | ||
count: 2, | ||
data_frame_analytics: [ | ||
{ | ||
id: 'outlier-cloudwatch', | ||
state: DATA_FRAME_TASK_STATE.STOPPED, | ||
progress: [ | ||
{ | ||
phase: 'reindexing', | ||
progress_percent: 0, | ||
}, | ||
{ | ||
phase: 'loading_data', | ||
progress_percent: 0, | ||
}, | ||
{ | ||
phase: 'analyzing', | ||
progress_percent: 0, | ||
}, | ||
{ | ||
phase: 'writing_results', | ||
progress_percent: 0, | ||
}, | ||
], | ||
}, | ||
{ | ||
id: 'reg-gallery', | ||
state: DATA_FRAME_TASK_STATE.FAILED, | ||
progress: [ | ||
{ | ||
phase: 'reindexing', | ||
progress_percent: 0, | ||
}, | ||
{ | ||
phase: 'loading_data', | ||
progress_percent: 0, | ||
}, | ||
{ | ||
phase: 'analyzing', | ||
progress_percent: 0, | ||
}, | ||
{ | ||
phase: 'writing_results', | ||
progress_percent: 0, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
// act and assert | ||
expect(getAnalyticsJobsStats(mockResponse)).toEqual({ | ||
total: { | ||
label: 'Total analytics jobs', | ||
value: 2, | ||
show: true, | ||
}, | ||
started: { | ||
label: 'Running', | ||
value: 0, | ||
show: true, | ||
}, | ||
stopped: { | ||
label: 'Stopped', | ||
value: 1, | ||
show: true, | ||
}, | ||
failed: { | ||
label: 'Failed', | ||
value: 1, | ||
show: true, | ||
}, | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.