[8.7] [Synthetics] Do not navigate away from cru before saving or cancelling changes (#152610) (#152965)

# Backport

This will backport the following commits from `main` to `8.7`:
- [[Synthetics] Do not navigate away from cru before saving or
cancelling changes
(#152610)](https://github.com/elastic/kibana/pull/152610)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Justin
Kambic","email":"jk@elastic.co"},"sourceCommit":{"committedDate":"2023-03-08T21:03:52Z","message":"[Synthetics]
Do not navigate away from cru before saving or cancelling changes
(#152610)\n\n## Summary\r\n\r\nResolves #152608.\r\n\r\nOpens run once
stats in a new tab when we're on the create/edit page.\r\nThis way if
the user clicks through, they don't lose their config inputs\r\nfrom the
form.\r\n\r\n## Testing\r\n\r\n### Create\r\n\r\n1. Add Monitor\r\n2.
Define a step\r\n3. Test the step using the test button at the
bottom\r\n4. Click the detail link in your step's row of the table\r\n5.
See that a separate tab/window opens instead of navigating from
the\r\nexisting page\r\n6. Close the detail page, save your
monitor\r\n\r\n### Edit\r\n\r\n1. Edit the monitor you created
above\r\n2. Ensure the same flow from _Create_ works\r\n\r\nRefer to the
GIF below for more
info\r\n\r\n\r\n![20230302140434](https://user-images.githubusercontent.com/18429259/222527423-508700b4-d775-4dc7-a762-ee1223bfd63a.gif)","sha":"9409550b0a35b3ba179657db76324b8facb6fb19","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:uptime","release_note:skip","v8.7.0","v8.8.0"],"number":152610,"url":"https://github.com/elastic/kibana/pull/152610","mergeCommit":{"message":"[Synthetics]
Do not navigate away from cru before saving or cancelling changes
(#152610)\n\n## Summary\r\n\r\nResolves #152608.\r\n\r\nOpens run once
stats in a new tab when we're on the create/edit page.\r\nThis way if
the user clicks through, they don't lose their config inputs\r\nfrom the
form.\r\n\r\n## Testing\r\n\r\n### Create\r\n\r\n1. Add Monitor\r\n2.
Define a step\r\n3. Test the step using the test button at the
bottom\r\n4. Click the detail link in your step's row of the table\r\n5.
See that a separate tab/window opens instead of navigating from
the\r\nexisting page\r\n6. Close the detail page, save your
monitor\r\n\r\n### Edit\r\n\r\n1. Edit the monitor you created
above\r\n2. Ensure the same flow from _Create_ works\r\n\r\nRefer to the
GIF below for more
info\r\n\r\n\r\n![20230302140434](https://user-images.githubusercontent.com/18429259/222527423-508700b4-d775-4dc7-a762-ee1223bfd63a.gif)","sha":"9409550b0a35b3ba179657db76324b8facb6fb19"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/152610","number":152610,"mergeCommit":{"message":"[Synthetics]
Do not navigate away from cru before saving or cancelling changes
(#152610)\n\n## Summary\r\n\r\nResolves #152608.\r\n\r\nOpens run once
stats in a new tab when we're on the create/edit page.\r\nThis way if
the user clicks through, they don't lose their config inputs\r\nfrom the
form.\r\n\r\n## Testing\r\n\r\n### Create\r\n\r\n1. Add Monitor\r\n2.
Define a step\r\n3. Test the step using the test button at the
bottom\r\n4. Click the detail link in your step's row of the table\r\n5.
See that a separate tab/window opens instead of navigating from
the\r\nexisting page\r\n6. Close the detail page, save your
monitor\r\n\r\n### Edit\r\n\r\n1. Edit the monitor you created
above\r\n2. Ensure the same flow from _Create_ works\r\n\r\nRefer to the
GIF below for more
info\r\n\r\n\r\n![20230302140434](https://user-images.githubusercontent.com/18429259/222527423-508700b4-d775-4dc7-a762-ee1223bfd63a.gif)","sha":"9409550b0a35b3ba179657db76324b8facb6fb19"}}]}]
BACKPORT-->

Co-authored-by: Justin Kambic <jk@elastic.co>
This commit is contained in:
Kibana Machine 2023-03-08 17:39:00 -05:00 committed by GitHub
parent e339cb85f5
commit 8addcf4e37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -17,12 +17,14 @@ export const StepDetailsLinkIcon = ({
configId,
asButton,
label,
target = '_self',
}: {
checkGroup: string;
label?: string;
configId: string;
stepIndex?: number;
asButton?: boolean;
target?: '_self' | '_blank';
}) => {
const { basePath } = useSyntheticsSettingsContext();
const selectedLocation = useSelectedLocation();
@ -45,7 +47,7 @@ export const StepDetailsLinkIcon = ({
title={VIEW_DETAILS}
size="s"
href={`${basePath}/app/synthetics/monitor/${configId}/test-run/${checkGroup}/step/${stepIndex}?locationId=${selectedLocation?.id}`}
target="_self"
target={target}
iconType="apmTrace"
/>
);

View file

@ -214,6 +214,7 @@ export const BrowserStepsList = ({
checkGroup={item.monitor.check_group}
stepIndex={item.synthetics?.step?.index}
configId={item.config_id!}
target="_blank"
/>
),
},