mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
resolves #64: graph jumps to previous values
Ensure the old chart is completely removed before loading a new set of values due to different page or sort options
This commit is contained in:
parent
f2bbfd91bb
commit
1f122518dd
@ -403,6 +403,7 @@ var Job = function() {
|
|||||||
pages: 0,
|
pages: 0,
|
||||||
sort: {}
|
sort: {}
|
||||||
};
|
};
|
||||||
|
var chtBt = null;
|
||||||
return Vue.extend({
|
return Vue.extend({
|
||||||
template: '#job',
|
template: '#job',
|
||||||
mixins: [WebsocketHandler, Utils, ProgressUpdater],
|
mixins: [WebsocketHandler, Utils, ProgressUpdater],
|
||||||
@ -419,7 +420,11 @@ var Job = function() {
|
|||||||
state.pages = msg.pages;
|
state.pages = msg.pages;
|
||||||
state.sort = msg.sort;
|
state.sort = msg.sort;
|
||||||
|
|
||||||
var chtBt = new Chart(document.getElementById("chartBt"), {
|
// "status" comes again if we change page/sorting. Delete the
|
||||||
|
// old chart and recreate it to prevent flickering of old data
|
||||||
|
if(chtBt)
|
||||||
|
chtBt.destroy();
|
||||||
|
chtBt = new Chart(document.getElementById("chartBt"), {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: {
|
data: {
|
||||||
labels: msg.recent.map(function(e) {
|
labels: msg.recent.map(function(e) {
|
||||||
@ -443,7 +448,6 @@ var Job = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
chtBt.update();
|
chtBt.update();
|
||||||
|
|
||||||
},
|
},
|
||||||
job_queued: function() {
|
job_queued: function() {
|
||||||
state.nQueued++;
|
state.nQueued++;
|
||||||
|
Loading…
Reference in New Issue
Block a user