Skip to content

Commit

Permalink
Revert fit and finish changes from 2.17 (#1111)
Browse files Browse the repository at this point in the history
* Revert "Fit and Finish UX changes Pt 2 (#1099) (#1107)"

This reverts commit bfb0d79.

Signed-off-by: Joanne Wang <[email protected]>

* Revert "Fit and Finish UX Fixes (#1092) (#1094)"

This reverts commit 51d2c95.

Signed-off-by: Joanne Wang <[email protected]>

---------

Signed-off-by: Joanne Wang <[email protected]>
  • Loading branch information
jowg-amazon authored Sep 24, 2024
1 parent bfb0d79 commit 195ac2c
Show file tree
Hide file tree
Showing 44 changed files with 867 additions and 186 deletions.
8 changes: 4 additions & 4 deletions cypress/integration/bucket_level_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ describe('Bucket-Level Monitors', () => {
// Add a trigger
addTriggerToVisualEditorMonitor(SAMPLE_TRIGGER, 0, SAMPLE_ACTION, true);

// Click save to save monitor changes
cy.get('button').contains('Save').last().click({ force: true });
// Click update button to save monitor changes
cy.get('button').contains('Update').last().click({ force: true });

// Confirm we can see only one row in the trigger list by checking <caption> element
cy.contains('This table contains 1 row');
Expand Down Expand Up @@ -375,8 +375,8 @@ describe('Bucket-Level Monitors', () => {
timeout: 25000,
});

// Click the save button
cy.get('button').contains('Save').last().click({ force: true });
// Click the update button
cy.get('button').contains('Update').last().click({ force: true });

// Confirm we're on the Monitor Details page by searching for the History element
cy.contains('History', { timeout: 20000 });
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/cluster_metrics_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ describe('ClusterMetricsMonitor', () => {
'ctx.results[0].number_of_pending_tasks >= 0'
);

// Click save button to save monitor changes
cy.get('button').contains('Save').last().click({ force: true });
// Click update button to save monitor changes
cy.get('button').contains('Update').last().click({ force: true });

// Confirm we can see only one row in the trigger list by checking <caption> element
cy.contains('This table contains 1 row');
Expand Down
3 changes: 1 addition & 2 deletions cypress/integration/composite_level_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ describe('CompositeLevelMonitor', () => {

it('by visual editor', () => {
// Verify edit page
cy.contains('Edit').click({ force: true });
cy.contains('Edit monitor', { timeout: 20000 });
cy.get('input[name="name"]').type('_edited');

Expand All @@ -151,7 +150,7 @@ describe('CompositeLevelMonitor', () => {
.type('{enter}');

cy.intercept('api/alerting/workflows/*').as('updateMonitorRequest');
cy.get('button').contains('Save').click({ force: true });
cy.get('button').contains('Update').click({ force: true });

// Wait for monitor to be created
cy.wait('@updateMonitorRequest').then(() => {
Expand Down
12 changes: 6 additions & 6 deletions cypress/integration/document_level_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ describe('DocumentLevelMonitor', () => {

// TODO: Test with Notifications plugin

// Click the save button
cy.get('button').contains('Save').last().click({ force: true });
// Click the update button
cy.get('button').contains('Update').last().click({ force: true });

// Confirm we can see only one row in the trigger list by checking <caption> element
cy.contains('This table contains 2 rows');
Expand Down Expand Up @@ -446,8 +446,8 @@ describe('DocumentLevelMonitor', () => {

// TODO: Test with Notifications plugin

// Click the save button
cy.get('button').contains('Save').last().click({ force: true });
// Click the create button
cy.get('button').contains('Update').last().click({ force: true });

// Confirm we can see only one row in the trigger list by checking <caption> element
cy.contains('This table contains 1 row');
Expand Down Expand Up @@ -489,8 +489,8 @@ describe('DocumentLevelMonitor', () => {
cy.get('[data-test-subj="indicesComboBox"]').should('not.have.text', TESTING_INDEX_A);
cy.get('[data-test-subj="indicesComboBox"]').contains(TESTING_INDEX_B, { timeout: 20000 });

// Click the save button
cy.get('button').contains('Save').last().click({ force: true });
// Click the update button
cy.get('button').contains('Update').last().click({ force: true });

// Confirm we're on the Monitor Details page by searching for the History element
cy.contains('History', { timeout: 20000 });
Expand Down
12 changes: 6 additions & 6 deletions cypress/integration/query_level_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ describe('Query-Level Monitors', () => {
.clear()
.type(UPDATED_MONITOR, { force: true });

// Click save button
cy.get('button').contains('Save').last().click({ force: true });
// Click Update button
cy.get('button').contains('Update').last().click({ force: true });

// Confirm the update process is done and the page loaded
cy.contains('Edit monitor');
Expand Down Expand Up @@ -222,8 +222,8 @@ describe('Query-Level Monitors', () => {
timeout: 25000,
});

// Click the save button
cy.get('button').contains('Save').last().click();
// Click the update button
cy.get('button').contains('Update').last().click();

// Confirm we're on the Monitor Details page by searching for the History element
cy.contains('History', { timeout: 25000 });
Expand Down Expand Up @@ -339,8 +339,8 @@ describe('Query-Level Monitors', () => {
addVisualQueryLevelTrigger(trigger.name, i, true, `IS ${trigger.enum}`, `${i}`);
}

// Click save button
cy.get('button').contains('Save').last().click({ force: true });
// Click Update button
cy.get('button').contains('Update').last().click({ force: true });

// Confirm we can see the correct number of rows in the trigger list by checking <caption> element
cy.contains(`This table contains ${triggers.length} rows`, { timeout: 25000 });
Expand Down
4 changes: 2 additions & 2 deletions public/components/Breadcrumbs/Breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ export async function getBreadcrumb(route, routeState, httpClient) {
console.error(err);
}
const breadcrumbs = [{ text: monitorName, href: `/monitors/${base}` }];
if (action === MONITOR_ACTIONS.EDIT_MONITOR)
breadcrumbs.push({ text: 'Edit monitor', href: '/' });
if (action === MONITOR_ACTIONS.UPDATE_MONITOR)
breadcrumbs.push({ text: 'Update monitor', href: '/' });
if (action === TRIGGER_ACTIONS.CREATE_TRIGGER)
breadcrumbs.push({ text: 'Create trigger', href: '/' });
if (action === TRIGGER_ACTIONS.UPDATE_TRIGGER)
Expand Down
2 changes: 1 addition & 1 deletion public/components/Breadcrumbs/Breadcrumbs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('getBreadcrumb', () => {
httpClientMock.get.mockResolvedValue({ ok: true, resp: { name: 'random_name' } });
expect(
await getBreadcrumb(
`${monitorId}?action=${MONITOR_ACTIONS.EDIT_MONITOR}`,
`${monitorId}?action=${MONITOR_ACTIONS.UPDATE_MONITOR}`,
{},
httpClientMock
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Array [
},
Object {
"href": "/",
"text": "Edit monitor",
"text": "Update monitor",
},
]
`;
Expand Down
2 changes: 1 addition & 1 deletion public/components/ContentPanel/ContentPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ContentPanel = ({
children,
panelOptions = {},
}) => (
<EuiPanel style={{ padding: '16px', ...panelStyles }}>
<EuiPanel style={{ paddingLeft: '0px', paddingRight: '0px', ...panelStyles }}>
<EuiFlexGroup style={{ padding: '0px 10px' }} justifyContent="spaceBetween" alignItems="center">
<EuiFlexItem>
<EuiText size={titleSize}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`ContentPanel renders 1`] = `
<div
class="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow"
style="padding:16px"
style="padding-left:0px;padding-right:0px"
>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--justifyContentSpaceBetween euiFlexGroup--directionRow euiFlexGroup--responsive"
Expand Down
29 changes: 10 additions & 19 deletions public/components/DataSourceAlertsCard/DataSourceAlertsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { dataSourceFilterFn, getSeverityColor, getSeverityBadgeText, getTruncate
import { renderTime } from "../../pages/Dashboard/utils/tableUtils";
import { ALERTS_NAV_ID, MONITORS_NAV_ID } from "../../../utils/constants";
import { APP_PATH, DEFAULT_EMPTY_DATA } from "../../utils/constants";
import { dataSourceEnabled, getURL } from "../../pages/utils/helpers.js";

export interface DataSourceAlertsCardProps {
getDataSourceMenu?: DataSourceManagementPluginSetup['ui']['getDataSourceMenu'];
Expand All @@ -28,13 +27,13 @@ export const DataSourceAlertsCard: React.FC<DataSourceAlertsCardProps> = ({ get

useEffect(() => {
setLoading(true);
getClient().get('../api/alerting/alerts', {
getClient().get('../api/alerting/alerts', {
query: {
size: 25,
sortField: 'start_time',
...(dataSourceEnabled() && { dataSourceId: dataSource?.id || ''}),
dataSourceId: dataSource?.id || '',
sortDirection: 'desc'
}
}
}).then(res => {
if (res.ok) {
setAlerts(res.alerts);
Expand All @@ -54,22 +53,14 @@ export const DataSourceAlertsCard: React.FC<DataSourceAlertsCardProps> = ({ get
const createAlertDetailsHeader = useCallback((alert) => {
const severityColor = getSeverityColor(alert.severity);
const triggerName = alert.trigger_name ?? DEFAULT_EMPTY_DATA;
const monitorUrl = `${MONITORS_NAV_ID}#/monitors/${
alert.alert_source === 'workflow' ? alert.workflow_id : alert.monitor_id
}?&type=${alert.alert_source}`;
const url = getURL(monitorUrl, dataSource?.id);


return (
<EuiFlexGroup gutterSize="s" justifyContent="spaceBetween" alignItems="center">
<EuiFlexItem grow={false}>
<div>
<EuiBadge color={severityColor?.background} style={{ padding: '1px 4px', color: severityColor?.text }}>{getSeverityBadgeText(alert.severity)}</EuiBadge>
&nbsp;&nbsp;
<EuiLink href={url}>
<span style={{ color: '#006BB4' }} className="eui-textTruncate">
{getTruncatedText(triggerName)}
</span>
</EuiLink>
<span style={{ color: "#006BB4" }} className="eui-textTruncate">{getTruncatedText(triggerName)}</span>
</div>
</EuiFlexItem>
<EuiFlexItem grow={false} >
Expand All @@ -88,8 +79,8 @@ export const DataSourceAlertsCard: React.FC<DataSourceAlertsCardProps> = ({ get
<EuiFlexItem grow={false}>
<EuiText size="s" color="subdued">Monitor:</EuiText>
</EuiFlexItem>
<EuiFlexItem grow={false} style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>
<EuiText size="m" style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>{monitorName}</EuiText>
<EuiFlexItem grow={false} >
<EuiText size="m">{getTruncatedText(monitorName)}</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
<EuiHorizontalRule margin="xs" />
Expand All @@ -105,7 +96,7 @@ export const DataSourceAlertsCard: React.FC<DataSourceAlertsCardProps> = ({ get
});

return (
<EuiPanel hasBorder={false} hasShadow={false} style={{ overflow: 'hidden' }}>
<EuiPanel hasBorder={false} hasShadow={false}>
<EuiFlexGroup style={{ height: '100%' }} direction="column" justifyContent="spaceBetween" alignItems="flexStart" gutterSize="xs">
<EuiFlexItem grow={false} style={{ width: '100%', height: '90%' }}>
<EuiFlexGroup direction="column" style={{ height: '100%' }}>
Expand Down Expand Up @@ -156,9 +147,9 @@ export const DataSourceAlertsCard: React.FC<DataSourceAlertsCardProps> = ({ get
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiLink href={getApplication().getUrlForApp(ALERTS_NAV_ID, { path: '#/dashboard' })}><EuiText size="s" className="eui-displayInline">View all</EuiText></EuiLink>
<EuiLink href={getApplication().getUrlForApp(ALERTS_NAV_ID, { path: '#/dashboard' })} target="_blank"><EuiText size="s" className="eui-displayInline">View all</EuiText></EuiLink>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
)
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ export default class AlertsDashboardFlyoutComponent extends Component {
onPageChange={this.onPageClick}
isAlertsFlyout={true}
monitorType={monitorType}
panelStyles={{ padding: '8px 0px 16px' }}
/>
<EuiHorizontalRule margin="xs" />
<EuiBasicTable
items={loading ? [] : trimmedAlerts}
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,13 @@ exports[`AlertsDashboardFlyoutComponent renders 1`] = `
onSearchChange={[Function]}
onStateChange={[Function]}
pageCount={1}
panelStyles={
Object {
"padding": "8px 0px 16px",
}
}
search=""
severity="ALL"
state="ALL"
/>
<EuiHorizontalRule
margin="xs"
/>
<EuiBasicTable
columns={
Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`QueryPerformance renders 1`] = `
<div
class="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow"
style="padding:16px;padding-left:10px;padding-right:10px"
style="padding-left:10px;padding-right:10px"
>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--justifyContentSpaceBetween euiFlexGroup--directionRow euiFlexGroup--responsive"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`VisualGraph renders 1`] = `
<div
class="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow"
style="padding:16px;padding-left:10px"
style="padding-left:10px;padding-right:0px"
>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--justifyContentSpaceBetween euiFlexGroup--directionRow euiFlexGroup--responsive"
Expand Down Expand Up @@ -544,7 +544,7 @@ exports[`VisualGraph renders 1`] = `
exports[`VisualGraph renders with bucket level monitor 1`] = `
<div
class="euiPanel euiPanel--paddingMedium euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow"
style="padding:16px;padding-left:10px"
style="padding-left:10px;padding-right:0px"
>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--justifyContentSpaceBetween euiFlexGroup--directionRow euiFlexGroup--responsive"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export default class CreateMonitor extends Component {
} = this.props;
const { createModalOpen, initialValues, plugins } = this.state;
return (
<div style={{ padding: '16px' }}>
<div style={{ padding: '25px 50px' }}>
<Formik
initialValues={initialValues}
onSubmit={this.evaluateSubmission}
Expand Down Expand Up @@ -268,7 +268,7 @@ export default class CreateMonitor extends Component {
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiSmallButton fill onClick={handleSubmit} isLoading={isSubmitting}>
{edit ? 'Save' : 'Create'}
{edit ? 'Update' : 'Create'}
</EuiSmallButton>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`CreateMonitor renders 1`] = `
<div
style={
Object {
"padding": "16px",
"padding": "25px 50px",
}
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class DataSource extends Component {
<ContentPanel
title="Select data"
titleSize="s"
panelStyles={{ paddingLeft: '10px', paddingRight: '10px' }}
bodyStyles={{ padding: 'initial' }}
>
{monitorIndexDisplay}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ exports[`DataSource renders 1`] = `
"padding": "initial",
}
}
panelStyles={
Object {
"paddingLeft": "10px",
"paddingRight": "10px",
}
}
title="Select data"
titleSize="s"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ class DefineMonitor extends Component {
<PanelComponent
title="Query"
titleSize="s"
panelStyles={{
paddingLeft: '10px',
paddingRight: '10px',
}}
bodyStyles={{ padding: 'initial' }}
actions={monitorContent.actions}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ exports[`DefineMonitor renders 1`] = `
"padding": "initial",
}
}
panelStyles={
Object {
"paddingLeft": "10px",
"paddingRight": "10px",
}
}
title="Query"
titleSize="s"
>
Expand Down Expand Up @@ -138,6 +144,12 @@ exports[`DefineMonitor should show warning in case of Ad monitor and plugin is n
"padding": "initial",
}
}
panelStyles={
Object {
"paddingLeft": "10px",
"paddingRight": "10px",
}
}
title="Query"
titleSize="s"
>
Expand Down
Loading

0 comments on commit 195ac2c

Please sign in to comment.