Skip to content

Commit

Permalink
Keep monitor table cell width flexible; Check for whether monitor is …
Browse files Browse the repository at this point in the history
…enabled when displaying related action (#402) (#416)

* made table cells flexible; added monitor enabled check for actions

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* updated snapshot

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* minor updates

Signed-off-by: Amardeepsingh Siglani <[email protected]>

* updated jest snapshots

Signed-off-by: Amardeepsingh Siglani <[email protected]>

Signed-off-by: Amardeepsingh Siglani <[email protected]>
(cherry picked from commit bd62a0b)

Co-authored-by: Amardeepsingh Siglani <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and amsiglan authored Dec 12, 2022
1 parent d3047e9 commit 8282ddf
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 56 deletions.
10 changes: 5 additions & 5 deletions cypress/integration/query_level_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down Expand Up @@ -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 });
Expand Down Expand Up @@ -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 });
Expand Down Expand Up @@ -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 });
Expand All @@ -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 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div>
<EuiCallOut title="Destinations have become channels in Notifications.">
<p>
Your destinations have been migrated to Notifications, a new centralized place to manage
your notification channels. Destinations will be deprecated going forward.
<EuiSpacer size="l" />
{hasNotificationPlugin && (
<EuiButton href={MANAGE_CHANNELS_PATH}>View Notifications</EuiButton>
)}
</p>
<EuiSpacer size="l" />
{hasNotificationPlugin && (
<EuiButton href={MANAGE_CHANNELS_PATH}>View Notifications</EuiButton>
)}
</EuiCallOut>
<EuiSpacer size="l" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ exports[`NotificationsInfoCallOut renders when Notifications plugin is installed
</span>
</span>
</a>
<p />
</div>
</div>
</div>
Expand Down Expand Up @@ -77,7 +76,6 @@ exports[`NotificationsInfoCallOut renders when Notifications plugin is not insta
<div
class="euiSpacer euiSpacer--l"
/>
<p />
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ exports[`DestinationsList renders when Notification plugin is installed 1`] = `
>
<p>
Your destinations have been migrated to Notifications, a new centralized place to manage your notification channels. Destinations will be deprecated going forward.
<EuiSpacer
size="l"
>
<div
className="euiSpacer euiSpacer--l"
/>
</EuiSpacer>
</p>
<EuiSpacer
size="l"
>
<div
className="euiSpacer euiSpacer--l"
/>
</EuiSpacer>
</div>
</EuiTextColor>
</div>
Expand Down Expand Up @@ -1556,14 +1556,14 @@ exports[`DestinationsList renders when Notification plugin is not installed 1`]
>
<p>
Your destinations have been migrated to Notifications, a new centralized place to manage your notification channels. Destinations will be deprecated going forward.
<EuiSpacer
size="l"
>
<div
className="euiSpacer euiSpacer--l"
/>
</EuiSpacer>
</p>
<EuiSpacer
size="l"
>
<div
className="euiSpacer euiSpacer--l"
/>
</EuiSpacer>
</div>
</EuiTextColor>
</div>
Expand Down Expand Up @@ -2888,14 +2888,14 @@ exports[`DestinationsList renders when email is disallowed 1`] = `
>
<p>
Your destinations have been migrated to Notifications, a new centralized place to manage your notification channels. Destinations will be deprecated going forward.
<EuiSpacer
size="l"
>
<div
className="euiSpacer euiSpacer--l"
/>
</EuiSpacer>
</p>
<EuiSpacer
size="l"
>
<div
className="euiSpacer euiSpacer--l"
/>
</EuiSpacer>
</div>
</EuiTextColor>
</div>
Expand Down
4 changes: 3 additions & 1 deletion public/pages/Monitors/containers/Monitors/Monitors.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default class Monitors extends Component {
...staticColumns,
{
name: 'Actions',
width: '75px',
width: '60px',
actions: [
{
name: 'Acknowledge',
Expand All @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ exports[`Monitors renders 1`] = `
"render": [Function],
"sortable": true,
"textOnly": true,
"truncateText": true,
"width": "150px",
},
Object {
"field": "user",
Expand All @@ -50,23 +48,20 @@ exports[`Monitors renders 1`] = `
"sortable": true,
"textOnly": true,
"truncateText": true,
"width": "100px",
},
Object {
"field": "latestAlert",
"name": "Latest alert",
"sortable": false,
"textOnly": true,
"truncateText": true,
"width": "150px",
},
Object {
"field": "enabled",
"name": "State",
"render": [Function],
"sortable": false,
"truncateText": false,
"width": "100px",
},
Object {
"dataType": "date",
Expand All @@ -75,35 +70,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 [
Expand All @@ -113,11 +103,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],
Expand All @@ -129,7 +121,7 @@ exports[`Monitors renders 1`] = `
},
],
"name": "Actions",
"width": "75px",
"width": "60px",
},
]
}
Expand Down
16 changes: 5 additions & 11 deletions public/pages/Monitors/containers/Monitors/utils/tableUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ export const columns = [
field: 'name',
name: 'Monitor name',
sortable: true,
truncateText: true,
textOnly: true,
width: '150px',
render: (name, item) => <EuiLink href={`${PLUGIN_NAME}#/monitors/${item.id}`}>{name}</EuiLink>,
render: (name, item) => (
<EuiLink data-test-subj={name} href={`${PLUGIN_NAME}#/monitors/${item.id}`}>
{name}
</EuiLink>
),
},
{
field: 'user',
name: 'Last updated by',
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.
Expand All @@ -47,14 +48,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'),
},
{
Expand All @@ -64,34 +63,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',
},
];

0 comments on commit 8282ddf

Please sign in to comment.