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] Hide location and enabled toggle on MonitorDetailsPanel for test run details #152373

Merged
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 @@ -40,27 +40,38 @@ const DescriptionLabel = euiStyled(EuiDescriptionListDescription)`
width: 60%;
`;

export interface MonitorDetailsPanelProps {
latestPing?: Ping;
loading: boolean;
configId: string;
monitor: EncryptedSyntheticsSavedMonitor | null;
hideEnabled?: boolean;
hideLocations?: boolean;
hasBorder?: boolean;
}

export const MonitorDetailsPanel = ({
monitor,
latestPing,
loading,
configId,
hideEnabled = false,
}: {
latestPing?: Ping;
loading: boolean;
configId: string;
monitor: EncryptedSyntheticsSavedMonitor | null;
hideEnabled?: boolean;
}) => {
hideLocations = false,
hasBorder = true,
}: MonitorDetailsPanelProps) => {
const dispatch = useDispatch();

if (!monitor) {
return <EuiLoadingContent lines={8} />;
}

return (
<PanelWithTitle paddingSize="m" title={MONITOR_DETAILS_LABEL} titleLeftAlign>
<PanelWithTitle
paddingSize="m"
title={MONITOR_DETAILS_LABEL}
titleLeftAlign
hasBorder={hasBorder}
>
<WrapperStyle>
<EuiSpacer size="s" />
<EuiDescriptionList type="column" compressed align="left">
Expand Down Expand Up @@ -116,10 +127,15 @@ export const MonitorDetailsPanel = ({
</DescriptionLabel>
<TitleLabel>{FREQUENCY_LABEL}</TitleLabel>
<DescriptionLabel>{frequencyStr(monitor[ConfigKey.SCHEDULE])}</DescriptionLabel>
<TitleLabel>{LOCATIONS_LABEL}</TitleLabel>
<DescriptionLabel>
<LocationsStatus configId={configId} monitorLocations={monitor.locations} />
</DescriptionLabel>

{!hideLocations && (
<>
<TitleLabel>{LOCATIONS_LABEL}</TitleLabel>
<DescriptionLabel>
<LocationsStatus configId={configId} monitorLocations={monitor.locations} />
</DescriptionLabel>
</>
)}

<TitleLabel>{TAGS_LABEL}</TitleLabel>
<DescriptionLabel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { FailedTestsList } from './components/failed_tests_list';
import { ErrorTimeline } from './components/error_timeline';
import { useErrorDetailsBreadcrumbs } from './hooks/use_error_details_breadcrumbs';
import { StepImage } from '../step_details_page/step_screenshot/step_image';
import { MonitorDetailsPanelContainer } from '../monitor_details/monitor_summary/monitor_details_panel';
import { MonitorDetailsPanelContainer } from '../monitor_details/monitor_summary/monitor_details_panel_container';

export function ErrorDetailsPage() {
const { failedTests, loading } = useErrorFailedTests();
Expand Down Expand Up @@ -80,7 +80,7 @@ export function ErrorDetailsPage() {
<EuiSpacer size="m" />
<StepDurationPanel doBreakdown={false} />
<EuiSpacer size="m" />
<MonitorDetailsPanelContainer />
<MonitorDetailsPanelContainer hideLocations />
</EuiFlexItem>
</EuiFlexGroup>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import React from 'react';
import { EuiLoadingContent } from '@elastic/eui';
import { useParams } from 'react-router-dom';
import { euiStyled } from '@kbn/kibana-react-plugin/common';
import { MonitorDetailsPanel } from '../../common/components/monitor_details_panel';
import {
MonitorDetailsPanelProps,
MonitorDetailsPanel,
} from '../../common/components/monitor_details_panel';
import { useSelectedMonitor } from '../hooks/use_selected_monitor';
import { ConfigKey } from '../../../../../../common/runtime_types';
import { useMonitorLatestPing } from '../hooks/use_monitor_latest_ping';

export const MonitorDetailsPanelContainer = () => {
export const MonitorDetailsPanelContainer = (props: Partial<MonitorDetailsPanelProps>) => {
const { latestPing } = useMonitorLatestPing();

const { monitorId: configId } = useParams<{ monitorId: string }>();
Expand All @@ -34,6 +37,7 @@ export const MonitorDetailsPanelContainer = () => {
monitor={monitor}
loading={loading}
configId={configId}
{...props}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { MonitorDurationTrend } from './duration_trend';
import { StepDurationPanel } from './step_duration_panel';
import { AvailabilityPanel } from './availability_panel';
import { DurationPanel } from './duration_panel';
import { MonitorDetailsPanelContainer } from './monitor_details_panel';
import { MonitorDetailsPanelContainer } from './monitor_details_panel_container';
import { AvailabilitySparklines } from './availability_sparklines';
import { LastTestRun } from './last_test_run';
import { LAST_10_TEST_RUNS, TestRunsTable } from './test_runs_table';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export function MonitorDetailFlyout(props: Props) {
<EuiFlyoutBody>
<DetailFlyoutDurationChart {...props} location={props.location} />
<MonitorDetailsPanel
hasBorder={false}
hideEnabled
latestPing={monitorDetail.data}
configId={configId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import moment from 'moment';
import { FormattedMessage } from '@kbn/i18n-react';
import { useParams } from 'react-router-dom';
import { TestRunErrorInfo } from './components/test_run_error_info';
import { MonitorDetailsPanelContainer } from '../monitor_details/monitor_summary/monitor_details_panel';
import { MonitorDetailsPanelContainer } from '../monitor_details/monitor_summary/monitor_details_panel_container';
import { useSelectedLocation } from '../monitor_details/hooks/use_selected_location';
import { MonitorDetailsLinkPortal } from '../monitor_add_edit/monitor_details_portal';
import { StepNumberNav } from './components/step_number_nav';
Expand Down Expand Up @@ -89,7 +89,7 @@ export const TestRunDetails = () => {
<EuiFlexItem grow={1}>
<StepDurationPanel legendPosition="bottom" />
<EuiSpacer size="m" />
<MonitorDetailsPanelContainer />
<MonitorDetailsPanelContainer hideEnabled hideLocations />
</EuiFlexItem>
</EuiFlexGroup>
)}
Expand Down