add max event count and discarding to stream service

This commit is contained in:
Jake McDermott
2018-08-18 23:34:01 -04:00
parent 2187655c68
commit 38b9b47e6b
5 changed files with 137 additions and 64 deletions

View File

@@ -31,6 +31,8 @@ const pattern = [
const re = new RegExp(pattern);
const hasAnsi = input => re.test(input);
const MISSING_EVENT_GROUP = 'MISSING_EVENT_GROUP';
function JobRenderService ($q, $sce, $window) {
this.init = ({ compile, toggles }) => {
this.parent = null;
@@ -39,6 +41,7 @@ function JobRenderService ($q, $sce, $window) {
this.hooks = { compile };
this.createToggles = toggles;
this.lastMissing = false;
this.state = {
collapseAll: false
};
@@ -76,10 +79,21 @@ function JobRenderService ($q, $sce, $window) {
};
this.transformEvent = event => {
if (this.record[event.uuid]) {
if (event.uuid && this.record[event.uuid]) {
return { html: '', count: 0 };
}
if (event.event === MISSING_EVENT_GROUP) {
if (this.lastMissing) {
return { html: '', count: 0 };
}
this.lastMissing = true;
return this.transformMissingEvent(event);
}
this.lastMissing = false;
if (!event || !event.stdout) {
return { html: '', count: 0 };
}
@@ -110,6 +124,13 @@ function JobRenderService ($q, $sce, $window) {
return { html, count };
};
this.transformMissingEvent = () => {
const html = '<div class="at-Stdout-row"><div class="at-Stdout-line">...</div></div>';
const count = 1;
return { html, count };
};
this.isHostEvent = (event) => {
if (typeof event.host === 'number') {
return true;