[8.6] [Synthetics] Hide URL field when value is falsey (#145938) (#146156)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Synthetics] Hide URL field when value is falsey
(#145938)](https://github.com/elastic/kibana/pull/145938)

<!--- 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":"2022-11-23T14:32:30Z","message":"[Synthetics]
Hide URL field when value is falsey (#145938)\n\n##
Summary\r\n\r\nResolves #144855.\r\n\r\nResolves #144854.\r\n\r\nHides
the URL field when it has no value, like in the case of
multistep\r\nmonitors.\r\n\r\n## Testing this PR\r\n\r\nCreate a
multistep monitor that will not have a URL field, and view the\r\nflyout
for your monitor. See that there is no URL field
displayed.\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"78f22099436519dc8c069d12d21f9a90b3a6eb92","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:uptime","release_note:skip","v8.6.0","v8.7.0"],"number":145938,"url":"https://github.com/elastic/kibana/pull/145938","mergeCommit":{"message":"[Synthetics]
Hide URL field when value is falsey (#145938)\n\n##
Summary\r\n\r\nResolves #144855.\r\n\r\nResolves #144854.\r\n\r\nHides
the URL field when it has no value, like in the case of
multistep\r\nmonitors.\r\n\r\n## Testing this PR\r\n\r\nCreate a
multistep monitor that will not have a URL field, and view the\r\nflyout
for your monitor. See that there is no URL field
displayed.\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"78f22099436519dc8c069d12d21f9a90b3a6eb92"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145938","number":145938,"mergeCommit":{"message":"[Synthetics]
Hide URL field when value is falsey (#145938)\n\n##
Summary\r\n\r\nResolves #144855.\r\n\r\nResolves #144854.\r\n\r\nHides
the URL field when it has no value, like in the case of
multistep\r\nmonitors.\r\n\r\n## Testing this PR\r\n\r\nCreate a
multistep monitor that will not have a URL field, and view the\r\nflyout
for your monitor. See that there is no URL field
displayed.\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"78f22099436519dc8c069d12d21f9a90b3a6eb92"}}]}]
BACKPORT-->

Co-authored-by: Justin Kambic <jk@elastic.co>
This commit is contained in:
Kibana Machine 2022-11-23 10:38:55 -05:00 committed by GitHub
parent e0f1586207
commit d458b8f214
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,7 @@ import {
EuiPanel,
EuiPopover,
EuiSpacer,
EuiText,
EuiTitle,
useIsWithinMaxBreakpoint,
} from '@elastic/eui';
@ -353,19 +354,23 @@ export function MonitorDetailFlyout(props: Props) {
compressed
listItems={
[
{
title: URL_HEADER_TEXT,
description: monitorDetail.data?.url?.full ? (
<EuiLink external href={monitorDetail.data.url.full}>
{monitorDetail.data.url.full}
</EuiLink>
) : (
''
),
},
monitorDetail.data?.url?.full
? {
title: URL_HEADER_TEXT,
description: (
<EuiLink external href={monitorDetail.data.url.full}>
{monitorDetail.data.url.full}
</EuiLink>
),
}
: undefined,
{
title: LAST_RUN_HEADER_TEXT,
description: <Time timestamp={monitorDetail.data?.timestamp} />,
description: monitorDetail.data?.timestamp ? (
<Time timestamp={monitorDetail.data.timestamp} />
) : (
<EuiText color="subdued">--</EuiText>
),
},
{
title: LAST_MODIFIED_HEADER_TEXT,