mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 11:00:03 -03:30
add basic click handler for fetching and showing missing events
This commit is contained in:
parent
0bc9b1d431
commit
04dbc2fcc4
@ -555,7 +555,41 @@ function showHostDetails (id, uuid) {
|
||||
}
|
||||
|
||||
function showMissingEvents (uuid) {
|
||||
console.log(`expandMissingEvents: ${uuid}`);
|
||||
const { counters } = render.records[uuid];
|
||||
|
||||
const min = Math.min(...counters);
|
||||
const max = Math.min(Math.max(...counters), min + OUTPUT_PAGE_SIZE);
|
||||
|
||||
const selector = `#${uuid}`;
|
||||
const clicked = $(selector);
|
||||
|
||||
return resource.events.getRange([min, max])
|
||||
.then(results => {
|
||||
let lines = 0;
|
||||
let untrusted = '';
|
||||
|
||||
for (let i = 0; i <= results.length - 1; i++) {
|
||||
const { html, count } = render.transformEvent(results[i]);
|
||||
|
||||
lines += count;
|
||||
untrusted += html;
|
||||
render.records[uuid].counters.shift();
|
||||
}
|
||||
|
||||
const trusted = render.trustHtml(untrusted);
|
||||
const elements = angular.element(trusted);
|
||||
|
||||
return render
|
||||
.requestAnimationFrame(() => {
|
||||
elements.insertBefore(clicked);
|
||||
|
||||
if (render.records[uuid].counters.length === 0) {
|
||||
clicked.remove();
|
||||
}
|
||||
})
|
||||
.then(() => render.compile(elements))
|
||||
.then(() => lines);
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user