From 2bc133ed0724fc69b9beb05a94a826ef96db8b75 Mon Sep 17 00:00:00 2001 From: Junqiu Lei Date: Thu, 3 Nov 2022 23:43:55 -0500 Subject: [PATCH] Correct OSD import path for custom-import-map (#88) * Correct import path for custom-import-map and move plugin to repo root path Signed-off-by: Junqiu Lei --- .../unit-tests-workflow-for-customImportMap.yml | 8 ++++---- .../custom_import_map => custom_import_map}/.babelrc | 0 .../custom_import_map => custom_import_map}/.eslintrc | 0 .../custom_import_map => custom_import_map}/.gitignore | 0 .../.lintstagedrc | 0 .../.prettierignore | 0 .../.prettierrc | 0 .../babel.config.js | 0 .../common/constants/shared.ts | 0 .../common/index.ts | 0 .../common/util.ts | 0 .../opensearch_dashboards.json | 0 .../package.json | 10 +++++----- .../__snapshots__/show_error_modal.test.tsx.snap | 0 .../__snapshots__/vector_upload_options.test.tsx.snap | 0 .../public/components/show_error_modal.test.tsx | 0 .../public/components/show_error_modal.tsx | 0 .../public/components/vector_upload_options.scss | 0 .../public/components/vector_upload_options.test.tsx | 2 +- .../public/components/vector_upload_options.tsx | 4 ++-- .../public/index.ts | 0 .../public/plugin.tsx | 4 ++-- .../public/services.ts | 2 +- .../public/types.ts | 4 ++-- .../server/clusters/geospatial_cluster.js | 0 .../server/clusters/geospatial_plugin.ts | 0 .../server/clusters/index.ts | 0 .../server/index.ts | 2 +- .../server/plugin.ts | 2 +- .../server/routes/geospatial.ts | 0 .../server/routes/index.ts | 0 .../server/routes/opensearch.ts | 0 .../server/services/geospatial_service.js | 0 .../server/services/index.js | 0 .../server/services/opensearch_service.js | 0 .../server/services/utils/constants.ts | 0 .../server/types.ts | 0 .../test/enzyme.js | 0 .../test/jest.config.js | 2 +- .../test/mocks/styleMock.js | 0 .../test/polyfills.js | 0 .../test/polyfills/mutationObserver.js | 0 .../test/setup.jest.js | 0 .../test/setupTests.js | 0 .../tsconfig.json | 0 45 files changed, 20 insertions(+), 20 deletions(-) rename {src/plugins/custom_import_map => custom_import_map}/.babelrc (100%) rename {src/plugins/custom_import_map => custom_import_map}/.eslintrc (100%) rename {src/plugins/custom_import_map => custom_import_map}/.gitignore (100%) rename {src/plugins/custom_import_map => custom_import_map}/.lintstagedrc (100%) rename {src/plugins/custom_import_map => custom_import_map}/.prettierignore (100%) rename {src/plugins/custom_import_map => custom_import_map}/.prettierrc (100%) rename {src/plugins/custom_import_map => custom_import_map}/babel.config.js (100%) rename {src/plugins/custom_import_map => custom_import_map}/common/constants/shared.ts (100%) rename {src/plugins/custom_import_map => custom_import_map}/common/index.ts (100%) rename {src/plugins/custom_import_map => custom_import_map}/common/util.ts (100%) rename {src/plugins/custom_import_map => custom_import_map}/opensearch_dashboards.json (100%) rename {src/plugins/custom_import_map => custom_import_map}/package.json (50%) rename {src/plugins/custom_import_map => custom_import_map}/public/components/__snapshots__/show_error_modal.test.tsx.snap (100%) rename {src/plugins/custom_import_map => custom_import_map}/public/components/__snapshots__/vector_upload_options.test.tsx.snap (100%) rename {src/plugins/custom_import_map => custom_import_map}/public/components/show_error_modal.test.tsx (100%) rename {src/plugins/custom_import_map => custom_import_map}/public/components/show_error_modal.tsx (100%) rename {src/plugins/custom_import_map => custom_import_map}/public/components/vector_upload_options.scss (100%) rename {src/plugins/custom_import_map => custom_import_map}/public/components/vector_upload_options.test.tsx (99%) rename {src/plugins/custom_import_map => custom_import_map}/public/components/vector_upload_options.tsx (98%) rename {src/plugins/custom_import_map => custom_import_map}/public/index.ts (100%) rename {src/plugins/custom_import_map => custom_import_map}/public/plugin.tsx (85%) rename {src/plugins/custom_import_map => custom_import_map}/public/services.ts (91%) rename {src/plugins/custom_import_map => custom_import_map}/public/types.ts (73%) rename {src/plugins/custom_import_map => custom_import_map}/server/clusters/geospatial_cluster.js (100%) rename {src/plugins/custom_import_map => custom_import_map}/server/clusters/geospatial_plugin.ts (100%) rename {src/plugins/custom_import_map => custom_import_map}/server/clusters/index.ts (100%) rename {src/plugins/custom_import_map => custom_import_map}/server/index.ts (86%) rename {src/plugins/custom_import_map => custom_import_map}/server/plugin.ts (97%) rename {src/plugins/custom_import_map => custom_import_map}/server/routes/geospatial.ts (100%) rename {src/plugins/custom_import_map => custom_import_map}/server/routes/index.ts (100%) rename {src/plugins/custom_import_map => custom_import_map}/server/routes/opensearch.ts (100%) rename {src/plugins/custom_import_map => custom_import_map}/server/services/geospatial_service.js (100%) rename {src/plugins/custom_import_map => custom_import_map}/server/services/index.js (100%) rename {src/plugins/custom_import_map => custom_import_map}/server/services/opensearch_service.js (100%) rename {src/plugins/custom_import_map => custom_import_map}/server/services/utils/constants.ts (100%) rename {src/plugins/custom_import_map => custom_import_map}/server/types.ts (100%) rename {src/plugins/custom_import_map => custom_import_map}/test/enzyme.js (100%) rename {src/plugins/custom_import_map => custom_import_map}/test/jest.config.js (93%) rename {src/plugins/custom_import_map => custom_import_map}/test/mocks/styleMock.js (100%) rename {src/plugins/custom_import_map => custom_import_map}/test/polyfills.js (100%) rename {src/plugins/custom_import_map => custom_import_map}/test/polyfills/mutationObserver.js (100%) rename {src/plugins/custom_import_map => custom_import_map}/test/setup.jest.js (100%) rename {src/plugins/custom_import_map => custom_import_map}/test/setupTests.js (100%) rename {src/plugins/custom_import_map => custom_import_map}/tsconfig.json (100%) diff --git a/.github/workflows/unit-tests-workflow-for-customImportMap.yml b/.github/workflows/unit-tests-workflow-for-customImportMap.yml index bc8c26e1..3faf383e 100644 --- a/.github/workflows/unit-tests-workflow-for-customImportMap.yml +++ b/.github/workflows/unit-tests-workflow-for-customImportMap.yml @@ -59,17 +59,17 @@ jobs: echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}" npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }} - - name: Move src/plugins/custom_import_map to Plugins Dir - run: mv src/ OpenSearch-Dashboards/plugins/ + - name: Move custom_import_map to Plugins Dir + run: mv custom_import_map OpenSearch-Dashboards/plugins/custom_import_map - name: Bootstrap plugin/opensearch-dashboards run: | - cd OpenSearch-Dashboards/plugins/src/plugins/custom_import_map + cd OpenSearch-Dashboards/plugins/custom_import_map yarn osd bootstrap - name: Run tests with coverage run: | - cd OpenSearch-Dashboards/plugins/src/plugins/custom_import_map + cd OpenSearch-Dashboards/plugins/custom_import_map yarn run test:jest --coverage - name: Uploads coverage diff --git a/src/plugins/custom_import_map/.babelrc b/custom_import_map/.babelrc similarity index 100% rename from src/plugins/custom_import_map/.babelrc rename to custom_import_map/.babelrc diff --git a/src/plugins/custom_import_map/.eslintrc b/custom_import_map/.eslintrc similarity index 100% rename from src/plugins/custom_import_map/.eslintrc rename to custom_import_map/.eslintrc diff --git a/src/plugins/custom_import_map/.gitignore b/custom_import_map/.gitignore similarity index 100% rename from src/plugins/custom_import_map/.gitignore rename to custom_import_map/.gitignore diff --git a/src/plugins/custom_import_map/.lintstagedrc b/custom_import_map/.lintstagedrc similarity index 100% rename from src/plugins/custom_import_map/.lintstagedrc rename to custom_import_map/.lintstagedrc diff --git a/src/plugins/custom_import_map/.prettierignore b/custom_import_map/.prettierignore similarity index 100% rename from src/plugins/custom_import_map/.prettierignore rename to custom_import_map/.prettierignore diff --git a/src/plugins/custom_import_map/.prettierrc b/custom_import_map/.prettierrc similarity index 100% rename from src/plugins/custom_import_map/.prettierrc rename to custom_import_map/.prettierrc diff --git a/src/plugins/custom_import_map/babel.config.js b/custom_import_map/babel.config.js similarity index 100% rename from src/plugins/custom_import_map/babel.config.js rename to custom_import_map/babel.config.js diff --git a/src/plugins/custom_import_map/common/constants/shared.ts b/custom_import_map/common/constants/shared.ts similarity index 100% rename from src/plugins/custom_import_map/common/constants/shared.ts rename to custom_import_map/common/constants/shared.ts diff --git a/src/plugins/custom_import_map/common/index.ts b/custom_import_map/common/index.ts similarity index 100% rename from src/plugins/custom_import_map/common/index.ts rename to custom_import_map/common/index.ts diff --git a/src/plugins/custom_import_map/common/util.ts b/custom_import_map/common/util.ts similarity index 100% rename from src/plugins/custom_import_map/common/util.ts rename to custom_import_map/common/util.ts diff --git a/src/plugins/custom_import_map/opensearch_dashboards.json b/custom_import_map/opensearch_dashboards.json similarity index 100% rename from src/plugins/custom_import_map/opensearch_dashboards.json rename to custom_import_map/opensearch_dashboards.json diff --git a/src/plugins/custom_import_map/package.json b/custom_import_map/package.json similarity index 50% rename from src/plugins/custom_import_map/package.json rename to custom_import_map/package.json index c08f1c28..d3887f74 100644 --- a/src/plugins/custom_import_map/package.json +++ b/custom_import_map/package.json @@ -3,12 +3,12 @@ "version": "3.0.0.0", "scripts": { "build": "yarn plugin-helpers build", - "plugin-helpers": "node ../../../../scripts/plugin_helpers", - "osd": "node ../../../../scripts/osd", + "plugin-helpers": "node ../../scripts/plugin_helpers", + "osd": "node ../../scripts/osd", "lint": "yarn run lint:es && yarn run lint:style", - "lint:es": "node ../../../../scripts/eslint", - "lint:style": "node ../../../../scripts/stylelint", - "test:jest": "../../../../node_modules/.bin/jest --config ./test/jest.config.js" + "lint:es": "node ../../scripts/eslint", + "lint:style": "node ../../scripts/stylelint", + "test:jest": "../../node_modules/.bin/jest --config ./test/jest.config.js" }, "husky": { "hooks": { diff --git a/src/plugins/custom_import_map/public/components/__snapshots__/show_error_modal.test.tsx.snap b/custom_import_map/public/components/__snapshots__/show_error_modal.test.tsx.snap similarity index 100% rename from src/plugins/custom_import_map/public/components/__snapshots__/show_error_modal.test.tsx.snap rename to custom_import_map/public/components/__snapshots__/show_error_modal.test.tsx.snap diff --git a/src/plugins/custom_import_map/public/components/__snapshots__/vector_upload_options.test.tsx.snap b/custom_import_map/public/components/__snapshots__/vector_upload_options.test.tsx.snap similarity index 100% rename from src/plugins/custom_import_map/public/components/__snapshots__/vector_upload_options.test.tsx.snap rename to custom_import_map/public/components/__snapshots__/vector_upload_options.test.tsx.snap diff --git a/src/plugins/custom_import_map/public/components/show_error_modal.test.tsx b/custom_import_map/public/components/show_error_modal.test.tsx similarity index 100% rename from src/plugins/custom_import_map/public/components/show_error_modal.test.tsx rename to custom_import_map/public/components/show_error_modal.test.tsx diff --git a/src/plugins/custom_import_map/public/components/show_error_modal.tsx b/custom_import_map/public/components/show_error_modal.tsx similarity index 100% rename from src/plugins/custom_import_map/public/components/show_error_modal.tsx rename to custom_import_map/public/components/show_error_modal.tsx diff --git a/src/plugins/custom_import_map/public/components/vector_upload_options.scss b/custom_import_map/public/components/vector_upload_options.scss similarity index 100% rename from src/plugins/custom_import_map/public/components/vector_upload_options.scss rename to custom_import_map/public/components/vector_upload_options.scss diff --git a/src/plugins/custom_import_map/public/components/vector_upload_options.test.tsx b/custom_import_map/public/components/vector_upload_options.test.tsx similarity index 99% rename from src/plugins/custom_import_map/public/components/vector_upload_options.test.tsx rename to custom_import_map/public/components/vector_upload_options.test.tsx index ef326e58..abd51b72 100644 --- a/src/plugins/custom_import_map/public/components/vector_upload_options.test.tsx +++ b/custom_import_map/public/components/vector_upload_options.test.tsx @@ -10,7 +10,7 @@ import { fireEvent } from '@testing-library/dom'; import '@testing-library/jest-dom'; import * as serviceApiCalls from '../services'; -jest.mock('../../../../../../src/plugins/opensearch_dashboards_react/public', () => ({ +jest.mock('../../../../src/plugins/opensearch_dashboards_react/public', () => ({ useOpenSearchDashboards: jest.fn().mockReturnValue({ services: { http: { diff --git a/src/plugins/custom_import_map/public/components/vector_upload_options.tsx b/custom_import_map/public/components/vector_upload_options.tsx similarity index 98% rename from src/plugins/custom_import_map/public/components/vector_upload_options.tsx rename to custom_import_map/public/components/vector_upload_options.tsx index 31fc8b53..9cb34aac 100644 --- a/src/plugins/custom_import_map/public/components/vector_upload_options.tsx +++ b/custom_import_map/public/components/vector_upload_options.tsx @@ -29,8 +29,8 @@ import { import { toMountPoint, useOpenSearchDashboards, -} from '../../../../../../src/plugins/opensearch_dashboards_react/public'; -import { RegionMapOptionsProps } from '../../../../../../src/plugins/region_map/public'; +} from '../../../../src/plugins/opensearch_dashboards_react/public'; +import { RegionMapOptionsProps } from '../../../../src/plugins/region_map/public'; const VectorUploadOptions = (props: RegionMapOptionsProps) => { const opensearchDashboards = useOpenSearchDashboards(); diff --git a/src/plugins/custom_import_map/public/index.ts b/custom_import_map/public/index.ts similarity index 100% rename from src/plugins/custom_import_map/public/index.ts rename to custom_import_map/public/index.ts diff --git a/src/plugins/custom_import_map/public/plugin.tsx b/custom_import_map/public/plugin.tsx similarity index 85% rename from src/plugins/custom_import_map/public/plugin.tsx rename to custom_import_map/public/plugin.tsx index 068e0602..da0b291d 100644 --- a/src/plugins/custom_import_map/public/plugin.tsx +++ b/custom_import_map/public/plugin.tsx @@ -5,13 +5,13 @@ import React from 'react'; import { i18n } from '@osd/i18n'; -import { CoreSetup, CoreStart, Plugin } from '../../../../../src/core/public'; +import { CoreSetup, CoreStart, Plugin } from '../../../src/core/public'; import { CustomImportMapPluginSetup, CustomImportMapPluginStart, AppPluginSetupDependencies, } from './types'; -import { RegionMapVisualizationDependencies } from '../../../../../src/plugins/region_map/public'; +import { RegionMapVisualizationDependencies } from '../../../src/plugins/region_map/public'; import { VectorUploadOptions } from './components/vector_upload_options'; export class CustomImportMapPlugin diff --git a/src/plugins/custom_import_map/public/services.ts b/custom_import_map/public/services.ts similarity index 91% rename from src/plugins/custom_import_map/public/services.ts rename to custom_import_map/public/services.ts index f2312fc8..25166d39 100644 --- a/src/plugins/custom_import_map/public/services.ts +++ b/custom_import_map/public/services.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { CoreStart } from '../../../../../src/core/public'; +import { CoreStart } from '../../../src/core/public'; export const postGeojson = async (requestBody: any, http: CoreStart['http']) => { try { diff --git a/src/plugins/custom_import_map/public/types.ts b/custom_import_map/public/types.ts similarity index 73% rename from src/plugins/custom_import_map/public/types.ts rename to custom_import_map/public/types.ts index 593f1b10..791b872f 100644 --- a/src/plugins/custom_import_map/public/types.ts +++ b/custom_import_map/public/types.ts @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { NavigationPublicPluginStart } from '../../../../../src/plugins/navigation/public'; -import { RegionMapPluginSetup } from '../../../../../src/plugins/region_map/public'; +import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public'; +import { RegionMapPluginSetup } from '../../../src/plugins/region_map/public'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface CustomImportMapPluginSetup {} diff --git a/src/plugins/custom_import_map/server/clusters/geospatial_cluster.js b/custom_import_map/server/clusters/geospatial_cluster.js similarity index 100% rename from src/plugins/custom_import_map/server/clusters/geospatial_cluster.js rename to custom_import_map/server/clusters/geospatial_cluster.js diff --git a/src/plugins/custom_import_map/server/clusters/geospatial_plugin.ts b/custom_import_map/server/clusters/geospatial_plugin.ts similarity index 100% rename from src/plugins/custom_import_map/server/clusters/geospatial_plugin.ts rename to custom_import_map/server/clusters/geospatial_plugin.ts diff --git a/src/plugins/custom_import_map/server/clusters/index.ts b/custom_import_map/server/clusters/index.ts similarity index 100% rename from src/plugins/custom_import_map/server/clusters/index.ts rename to custom_import_map/server/clusters/index.ts diff --git a/src/plugins/custom_import_map/server/index.ts b/custom_import_map/server/index.ts similarity index 86% rename from src/plugins/custom_import_map/server/index.ts rename to custom_import_map/server/index.ts index 7adea51f..b230f714 100644 --- a/src/plugins/custom_import_map/server/index.ts +++ b/custom_import_map/server/index.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { PluginInitializerContext } from '../../../../../src/core/server'; +import { PluginInitializerContext } from '../../../src/core/server'; import { CustomImportMapPlugin } from './plugin'; // This exports static code and TypeScript types, diff --git a/src/plugins/custom_import_map/server/plugin.ts b/custom_import_map/server/plugin.ts similarity index 97% rename from src/plugins/custom_import_map/server/plugin.ts rename to custom_import_map/server/plugin.ts index b094bb6c..d92f3650 100644 --- a/src/plugins/custom_import_map/server/plugin.ts +++ b/custom_import_map/server/plugin.ts @@ -10,7 +10,7 @@ import { CoreStart, Plugin, Logger, -} from '../../../../../src/core/server'; +} from '../../../src/core/server'; import { CustomImportMapPluginSetup, CustomImportMapPluginStart } from './types'; import { createGeospatialCluster } from './clusters'; diff --git a/src/plugins/custom_import_map/server/routes/geospatial.ts b/custom_import_map/server/routes/geospatial.ts similarity index 100% rename from src/plugins/custom_import_map/server/routes/geospatial.ts rename to custom_import_map/server/routes/geospatial.ts diff --git a/src/plugins/custom_import_map/server/routes/index.ts b/custom_import_map/server/routes/index.ts similarity index 100% rename from src/plugins/custom_import_map/server/routes/index.ts rename to custom_import_map/server/routes/index.ts diff --git a/src/plugins/custom_import_map/server/routes/opensearch.ts b/custom_import_map/server/routes/opensearch.ts similarity index 100% rename from src/plugins/custom_import_map/server/routes/opensearch.ts rename to custom_import_map/server/routes/opensearch.ts diff --git a/src/plugins/custom_import_map/server/services/geospatial_service.js b/custom_import_map/server/services/geospatial_service.js similarity index 100% rename from src/plugins/custom_import_map/server/services/geospatial_service.js rename to custom_import_map/server/services/geospatial_service.js diff --git a/src/plugins/custom_import_map/server/services/index.js b/custom_import_map/server/services/index.js similarity index 100% rename from src/plugins/custom_import_map/server/services/index.js rename to custom_import_map/server/services/index.js diff --git a/src/plugins/custom_import_map/server/services/opensearch_service.js b/custom_import_map/server/services/opensearch_service.js similarity index 100% rename from src/plugins/custom_import_map/server/services/opensearch_service.js rename to custom_import_map/server/services/opensearch_service.js diff --git a/src/plugins/custom_import_map/server/services/utils/constants.ts b/custom_import_map/server/services/utils/constants.ts similarity index 100% rename from src/plugins/custom_import_map/server/services/utils/constants.ts rename to custom_import_map/server/services/utils/constants.ts diff --git a/src/plugins/custom_import_map/server/types.ts b/custom_import_map/server/types.ts similarity index 100% rename from src/plugins/custom_import_map/server/types.ts rename to custom_import_map/server/types.ts diff --git a/src/plugins/custom_import_map/test/enzyme.js b/custom_import_map/test/enzyme.js similarity index 100% rename from src/plugins/custom_import_map/test/enzyme.js rename to custom_import_map/test/enzyme.js diff --git a/src/plugins/custom_import_map/test/jest.config.js b/custom_import_map/test/jest.config.js similarity index 93% rename from src/plugins/custom_import_map/test/jest.config.js rename to custom_import_map/test/jest.config.js index 53d38049..1d87b42b 100644 --- a/src/plugins/custom_import_map/test/jest.config.js +++ b/custom_import_map/test/jest.config.js @@ -19,7 +19,7 @@ module.exports = { '\\.(css|less|scss)$': '/test/mocks/styleMock.js', '^ui/(.*)': '/../../src/legacy/ui/public/$1/', }, - snapshotSerializers: ['../../../../node_modules/enzyme-to-json/serializer'], + snapshotSerializers: ['../../node_modules/enzyme-to-json/serializer'], coverageReporters: ['lcov', 'text', 'cobertura'], testMatch: ['**/*.test.js', '**/*.test.ts', '**/*.test.tsx'], coveragePathIgnorePatterns: ['/build/', '/node_modules/', '/test/'], diff --git a/src/plugins/custom_import_map/test/mocks/styleMock.js b/custom_import_map/test/mocks/styleMock.js similarity index 100% rename from src/plugins/custom_import_map/test/mocks/styleMock.js rename to custom_import_map/test/mocks/styleMock.js diff --git a/src/plugins/custom_import_map/test/polyfills.js b/custom_import_map/test/polyfills.js similarity index 100% rename from src/plugins/custom_import_map/test/polyfills.js rename to custom_import_map/test/polyfills.js diff --git a/src/plugins/custom_import_map/test/polyfills/mutationObserver.js b/custom_import_map/test/polyfills/mutationObserver.js similarity index 100% rename from src/plugins/custom_import_map/test/polyfills/mutationObserver.js rename to custom_import_map/test/polyfills/mutationObserver.js diff --git a/src/plugins/custom_import_map/test/setup.jest.js b/custom_import_map/test/setup.jest.js similarity index 100% rename from src/plugins/custom_import_map/test/setup.jest.js rename to custom_import_map/test/setup.jest.js diff --git a/src/plugins/custom_import_map/test/setupTests.js b/custom_import_map/test/setupTests.js similarity index 100% rename from src/plugins/custom_import_map/test/setupTests.js rename to custom_import_map/test/setupTests.js diff --git a/src/plugins/custom_import_map/tsconfig.json b/custom_import_map/tsconfig.json similarity index 100% rename from src/plugins/custom_import_map/tsconfig.json rename to custom_import_map/tsconfig.json