performance / ux improvements for higher volume jobs

This commit is contained in:
Jake McDermott
2018-08-12 11:12:49 -04:00
parent 49222d5e72
commit 91bc39be6b
3 changed files with 24 additions and 41 deletions

View File

@@ -234,6 +234,9 @@ function stopFollowing () {
return; return;
} }
scroll.unlock();
scroll.unhide();
vm.isFollowing = false; vm.isFollowing = false;
vm.followTooltip = vm.strings.get('tooltips.MENU_LAST'); vm.followTooltip = vm.strings.get('tooltips.MENU_LAST');
} }
@@ -482,10 +485,23 @@ function OutputIndexController (
}, },
}); });
const rates = [];
stream.init({ stream.init({
bufferAdd, bufferAdd,
bufferEmpty, bufferEmpty,
onFrames, onFrames,
onFrameRate (rate) {
rates.push(rate);
rates.splice(0, rates.length - 5);
if (rate > 1 && vm.isFollowing) {
scroll.lock();
scroll.hide();
} else if (rates.every(value => value === 1)) {
scroll.unlock();
scroll.unhide();
}
},
onStop () { onStop () {
lockFollow = true; lockFollow = true;
stopFollowing(); stopFollowing();
@@ -493,7 +509,8 @@ function OutputIndexController (
status.updateStats(); status.updateStats();
status.dispatch(); status.dispatch();
status.sync(); status.sync();
scroll.stop(); scroll.unlock();
scroll.unhide();
} }
}); });
@@ -533,3 +550,4 @@ OutputIndexController.$inject = [
]; ];
module.exports = OutputIndexController; module.exports = OutputIndexController;

View File

@@ -5,8 +5,6 @@ import {
OUTPUT_SCROLL_THRESHOLD, OUTPUT_SCROLL_THRESHOLD,
} from './constants'; } from './constants';
const MAX_THRASH = 20;
function JobScrollService ($q, $timeout) { function JobScrollService ($q, $timeout) {
this.init = ({ next, previous, onThresholdLeave }) => { this.init = ({ next, previous, onThresholdLeave }) => {
this.el = $(OUTPUT_ELEMENT_CONTAINER); this.el = $(OUTPUT_ELEMENT_CONTAINER);
@@ -33,7 +31,6 @@ function JobScrollService ($q, $timeout) {
paused: false, paused: false,
locked: false, locked: false,
hover: false, hover: false,
running: true,
thrash: 0, thrash: 0,
}; };
@@ -44,13 +41,6 @@ function JobScrollService ($q, $timeout) {
this.onMouseEnter = () => { this.onMouseEnter = () => {
this.state.hover = true; this.state.hover = true;
if (this.state.thrash >= MAX_THRASH) {
this.state.thrash = MAX_THRASH - 1;
}
this.unlock();
this.unhide();
}; };
this.onMouseLeave = () => { this.onMouseLeave = () => {
@@ -62,23 +52,6 @@ function JobScrollService ($q, $timeout) {
return; return;
} }
if (this.state.thrash > 0) {
if (this.isLocked() || this.state.hover) {
this.state.thrash--;
}
}
if (!this.state.hover) {
this.state.thrash++;
}
if (this.state.thrash >= MAX_THRASH) {
if (this.isRunning()) {
this.lock();
this.hide();
}
}
if (this.isLocked()) { if (this.isLocked()) {
return; return;
} }
@@ -195,16 +168,6 @@ function JobScrollService ($q, $timeout) {
this.setScrollPosition(this.getScrollHeight()); this.setScrollPosition(this.getScrollHeight());
}; };
this.start = () => {
this.state.running = true;
};
this.stop = () => {
this.unlock();
this.unhide();
this.state.running = false;
};
this.lock = () => { this.lock = () => {
this.state.locked = true; this.state.locked = true;
}; };
@@ -256,7 +219,6 @@ function JobScrollService ($q, $timeout) {
}; };
this.isPaused = () => this.state.paused; this.isPaused = () => this.state.paused;
this.isRunning = () => this.state.running;
this.isLocked = () => this.state.locked; this.isLocked = () => this.state.locked;
this.isMissing = () => $(OUTPUT_ELEMENT_TBODY)[0].clientHeight < this.getViewableHeight(); this.isMissing = () => $(OUTPUT_ELEMENT_TBODY)[0].clientHeight < this.getViewableHeight();
} }

View File

@@ -6,11 +6,12 @@ import {
} from './constants'; } from './constants';
function OutputStream ($q) { function OutputStream ($q) {
this.init = ({ bufferAdd, bufferEmpty, onFrames, onStop }) => { this.init = ({ bufferAdd, bufferEmpty, onFrames, onFrameRate, onStop }) => {
this.hooks = { this.hooks = {
bufferAdd, bufferAdd,
bufferEmpty, bufferEmpty,
onFrames, onFrames,
onFrameRate,
onStop, onStop,
}; };
@@ -53,6 +54,7 @@ function OutputStream ($q) {
const boundedIndex = Math.min(this.factors.length - 1, index); const boundedIndex = Math.min(this.factors.length - 1, index);
this.framesPerRender = this.factors[boundedIndex]; this.framesPerRender = this.factors[boundedIndex];
this.hooks.onFrameRate(this.framesPerRender);
}; };
this.setMissingCounterThreshold = counter => { this.setMissingCounterThreshold = counter => {
@@ -111,7 +113,8 @@ function OutputStream ($q) {
} }
const isReady = maxReady && (this.state.ending || const isReady = maxReady && (this.state.ending ||
(maxReady - minReady) % this.framesPerRender === 0); count % this.framesPerRender === 0 ||
count < OUTPUT_PAGE_SIZE && (maxReady - minReady) % this.framesPerRender === 0);
if (!isReady) { if (!isReady) {
return $q.resolve(); return $q.resolve();