From 07148207cb224728f114b78e76d3816ccf66bbae Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Mon, 5 Dec 2022 18:58:05 -0800 Subject: [PATCH 1/4] made table cells flexible; added monitor enabled check for actions Signed-off-by: Amardeepsingh Siglani --- public/pages/Monitors/containers/Monitors/Monitors.js | 4 +++- .../Monitors/containers/Monitors/utils/tableUtils.js | 9 --------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/public/pages/Monitors/containers/Monitors/Monitors.js b/public/pages/Monitors/containers/Monitors/Monitors.js index 21f9de5a5..9367aafa0 100644 --- a/public/pages/Monitors/containers/Monitors/Monitors.js +++ b/public/pages/Monitors/containers/Monitors/Monitors.js @@ -75,7 +75,7 @@ export default class Monitors extends Component { ...staticColumns, { name: 'Actions', - width: '75px', + width: '60px', actions: [ { name: 'Acknowledge', @@ -86,11 +86,13 @@ export default class Monitors extends Component { name: 'Enable', description: 'Enable this Monitor', onClick: this.onClickEnable, + available: (item) => !item.enabled, }, { name: 'Disable', description: 'Disable this Monitor', onClick: this.onClickDisable, + available: (item) => item.enabled, }, { name: 'Delete', diff --git a/public/pages/Monitors/containers/Monitors/utils/tableUtils.js b/public/pages/Monitors/containers/Monitors/utils/tableUtils.js index c8b92249f..18fb85730 100644 --- a/public/pages/Monitors/containers/Monitors/utils/tableUtils.js +++ b/public/pages/Monitors/containers/Monitors/utils/tableUtils.js @@ -22,7 +22,6 @@ export const columns = [ sortable: true, truncateText: true, textOnly: true, - width: '150px', render: (name, item) => {name}, }, { @@ -31,7 +30,6 @@ export const columns = [ sortable: true, truncateText: true, textOnly: true, - width: '100px', /* 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. @@ -47,14 +45,12 @@ export const columns = [ sortable: false, truncateText: true, textOnly: true, - width: '150px', }, { field: 'enabled', name: 'State', sortable: false, truncateText: false, - width: '100px', render: (enabled) => (enabled ? 'Enabled' : 'Disabled'), }, { @@ -64,34 +60,29 @@ export const columns = [ truncateText: false, render: renderTime, dataType: 'date', - width: '150px', }, { field: 'active', name: 'Active', sortable: true, truncateText: false, - width: '100px', }, { field: 'acknowledged', name: 'Acknowledged', sortable: true, truncateText: false, - width: '100px', }, { field: 'errors', name: 'Errors', sortable: true, truncateText: false, - width: '100px', }, { field: 'ignored', name: 'Ignored', sortable: true, truncateText: false, - width: '100px', }, ]; From cb0a9c6ecc65cc65d20f1f9233614e0218bd6b7f Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Mon, 5 Dec 2022 19:31:20 -0800 Subject: [PATCH 2/4] updated snapshot Signed-off-by: Amardeepsingh Siglani --- .../Monitors/__snapshots__/Monitors.test.js.snap | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) 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 d664a137d..fe4eea450 100644 --- a/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap +++ b/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap @@ -41,7 +41,6 @@ exports[`Monitors renders 1`] = ` "sortable": true, "textOnly": true, "truncateText": true, - "width": "150px", }, Object { "field": "user", @@ -50,7 +49,6 @@ exports[`Monitors renders 1`] = ` "sortable": true, "textOnly": true, "truncateText": true, - "width": "100px", }, Object { "field": "latestAlert", @@ -58,7 +56,6 @@ exports[`Monitors renders 1`] = ` "sortable": false, "textOnly": true, "truncateText": true, - "width": "150px", }, Object { "field": "enabled", @@ -66,7 +63,6 @@ exports[`Monitors renders 1`] = ` "render": [Function], "sortable": false, "truncateText": false, - "width": "100px", }, Object { "dataType": "date", @@ -75,35 +71,30 @@ exports[`Monitors renders 1`] = ` "render": [Function], "sortable": true, "truncateText": false, - "width": "150px", }, Object { "field": "active", "name": "Active", "sortable": true, "truncateText": false, - "width": "100px", }, Object { "field": "acknowledged", "name": "Acknowledged", "sortable": true, "truncateText": false, - "width": "100px", }, Object { "field": "errors", "name": "Errors", "sortable": true, "truncateText": false, - "width": "100px", }, Object { "field": "ignored", "name": "Ignored", "sortable": true, "truncateText": false, - "width": "100px", }, Object { "actions": Array [ @@ -113,11 +104,13 @@ exports[`Monitors renders 1`] = ` "onClick": [Function], }, Object { + "available": [Function], "description": "Enable this Monitor", "name": "Enable", "onClick": [Function], }, Object { + "available": [Function], "description": "Disable this Monitor", "name": "Disable", "onClick": [Function], @@ -129,7 +122,7 @@ exports[`Monitors renders 1`] = ` }, ], "name": "Actions", - "width": "75px", + "width": "60px", }, ] } From 8a095194ed6440bb636cd09d0d090647c3bd5180 Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Wed, 7 Dec 2022 15:45:09 -0800 Subject: [PATCH 3/4] minor updates Signed-off-by: Amardeepsingh Siglani --- cypress/integration/query_level_monitor_spec.js | 10 +++++----- .../NotificationsInfoCallOut.js | 9 ++++----- .../Monitors/containers/Monitors/utils/tableUtils.js | 7 +++++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/cypress/integration/query_level_monitor_spec.js b/cypress/integration/query_level_monitor_spec.js index 3ca9a3b91..1e3cb3bb1 100644 --- a/cypress/integration/query_level_monitor_spec.js +++ b/cypress/integration/query_level_monitor_spec.js @@ -166,7 +166,7 @@ describe('Query-Level Monitors', () => { cy.contains(SAMPLE_MONITOR, { timeout: 20000 }); // Select the existing monitor - cy.get('a').contains(SAMPLE_MONITOR, { timeout: 20000 }).click(); + cy.get(`[data-test-subj="${SAMPLE_MONITOR}"]`).click(); // Click Edit button cy.contains('Edit', { timeout: 20000 }).click({ force: true }); @@ -195,7 +195,7 @@ describe('Query-Level Monitors', () => { cy.contains(SAMPLE_MONITOR, { timeout: 20000 }); // Select the existing monitor - cy.get('a').contains(SAMPLE_MONITOR, { timeout: 20000 }).click({ force: true }); + cy.get(`[data-test-subj="${SAMPLE_MONITOR}"]`).click({ force: true }); // Click Edit button cy.contains('Edit', { timeout: 20000 }).click({ force: true }); @@ -304,7 +304,7 @@ describe('Query-Level Monitors', () => { cy.contains(SAMPLE_MONITOR); // Select the existing monitor - cy.get('a').contains(SAMPLE_MONITOR).click(); + cy.get(`[data-test-subj="${SAMPLE_MONITOR}"]`).click(); // Click Edit button cy.contains('Edit').click({ force: true }); @@ -373,7 +373,7 @@ describe('Query-Level Monitors', () => { cy.contains(SAMPLE_DAYS_INTERVAL_MONITOR, { timeout: 20000 }); // Select the existing monitor - cy.get('a').contains(SAMPLE_DAYS_INTERVAL_MONITOR).click({ force: true }); + cy.get(`[data-test-subj="${SAMPLE_DAYS_INTERVAL_MONITOR}"]`).click({ force: true }); // Click Edit button cy.contains('Edit').click({ force: true }); @@ -398,7 +398,7 @@ describe('Query-Level Monitors', () => { cy.contains(SAMPLE_CRON_EXPRESSION_MONITOR, { timeout: 20000 }); // Select the existing monitor - cy.get('a').contains(SAMPLE_CRON_EXPRESSION_MONITOR).click({ force: true }); + cy.get(`[data-test-subj="${SAMPLE_CRON_EXPRESSION_MONITOR}"]`).click({ force: true }); // Click Edit button cy.contains('Edit').click({ force: true }); diff --git a/public/pages/Destinations/components/NotificationsInfoCallOut/NotificationsInfoCallOut.js b/public/pages/Destinations/components/NotificationsInfoCallOut/NotificationsInfoCallOut.js index 78091dc7d..0a186fd61 100644 --- a/public/pages/Destinations/components/NotificationsInfoCallOut/NotificationsInfoCallOut.js +++ b/public/pages/Destinations/components/NotificationsInfoCallOut/NotificationsInfoCallOut.js @@ -8,18 +8,17 @@ import { EuiCallOut, EuiButton, EuiSpacer } from '@elastic/eui'; import { MANAGE_CHANNELS_PATH } from '../../../CreateTrigger/utils/constants'; const NotificationsInfoCallOut = ({ hasNotificationPlugin }) => { - console.log(`NotificationsInfoCallOut: ${hasNotificationPlugin}`); return (

Your destinations have been migrated to Notifications, a new centralized place to manage your notification channels. Destinations will be deprecated going forward. - - {hasNotificationPlugin && ( - View Notifications - )}

+ + {hasNotificationPlugin && ( + View Notifications + )}
diff --git a/public/pages/Monitors/containers/Monitors/utils/tableUtils.js b/public/pages/Monitors/containers/Monitors/utils/tableUtils.js index 18fb85730..4aab897e9 100644 --- a/public/pages/Monitors/containers/Monitors/utils/tableUtils.js +++ b/public/pages/Monitors/containers/Monitors/utils/tableUtils.js @@ -20,9 +20,12 @@ export const columns = [ field: 'name', name: 'Monitor name', sortable: true, - truncateText: true, textOnly: true, - render: (name, item) => {name}, + render: (name, item) => ( + + {name} + + ), }, { field: 'user', From ba8fa97c335d1b8d5dcfc56d6f27526be66aa1a8 Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Wed, 7 Dec 2022 15:59:14 -0800 Subject: [PATCH 4/4] updated jest snapshots Signed-off-by: Amardeepsingh Siglani --- .../NotificationsInfoCallOut.test.js.snap | 2 - .../DestinationsList.test.js.snap | 42 +++++++++---------- .../__snapshots__/Monitors.test.js.snap | 1 - 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/public/pages/Destinations/components/NotificationsInfoCallOut/__snapshots__/NotificationsInfoCallOut.test.js.snap b/public/pages/Destinations/components/NotificationsInfoCallOut/__snapshots__/NotificationsInfoCallOut.test.js.snap index 0e03bbd9b..750bb13c6 100644 --- a/public/pages/Destinations/components/NotificationsInfoCallOut/__snapshots__/NotificationsInfoCallOut.test.js.snap +++ b/public/pages/Destinations/components/NotificationsInfoCallOut/__snapshots__/NotificationsInfoCallOut.test.js.snap @@ -41,7 +41,6 @@ exports[`NotificationsInfoCallOut renders when Notifications plugin is installed -

@@ -77,7 +76,6 @@ exports[`NotificationsInfoCallOut renders when Notifications plugin is not insta

-

diff --git a/public/pages/Destinations/containers/DestinationsList/__snapshots__/DestinationsList.test.js.snap b/public/pages/Destinations/containers/DestinationsList/__snapshots__/DestinationsList.test.js.snap index 3cbd3af90..60098e69b 100644 --- a/public/pages/Destinations/containers/DestinationsList/__snapshots__/DestinationsList.test.js.snap +++ b/public/pages/Destinations/containers/DestinationsList/__snapshots__/DestinationsList.test.js.snap @@ -82,14 +82,14 @@ exports[`DestinationsList renders when Notification plugin is installed 1`] = ` >

Your destinations have been migrated to Notifications, a new centralized place to manage your notification channels. Destinations will be deprecated going forward. - -

-

+ +
+
@@ -1556,14 +1556,14 @@ exports[`DestinationsList renders when Notification plugin is not installed 1`] >

Your destinations have been migrated to Notifications, a new centralized place to manage your notification channels. Destinations will be deprecated going forward. - -

-

+ +
+
@@ -2888,14 +2888,14 @@ exports[`DestinationsList renders when email is disallowed 1`] = ` >

Your destinations have been migrated to Notifications, a new centralized place to manage your notification channels. Destinations will be deprecated going forward. - -

-

+ +
+
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 fe4eea450..5dcbfd468 100644 --- a/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap +++ b/public/pages/Monitors/containers/Monitors/__snapshots__/Monitors.test.js.snap @@ -40,7 +40,6 @@ exports[`Monitors renders 1`] = ` "render": [Function], "sortable": true, "textOnly": true, - "truncateText": true, }, Object { "field": "user",