Skip to content

Commit b0b970c

Browse files
KashKondakaopensearch-trigger-bot[bot]github-actions[bot]
authored
Ppl Alerting (#1333)
* Add release notes for 3.3.0 (#1293) (#1295) (cherry picked from commit a232821) Signed-off-by: opensearch-ci <opensearch-infra@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Bump form-data, cipher-base, sha.js version (#1296) (#1297) (cherry picked from commit 147e2e7) Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * Onboarded opensearch apis to use MDS client for Neo (#1313) (#1323) cr: https://code.amazon.com/reviews/CR-234395069 (cherry picked from commit 36ccb85) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * added v2 apis add feature flag add v2 create monitor fix cypress test trigger v2 implemented add monitor details v2 update dashboard pages with v2 fix cypress test discover flyout and explore dependency added in progress, broken monitor details Revert "in progress, broken monitor details" This reverts commit f2da5e8. api bug fixes for edit, disable/enable,export as json,delete finalized edits for monitor detailsv2 page(title still in progress v2 alerts flyout fixed added more alert separation, fix v2 alert flyout and pagination fix duplicate buttons on dashbaord classic fix double v1/v2 get call for monitor details remove combined v1/v2 calls in monitor details page fix buttons in dashboard and monitors pages set view to classic for v1 create monitor depends on view fix search monitors call v2 trigger impl fix create monitor flyout fix delete in monitor details page fix notification validation issue and v2 creation w/ notifs Parse the monitor payload in V2 to conform with the v1 execute API remove false failed to load destination toast fix send test message for alert flyout fix trigger not loading in v2 monitor edit allow monitor creation without actions set dont set default throttle issue when edit/creating validate on change to true fix padding in alerting new/classic update unit tests refresh monitor list when switching views remove sequence no and primary term from update monitor call fix mustache message for notification action look back window no longer selected when editing monitor w/o lookback check box disappeared for v1 monitor creation submitting monitor create wihout trigger name is invalid add validation error for trigger condition value >=10000 remove debug logs remove debug logs use seq no to fix race condition to properly update lookback window provide clear toast message for invalid ppl query add look back window to monitor overview stats fix description layout in monitor detail stats card and change limit to 500 chars make text labels for fields unclickable on hover cannot acknowledge monitor in empty classic monitor list if editing a monitor, do not allow switching monitor view add info to monitor details v2 add monitor datasource to ppl alert flyout Revert "add monitor datasource to ppl alert flyout" This reverts commit a1c7a35. remove execute ppl on keystroke and add update graph button graph formatting small utc formatting fix for look back window remove comment action from alerts table in monitorv2 details update unit tests remove debug logs remove logs and add helper for dupe code switch back to euitheme trigger condition cannot be negative address comments get rid of redundant v2 api declaratoin for v2 monitor details get rid of classic monitor code in v2 file and remove seq no/primary term Remove acknowledge action from PPL monitor actions and add edit action Fix improper import causing acknowledge alerts modal to break cr: https://code.amazon.com/reviews/CR-234635093 Fix action on create monitor from alerts page cr: https://code.amazon.com/reviews/CR-234678247 Signed-off-by: KashKondaka <37753523+KashKondaka@users.noreply.github.com> * update unit tests Signed-off-by: KashKondaka <37753523+KashKondaka@users.noreply.github.com> --------- Signed-off-by: opensearch-ci <opensearch-infra@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: KashKondaka <37753523+KashKondaka@users.noreply.github.com> Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 0c816e1 commit b0b970c

File tree

145 files changed

+17328
-6818
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+17328
-6818
lines changed

.cypress/integration/alerts_dashboard_flyout.spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ describe('Alerts by trigger flyout', () => {
4747
beforeEach(() => {
4848
// Reloading the page to close any flyouts that were not closed by other tests that had failures.
4949
cy.visit(`${Cypress.env('opensearch_dashboards')}/app/${PLUGIN_NAME}#/dashboard`);
50-
cy.contains('Alerts by triggers', { timeout: TWENTY_SECONDS });
50+
cy.get('[data-test-subj="alertsDashboard_table"]', {
51+
timeout: TWENTY_SECONDS,
52+
}).should('exist');
5153

5254
// Waiting 5 seconds for alerts to finish loading.
5355
// This short wait period alleviates flakiness observed during these tests.

.cypress/integration/bucket_level_monitor.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ describe('Bucket-Level Monitors', () => {
192192
cy.contains(SAMPLE_TRIGGER);
193193

194194
// Go back to the Monitors list
195-
cy.get('a').contains('Monitors').click({ force: true });
195+
cy.contains('Monitors').click({ force: true });
196196

197197
// Confirm we can see the created monitor in the list
198198
cy.contains(SAMPLE_EXTRACTION_QUERY_MONITOR);
@@ -298,7 +298,7 @@ describe('Bucket-Level Monitors', () => {
298298
cy.contains(SAMPLE_TRIGGER);
299299

300300
// Go back to the Monitors list
301-
cy.get('a').contains('Monitors').click({ force: true });
301+
cy.contains('Monitors').click({ force: true });
302302

303303
// Confirm we can see the created monitor in the list
304304
cy.contains(SAMPLE_VISUAL_EDITOR_MONITOR);

.cypress/integration/cluster_metrics_monitor.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ describe('ClusterMetricsMonitor', () => {
133133
cy.contains(SAMPLE_TRIGGER);
134134

135135
// Go back to the Monitors list
136-
cy.get('a').contains('Monitors').click({ force: true });
136+
cy.contains('Monitors').click({ force: true });
137137

138138
// Confirm we can see the created monitor in the list
139139
cy.contains(SAMPLE_CLUSTER_METRICS_HEALTH_MONITOR);
@@ -187,7 +187,7 @@ describe('ClusterMetricsMonitor', () => {
187187
cy.contains(SAMPLE_TRIGGER);
188188

189189
// Go back to the Monitors list
190-
cy.get('a').contains('Monitors').click({ force: true });
190+
cy.contains('Monitors').click({ force: true });
191191

192192
// Confirm we can see the created monitor in the list
193193
cy.contains(SAMPLE_CLUSTER_METRICS_NODES_STATS_MONITOR);

.cypress/integration/composite_level_monitor.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe('CompositeLevelMonitor', () => {
8585
cy.contains(SAMPLE_VISUAL_EDITOR_MONITOR);
8686

8787
// Go back to the Monitors list
88-
cy.get('a').contains('Monitors').click({ force: true });
88+
cy.contains('Monitors').click({ force: true });
8989

9090
cy.contains(SAMPLE_VISUAL_EDITOR_MONITOR);
9191
});

.cypress/integration/document_level_monitor.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ describe('DocumentLevelMonitor', () => {
180180
cy.contains(sampleDocumentLevelMonitor.triggers[0].document_level_trigger.name);
181181

182182
// Go back to the Monitors list
183-
cy.get('a').contains('Monitors').click({ force: true });
183+
cy.contains('Monitors').click({ force: true });
184184

185185
// Confirm we can see the created monitor in the list
186186
cy.contains(SAMPLE_EXTRACTION_QUERY_MONITOR);
@@ -314,7 +314,7 @@ describe('DocumentLevelMonitor', () => {
314314
).contains(sampleDocumentLevelMonitor.inputs[0].doc_level_input.queries[0].name);
315315

316316
// Go back to the Monitors list
317-
cy.get('a').contains('Monitors').click({ force: true });
317+
cy.contains('Monitors').click({ force: true });
318318

319319
// Confirm we can see the created monitor in the list
320320
cy.contains(SAMPLE_VISUAL_EDITOR_MONITOR);

.cypress/integration/query_level_monitor.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('Query-Level Monitors', () => {
148148
cy.contains(SAMPLE_TRIGGER);
149149

150150
// Go back to the Monitors list
151-
cy.get('a').contains('Monitors').click({ force: true });
151+
cy.contains('Monitors').click({ force: true });
152152

153153
// Confirm we can see the created monitor in the list
154154
cy.contains(SAMPLE_MONITOR);
@@ -185,7 +185,7 @@ describe('Query-Level Monitors', () => {
185185
cy.contains('Edit monitor');
186186

187187
// Go back to the Monitors list
188-
cy.get('a').contains('Monitors').click({ force: true });
188+
cy.contains('Monitors').click({ force: true });
189189

190190
// Confirm we can see the updated monitor in the list
191191
cy.contains(UPDATED_MONITOR);

cypress/integration/alerts_dashboard_flyout.spec.js

Whitespace-only changes.

opensearch_dashboards.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "3.5.0.0",
44
"opensearchDashboardsVersion": "3.5.0",
55
"configPath": ["opensearch_alerting"],
6-
"optionalPlugins": ["dataSource", "dataSourceManagement", "assistantDashboards"],
6+
"optionalPlugins": ["dataSource", "dataSourceManagement", "assistantDashboards", "explore"],
77
"requiredPlugins": [
88
"uiActions",
99
"dashboard",

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@
3636
"@types/react": "^16.14.23"
3737
},
3838
"dependencies": {
39+
"@reduxjs/toolkit": "^1.6.1",
3940
"brace": "0.11.1",
4041
"formik": "^2.2.6",
4142
"lodash": "^4.17.21",
4243
"query-string": "^6.13.2",
44+
"react-redux": "^7.2.0",
4345
"react-vis": "^1.8.1",
4446
"prettier": "^2.1.1"
4547
},

public/app.js

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import React from 'react';
66
import ReactDOM from 'react-dom';
77
import { HashRouter as Router, Route } from 'react-router-dom';
8+
import { Provider } from 'react-redux';
89

910
import 'react-vis/dist/style.css';
1011
// TODO: review the CSS style and migrate the necessary style to SASS, as Less is not supported in OpenSearch Dashboards "new platform" anymore
@@ -14,13 +15,16 @@ import Main from './pages/Main';
1415
import { CoreContext } from './utils/CoreContext';
1516
import { ServicesContext, NotificationService, getDataSourceEnabled } from './services';
1617
import { initManageChannelsUrl } from './utils/helpers';
18+
import { OpenSearchDashboardsContextProvider } from '../../../src/plugins/opensearch_dashboards_react/public';
19+
import { getAlertingStore } from './redux/store';
20+
import { DatasetProvider } from './contexts';
1721

18-
export function renderApp(coreStart, params, defaultRoute) {
22+
export function renderApp(coreStart, depsStart, params, defaultRoute) {
1923
const isDarkMode = coreStart.uiSettings.get('theme:darkMode') || false;
2024
const http = coreStart.http;
2125
coreStart.chrome.setBreadcrumbs([{ text: 'Alerting' }]); // Set Breadcrumbs for the plugin
2226
const notificationService = new NotificationService(http);
23-
const services = { notificationService };
27+
const services = { notificationService, data: depsStart?.data };
2428
const mdsProps = {
2529
setActionMenu: params.setHeaderActionMenu,
2630
dataSourceEnabled: getDataSourceEnabled()?.enabled,
@@ -39,25 +43,39 @@ export function renderApp(coreStart, params, defaultRoute) {
3943

4044
initManageChannelsUrl(coreStart.http);
4145

42-
// render react to DOM
46+
// Initialize Redux store
47+
const store = getAlertingStore();
48+
4349
ReactDOM.render(
44-
<Router>
45-
<ServicesContext.Provider value={services}>
46-
<CoreContext.Provider
47-
value={{
48-
http: coreStart.http,
49-
isDarkMode,
50-
notifications: coreStart.notifications,
51-
chrome: coreStart.chrome,
52-
defaultRoute: defaultRoute,
53-
}}
54-
>
55-
<Route
56-
render={(props) => <Main title="Alerting" {...mdsProps} {...navProps} {...props} />}
57-
/>
58-
</CoreContext.Provider>
59-
</ServicesContext.Provider>
60-
</Router>,
50+
<Provider store={store}>
51+
<OpenSearchDashboardsContextProvider services={{ ...coreStart, ...depsStart }}>
52+
<OpenSearchDashboardsContextProvider services={{ data: depsStart?.data }}>
53+
<DatasetProvider>
54+
<Router>
55+
<ServicesContext.Provider value={services}>
56+
<CoreContext.Provider
57+
value={{
58+
http: coreStart.http,
59+
isDarkMode,
60+
notifications: coreStart.notifications,
61+
chrome: coreStart.chrome,
62+
defaultRoute: defaultRoute,
63+
data: depsStart?.data,
64+
services: { ...coreStart, ...depsStart },
65+
}}
66+
>
67+
<Route
68+
render={(props) => (
69+
<Main title="Alerting" {...mdsProps} {...navProps} {...props} />
70+
)}
71+
/>
72+
</CoreContext.Provider>
73+
</ServicesContext.Provider>
74+
</Router>
75+
</DatasetProvider>
76+
</OpenSearchDashboardsContextProvider>
77+
</OpenSearchDashboardsContextProvider>
78+
</Provider>,
6179
params.element
6280
);
6381
return () => ReactDOM.unmountComponentAtNode(params.element);

0 commit comments

Comments
 (0)