Skip to content

Commit

Permalink
[Synthetics] UI clean up (elastic#131598)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 authored and kertal committed May 24, 2022
1 parent 34cd80d commit 4f41469
Show file tree
Hide file tree
Showing 30 changed files with 16 additions and 854 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,10 @@
*/

import React from 'react';
import { fireEvent, waitFor } from '@testing-library/react';
import { render } from '../../../utils/testing/rtl_helpers';
import { ActionMenuContent } from './action_menu_content';

describe('ActionMenuContent', () => {
it('renders alerts dropdown', async () => {
const { getByLabelText, getByText } = render(<ActionMenuContent />);

const alertsDropdown = getByLabelText('Open alerts and rules context menu');
fireEvent.click(alertsDropdown);

await waitFor(() => {
expect(getByText('Create rule'));
expect(getByText('Manage rules'));
});
});

it('renders settings link', () => {
const { getByRole, getByText } = render(<ActionMenuContent />);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ import { createExploratoryViewUrl } from '@kbn/observability-plugin/public';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { useSyntheticsSettingsContext } from '../../../contexts';
import { useGetUrlParams } from '../../../hooks';
import { ToggleAlertFlyoutButton } from '../../overview/alerts/alerts_containers/toggle_alert_flyout_button';
import { MONITOR_ROUTE, SETTINGS_ROUTE } from '../../../../../../common/constants';
import { stringifyUrlParams } from '../../../utils/url_params';
import { InspectorHeaderLink } from './inspector_header_link';
// import { monitorStatusSelector } from '../../../state/selectors';
// import { ManageMonitorsBtn } from './manage_monitors_btn';

const ADD_DATA_LABEL = i18n.translate('xpack.synthetics.addDataButtonLabel', {
defaultMessage: 'Add data',
Expand Down Expand Up @@ -93,8 +90,6 @@ export function ActionMenuContent(): React.ReactElement {
/>
</EuiHeaderLink>

<ToggleAlertFlyoutButton />

<EuiToolTip position="top" content={<p>{ANALYZE_MESSAGE}</p>}>
<EuiHeaderLink
aria-label={i18n.translate('xpack.synthetics.page_header.analyzeData.label', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import 'jest-styled-components';
import { render } from '../../../utils/testing/rtl_helpers';
import { SyntheticsPageTemplateComponent } from './synthetics_page_template';
import { OVERVIEW_ROUTE } from '../../../../../../common/constants';
import { useBreakpoints } from '../../../hooks/use_breakpoints';
import { useBreakpoints } from '../../../../../hooks/use_breakpoints';

jest.mock('../../../hooks/use_breakpoints', () => {
jest.mock('../../../../../hooks/use_breakpoints', () => {
const down = jest.fn().mockReturnValue(false);
return {
useBreakpoints: () => ({ down }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import styled from 'styled-components';
import { EuiPageHeaderProps, EuiPageTemplateProps } from '@elastic/eui';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { useInspectorContext } from '@kbn/observability-plugin/public';
import { CERTIFICATES_ROUTE, OVERVIEW_ROUTE } from '../../../../../../common/constants';
import { ClientPluginsStart } from '../../../../../plugin';
import { useNoDataConfig } from '../../../hooks/use_no_data_config';
import { EmptyStateLoading } from '../../overview/empty_state/empty_state_loading';
Expand Down Expand Up @@ -65,17 +64,15 @@ export const SyntheticsPageTemplateComponent: React.FC<Props & EuiPageTemplatePr
return <EmptyStateError errors={[error]} />;
}

const isMainRoute = path === OVERVIEW_ROUTE || path === CERTIFICATES_ROUTE;

const showLoading = loading && isMainRoute && !data;
const showLoading = loading && !data;

return (
<>
<StyledPageTemplateComponent
isMobile={isMobile}
pageHeader={pageHeader}
data-test-subj={noDataConfig ? 'data-missing' : undefined}
noDataConfig={isMainRoute && !loading ? noDataConfig : undefined}
noDataConfig={!loading ? noDataConfig : undefined}
{...pageTemplateProps}
>
{showLoading && <EmptyStateLoading />}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 4f41469

Please sign in to comment.