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

[Uptime] Synthetic check steps list view #90978

Merged
merged 46 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8ba5f53
wip
shahzad31 Feb 9, 2021
8d30c5f
Merge branch 'master' into synthetics-checks-view
shahzad31 Feb 9, 2021
6b31192
Addew check steps list view
shahzad31 Feb 10, 2021
8797f45
Addew check steps list view
shahzad31 Feb 10, 2021
e548040
fix i18n
shahzad31 Feb 10, 2021
7d92edb
wip
shahzad31 Feb 11, 2021
db784ac
Merge branch 'master' into synthetics-checks-view
shahzad31 Feb 11, 2021
cd4b69d
Added last successful check image
shahzad31 Feb 11, 2021
4efe69a
collapse accordion on success step
shahzad31 Feb 11, 2021
8707075
update breadcrumb test
shahzad31 Feb 11, 2021
135fbd2
update last successful step timestamp
shahzad31 Feb 11, 2021
2cc8591
remove unused popover code
shahzad31 Feb 11, 2021
3b0571e
Merge branch 'master' into synthetics-checks-view
shahzad31 Feb 11, 2021
639d679
fix epand row
shahzad31 Feb 13, 2021
8796429
fix epand row
shahzad31 Feb 13, 2021
c4928bc
added tests
shahzad31 Feb 13, 2021
cfa19c1
Merge branch 'master' into synthetics-checks-view
shahzad31 Feb 15, 2021
28ff3a3
update loading view
shahzad31 Feb 15, 2021
a720eea
fix types
shahzad31 Feb 15, 2021
82cb947
update tests
shahzad31 Feb 15, 2021
4661313
i18fix
shahzad31 Feb 15, 2021
287d887
Merge branch 'master' into synthetics-checks-view
shahzad31 Feb 15, 2021
7a89640
fix ping list
shahzad31 Feb 15, 2021
a565566
added loading state
shahzad31 Feb 15, 2021
c42d1f1
Merge branch 'master' into synthetics-checks-view
shahzad31 Feb 15, 2021
342002b
fixed icon in console logs
shahzad31 Feb 15, 2021
65ea39c
update link
shahzad31 Feb 16, 2021
5482ec1
Merge branch 'master' into synthetics-checks-view
shahzad31 Feb 17, 2021
fb94f15
fixed showing first step image in all rows
shahzad31 Feb 17, 2021
8ad9959
always show relevant step in thumbnail
shahzad31 Feb 17, 2021
48623d0
fix test
shahzad31 Feb 17, 2021
8116b82
fix i18n
shahzad31 Feb 18, 2021
8ebf29b
Merge branch 'master' into synthetics-checks-view
shahzad31 Feb 18, 2021
e33c118
added row height
shahzad31 Feb 18, 2021
59f9d6f
Merge branch 'master' into synthetics-checks-view
shahzad31 Feb 19, 2021
5659d5f
removed fixed width
shahzad31 Feb 19, 2021
de2f3cf
update link text
shahzad31 Feb 19, 2021
5536311
Merge branch 'master' into synthetics-checks-view
kibanamachine Feb 22, 2021
e16344f
Merge branch 'master' into synthetics-checks-view
shahzad31 Mar 5, 2021
c10df6a
Merge branch 'synthetics-checks-view' of https://github.com/shahzad31…
shahzad31 Mar 5, 2021
1655bee
Merge branch 'master' into synthetics-checks-view
shahzad31 Mar 10, 2021
1debf85
resolve conflicts
shahzad31 Mar 10, 2021
d1b4167
fix breadcrumb and last successfull step screenshot
shahzad31 Mar 11, 2021
2277e40
Merge branch 'master' into synthetics-checks-view
shahzad31 Mar 11, 2021
cc7f99b
Merge branch 'master' into synthetics-checks-view
kibanamachine Mar 15, 2021
3670f0a
Merge branch 'master' into synthetics-checks-view
kibanamachine Mar 15, 2021
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
4 changes: 0 additions & 4 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -22120,12 +22120,8 @@
"xpack.uptime.synthetics.emptyJourney.message.footer": "表示する詳細情報はありません。",
"xpack.uptime.synthetics.emptyJourney.message.heading": "ステップが含まれていませんでした。",
"xpack.uptime.synthetics.emptyJourney.title": "ステップがありません。",
"xpack.uptime.synthetics.executedJourney.heading": "概要情報",
"xpack.uptime.synthetics.executedStep.errorHeading": "エラー",
"xpack.uptime.synthetics.executedStep.scriptHeading": "スクリプトのステップ",
"xpack.uptime.synthetics.executedStep.stackTrace": "スタックトレース",
"xpack.uptime.synthetics.executedStep.stepName": "{stepNumber}. {stepName}",
"xpack.uptime.synthetics.experimentalCallout.title": "実験的機能",
"xpack.uptime.synthetics.journey.allFailedMessage": "{total}ステップ - すべて失敗またはスキップされました",
"xpack.uptime.synthetics.journey.allSucceededMessage": "{total}ステップ - すべて成功しました",
"xpack.uptime.synthetics.journey.partialSuccessMessage": "{total}ステップ - {succeeded}成功しました",
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -22170,12 +22170,8 @@
"xpack.uptime.synthetics.emptyJourney.message.footer": "没有更多可显示的信息。",
"xpack.uptime.synthetics.emptyJourney.message.heading": "此过程不包含任何步骤。",
"xpack.uptime.synthetics.emptyJourney.title": "没有此过程的任何步骤",
"xpack.uptime.synthetics.executedJourney.heading": "摘要信息",
"xpack.uptime.synthetics.executedStep.errorHeading": "错误",
"xpack.uptime.synthetics.executedStep.scriptHeading": "步骤脚本",
"xpack.uptime.synthetics.executedStep.stackTrace": "堆栈跟踪",
"xpack.uptime.synthetics.executedStep.stepName": "{stepNumber}:{stepName}",
"xpack.uptime.synthetics.experimentalCallout.title": "实验功能",
"xpack.uptime.synthetics.journey.allFailedMessage": "{total} 个步骤 - 全部失败或跳过",
"xpack.uptime.synthetics.journey.allSucceededMessage": "{total} 个步骤 - 全部成功",
"xpack.uptime.synthetics.journey.partialSuccessMessage": "{total} 个步骤 - {succeeded} 个成功",
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/uptime/common/constants/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export const CERTIFICATES_ROUTE = '/certificates';

