Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -20,5 +26,7 @@
"server": true,
"ui": true,
"supportedOSDataSourceVersions": ">=2.13.0",
"requiredOSDataSourcePlugins": ["opensearch-alerting"]
}
"requiredOSDataSourcePlugins": [
"opensearch-alerting"
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@
"engines": {
"yarn": "^1.21.1"
}
}
}
17 changes: 10 additions & 7 deletions public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -18,12 +18,15 @@ export interface DataSourceAlertsCardProps {
}

export const DataSourceAlertsCard: React.FC<DataSourceAlertsCardProps> = ({ getDataSourceMenu }) => {
const DataSourceSelector = getDataSourceMenu?.();
const DataSourceSelector = useMemo(() => {
if (getDataSourceMenu) {
return getDataSourceMenu();
}

return null;
}, [getDataSourceMenu]);
const [loading, setLoading] = useState(false);
const [dataSource, setDataSource] = useState<DataSourceOption>({
label: 'Local cluster',
id: '',
});
const [dataSource, setDataSource] = useState<DataSourceOption>();
const [alerts, setAlerts] = useState<any[]>([]);

useEffect(() => {
Expand All @@ -46,7 +49,7 @@ export const DataSourceAlertsCard: React.FC<DataSourceAlertsCardProps> = ({ 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]);
Expand Down
1 change: 1 addition & 0 deletions public/pages/Dashboard/utils/tableUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export const alertColumns = (
dsl: dsl,
index: index,
topNLogPatternData: topNLogPatternData,
isVisualEditorMonitor: isVisualEditorMonitor,
},
dataSourceId: dataSourceQuery?.query?.dataSourceId,
};
Expand Down
15 changes: 8 additions & 7 deletions public/pages/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<DataSourceOption>(LocalCluster);
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<DataSourceOption>({});
9 changes: 8 additions & 1 deletion public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ export interface AlertingStartDeps {
export class AlertingPlugin implements Plugin<void, AlertingStart, AlertingSetupDeps, AlertingStartDeps> {

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,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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))
Loading