Skip to content

Commit

Permalink
7.17 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Jan 4, 2023
1 parent cf42480 commit acf91cd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
11 changes: 7 additions & 4 deletions server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* under the License.
*/

import type { DataRequestHandlerContext } from 'src/plugins/data/server';

import {
PluginInitializerContext,
CoreSetup,
Expand All @@ -31,7 +33,7 @@ import {
KibanaMilestonesVisPluginSetupDeps,
KibanaMilestonesVisPluginStartDeps,
} from './types';
import { registerRoutes } from './routes';
import { defineRoutes } from './routes';

export class KibanaMilestonesVisPlugin
implements
Expand All @@ -40,7 +42,8 @@ export class KibanaMilestonesVisPlugin
KibanaMilestonesVisPluginStart,
KibanaMilestonesVisPluginSetupDeps,
KibanaMilestonesVisPluginStartDeps
> {
>
{
private readonly logger: Logger;

constructor(initializerContext: PluginInitializerContext) {
Expand All @@ -49,10 +52,10 @@ export class KibanaMilestonesVisPlugin

public setup(core: CoreSetup<KibanaMilestonesVisPluginStartDeps>) {
this.logger.debug('kibanaMilestonesVis: Setup');
const router = core.http.createRouter();
const router = core.http.createRouter<DataRequestHandlerContext>();

core.getStartServices().then(() => {
registerRoutes(router);
defineRoutes(router);
});

return {};
Expand Down
9 changes: 9 additions & 0 deletions server/routes/define_routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { IRouter } from 'kibana/server';

import type { DataRequestHandlerContext } from 'src/plugins/data/server';

import { defineServerSearchRoute } from './server_search_route';

export function defineRoutes(router: IRouter<DataRequestHandlerContext>) {
defineServerSearchRoute(router);
}
2 changes: 1 addition & 1 deletion server/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { registerRoutes } from './register_routes';
export { defineRoutes } from './define_routes';
6 changes: 0 additions & 6 deletions server/routes/register_routes.ts

This file was deleted.

12 changes: 8 additions & 4 deletions server/routes/server_search_route.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { get } from 'lodash';
import { IEsSearchRequest } from 'src/plugins/data/server';

import { schema } from '@kbn/config-schema';
import { IEsSearchResponse } from 'src/plugins/data/common';
import { IRouter } from '../../../../src/core/server';

import type { DataRequestHandlerContext, IEsSearchRequest } from 'src/plugins/data/server';
import type { IEsSearchResponse } from 'src/plugins/data/common';

import type { IRouter } from '../../../../src/core/server';

import { NONE_SELECTED, SERVER_SEARCH_ROUTE_PATH } from '../../common';

export function registerServerSearchRoute(router: IRouter) {
export function defineServerSearchRoute(router: IRouter<DataRequestHandlerContext>) {
router.post(
{
path: SERVER_SEARCH_ROUTE_PATH,
Expand Down

0 comments on commit acf91cd

Please sign in to comment.