mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-14 15:58:38 -05:00
event processing for details panel and initial stats bar integration
This commit is contained in:
@@ -3,7 +3,7 @@ const JOB_END = 'playbook_on_stats';
|
||||
const MAX_LAG = 120;
|
||||
|
||||
function JobStreamService ($q) {
|
||||
this.init = ({ resource, scroll, page, render, listen }) => {
|
||||
this.init = ({ resource, scroll, page, onStreamStart, onStreamFinish, render, listen }) => {
|
||||
this.resource = resource;
|
||||
this.scroll = scroll;
|
||||
this.page = page;
|
||||
@@ -23,8 +23,10 @@ function JobStreamService ($q) {
|
||||
};
|
||||
|
||||
this.hooks = {
|
||||
onStreamStart,
|
||||
onStreamFinish,
|
||||
render,
|
||||
listen
|
||||
listen,
|
||||
};
|
||||
|
||||
this.lines = {
|
||||
@@ -35,7 +37,7 @@ function JobStreamService ($q) {
|
||||
max: 0
|
||||
};
|
||||
|
||||
this.hooks.listen(resource.ws.namespace, this.listen);
|
||||
this.hooks.listen(resource.ws.namespace, this.listener);
|
||||
};
|
||||
|
||||
this.getBatchFactors = size => {
|
||||
@@ -105,19 +107,25 @@ function JobStreamService ($q) {
|
||||
}
|
||||
};
|
||||
|
||||
this.listen = data => {
|
||||
this.listener = data => {
|
||||
this.lag++;
|
||||
|
||||
this.chain = this.chain
|
||||
.then(() => {
|
||||
// console.log(data);
|
||||
if (!this.isActive()) {
|
||||
this.start();
|
||||
if (!this.isEnding()) {
|
||||
this.hooks.onStreamStart(data);
|
||||
}
|
||||
} else if (data.event === JOB_END) {
|
||||
if (this.isPaused()) {
|
||||
this.end(true);
|
||||
} else {
|
||||
this.end();
|
||||
}
|
||||
|
||||
this.hooks.onStreamFinish(data);
|
||||
}
|
||||
|
||||
this.checkLines(data);
|
||||
|
||||
Reference in New Issue
Block a user