-
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
[lens] Calculate existence of fields in datasource #44422
Changes from 4 commits
c74f855
73f0550
ba15002
75f13f9
2ac6456
2cbf00b
3978193
ed662c4
ed3e734
2466788
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,13 @@ | |
*/ | ||
|
||
import * as Joi from 'joi'; | ||
import { Server } from 'hapi'; | ||
import { resolve } from 'path'; | ||
import { LegacyPluginInitializer } from 'src/legacy/types'; | ||
import KbnServer, { Server } from 'src/legacy/server/kbn_server'; | ||
import { CoreSetup } from 'src/core/server'; | ||
import mappings from './mappings.json'; | ||
import { PLUGIN_ID, getEditPath } from './common'; | ||
import { lensServerPlugin } from './server'; | ||
|
||
const NOT_INTERNATIONALIZED_PRODUCT_NAME = 'Lens Visualizations'; | ||
|
||
|
@@ -49,7 +51,9 @@ export const lens: LegacyPluginInitializer = kibana => { | |
}).default(); | ||
}, | ||
|
||
init(server: Server) { | ||
async init(server: Server) { | ||
const kbnServer = (server as unknown) as KbnServer; | ||
|
||
server.plugins.xpack_main.registerFeature({ | ||
id: PLUGIN_ID, | ||
name: NOT_INTERNATIONALIZED_PRODUCT_NAME, | ||
|
@@ -77,6 +81,19 @@ export const lens: LegacyPluginInitializer = kibana => { | |
}, | ||
}, | ||
}); | ||
|
||
// Set up with the new platform plugin lifecycle API. | ||
const plugin = lensServerPlugin(); | ||
await plugin.setup(({ | ||
http: { | ||
...kbnServer.newPlatform.setup.core.http, | ||
createRouter: () => kbnServer.newPlatform.setup.core.http.createRouter('/api/lens'), | ||
}, | ||
} as unknown) as CoreSetup); | ||
|
||
server.events.on('stop', async () => { | ||
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. The async / await is unnecessary: 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. You're right, I'm going to make it all synchronous. I was going back and forth on this while developing because I think we will eventually want async here once we are fully on the new platform. |
||
await plugin.stop(); | ||
}); | ||
}, | ||
}); | ||
}; |
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.
Not a big deal, but I wonder if this
/api/lens
path should be in a const in ourcommon
folder?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.
Good idea. Updated here and one other place.