export const STEP_DETAIL_ROUTE = '/journey/:checkGroupId/step/:stepIndex';

export const SYNTHETIC_CHECK_STEPS_ROUTE = '/journey/:checkGroupId/steps';

export enum STATUS {
UP = 'up',
DOWN = 'down',
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/uptime/common/runtime_types/ping/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export const PingType = t.intersection([
type: t.string,
url: t.string,
end: t.number,
text: t.string,
}),
}),
tags: t.array(t.string),
Expand Down Expand Up @@ -251,6 +252,7 @@ export const SyntheticsJourneyApiResponseType = t.intersection([
t.intersection([
t.type({
timestamp: t.string,
journey: PingType,
}),
t.partial({
next: t.type({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import React, { FC } from 'react';
import { ReactRouterEuiButton } from './react_router_helpers';
import { ReactRouterEuiButtonEmpty } from './react_router_helpers';

interface StepDetailLinkProps {
/**
Expand All @@ -23,14 +23,8 @@ export const StepDetailLink: FC<StepDetailLinkProps> = ({ children, checkGroupId
const to = `/journey/${checkGroupId}/step/${stepIndex}`;

return (
<ReactRouterEuiButton
data-test-subj={`step-detail-link`}
to={to}
size="s"
fill
fullWidth={false}
>
<ReactRouterEuiButtonEmpty data-test-subj={`step-detail-link`} to={to}>
{children}
</ReactRouterEuiButton>
</ReactRouterEuiButtonEmpty>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { EuiButtonIcon, EuiFlexItem, EuiFlexGroup } from '@elastic/eui';
import React from 'react';
import React, { MouseEvent } from 'react';
import { nextAriaLabel, prevAriaLabel } from './translations';

export interface NavButtonsProps {
Expand Down Expand Up @@ -34,8 +34,9 @@ export const NavButtons: React.FC<NavButtonsProps> = ({
disabled={stepNumber === 1}
color="subdued"
size="s"
onClick={() => {
onClick={(evt: MouseEvent<HTMLButtonElement>) => {
setStepNumber(stepNumber - 1);
evt.stopPropagation();
}}
iconType="arrowLeft"
aria-label={prevAriaLabel}
Expand All @@ -46,8 +47,9 @@ export const NavButtons: React.FC<NavButtonsProps> = ({
disabled={stepNumber === maxSteps}
color="subdued"
size="s"
onClick={() => {
onClick={(evt: MouseEvent<HTMLButtonElement>) => {
setStepNumber(stepNumber + 1);
evt.stopPropagation();
}}
iconType="arrowRight"
aria-label={nextAriaLabel}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { mockReduxHooks } from '../../../../../lib/helper/test_helpers';
import { render } from '../../../../../lib/helper/rtl_helpers';
import { Ping } from '../../../../../../common/runtime_types/ping';
import * as observabilityPublic from '../../../../../../../observability/public';
import { getShortTimeStamp } from '../../../../overview/monitor_list/columns/monitor_status_column';
import moment from 'moment';

mockReduxHooks();

Expand Down Expand Up @@ -68,7 +70,7 @@ describe('Ping Timestamp component', () => {
.spyOn(observabilityPublic, 'useFetcher')
.mockReturnValue({ status: fetchStatus, data: null, refetch: () => null });
const { getByTestId } = render(
<PingTimestamp ping={response} timestamp={response.timestamp} />
<PingTimestamp ping={response} label={getShortTimeStamp(moment(response.timestamp))} />
);
expect(getByTestId('pingTimestampSpinner')).toBeInTheDocument();
}
Expand All @@ -79,7 +81,7 @@ describe('Ping Timestamp component', () => {
.spyOn(observabilityPublic, 'useFetcher')
.mockReturnValue({ status: FETCH_STATUS.SUCCESS, data: null, refetch: () => null });
const { getByTestId } = render(
<PingTimestamp ping={response} timestamp={response.timestamp} />
<PingTimestamp ping={response} label={getShortTimeStamp(moment(response.timestamp))} />
);
expect(getByTestId('pingTimestampNoImageAvailable')).toBeInTheDocument();
});
Expand All @@ -91,7 +93,9 @@ describe('Ping Timestamp component', () => {
data: { src },
refetch: () => null,
});
const { container } = render(<PingTimestamp ping={response} timestamp={response.timestamp} />);
const { container } = render(
<PingTimestamp ping={response} label={getShortTimeStamp(moment(response.timestamp))} />
);
expect(container.querySelector('img')?.src).toBe(src);
});

Expand All @@ -103,7 +107,7 @@ describe('Ping Timestamp component', () => {
refetch: () => null,
});
const { getByAltText, getByText, queryByAltText } = render(
<PingTimestamp ping={response} timestamp={response.timestamp} />
<PingTimestamp ping={response} label={getShortTimeStamp(moment(response.timestamp))} />
);
const caption = getByText('Nov 26, 2020 10:28:56 AM');
fireEvent.mouseEnter(caption);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ const StepDiv = styled.div`
`;

interface Props {
timestamp: string;
label?: string;
ping: Ping;
showNavBtn?: boolean;
}

export const PingTimestamp = ({ timestamp, ping }: Props) => {
export const PingTimestamp = ({ label, ping, showNavBtn = true }: Props) => {
const [stepNumber, setStepNumber] = useState(1);
const [isImagePopoverOpen, setIsImagePopoverOpen] = useState(false);

Expand Down Expand Up @@ -86,7 +87,7 @@ export const PingTimestamp = ({ timestamp, ping }: Props) => {
maxSteps={data?.maxSteps}
setStepNumber={setStepNumber}
stepNumber={stepNumber}
timestamp={timestamp}
label={label}
/>
);

Expand All @@ -110,12 +111,14 @@ export const PingTimestamp = ({ timestamp, ping }: Props) => {
isPending={status === FETCH_STATUS.PENDING}
/>
)}
<NavButtons
maxSteps={data?.maxSteps}
setIsImagePopoverOpen={setIsImagePopoverOpen}
setStepNumber={setStepNumber}
stepNumber={stepNumber}
/>
{showNavBtn && (
shahzad31 marked this conversation as resolved.
Show resolved Hide resolved
<NavButtons
maxSteps={data?.maxSteps}
setIsImagePopoverOpen={setIsImagePopoverOpen}
setStepNumber={setStepNumber}
stepNumber={stepNumber}
/>
)}
</StepDiv>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { fireEvent, waitFor } from '@testing-library/react';
import React from 'react';
import { render } from '../../../../../lib/helper/rtl_helpers';
import { StepImageCaption, StepImageCaptionProps } from './step_image_caption';
import { getShortTimeStamp } from '../../../../overview/monitor_list/columns/monitor_status_column';
import moment from 'moment';

describe('StepImageCaption', () => {
let defaultProps: StepImageCaptionProps;
Expand All @@ -20,7 +22,7 @@ describe('StepImageCaption', () => {
maxSteps: 3,
setStepNumber: jest.fn(),
stepNumber: 2,
timestamp: '2020-11-26T15:28:56.896Z',
label: getShortTimeStamp(moment('2020-11-26T15:28:56.896Z')),
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
*/

import { EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText } from '@elastic/eui';
import React from 'react';
import moment from 'moment';
import React, { MouseEvent } from 'react';
import { nextAriaLabel, prevAriaLabel } from './translations';
import { getShortTimeStamp } from '../../../../overview/monitor_list/columns/monitor_status_column';

export interface StepImageCaptionProps {
captionContent: string;
imgSrc?: string;
maxSteps?: number;
setStepNumber: React.Dispatch<React.SetStateAction<number>>;
stepNumber: number;
timestamp: string;
label?: string;
}

export const StepImageCaption: React.FC<StepImageCaptionProps> = ({
Expand All @@ -26,7 +24,7 @@ export const StepImageCaption: React.FC<StepImageCaptionProps> = ({
maxSteps,
setStepNumber,
stepNumber,
timestamp,
label,
}) => {
return (
<>
Expand All @@ -37,8 +35,9 @@ export const StepImageCaption: React.FC<StepImageCaptionProps> = ({
<EuiButtonIcon
disabled={stepNumber === 1}
size="m"
onClick={() => {
onClick={(evt: MouseEvent<HTMLButtonElement>) => {
setStepNumber(stepNumber - 1);
evt.preventDefault();
}}
iconType="arrowLeft"
aria-label={prevAriaLabel}
Expand All @@ -51,8 +50,9 @@ export const StepImageCaption: React.FC<StepImageCaptionProps> = ({
<EuiButtonIcon
disabled={stepNumber === maxSteps}
size="m"
onClick={() => {
onClick={(evt: MouseEvent<HTMLButtonElement>) => {
setStepNumber(stepNumber + 1);
evt.stopPropagation();
}}
iconType="arrowRight"
aria-label={nextAriaLabel}
Expand All @@ -61,8 +61,7 @@ export const StepImageCaption: React.FC<StepImageCaptionProps> = ({
</EuiFlexGroup>
)}
</div>
{/* TODO: Add link to details page once it's available */}
<span className="eui-textNoWrap">{getShortTimeStamp(moment(timestamp))}</span>
{label && <span className="eui-textNoWrap">{label}</span>}
<EuiSpacer size="s" />
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const StepImagePopover: React.FC<StepImagePopoverProps> = ({
/>
}
isOpen={isImagePopoverOpen}
closePopover={() => {}}
shahzad31 marked this conversation as resolved.
Show resolved Hide resolved
>
<EuiImage
alt={fullSizeImageAlt}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,35 @@ describe('PingListExpandedRow', () => {
>
<EuiFlexItem>
<EuiCallOut
iconType="beaker"
title="Experimental feature"
/>
</EuiFlexItem>
<EuiFlexItem>
<BrowserExpandedRow
checkGroup="check_group_id"
/>
color="primary"
>
<EuiDescriptionList
listItems={
Array [
Object {
"description": <React.Fragment>
<BodyDescription
body={
Object {
"bytes": 1200000,
"content": "<http><head><title>The Title</title></head><body></body></http>",
"hash": "testhash",
}
}
/>
<EuiSpacer
size="s"
/>
<BodyExcerpt
content="<http><head><title>The Title</title></head><body></body></http>"
/>
</React.Fragment>,
"title": "Response Body",
},
]
}
/>
</EuiCallOut>
</EuiFlexItem>
</EuiFlexGroup>
`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { i18n } from '@kbn/i18n';
import { Ping, HttpResponseBody } from '../../../../common/runtime_types';
import { DocLinkForBody } from './doc_link_body';
import { PingRedirects } from './ping_redirects';
import { BrowserExpandedRow } from '../synthetics/browser_expanded_row';
import { PingHeaders } from './headers';

interface Props {
Expand Down Expand Up @@ -57,24 +56,6 @@ const BodyExcerpt = ({ content }: { content: string }) =>
export const PingListExpandedRowComponent = ({ ping }: Props) => {
const listItems = [];

if (ping.monitor.type === 'browser') {
return (
<EuiFlexGroup direction="column">
<EuiFlexItem>
<EuiCallOut
iconType="beaker"
title={i18n.translate('xpack.uptime.synthetics.experimentalCallout.title', {
defaultMessage: 'Experimental feature',
})}
/>
</EuiFlexItem>
<EuiFlexItem>
<BrowserExpandedRow checkGroup={ping.monitor.check_group} />
</EuiFlexItem>
</EuiFlexGroup>
);
}

// Show the error block
if (ping.error) {
listItems.push({
Expand Down
Loading