-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
101 changed files
with
4,546 additions
and
2,035 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import { coreMock } from '../../../../../src/core/public/mocks'; | ||
import { createMlStartDepsMock } from './ml_start_deps'; | ||
|
||
export const createCoreStartMock = () => | ||
coreMock.createSetup({ pluginStartDeps: createMlStartDepsMock() }); |
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,28 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { uiActionsPluginMock } from '../../../../../src/plugins/ui_actions/public/mocks'; | ||
import { dataPluginMock } from '../../../../../src/plugins/data/public/mocks'; | ||
import { kibanaLegacyPluginMock } from '../../../../../src/plugins/kibana_legacy/public/mocks'; | ||
import { embeddablePluginMock } from '../../../../../src/plugins/embeddable/public/mocks'; | ||
import { lensPluginMock } from '../../../lens/public/mocks'; | ||
import { triggersActionsUiMock } from '../../../triggers_actions_ui/public/mocks'; | ||
|
||
export const createMlStartDepsMock = () => ({ | ||
data: dataPluginMock.createStartContract(), | ||
share: { | ||
urlGenerators: { getUrlGenerator: jest.fn() }, | ||
}, | ||
kibanaLegacy: kibanaLegacyPluginMock.createStartContract(), | ||
uiActions: uiActionsPluginMock.createStartContract(), | ||
spaces: jest.fn(), | ||
embeddable: embeddablePluginMock.createStartContract(), | ||
maps: jest.fn(), | ||
lens: lensPluginMock.createStartContract(), | ||
triggersActionsUi: triggersActionsUiMock.createStart(), | ||
fileUpload: jest.fn(), | ||
}); |
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
23 changes: 23 additions & 0 deletions
23
x-pack/plugins/ml/public/application/components/custom_hooks/use_time_buckets.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,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { useMemo } from 'react'; | ||
import { useUiSettings } from '../../contexts/kibana'; | ||
import { TimeBuckets } from '../../util/time_buckets'; | ||
import { UI_SETTINGS } from '../../../../../../../src/plugins/data/common'; | ||
|
||
export const useTimeBuckets = () => { | ||
const uiSettings = useUiSettings(); | ||
return useMemo(() => { | ||
return new TimeBuckets({ | ||
'histogram:maxBars': uiSettings.get(UI_SETTINGS.HISTOGRAM_MAX_BARS), | ||
'histogram:barTarget': uiSettings.get(UI_SETTINGS.HISTOGRAM_BAR_TARGET), | ||
dateFormat: uiSettings.get('dateFormat'), | ||
'dateFormat:scaled': uiSettings.get('dateFormat:scaled'), | ||
}); | ||
}, [uiSettings]); | ||
}; |
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
Oops, something went wrong.