-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Synthetics] Step details page screenshot #143452
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
Merged
shahzad31
merged 22 commits into
elastic:main
from
shahzad31:step-detail-page-screenshot
Nov 1, 2022
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
92a62b3
added screenshot
shahzad31 27c69b1
Merge branch 'main' of github.com:elastic/kibana into step-detail-pag…
shahzad31 70e2710
fix type
shahzad31 7170388
test fix
shahzad31 b9bf384
update
shahzad31 f6d8f90
data
shahzad31 a9644a6
Merge branch 'main' of github.com:elastic/kibana into step-detail-pag…
shahzad31 8da9545
tr test
shahzad31 580d0d9
Merge branch 'main' of github.com:elastic/kibana into step-detail-pag…
shahzad31 ef442f2
Merge branch 'main' into step-detail-page-screenshot
shahzad31 3a14d34
Merge branch 'main' of github.com:elastic/kibana into step-detail-pag…
shahzad31 06f800c
fix default mode
shahzad31 afbcd02
PR feedback fix
shahzad31 b6150b9
Merge branch 'main' of github.com:elastic/kibana into step-detail-pag…
shahzad31 80e909a
test
shahzad31 5ebc15c
update test
shahzad31 25b40b0
Merge branch 'update-test' into step-detail-page-screenshot
shahzad31 edbdd7e
Merge branch 'main' into step-detail-page-screenshot
shahzad31 afd946d
Merge branch 'main' of github.com:elastic/kibana into step-detail-pag…
shahzad31 d393733
fix pr feedback
shahzad31 3ad9e87
Merge branch 'main' of github.com:elastic/kibana into step-detail-pag…
shahzad31 bf52e21
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
...ck/plugins/synthetics/public/apps/synthetics/components/common/screenshot/empty_image.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { css } from '@emotion/react'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { | ||
| useEuiTheme, | ||
| useEuiBackgroundColor, | ||
| EuiIcon, | ||
| EuiLoadingContent, | ||
| EuiText, | ||
| } from '@elastic/eui'; | ||
|
|
||
| export const IMAGE_WIDTH = 360; | ||
| export const IMAGE_HEIGHT = 203; | ||
|
|
||
| export const imageStyle = css` | ||
| padding: 0; | ||
| margin: auto; | ||
| width: ${IMAGE_WIDTH}px; | ||
| height: ${IMAGE_HEIGHT}px; | ||
| object-fit: contain; | ||
| overflow: hidden; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| `; | ||
|
|
||
| export const EmptyImage = ({ | ||
| isLoading = false, | ||
| width = IMAGE_WIDTH, | ||
| height = IMAGE_HEIGHT, | ||
| }: { | ||
| isLoading: boolean; | ||
| width?: number; | ||
| height?: number; | ||
| }) => { | ||
| const { euiTheme } = useEuiTheme(); | ||
|
|
||
| return ( | ||
| <div | ||
| data-test-subj="stepScreenshotPlaceholder" | ||
| role="img" | ||
| aria-label={isLoading ? SCREENSHOT_LOADING_ARIA_LABEL : SCREENSHOT_NOT_AVAILABLE} | ||
| title={isLoading ? SCREENSHOT_LOADING_ARIA_LABEL : SCREENSHOT_NOT_AVAILABLE} | ||
| css={css` | ||
| ${imageStyle}; | ||
| width: ${width}px; | ||
| height: ${height}px; | ||
| background: ${useEuiBackgroundColor('subdued')}; | ||
| border: ${euiTheme.border.thin}; | ||
| `} | ||
| > | ||
| {isLoading ? ( | ||
| <EuiLoadingContent | ||
| lines={1} | ||
| data-test-subj="stepScreenshotPlaceholderLoading" | ||
| css={css` | ||
| width: 100%; | ||
| height: 8%; | ||
| transform: scale(1, 13); // To create a skeleton loading effect | ||
| `} | ||
| /> | ||
| ) : ( | ||
| <div> | ||
| <EuiIcon | ||
| data-test-subj="stepScreenshotNotAvailable" | ||
| type="eyeClosed" | ||
| color={euiTheme.colors.disabledText} | ||
| /> | ||
| <EuiText color={euiTheme.colors.disabledText}>{IMAGE_UN_AVAILABLE}</EuiText> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export const SCREENSHOT_LOADING_ARIA_LABEL = i18n.translate( | ||
| 'xpack.synthetics.monitor.step.screenshot.ariaLabel', | ||
| { | ||
| defaultMessage: 'Step screenshot is being loaded.', | ||
| } | ||
| ); | ||
|
|
||
| export const SCREENSHOT_NOT_AVAILABLE = i18n.translate( | ||
| 'xpack.synthetics.monitor.step.screenshot.notAvailable', | ||
| { | ||
| defaultMessage: 'Step screenshot is not available.', | ||
| } | ||
| ); | ||
|
|
||
| export const IMAGE_UN_AVAILABLE = i18n.translate( | ||
| 'xpack.synthetics.monitor.step.screenshot.unAvailable', | ||
| { | ||
| defaultMessage: 'Image unavailable', | ||
| } | ||
| ); |
39 changes: 39 additions & 0 deletions
39
...ins/synthetics/public/apps/synthetics/components/common/screenshot/journey_screenshot.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import React, { useMemo } from 'react'; | ||
| import { useJourneySteps } from '../../monitor_details/hooks/use_journey_steps'; | ||
| import { parseBadgeStatus } from '../monitor_test_result/status_badge'; | ||
| import { JourneyStepScreenshotContainer } from './journey_step_screenshot_container'; | ||
|
|
||
| export const JourneyScreenshot = ({ checkGroupId }: { checkGroupId: string }) => { | ||
| const { loading: stepsLoading, stepEnds } = useJourneySteps(checkGroupId); | ||
| const stepLabels = stepEnds.map((stepEnd) => stepEnd?.synthetics?.step?.name ?? ''); | ||
|
|
||
| const lastSignificantStep = useMemo(() => { | ||
| const copy = [...stepEnds]; | ||
| // Sort desc by timestamp | ||
| copy.sort( | ||
| (stepA, stepB) => | ||
| Number(new Date(stepB['@timestamp'])) - Number(new Date(stepA['@timestamp'])) | ||
| ); | ||
| return copy.find( | ||
| (stepEnd) => parseBadgeStatus(stepEnd?.synthetics?.step?.status ?? 'skipped') !== 'skipped' | ||
| ); | ||
| }, [stepEnds]); | ||
|
|
||
| return ( | ||
| <JourneyStepScreenshotContainer | ||
| checkGroup={lastSignificantStep?.monitor.check_group} | ||
| initialStepNo={lastSignificantStep?.synthetics?.step?.index} | ||
| stepStatus={lastSignificantStep?.synthetics.payload?.status} | ||
| allStepsLoaded={!stepsLoading} | ||
| stepLabels={stepLabels} | ||
| retryFetchOnRevisit={false} | ||
| /> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.