From 44147ebbb143c94b5f38f0d297bcb4583eb24865 Mon Sep 17 00:00:00 2001 From: AWSHurneyt Date: Fri, 15 Mar 2024 16:21:39 -0700 Subject: [PATCH] [Backport 2.7] Removed "last updated by" sections from the UI. (#767) (#903) * Removed "last updated by" sections from the UI. (#767) * Removed "last updated by" section from the UI as the SearchMonitor API can no longer return that info. Signed-off-by: AWSHurneyt * Updated cypress workflow. Signed-off-by: AWSHurneyt --------- Signed-off-by: AWSHurneyt (cherry picked from commit 1bea77f5af67faf294ce24f9239914c6a0c5c7a8) Signed-off-by: AWSHurneyt * Updated cypress workflow. Signed-off-by: AWSHurneyt * Updated snapshots. Signed-off-by: AWSHurneyt * Fixed unit test workflow. Signed-off-by: AWSHurneyt * Fixed cypress tests. Signed-off-by: AWSHurneyt * Fixed cypress test. Signed-off-by: AWSHurneyt * Updated snapshot. Signed-off-by: AWSHurneyt --------- Signed-off-by: AWSHurneyt --- .github/workflows/cypress-workflow.yml | 6 +++--- .github/workflows/unit-tests-workflow.yml | 2 +- .../cluster_metrics_monitor_spec.js | 18 +++++++++--------- cypress/integration/monitors_dashboard_spec.js | 9 +++++++-- .../FormikFieldPassword.test.js.snap | 1 + .../DestinationsList/utils/constants.js | 9 --------- .../__snapshots__/MonitorOverview.test.js.snap | 14 -------------- .../MonitorOverview/utils/getOverviewStats.js | 10 ---------- .../utils/getOverviewStats.test.js | 4 ---- .../__snapshots__/Monitors.test.js.snap | 8 -------- .../containers/Monitors/utils/tableUtils.js | 15 --------------- 11 files changed, 21 insertions(+), 75 deletions(-) diff --git a/.github/workflows/cypress-workflow.yml b/.github/workflows/cypress-workflow.yml index 8ddceaf47..7cee4f3e5 100644 --- a/.github/workflows/cypress-workflow.yml +++ b/.github/workflows/cypress-workflow.yml @@ -7,9 +7,9 @@ on: branches: - "*" env: - OPENSEARCH_DASHBOARDS_VERSION: '2.x' + OPENSEARCH_DASHBOARDS_VERSION: '2.7.0' OPENSEARCH_VERSION: '2.7.0-SNAPSHOT' - ALERTING_PLUGIN_BRANCH: '2.x' + ALERTING_PLUGIN_BRANCH: '2.7.0.0' jobs: tests: name: Run Cypress E2E tests @@ -67,7 +67,7 @@ jobs: - name: Run OpenSearch Dashboards server run: | cd OpenSearch-Dashboards - yarn start --no-base-path --no-watch & + yarn start --no-base-path --no-watch --server.host="0.0.0.0" & sleep 300 # timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:5601/api/status)" != "200" ]]; do sleep 5; done' - name: Run Cypress tests diff --git a/.github/workflows/unit-tests-workflow.yml b/.github/workflows/unit-tests-workflow.yml index 83edbf942..31ca25bee 100644 --- a/.github/workflows/unit-tests-workflow.yml +++ b/.github/workflows/unit-tests-workflow.yml @@ -7,7 +7,7 @@ on: branches: - "*" env: - OPENSEARCH_DASHBOARDS_VERSION: '2.x' + OPENSEARCH_DASHBOARDS_VERSION: '2.7.0' jobs: tests: name: Run unit tests diff --git a/cypress/integration/cluster_metrics_monitor_spec.js b/cypress/integration/cluster_metrics_monitor_spec.js index 50d05aaf3..2a00488f9 100644 --- a/cypress/integration/cluster_metrics_monitor_spec.js +++ b/cypress/integration/cluster_metrics_monitor_spec.js @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import sampleClusterMetricsMonitor from '../fixtures/sample_cluster_metrics_monitor.json'; +import sampleClusterMetricsMonitor from '../fixtures/sample_cluster_metrics_health_monitor.json'; import { INDEX, PLUGIN_NAME } from '../../cypress/support/constants'; const SAMPLE_CLUSTER_METRICS_HEALTH_MONITOR = 'sample_cluster_metrics_health_monitor'; @@ -101,8 +101,8 @@ describe('ClusterMetricsMonitor', () => { // Wait for the API types to load and then type in the Cluster Health API cy.get('[data-test-subj="clusterMetricsApiTypeComboBox"]').type('cluster health{enter}'); - // Confirm the Query parameters field is present and described as "optional" - cy.contains('Query parameters - optional'); + // Confirm the Path parameters field is present and described as "optional" + cy.contains('Path parameters - optional'); cy.get('[data-test-subj="clusterMetricsParamsFieldText"]'); // Press the 'Run for response' button @@ -158,8 +158,8 @@ describe('ClusterMetricsMonitor', () => { // Wait for the API types to load and then type in the Cluster Health API cy.get('[data-test-subj="clusterMetricsApiTypeComboBox"]').type('nodes stats{enter}'); - // Confirm the Query parameters field is not present - cy.contains('Query parameters').should('not.exist'); + // Confirm the Path parameters field is not present + cy.contains('Path parameters').should('not.exist'); cy.get('[data-test-subj="clusterMetricsParamsFieldText"]').should('not.exist'); // Press the 'Run for response' button @@ -200,7 +200,7 @@ describe('ClusterMetricsMonitor', () => { }); }); - describe('displays Query parameters field appropriately', () => { + describe('displays Path parameters field appropriately', () => { beforeEach(() => { cy.deleteAllMonitors(); cy.reload(); @@ -222,9 +222,9 @@ describe('ClusterMetricsMonitor', () => { // Wait for the API types to load and then type in the Cluster Health API cy.get('[data-test-subj="clusterMetricsApiTypeComboBox"]').type('list snapshots{enter}'); - // Confirm the Query parameters field is present and is not described as "optional" - cy.contains('Query parameters - optional').should('not.exist'); - cy.contains('Query parameters'); + // Confirm the Path parameters field is present and is not described as "optional" + cy.contains('Path parameters - optional').should('not.exist'); + cy.contains('Path parameters'); cy.get('[data-test-subj="clusterMetricsParamsFieldText"]'); }); }); diff --git a/cypress/integration/monitors_dashboard_spec.js b/cypress/integration/monitors_dashboard_spec.js index 61facec7a..ea7f4b183 100644 --- a/cypress/integration/monitors_dashboard_spec.js +++ b/cypress/integration/monitors_dashboard_spec.js @@ -34,7 +34,7 @@ const clusterHealthMonitor = { severity: '1', condition: { script: { - source: 'ctx.results[0].status != "green"', + source: 'ctx.results[0].status != "blue"', lang: 'painless', }, }, @@ -101,8 +101,13 @@ describe('Monitors dashboard page', () => { }); it('Displays expected number of alerts', () => { + // Wait for table to finish loading + cy.get('tbody > tr', { timeout: 20000 }).should(($tr) => + expect($tr).to.have.length.greaterThan(1) + ); + // Ensure the 'Monitor name' column is sorted in ascending order by sorting another column first - cy.contains('Last updated by').click({ force: true }); + cy.contains('Last notification time').click({ force: true }); cy.contains('Monitor name').click({ force: true }); testMonitors.forEach((entry) => { diff --git a/public/components/FormControls/FormikFieldPassword/__snapshots__/FormikFieldPassword.test.js.snap b/public/components/FormControls/FormikFieldPassword/__snapshots__/FormikFieldPassword.test.js.snap index c523339ce..1a14c7612 100644 --- a/public/components/FormControls/FormikFieldPassword/__snapshots__/FormikFieldPassword.test.js.snap +++ b/public/components/FormControls/FormikFieldPassword/__snapshots__/FormikFieldPassword.test.js.snap @@ -10,6 +10,7 @@ exports[`FormikFieldPassword renders 1`] = `
(value && value.name ? value.name : '-'), - }, ]; diff --git a/public/pages/MonitorDetails/components/MonitorOverview/__snapshots__/MonitorOverview.test.js.snap b/public/pages/MonitorDetails/components/MonitorOverview/__snapshots__/MonitorOverview.test.js.snap index 56795047d..69cc25cf8 100644 --- a/public/pages/MonitorDetails/components/MonitorOverview/__snapshots__/MonitorOverview.test.js.snap +++ b/public/pages/MonitorDetails/components/MonitorOverview/__snapshots__/MonitorOverview.test.js.snap @@ -143,20 +143,6 @@ exports[`MonitorOverview renders 1`] = `
-
-
- - Last updated by - -
- - -
-
-
diff --git a/public/pages/MonitorDetails/components/MonitorOverview/utils/getOverviewStats.js b/public/pages/MonitorDetails/components/MonitorOverview/utils/getOverviewStats.js index d9844b262..d96f635c3 100644 --- a/public/pages/MonitorDetails/components/MonitorOverview/utils/getOverviewStats.js +++ b/public/pages/MonitorDetails/components/MonitorOverview/utils/getOverviewStats.js @@ -115,15 +115,5 @@ export default function getOverviewStats( header: 'Monitor version number', value: monitorVersion, }, - { - /* There are 3 cases: - 1. Monitors created by older versions and never updated. - These monitors won’t have User details in the monitor object. `monitor.user` will be null. - 2. Monitors are created when security plugin is disabled, these will have empty User object. - (`monitor.user.name`, `monitor.user.roles` are empty ) - 3. Monitors are created when security plugin is enabled, these will have an User object. */ - header: 'Last updated by', - value: monitor.user && monitor.user.name ? monitor.user.name : '-', - }, ]; } diff --git a/public/pages/MonitorDetails/components/MonitorOverview/utils/getOverviewStats.test.js b/public/pages/MonitorDetails/components/MonitorOverview/utils/getOverviewStats.test.js index 2bf486470..d9c567dfe 100644 --- a/public/pages/MonitorDetails/components/MonitorOverview/utils/getOverviewStats.test.js +++ b/public/pages/MonitorDetails/components/MonitorOverview/utils/getOverviewStats.test.js @@ -46,10 +46,6 @@ describe('getOverviewStats', () => { header: 'Monitor version number', value: monitorVersion, }, - { - header: 'Last updated by', - value: monitor.user.name, - }, ]); }); }); diff --git a/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap b/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap index 929c0d132..966eebe2b 100644 --- a/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap +++ b/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap @@ -41,14 +41,6 @@ exports[`Monitors renders 1`] = ` "sortable": true, "textOnly": true, }, - Object { - "field": "user", - "name": "Last updated by", - "render": [Function], - "sortable": true, - "textOnly": true, - "truncateText": true, - }, Object { "field": "latestAlert", "name": "Latest alert", diff --git a/public/pages/Monitors/containers/Monitors/utils/tableUtils.js b/public/pages/Monitors/containers/Monitors/utils/tableUtils.js index c51204f1f..bc9ca3135 100644 --- a/public/pages/Monitors/containers/Monitors/utils/tableUtils.js +++ b/public/pages/Monitors/containers/Monitors/utils/tableUtils.js @@ -27,21 +27,6 @@ export const columns = [ ), }, - { - field: 'user', - name: 'Last updated by', - sortable: true, - truncateText: true, - textOnly: true, - /* There are 3 cases: - 1. Monitors created by older versions and never updated. - These monitors won’t have User details in the monitor object. `monitor.user` will be null. - 2. Monitors are created when security plugin is disabled, these will have empty User object. - (`monitor.user.name`, `monitor.user.roles` are empty ) - 3. Monitors are created when security plugin is enabled, these will have an User object. */ - render: (_, item) => - item.monitor.user && item.monitor.user.name ? item.monitor.user.name : '-', - }, { field: 'latestAlert', name: 'Latest alert',