mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Synthetics] Fix next / prev test navigation (#155624)
This commit is contained in:
parent
1ae38df15d
commit
4e4f408a34
2 changed files with 39 additions and 29 deletions
|
@ -57,19 +57,23 @@ export const StepPageNavigation = ({ testRunPage }: { testRunPage?: boolean }) =
|
|||
checkGroupId: data?.details?.next?.checkGroup,
|
||||
});
|
||||
|
||||
if (testRunPage && data?.details?.previous?.checkGroup && data?.details?.next?.checkGroup) {
|
||||
prevHref = getTestRunDetailLink({
|
||||
basePath,
|
||||
monitorId,
|
||||
locationId: selectedLocation?.id,
|
||||
checkGroup: data?.details?.previous?.checkGroup,
|
||||
});
|
||||
nextHref = getTestRunDetailLink({
|
||||
basePath,
|
||||
monitorId,
|
||||
locationId: selectedLocation?.id,
|
||||
checkGroup: data?.details?.next?.checkGroup,
|
||||
});
|
||||
if (testRunPage) {
|
||||
if (data?.details?.previous?.checkGroup) {
|
||||
prevHref = getTestRunDetailLink({
|
||||
basePath,
|
||||
monitorId,
|
||||
locationId: selectedLocation?.id,
|
||||
checkGroup: data?.details?.previous?.checkGroup,
|
||||
});
|
||||
}
|
||||
if (data?.details?.next?.checkGroup) {
|
||||
nextHref = getTestRunDetailLink({
|
||||
basePath,
|
||||
monitorId,
|
||||
locationId: selectedLocation?.id,
|
||||
checkGroup: data?.details?.next?.checkGroup,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!startedAt) {
|
||||
|
|
|
@ -64,6 +64,15 @@ export const getJourneyDetails: UMElasticsearchQueryFn<
|
|||
body: {
|
||||
query: {
|
||||
bool: {
|
||||
must_not: [
|
||||
{
|
||||
term: {
|
||||
'monitor.check_group': {
|
||||
value: journeySource.monitor.check_group,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
filter: [
|
||||
{
|
||||
term: {
|
||||
|
@ -93,6 +102,7 @@ export const getJourneyDetails: UMElasticsearchQueryFn<
|
|||
...baseSiblingParams.body,
|
||||
query: {
|
||||
bool: {
|
||||
must_not: baseSiblingParams.body.query.bool.must_not,
|
||||
filter: [
|
||||
...baseSiblingParams.body.query.bool.filter,
|
||||
{
|
||||
|
@ -114,6 +124,7 @@ export const getJourneyDetails: UMElasticsearchQueryFn<
|
|||
...baseSiblingParams.body,
|
||||
query: {
|
||||
bool: {
|
||||
must_not: baseSiblingParams.body.query.bool.must_not,
|
||||
filter: [
|
||||
...baseSiblingParams.body.query.bool.filter,
|
||||
{
|
||||
|
@ -151,20 +162,6 @@ export const getJourneyDetails: UMElasticsearchQueryFn<
|
|||
({ _source: summarySource }) => summarySource.synthetics?.type === 'heartbeat/summary'
|
||||
)?._source;
|
||||
|
||||
const previousInfo = previousJourney
|
||||
? {
|
||||
checkGroup: previousJourney._source.monitor.check_group,
|
||||
timestamp: previousJourney._source['@timestamp'],
|
||||
}
|
||||
: undefined;
|
||||
|
||||
const nextInfo = nextJourney
|
||||
? {
|
||||
checkGroup: nextJourney._source.monitor.check_group,
|
||||
timestamp: nextJourney._source['@timestamp'],
|
||||
}
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
timestamp: journeySource['@timestamp'],
|
||||
journey: { ...journeySource, _id: foundJourney._id },
|
||||
|
@ -175,10 +172,19 @@ export const getJourneyDetails: UMElasticsearchQueryFn<
|
|||
},
|
||||
}
|
||||
: {}),
|
||||
previous: previousInfo,
|
||||
next: nextInfo,
|
||||
previous: filterNextPrevJourney(journeySource.monitor.check_group, previousJourney?._source),
|
||||
next: filterNextPrevJourney(journeySource.monitor.check_group, nextJourney?._source),
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const filterNextPrevJourney = (checkGroup: string, pingSource: DocumentSource) => {
|
||||
return pingSource && pingSource.monitor.check_group !== checkGroup
|
||||
? {
|
||||
checkGroup: pingSource.monitor.check_group,
|
||||
timestamp: pingSource['@timestamp'],
|
||||
}
|
||||
: undefined;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue