mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 22:19:28 -02:30
refresh events when first websocket event streams
This commit is contained in:
committed by
Keith J. Grant
parent
ac9871b36f
commit
6f6f04a071
@@ -251,6 +251,9 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
|
|||||||
});
|
});
|
||||||
const updated = oldWsEvents.concat(newEvents);
|
const updated = oldWsEvents.concat(newEvents);
|
||||||
jobSocketCounter.current = updated.length;
|
jobSocketCounter.current = updated.length;
|
||||||
|
if (!oldWsEvents.length && min > remoteRowCount + 1) {
|
||||||
|
loadJobEvents(min);
|
||||||
|
}
|
||||||
return updated.sort((a, b) => a.counter - b.counter);
|
return updated.sort((a, b) => a.counter - b.counter);
|
||||||
});
|
});
|
||||||
setCssMap((prevCssMap) => ({
|
setCssMap((prevCssMap) => ({
|
||||||
@@ -358,7 +361,7 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadJobEvents = async () => {
|
const loadJobEvents = async (firstWsCounter = null) => {
|
||||||
const [params, loadRange] = getEventRequestParams(job, 50, [1, 50]);
|
const [params, loadRange] = getEventRequestParams(job, 50, [1, 50]);
|
||||||
|
|
||||||
if (isMounted.current) {
|
if (isMounted.current) {
|
||||||
@@ -371,6 +374,9 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
|
|||||||
if (isFlatMode) {
|
if (isFlatMode) {
|
||||||
params.not__stdout = '';
|
params.not__stdout = '';
|
||||||
}
|
}
|
||||||
|
if (firstWsCounter) {
|
||||||
|
params.counter__lt = firstWsCounter;
|
||||||
|
}
|
||||||
const qsParams = parseQueryString(QS_CONFIG, location.search);
|
const qsParams = parseQueryString(QS_CONFIG, location.search);
|
||||||
const eventPromise = getJobModel(job.type).readEvents(job.id, {
|
const eventPromise = getJobModel(job.type).readEvents(job.id, {
|
||||||
...params,
|
...params,
|
||||||
@@ -435,7 +441,7 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
|
|||||||
if (getEvent(counter)) {
|
if (getEvent(counter)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (index > remoteRowCount && index < remoteRowCount + wsEvents.length) {
|
if (index >= remoteRowCount && index < remoteRowCount + wsEvents.length) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return currentlyLoading.includes(counter);
|
return currentlyLoading.includes(counter);
|
||||||
@@ -462,7 +468,7 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
|
|||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
!event &&
|
!event &&
|
||||||
index > remoteRowCount &&
|
index >= remoteRowCount &&
|
||||||
index < remoteRowCount + wsEvents.length
|
index < remoteRowCount + wsEvents.length
|
||||||
) {
|
) {
|
||||||
event = wsEvents[index - remoteRowCount];
|
event = wsEvents[index - remoteRowCount];
|
||||||
|
|||||||
Reference in New Issue
Block a user