-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[TSVB] Shim new platform #39169
Merged
alexwizp
merged 46 commits into
elastic:master
from
gospodarsky:metrics-shim-new-platform
Aug 5, 2019
Merged
[TSVB] Shim new platform #39169
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
001dc1a
Shim server side to new platform
d4c049c
Merge branch 'master' into metrics-shim-new-platform
ae523fb
Shim public to new platfrom
1aeb0be
Break by services
c72cebd
Merge branch 'master' into metrics-shim-new-platform
60db353
Add dependencies to the TSVB plugin
9444061
Change folder structure for the shim
2a7174b
Pass services as a second argument of setup() and small fixes
379b3d5
Merge branch 'master' into metrics-shim-new-platform
a90d699
Add start() to the Plugin
3b91dcc
Get rid of the Private
9f4c116
Merge branch 'master' into metrics-shim-new-platform
69d0aff
Pass the core to setup()
f821fe5
Merge branch 'master' into metrics-shim-new-platform
bbb4c49
Get rid of NP folder
263378b
Set config to timezoneProvider()
847f90b
Take an external dependency from EditorController
335b5af
Take an extra dependency out from Request Handler
4d87639
Merge remote-tracking branch 'upstream/master' into metrics-shim-new-…
6422fe3
Merge branch 'master' into metrics-shim-new-platform
5310184
Rename metricsPlugin to Plugin
05a0973
Fix reviews
61e9140
Merge branch 'master' into metrics-shim-new-platform
2c035e1
Merge branch 'master' into metrics-shim-new-platform
214e6f6
Add types to .setup()
486917c
Change types of TSVB
3b94740
Merge remote-tracking branch 'upstream/master' into metrics-shim-new-…
b5891c4
Divide the plugin, its setup config and and entry point
c36da2c
Get rid of @ts-ignore
87ca0e8
Merge remote-tracking branch 'upstream/master' into metrics-shim-new-…
8c929fa
Merge branch 'metrics-shim-new-platform' of github.com:Avinar-24/kiba…
ad4f29a
Merge remote-tracking branch 'upstream/master' into metrics-shim-new-…
69f74c5
Merge branch 'metrics-shim-new-platform' of github.com:Avinar-24/kiba…
9801e7c
Add a server type to the CustomCoreSetup interface
b5cf84e
Merge remote-tracking branch 'upstream/master' into metrics-shim-new-…
669c098
Revert kbn_vis_type settings
410371c
Merge remote-tracking branch 'upstream/master' into metrics-shim-new-…
e1055fd
Restructure public assets
17f4344
Merge remote-tracking branch 'upstream/master' into metrics-shim-new-…
f1ed49a
Merge remote-tracking branch 'upstream/master' into metrics-shim-new-…
5eee987
Move setup.js inner to the legacy.ts
468ada5
Merge remote-tracking branch 'upstream/master' into metrics-shim-new-…
6b95d14
Merge branch 'master' into metrics-shim-new-platform
alexwizp f5143e2
clean up
alexwizp ae36579
fix PR commnets
alexwizp 5d07730
Merge branch 'master' of github.com:elastic/kibana into metrics-shim-…
alexwizp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { PluginInitializerContext } from '../../../../core/public'; | ||
import { MetricsPlugin as Plugin } from './plugin'; | ||
|
||
export function plugin(initializerContext: PluginInitializerContext) { | ||
return new Plugin(initializerContext); | ||
} |
74 changes: 0 additions & 74 deletions
74
src/legacy/core_plugins/metrics/public/kbn_vis_types/request_handler.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { PluginInitializerContext } from 'kibana/public'; | ||
import { npSetup, npStart } from 'ui/new_platform'; | ||
|
||
import { visualizations } from '../../visualizations/public'; | ||
import { MetricsPluginSetupDependencies } from './plugin'; | ||
import { plugin } from '.'; | ||
|
||
const plugins: Readonly<MetricsPluginSetupDependencies> = { | ||
visualizations, | ||
data: npSetup.plugins.data, | ||
}; | ||
|
||
const pluginInstance = plugin({} as PluginInitializerContext); | ||
|
||
export const setup = pluginInstance.setup(npSetup.core, plugins); | ||
export const start = pluginInstance.start(npStart.core); |
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 |
---|---|---|
|
@@ -17,16 +17,37 @@ | |
* under the License. | ||
*/ | ||
|
||
import { functionsRegistry } from 'plugins/interpreter/registries'; | ||
import { get } from 'lodash'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { MetricsRequestHandlerProvider } from './kbn_vis_types/request_handler'; | ||
import { PersistedState } from 'ui/persisted_state'; | ||
|
||
import chrome from 'ui/chrome'; | ||
|
||
export const tsvb = () => ({ | ||
name: 'tsvb', | ||
import { ExpressionFunction, KibanaContext, Render } from '../../interpreter/types'; | ||
|
||
// @ts-ignore | ||
import { createMetricsRequestHandler } from './request_handler'; | ||
|
||
const name = 'tsvb'; | ||
type Context = KibanaContext | null; | ||
|
||
interface Arguments { | ||
params: string; | ||
uiState: string; | ||
} | ||
|
||
type VisParams = Required<Arguments>; | ||
|
||
interface RenderValue { | ||
visType: 'metrics'; | ||
visData: Context; | ||
visConfig: VisParams; | ||
uiState: any; | ||
} | ||
|
||
type Return = Promise<Render<RenderValue>>; | ||
|
||
export const createMetricsFn = (): ExpressionFunction<typeof name, Context, Arguments, Return> => ({ | ||
name, | ||
type: 'render', | ||
context: { | ||
types: ['kibana_context', 'null'], | ||
|
@@ -38,17 +59,17 @@ export const tsvb = () => ({ | |
params: { | ||
types: ['string'], | ||
default: '"{}"', | ||
help: '', | ||
}, | ||
uiState: { | ||
types: ['string'], | ||
default: '"{}"', | ||
help: '', | ||
}, | ||
}, | ||
async fn(context, args) { | ||
const $injector = await chrome.dangerouslyGetActiveInjector(); | ||
const Private = $injector.get('Private'); | ||
const metricsRequestHandler = Private(MetricsRequestHandlerProvider).handler; | ||
|
||
async fn(context: Context, args: Arguments) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: context, arguments types don't need to be here |
||
const uiSettings = chrome.getUiSettingsClient(); | ||
const metricsRequestHandler = createMetricsRequestHandler(uiSettings); | ||
const params = JSON.parse(args.params); | ||
const uiStateParams = JSON.parse(args.uiState); | ||
const uiState = new PersistedState(uiStateParams); | ||
|
@@ -58,7 +79,7 @@ export const tsvb = () => ({ | |
query: get(context, 'query', null), | ||
filters: get(context, 'filters', null), | ||
visParams: params, | ||
uiState: uiState, | ||
uiState, | ||
}); | ||
|
||
response.visType = 'metrics'; | ||
|
@@ -67,13 +88,11 @@ export const tsvb = () => ({ | |
type: 'render', | ||
as: 'visualization', | ||
value: { | ||
uiState, | ||
visType: 'metrics', | ||
visConfig: params, | ||
uiState: uiState, | ||
visData: response, | ||
}, | ||
}; | ||
}, | ||
}); | ||
|
||
functionsRegistry.register(tsvb); |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could combine the above two imports