diff --git a/src/plugins/plugin_integration/opensearch_dashboards.json b/src/plugins/plugin_integration/opensearch_dashboards.json index dda963e2996d..c87b0a10ce35 100644 --- a/src/plugins/plugin_integration/opensearch_dashboards.json +++ b/src/plugins/plugin_integration/opensearch_dashboards.json @@ -3,5 +3,5 @@ "version": "opensearchDashboards", "server": true, "ui": true, - "requiredPlugins": ["data", "visualizations", "savedObjects", "opensearchDashboardsUtils"] + "requiredPlugins": ["data", "savedObjects", "opensearchDashboardsUtils"] } diff --git a/src/plugins/plugin_integration/public/index.ts b/src/plugins/plugin_integration/public/index.ts index 9011382f5759..08eab8873e32 100644 --- a/src/plugins/plugin_integration/public/index.ts +++ b/src/plugins/plugin_integration/public/index.ts @@ -1,31 +1,6 @@ /* + * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * 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 'src/core/public'; @@ -35,3 +10,12 @@ export function plugin(initializerContext: PluginInitializerContext) { return new PluginIntegrationPlugin(initializerContext); } export { PluginIntegrationSetup, PluginIntegrationStart }; + +export { + VisLayer, + VisLayers, + PointInTimeEventsVisLayer, + PointInTimeEvent, + PointInTimeEventMetadata, + isPointInTimeEventsVisLayer, +} from './types'; diff --git a/src/plugins/plugin_integration/public/plugin.ts b/src/plugins/plugin_integration/public/plugin.ts index 38c7d93003ec..78c079b6b9b5 100644 --- a/src/plugins/plugin_integration/public/plugin.ts +++ b/src/plugins/plugin_integration/public/plugin.ts @@ -1,31 +1,6 @@ /* + * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * 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, CoreSetup, CoreStart, Plugin } from '../../../core/public'; diff --git a/src/plugins/plugin_integration/public/types.test.ts b/src/plugins/plugin_integration/public/types.test.ts new file mode 100644 index 000000000000..6aa2ca8d96e4 --- /dev/null +++ b/src/plugins/plugin_integration/public/types.test.ts @@ -0,0 +1,33 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { VisLayer, isPointInTimeEventsVisLayer } from './types'; + +describe('isPointInTimeEventsVisLayer()', function () { + it('should return false if no events field', function () { + const visLayer = { + id: 'visLayerId', + name: 'visLayerName', + field1: 'value1', + field2: 'value2', + } as VisLayer; + expect(isPointInTimeEventsVisLayer(visLayer)).toBe(false); + }); + + it('should return true if events field exists', function () { + const visLayer = { + id: 'testId', + name: 'testName', + events: [ + { + timestamp: 123, + resourceId: 'testId', + resourceName: 'testName', + }, + ], + } as VisLayer; + expect(isPointInTimeEventsVisLayer(visLayer)).toBe(true); + }); +}); diff --git a/src/plugins/plugin_integration/public/types.ts b/src/plugins/plugin_integration/public/types.ts new file mode 100644 index 000000000000..3716e964659f --- /dev/null +++ b/src/plugins/plugin_integration/public/types.ts @@ -0,0 +1,34 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +export interface VisLayer { + // will be used as the column ID + id: string; + // will be used as the name when hovering over the tooltip + name: string; +} + +export type VisLayers = VisLayer[]; + +export interface PointInTimeEventMetadata { + resourceId: string; + resourceName: string; + tooltip?: string; +} + +export interface PointInTimeEvent { + timestamp: number; + metadata: PointInTimeEventMetadata; +} + +export interface PointInTimeEventsVisLayer extends VisLayer { + events: PointInTimeEvent[]; +} + +// used to determine what vis layer's interface is being implemented. +// currently PointInTimeEventsLayer is the only interface extending VisLayer +export const isPointInTimeEventsVisLayer = (obj: any) => { + return 'events' in obj; +}; diff --git a/src/plugins/plugin_integration/server/index.ts b/src/plugins/plugin_integration/server/index.ts index 7b9659f90f42..25adbc15fd57 100644 --- a/src/plugins/plugin_integration/server/index.ts +++ b/src/plugins/plugin_integration/server/index.ts @@ -1,31 +1,6 @@ /* + * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * 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/server'; diff --git a/src/plugins/plugin_integration/server/plugin.ts b/src/plugins/plugin_integration/server/plugin.ts index 5c2e7784eb89..c5fedf3fcd97 100644 --- a/src/plugins/plugin_integration/server/plugin.ts +++ b/src/plugins/plugin_integration/server/plugin.ts @@ -1,31 +1,6 @@ /* + * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * 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 {