Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/legacy/core_plugins/data/public/expressions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

export { ExpressionsService, ExpressionsSetup, ExpressionsStart } from './expressions_service';
export { ExpressionRenderer, ExpressionRendererProps } from './expression_renderer';
export { IInterpreterRenderFunction } from './lib/_types';
30 changes: 30 additions & 0 deletions src/legacy/core_plugins/expressions/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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.
*/

// /// Define plugin function
import { ExpressionsPlugin as Plugin } from './plugin';

export function plugin() {
return new Plugin();
}

// /// Export types & static code

/** @public types */
export * from './expressions';
37 changes: 37 additions & 0 deletions src/legacy/core_plugins/expressions/public/mocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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 { ExpressionsSetup, ExpressionsStart } from '.';

function createExpressionsSetupMock() {
const mock: MockedKeys<Partial<ExpressionsSetup>> = {};

return mock;
}

function createExpressionsStartMock() {
const mock: MockedKeys<Partial<ExpressionsStart>> = {};

return mock;
}

export const expressionsPluginMock = {
createSetup: createExpressionsSetupMock,
createStart: createExpressionsStartMock,
};
72 changes: 72 additions & 0 deletions src/legacy/core_plugins/expressions/public/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* 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 { CoreSetup, CoreStart, Plugin } from '../../../../core/public';
import { ExpressionsService, ExpressionsSetup, ExpressionsStart } from './expressions';
import {
Start as InspectorStart,
Setup as InspectorSetup,
} from '../../../../plugins/inspector/public';

/**
* Interface for any dependencies on other plugins' `setup` contracts.
*
* @internal
*/
export interface ExpressionsPluginSetupDependencies {
inspector: InspectorSetup;
}

export interface ExpressionsPluginStartDependencies {
inspector: InspectorStart;
}

/**
* Interface for this plugin's returned `setup` contract.
*
* @public
*/

export class ExpressionsPlugin
implements
Plugin<
ExpressionsSetup,
ExpressionsStart,
ExpressionsPluginSetupDependencies,
ExpressionsPluginStartDependencies
> {
// Exposed services, sorted alphabetically
private readonly expressions: ExpressionsService = new ExpressionsService();

public setup(core: CoreSetup): ExpressionsSetup {
return {
...this.expressions.setup(),
};
}

public start(core: CoreStart, plugins: ExpressionsPluginStartDependencies): ExpressionsStart {
return {
...this.expressions.start({ inspector: plugins.inspector }),
};
}

public stop() {
this.expressions.stop();
}
}