mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.7`: - [[Synthetics] Fix next / prev test navigation (#155624)](https://github.com/elastic/kibana/pull/155624) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2023-04-25T06:11:19Z","message":"[Synthetics] Fix next / prev test navigation (#155624)","sha":"4e4f408a34f418053d5433eec8d59250816b0ba8","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:uptime","v8.8.0","v8.7.2"],"number":155624,"url":"https://github.com/elastic/kibana/pull/155624","mergeCommit":{"message":"[Synthetics] Fix next / prev test navigation (#155624)","sha":"4e4f408a34f418053d5433eec8d59250816b0ba8"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/155624","number":155624,"mergeCommit":{"message":"[Synthetics] Fix next / prev test navigation (#155624)","sha":"4e4f408a34f418053d5433eec8d59250816b0ba8"}},{"branch":"8.7","label":"v8.7.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Shahzad <shahzad31comp@gmail.com>
This commit is contained in:
parent
afeb66cdf7
commit
bc7c5fcad9
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