Skip to content

Commit

Permalink
[Backport 2.3] Removed "last updated by" sections from the UI. (#767) (
Browse files Browse the repository at this point in the history
…#901)

* 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 <hurneyt@amazon.com>

* Updated cypress workflow.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

---------

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

(cherry picked from commit 1bea77f)
Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Updated snapshots.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Updated cypress workflow.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Fixed import.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

* Fixed cypress test.

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>

---------

Signed-off-by: AWSHurneyt <hurneyt@amazon.com>
  • Loading branch information
AWSHurneyt authored Mar 15, 2024
1 parent 342dd18 commit 702bcae
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 72 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cypress-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
env:
OPENSEARCH_DASHBOARDS_VERSION: '2.3.0'
OPENSEARCH_VERSION: '2.3.0-SNAPSHOT'
ALERTING_PLUGIN_BRANCH: '2.3'
ALERTING_PLUGIN_BRANCH: '2.3.0.0'
jobs:
tests:
name: Run Cypress E2E tests
Expand Down Expand Up @@ -68,7 +68,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
Expand Down
18 changes: 9 additions & 9 deletions cypress/integration/cluster_metrics_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -200,7 +200,7 @@ describe('ClusterMetricsMonitor', () => {
});
});

describe('displays Query parameters field appropriately', () => {
describe('displays Path parameters field appropriately', () => {
beforeEach(() => {
cy.deleteAllMonitors();
cy.reload();
Expand All @@ -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"]');
});
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/monitors_dashboard_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('Monitors dashboard page', () => {

it('Displays expected number of alerts', () => {
// 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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,4 @@ export const staticColumns = [
}
},
},
{
field: 'user',
name: 'Last updated by',
sortable: true,
truncateText: true,
textOnly: true,
width: '100px',
render: (value) => (value && value.name ? value.name : '-'),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,6 @@ exports[`MonitorOverview renders 1`] = `
</div>
</div>
</div>
<div
class="euiFlexItem"
>
<div
class="euiText euiText--extraSmall"
>
<strong>
Last updated by
</strong>
<div>
-
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 : '-',
},
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ describe('getOverviewStats', () => {
header: 'Monitor version number',
value: monitorVersion,
},
{
header: 'Last updated by',
value: monitor.user.name,
},
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 0 additions & 15 deletions public/pages/Monitors/containers/Monitors/utils/tableUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,6 @@ export const columns = [
</EuiLink>
),
},
{
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',
Expand Down

0 comments on commit 702bcae

Please sign in to comment.