diff --git a/opensearch_dashboards.json b/opensearch_dashboards.json index 49b04f68e..d5fa6d7fe 100644 --- a/opensearch_dashboards.json +++ b/opensearch_dashboards.json @@ -2,8 +2,14 @@ "id": "alertingDashboards", "version": "2.18.0.0", "opensearchDashboardsVersion": "2.18.0", - "configPath": ["opensearch_alerting"], - "optionalPlugins": ["dataSource", "dataSourceManagement", "assistantDashboards"], + "configPath": [ + "opensearch_alerting" + ], + "optionalPlugins": [ + "dataSource", + "dataSourceManagement", + "assistantDashboards" + ], "requiredPlugins": [ "uiActions", "dashboard", @@ -20,5 +26,7 @@ "server": true, "ui": true, "supportedOSDataSourceVersions": ">=2.13.0", - "requiredOSDataSourcePlugins": ["opensearch-alerting"] -} + "requiredOSDataSourcePlugins": [ + "opensearch-alerting" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index ea185ed3d..afe19eb69 100644 --- a/package.json +++ b/package.json @@ -68,4 +68,4 @@ "engines": { "yarn": "^1.21.1" } -} +} \ No newline at end of file diff --git a/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx b/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx index 6dd41b899..77f9089c0 100644 --- a/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx +++ b/public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import React, { useCallback, useEffect, useState } from "react"; +import React, { useCallback, useEffect, useMemo, useState } from "react"; import { EuiBadge, EuiDescriptionList, EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, EuiHorizontalRule, EuiLink, EuiLoadingContent, EuiPanel, EuiText, EuiTitle } from "@elastic/eui"; import { DataSourceManagementPluginSetup, DataSourceOption } from "../../../../../src/plugins/data_source_management/public"; import { getApplication, getClient, getNotifications, getSavedObjectsClient } from "../../services"; @@ -18,12 +18,15 @@ export interface DataSourceAlertsCardProps { } export const DataSourceAlertsCard: React.FC = ({ getDataSourceMenu }) => { - const DataSourceSelector = getDataSourceMenu?.(); + const DataSourceSelector = useMemo(() => { + if (getDataSourceMenu) { + return getDataSourceMenu(); + } + + return null; + }, [getDataSourceMenu]); const [loading, setLoading] = useState(false); - const [dataSource, setDataSource] = useState({ - label: 'Local cluster', - id: '', - }); + const [dataSource, setDataSource] = useState(); const [alerts, setAlerts] = useState([]); useEffect(() => { @@ -46,7 +49,7 @@ export const DataSourceAlertsCard: React.FC = ({ get }, [dataSource]); const onDataSourceSelected = useCallback((options: any[]) => { - if (dataSource?.id !== undefined && dataSource?.id !== options[0]?.id) { + if (dataSource?.id === undefined || dataSource?.id !== options[0]?.id) { setDataSource(options[0]); } }, [dataSource]); diff --git a/public/pages/Dashboard/utils/tableUtils.js b/public/pages/Dashboard/utils/tableUtils.js index 3e58cd37a..0f35a706f 100644 --- a/public/pages/Dashboard/utils/tableUtils.js +++ b/public/pages/Dashboard/utils/tableUtils.js @@ -283,6 +283,7 @@ export const alertColumns = ( dsl: dsl, index: index, topNLogPatternData: topNLogPatternData, + isVisualEditorMonitor: isVisualEditorMonitor, }, dataSourceId: dataSourceQuery?.query?.dataSourceId, }; diff --git a/public/pages/utils/constants.ts b/public/pages/utils/constants.ts index a08e2ba2c..ff30dd076 100644 --- a/public/pages/utils/constants.ts +++ b/public/pages/utils/constants.ts @@ -9,10 +9,11 @@ import { DataSourceOption } from "../../../../../src/plugins/data_source_managem export const COMMENTS_ENABLED_SETTING = "plugins.alerting.comments_enabled"; const LocalCluster: DataSourceOption = { - label: i18n.translate("dataSource.localCluster", { - defaultMessage: "Local cluster", - }), - id: "", - }; - - export const dataSourceObservable = new BehaviorSubject(LocalCluster); \ No newline at end of file + label: i18n.translate("dataSource.localCluster", { + defaultMessage: "Local cluster", + }), + id: "", +}; + +// We should use empty object for default value as local cluster may be disabled +export const dataSourceObservable = new BehaviorSubject({}); \ No newline at end of file diff --git a/public/plugin.tsx b/public/plugin.tsx index 82ce91b70..bc63d80b0 100644 --- a/public/plugin.tsx +++ b/public/plugin.tsx @@ -62,7 +62,14 @@ export interface AlertingStartDeps { export class AlertingPlugin implements Plugin { private updateDefaultRouteOfManagementApplications: AppUpdater = () => { - const hash = `#/?dataSourceId=${dataSourceObservable.value?.id || ""}`; + const dataSourceValue = dataSourceObservable.value?.id; + let hash = `#/`; + // When data source value is undefined, + // it means the data source picker has not determine which data source to use(local or default data source) + // so we should not append any data source id into hash to avoid impacting the data source picker. + if (dataSourceValue !== undefined) { + hash = `#/?dataSourceId=${dataSourceValue}`; + } return { defaultPath: hash, }; diff --git a/release-notes/opensearch-alerting-dashboards-plugin.release-notes-2.18.0.0.md b/release-notes/opensearch-alerting-dashboards-plugin.release-notes-2.18.0.0.md new file mode 100644 index 000000000..0f55feb48 --- /dev/null +++ b/release-notes/opensearch-alerting-dashboards-plugin.release-notes-2.18.0.0.md @@ -0,0 +1,20 @@ +## Version 2.18.0.0 2024-10-15 +Compatible with OpenSearch Dashboards 2.18.0 + +### Maintenance +* Increment version to 2.18.0.0 ([#1098](https://github.com/opensearch-project/alerting-dashboards-plugin/pull/1098)) + +### Enhancements +* Context aware alert analysis ([#996](https://github.com/opensearch-project/alerting-dashboards-plugin/pull/996)) +* [navigation]feat: update category to flatten menus in analytics(all) use case ([#1114](https://github.com/opensearch-project/alerting-dashboards-plugin/pull/1114)) +* Support top N log pattern data in summary context provider for visual editor monitor ([#1119](https://github.com/opensearch-project/alerting-dashboards-plugin/pull/1119)) + +### Bug fixes +* Fit and Finish UX Fixes ([#1092](https://github.com/opensearch-project/alerting-dashboards-plugin/pull/1092)) +* Fit and Finish UX changes Pt 2 ([#1099](https://github.com/opensearch-project/alerting-dashboards-plugin/pull/1099)) +* Fix assistant plugin override issue and return dataSourceId in context ([#1102](https://github.com/opensearch-project/alerting-dashboards-plugin/pull/1102)) +* add width for recent alerts card ([#1117](https://github.com/opensearch-project/alerting-dashboards-plugin/pull/1117)) +* Fix ui_metadata is not fetched when MDS client is used ([#1124](https://github.com/opensearch-project/alerting-dashboards-plugin/pull/1124)) + +### Documentation +* Added 2.18.0 release notes. ([#1132](https://github.com/opensearch-project/alerting-dashboards-plugin/pull/1132)) \ No newline at end of file