diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx index 20fab4238952b..2a1989cafa434 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.test.tsx @@ -102,17 +102,17 @@ describe('Ping Timestamp component', () => { data: { src }, refetch: () => null, }); - const { getByAltText, getByText, queryByAltText } = render( + const { getByAltText, getAllByText, queryByAltText } = render( ); - const caption = getByText('Nov 26, 2020 10:28:56 AM'); - fireEvent.mouseEnter(caption); + const caption = getAllByText('Nov 26, 2020 10:28:56 AM'); + fireEvent.mouseEnter(caption[0]); const altText = `A larger version of the screenshot for this journey step's thumbnail.`; await waitFor(() => getByAltText(altText)); - fireEvent.mouseLeave(caption); + fireEvent.mouseLeave(caption[0]); await waitFor(() => expect(queryByAltText(altText)).toBeNull()); }); diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx index 60c01765c68b8..71c22b4406867 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/ping_timestamp.tsx @@ -8,6 +8,8 @@ import React, { useContext, useEffect, useState } from 'react'; import useIntersection from 'react-use/lib/useIntersection'; import styled from 'styled-components'; +import moment from 'moment'; +import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { Ping } from '../../../../../../common/runtime_types/ping'; import { useFetcher, FETCH_STATUS } from '../../../../../../../observability/public'; import { getJourneyScreenshot } from '../../../../../state/api/journey'; @@ -17,6 +19,7 @@ import { NoImageDisplay } from './no_image_display'; import { StepImageCaption } from './step_image_caption'; import { StepImagePopover } from './step_image_popover'; import { formatCaptionContent } from './translations'; +import { getShortTimeStamp } from '../../../../overview/monitor_list/columns/monitor_status_column'; const StepDiv = styled.div` figure.euiImage { @@ -25,11 +28,6 @@ const StepDiv = styled.div` } } - figure.euiImage-isFullScreen { - div.stepArrowsFullScreen { - display: flex; - } - } position: relative; div.stepArrows { display: none; @@ -91,31 +89,38 @@ export const PingTimestamp = ({ timestamp, ping }: Props) => { ); return ( - setIsImagePopoverOpen(true)} - onMouseLeave={() => setIsImagePopoverOpen(false)} - ref={intersectionRef} - > - {imgSrc ? ( - - ) : ( - - )} - - + + + setIsImagePopoverOpen(true)} + onMouseLeave={() => setIsImagePopoverOpen(false)} + ref={intersectionRef} + > + {imgSrc ? ( + + ) : ( + + )} + + + + + {getShortTimeStamp(moment(timestamp))} + + ); }; diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx index c9f4efa53fc07..018ef85062ecc 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_caption.tsx @@ -5,11 +5,12 @@ * 2.0. */ -import { EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText } from '@elastic/eui'; +import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; import React from 'react'; import moment from 'moment'; import { nextAriaLabel, prevAriaLabel } from './translations'; import { getShortTimeStamp } from '../../../../overview/monitor_list/columns/monitor_status_column'; +import { euiStyled } from '../../../../../../../../../src/plugins/kibana_react/common'; export interface StepImageCaptionProps { captionContent: string; @@ -20,6 +21,13 @@ export interface StepImageCaptionProps { timestamp: string; } +const ImageCaption = euiStyled.div` + background-color: ${(props) => props.theme.eui.euiColorLightestShade}; + display: inline-block; + width: 100%; + text-decoration: none; +`; + export const StepImageCaption: React.FC = ({ captionContent, imgSrc, @@ -29,41 +37,42 @@ export const StepImageCaption: React.FC = ({ timestamp, }) => { return ( - <> +
{imgSrc && ( - + - { setStepNumber(stepNumber - 1); }} iconType="arrowLeft" aria-label={prevAriaLabel} - /> + > + {prevAriaLabel} + {captionContent} - { setStepNumber(stepNumber + 1); }} iconType="arrowRight" + iconSide="right" aria-label={nextAriaLabel} - /> + > + {nextAriaLabel} + )} + {getShortTimeStamp(moment(timestamp))}
- {/* TODO: Add link to details page once it's available */} - {getShortTimeStamp(moment(timestamp))} - - +
); }; diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx b/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx index 1e6c97cd131a4..4fc8db515a5d6 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/step_image_popover.tsx @@ -16,12 +16,11 @@ const POPOVER_IMG_WIDTH = 640; const StepImage = styled(EuiImage)` &&& { display: flex; - figcaption { - white-space: nowrap; - align-self: center; - margin-left: 8px; - margin-top: 8px; - text-decoration: none !important; + figure.euiImage-isFullScreen { + display: flex; + div.stepArrowsFullScreen { + display: flex; + } } } `; @@ -39,7 +38,7 @@ export const StepImagePopover: React.FC = ({ isImagePopoverOpen, }) => ( = ({ hasShadow url={imgSrc} size="s" + className="syntheticsStepImage" /> } isOpen={isImagePopoverOpen} diff --git a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/translations.ts b/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/translations.ts index 4ff1416bacc79..f781610745ced 100644 --- a/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/translations.ts +++ b/x-pack/plugins/uptime/public/components/monitor/ping_list/columns/ping_timestamp/translations.ts @@ -26,11 +26,11 @@ export const fullSizeImageAlt = i18n.translate('xpack.uptime.synthetics.thumbnai defaultMessage: `A larger version of the screenshot for this journey step's thumbnail.`, }); -export const formatCaptionContent = (stepNumber: number, stepName?: number) => +export const formatCaptionContent = (stepNumber: number, totalSteps?: number) => i18n.translate('xpack.uptime.synthetics.pingTimestamp.captionContent', { - defaultMessage: 'Step: {stepNumber} {stepName}', + defaultMessage: 'Step: {stepNumber} of {totalSteps}', values: { stepNumber, - stepName, + totalSteps, }, });