Skip to content

Commit

Permalink
Do not show a link to test details for ping monitors.
Browse files Browse the repository at this point in the history
  • Loading branch information
awahab07 committed Sep 21, 2022
1 parent d16676e commit 39553a3
Showing 1 changed file with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ import { useJourneySteps } from '../hooks/use_journey_steps';
type SortableField = 'timestamp' | 'monitor.status' | 'monitor.duration.us';

export const LastTenTestRuns = () => {
const { euiTheme } = useEuiTheme();

const { basePath } = useSyntheticsSettingsContext();

const [sortField, setSortField] = useState<SortableField>('timestamp');
Expand Down Expand Up @@ -93,11 +91,7 @@ export const LastTenTestRuns = () => {
name: '@timestamp',
sortable: true,
render: (timestamp: string, ping: Ping) => (
<EuiLink href={`${basePath}/app/uptime/journey/${ping?.monitor?.check_group ?? ''}/steps`}>
<EuiText size="s" css={{ fontWeight: euiTheme.font.weight.medium }}>
{formatTestRunAt(timestamp)}
</EuiText>
</EuiLink>
<TestDetailsLink isBrowserMonitor={isBrowserMonitor} timestamp={timestamp} ping={ping} />
),
},
{
Expand Down Expand Up @@ -202,6 +196,33 @@ const JourneyScreenshot = ({ ping }: { ping: Ping }) => {
);
};

const TestDetailsLink = ({
isBrowserMonitor,
timestamp,
ping,
}: {
isBrowserMonitor: boolean;
timestamp: string;
ping: Ping;
}) => {
const { euiTheme } = useEuiTheme();
const { basePath } = useSyntheticsSettingsContext();

const timestampText = (
<EuiText size="s" css={{ fontWeight: euiTheme.font.weight.medium }}>
{formatTestRunAt(timestamp)}
</EuiText>
);

return isBrowserMonitor ? (
<EuiLink href={`${basePath}/app/uptime/journey/${ping?.monitor?.check_group ?? ''}/steps`}>
{timestampText}
</EuiLink>
) : (
timestampText
);
};

const TEST_RUNS = i18n.translate('xpack.synthetics.monitorDetails.summary.testRuns', {
defaultMessage: 'Test Runs',
});
Expand Down

0 comments on commit 39553a3

Please sign in to comment.