diff --git a/.github/workflows/dashboards-observability-test-and-build-workflow.yml b/.github/workflows/dashboards-observability-test-and-build-workflow.yml index 124cc81b34..610c15b460 100644 --- a/.github/workflows/dashboards-observability-test-and-build-workflow.yml +++ b/.github/workflows/dashboards-observability-test-and-build-workflow.yml @@ -39,23 +39,6 @@ jobs: with: path: OpenSearch-Dashboards/plugins/dashboards-observability - - name: Get yarn cache dir - id: setup-yarn - shell: bash - run: | - cd ./OpenSearch-Dashboards - source $NVM_DIR/nvm.sh - nvm use - echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - name: Yarn Cache - uses: actions/cache@v4 - with: - path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }} - key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }} - restore-keys: | - ${{ runner.OS }}-yarn- - - name: Plugin Bootstrap uses: nick-fields/retry@v2 with: @@ -135,20 +118,6 @@ jobs: - run: node -v - run: yarn -v - - name: Get yarn cache dir - id: setup-yarn - shell: bash - run: | - echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - - name: Yarn Cache - uses: actions/cache@v4 - with: - path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }} - key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }} - restore-keys: | - ${{ runner.OS }}-yarn- - - name: Checkout Dashboards Observability uses: actions/checkout@v2 with: diff --git a/.github/workflows/ftr-e2e-dashboards-observability-test.yml b/.github/workflows/ftr-e2e-dashboards-observability-test.yml index c70e929d68..5c47de6f16 100644 --- a/.github/workflows/ftr-e2e-dashboards-observability-test.yml +++ b/.github/workflows/ftr-e2e-dashboards-observability-test.yml @@ -114,15 +114,16 @@ jobs: npm uninstall -g yarn echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}" npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }} - echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Yarn Cache uses: actions/cache@v4 with: - path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }} - key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }} + path: | + OpenSearch-Dashboards/**/target + OpenSearch-Dashboards/**/node_modules + key: ${{ runner.OS }}-build-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }} restore-keys: | - ${{ runner.OS }}-yarn- + ${{ runner.OS }}-build- - name: Bootstrap OpenSearch Dashboards run: | diff --git a/.github/workflows/integration-tests-workflow.yml b/.github/workflows/integration-tests-workflow.yml index adc1cc7177..def8303954 100644 --- a/.github/workflows/integration-tests-workflow.yml +++ b/.github/workflows/integration-tests-workflow.yml @@ -136,15 +136,16 @@ jobs: npm uninstall -g yarn echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}" npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }} - echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Yarn Cache uses: actions/cache@v4 with: - path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }} - key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }} + path: | + OpenSearch-Dashboards/**/target + OpenSearch-Dashboards/**/node_modules + key: ${{ runner.OS }}-build-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }} restore-keys: | - ${{ runner.OS }}-yarn- + ${{ runner.OS }}-build- - name: Bootstrap OpenSearch Dashboards run: | diff --git a/public/components/integrations/components/__tests__/__snapshots__/added_integration.test.tsx.snap b/public/components/integrations/components/__tests__/__snapshots__/added_integration.test.tsx.snap index bbbaeb6cf3..5340e2d024 100644 --- a/public/components/integrations/components/__tests__/__snapshots__/added_integration.test.tsx.snap +++ b/public/components/integrations/components/__tests__/__snapshots__/added_integration.test.tsx.snap @@ -531,11 +531,11 @@ exports[`Added Integration View Test Renders added integration view using dummy >
`${BASE_URL}/${obj.id}/edit`, - viewUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}`, - createLinkText: 'Observability Dashboard', - createSortText: 'Observability Dashboard', - createUrl: `${BASE_URL}/create`, - }); + // if MDS is not enabled register observability dashboards & PPL visualizations in core + if (!setupDeps.dataSource) { + const BASE_URL = core.http.basePath.prepend('/app/observability-dashboards#'); + setupDeps.dashboard.registerDashboardProvider({ + appId: 'observability-panel', + savedObjectsType: 'observability-panel', + savedObjectsName: 'Observability', + editUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}/edit`, + viewUrlPathFn: (obj: SavedObject) => `${BASE_URL}/${obj.id}`, + createLinkText: 'Observability Dashboard', + createSortText: 'Observability Dashboard', + createUrl: `${BASE_URL}/create`, + }); + + setupDeps.visualizations.registerAlias({ + name: OBSERVABILITY_EMBEDDABLE_ID, + title: OBSERVABILITY_EMBEDDABLE_DISPLAY_NAME, + description: OBSERVABILITY_EMBEDDABLE_DESCRIPTION, + icon: OBSERVABILITY_EMBEDDABLE_ICON, + aliasApp: observabilityLogsID, + aliasPath: `#/explorer/?${CREATE_TAB_PARAM_KEY}=${CREATE_TAB_PARAM[TAB_CHART_ID]}`, + stage: 'production', + appExtensions: { + visualizations: { + docTypes: [VISUALIZATION_SAVED_OBJECT], + toListItem: ({ id, attributes, updated_at: updatedAt }) => ({ + description: attributes?.description, + editApp: observabilityLogsID, + editUrl: `#/explorer/${VISUALIZATION_SAVED_OBJECT}:${id}`, + icon: OBSERVABILITY_EMBEDDABLE_ICON, + id, + savedObjectType: VISUALIZATION_SAVED_OBJECT, + title: attributes?.title, + typeTitle: OBSERVABILITY_EMBEDDABLE_DISPLAY_NAME, + stage: 'production', + updated_at: updatedAt, + }), + }, + }, + }); + } const OBSERVABILITY_APP_CATEGORIES: Record = Object.freeze({ observability: { @@ -401,33 +431,6 @@ export class ObservabilityPlugin })); setupDeps.embeddable.registerEmbeddableFactory(OBSERVABILITY_EMBEDDABLE, embeddableFactory); - setupDeps.visualizations.registerAlias({ - name: OBSERVABILITY_EMBEDDABLE_ID, - title: OBSERVABILITY_EMBEDDABLE_DISPLAY_NAME, - description: OBSERVABILITY_EMBEDDABLE_DESCRIPTION, - icon: OBSERVABILITY_EMBEDDABLE_ICON, - aliasApp: observabilityLogsID, - aliasPath: `#/explorer/?${CREATE_TAB_PARAM_KEY}=${CREATE_TAB_PARAM[TAB_CHART_ID]}`, - stage: 'production', - appExtensions: { - visualizations: { - docTypes: [VISUALIZATION_SAVED_OBJECT], - toListItem: ({ id, attributes, updated_at: updatedAt }) => ({ - description: attributes?.description, - editApp: observabilityLogsID, - editUrl: `#/explorer/${VISUALIZATION_SAVED_OBJECT}:${id}`, - icon: OBSERVABILITY_EMBEDDABLE_ICON, - id, - savedObjectType: VISUALIZATION_SAVED_OBJECT, - title: attributes?.title, - typeTitle: OBSERVABILITY_EMBEDDABLE_DISPLAY_NAME, - stage: 'production', - updated_at: updatedAt, - }), - }, - }, - }); - registerAsssitantDependencies(setupDeps.assistantDashboards); // Return methods that should be available to other plugins diff --git a/server/plugin.ts b/server/plugin.ts index 627f97b40a..e1b3180602 100644 --- a/server/plugin.ts +++ b/server/plugin.ts @@ -16,6 +16,7 @@ import { } from '../../../src/core/server'; import { DataSourcePluginSetup } from '../../../src/plugins/data_source/server/types'; import { DataSourceManagementPlugin } from '../../../src/plugins/data_source_management/public/plugin'; +import { observabilityPanelsID } from '../common/constants/shared'; import { migrateV1IntegrationToV2Integration } from './adaptors/integrations/migrations'; import { OpenSearchObservabilityPlugin } from './adaptors/opensearch_observability_plugin'; import { PPLPlugin } from './adaptors/ppl_plugin'; @@ -23,9 +24,9 @@ import { PPLParsers } from './parsers/ppl_parser'; import { registerObservabilityUISettings } from './plugin_helper/register_settings'; import { setupRoutes } from './routes/index'; import { + getSearchSavedObject, + getVisualizationSavedObject, notebookSavedObject, - searchSavedObject, - visualizationSavedObject, } from './saved_objects/observability_saved_object'; import { AssistantPluginSetup, ObservabilityPluginSetup, ObservabilityPluginStart } from './types'; @@ -89,9 +90,9 @@ export class ObservabilityPlugin }, management: { importableAndExportable: true, - getInAppUrl() { + getInAppUrl(obj) { return { - path: `/app/management/observability/settings`, + path: dataSourceEnabled ? '' : `/app/${observabilityPanelsID}#/${obj.id}`, uiCapabilitiesPath: 'advancedSettings.show', }; }, @@ -219,8 +220,8 @@ export class ObservabilityPlugin // Register server side APIs setupRoutes({ router, client: openSearchObservabilityClient, dataSourceEnabled }); - core.savedObjects.registerType(visualizationSavedObject); - core.savedObjects.registerType(searchSavedObject); + core.savedObjects.registerType(getVisualizationSavedObject(dataSourceEnabled)); + core.savedObjects.registerType(getSearchSavedObject(dataSourceEnabled)); core.savedObjects.registerType(notebookSavedObject); core.capabilities.registerProvider(() => ({ observability: { diff --git a/server/saved_objects/observability_saved_object.ts b/server/saved_objects/observability_saved_object.ts index 6f351d718d..23d68d2980 100644 --- a/server/saved_objects/observability_saved_object.ts +++ b/server/saved_objects/observability_saved_object.ts @@ -11,7 +11,7 @@ import { VISUALIZATION_SAVED_OBJECT, } from '../../common/types/observability_saved_object_attributes'; -export const visualizationSavedObject: SavedObjectsType = { +export const getVisualizationSavedObject = (dataSourceEnabled: boolean): SavedObjectsType => ({ name: VISUALIZATION_SAVED_OBJECT, hidden: false, namespaceType: 'single', @@ -26,7 +26,7 @@ export const visualizationSavedObject: SavedObjectsType = { const editPath = `#/explorer/${VISUALIZATION_SAVED_OBJECT}:${obj.id}`; const editUrl = `/app/${observabilityLogsID}${editPath}`; return { - path: editUrl, + path: dataSourceEnabled ? '' : editUrl, uiCapabilitiesPath: 'observability.show', }; }, @@ -44,9 +44,9 @@ export const visualizationSavedObject: SavedObjectsType = { }, }, migrations: {}, -}; +}); -export const searchSavedObject: SavedObjectsType = { +export const getSearchSavedObject = (dataSourceEnabled: boolean): SavedObjectsType => ({ name: SEARCH_SAVED_OBJECT, icon: 'editorCodeBlock', hidden: false, @@ -61,7 +61,7 @@ export const searchSavedObject: SavedObjectsType = { const editPath = `#/explorer/${SEARCH_SAVED_OBJECT}:${obj.id}`; const editUrl = `/app/${observabilityLogsID}${editPath}`; return { - path: editUrl, + path: dataSourceEnabled ? '' : editUrl, uiCapabilitiesPath: 'observability.show', }; }, @@ -79,7 +79,7 @@ export const searchSavedObject: SavedObjectsType = { }, }, migrations: {}, -}; +}); export const notebookSavedObject: SavedObjectsType = { name: NOTEBOOK_SAVED_OBJECT,