Skip to content

Commit

Permalink
Add a new vis_augmenter plugin (opensearch-project#3107)
Browse files Browse the repository at this point in the history
This PR only sets up the boilerplate code for the new plugin. The additions of the new saved object type and expression function types will be added in later PRs. Breaking it up for readability purposes.

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
  • Loading branch information
ohltyler committed Feb 1, 2023
1 parent 24b1a78 commit 749f373
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/plugins/vis_augmenter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Contains interfaces and type definitions used for allowing external plugins to augment Visualizations. Registers the relevant saved object types and expression functions.
7 changes: 7 additions & 0 deletions src/plugins/vis_augmenter/opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "visAugmenter",
"version": "opensearchDashboards",
"server": true,
"ui": true,
"requiredPlugins": ["data", "savedObjects", "opensearchDashboardsUtils"]
}
12 changes: 12 additions & 0 deletions src/plugins/vis_augmenter/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { PluginInitializerContext } from 'src/core/public';
import { VisAugmenterPlugin, VisAugmenterSetup, VisAugmenterStart } from './plugin';

export function plugin(initializerContext: PluginInitializerContext) {
return new VisAugmenterPlugin(initializerContext);
}
export { VisAugmenterSetup, VisAugmenterStart };
40 changes: 40 additions & 0 deletions src/plugins/vis_augmenter/public/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../core/public';
import { DataPublicPluginSetup, DataPublicPluginStart } from '../../data/public';

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface VisAugmenterSetup {}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface VisAugmenterStart {}

export interface VisAugmenterSetupDeps {
data: DataPublicPluginSetup;
}

export interface VisAugmenterStartDeps {
data: DataPublicPluginStart;
}

export class VisAugmenterPlugin
implements
Plugin<VisAugmenterSetup, VisAugmenterStart, VisAugmenterSetupDeps, VisAugmenterStartDeps> {
constructor(initializerContext: PluginInitializerContext) {}

public setup(
core: CoreSetup<VisAugmenterStartDeps, VisAugmenterStart>,
{ data }: VisAugmenterSetupDeps
): VisAugmenterSetup {
return {};
}

public start(core: CoreStart, { data }: VisAugmenterStartDeps): VisAugmenterStart {
return {};
}

public stop() {}
}
12 changes: 12 additions & 0 deletions src/plugins/vis_augmenter/server/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { PluginInitializerContext } from '../../../core/server';
import { VisAugmenterPlugin } from './plugin';

export function plugin(initializerContext: PluginInitializerContext) {
return new VisAugmenterPlugin(initializerContext);
}
export { VisAugmenterPluginSetup, VisAugmenterPluginStart } from './plugin';
38 changes: 38 additions & 0 deletions src/plugins/vis_augmenter/server/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import {
PluginInitializerContext,
CoreSetup,
CoreStart,
Plugin,
Logger,
} from '../../../core/server';

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface VisAugmenterPluginSetup {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface VisAugmenterPluginStart {}

export class VisAugmenterPlugin
implements Plugin<VisAugmenterPluginSetup, VisAugmenterPluginStart> {
private readonly logger: Logger;

constructor(initializerContext: PluginInitializerContext) {
this.logger = initializerContext.logger.get();
}

public setup(core: CoreSetup) {
this.logger.debug('VisAugmenter: Setup');
return {};
}

public start(core: CoreStart) {
this.logger.debug('VisAugmenter: Started');
return {};
}

public stop() {}
}

0 comments on commit 749f373

Please sign in to comment.