Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Synthetics] UI clean up #131598

Merged
merged 5 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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