Skip to content

Commit

Permalink
[Synthetics] Hide location and enabled toggle on `MonitorDetailsPanel…
Browse files Browse the repository at this point in the history
…` for test run details (#152373)

Co-authored-by: Shahzad <[email protected]>
  • Loading branch information
justinkambic and shahzad31 authored Mar 1, 2023
1 parent f6a0b88 commit f23346e
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 19 deletions.
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

0 comments on commit f23346e

Please sign in to comment.