Commit de4c510a by Johannes Edmeier

Fix refresh trace view showing duplicates

fixes #175
parent 62c665a0
......@@ -16,27 +16,20 @@
'use strict';
module.exports = function ($scope, application, $interval) {
$scope.lastTraceTime = 0;
$scope.traces = [];
$scope.refresher = null;
$scope.refreshInterval = 5;
$scope.refresh = function () {
application.getTraces()
.then(function (traces) {
for (var i = 0; i < traces.length; i++) {
if (traces[i].timestamp > $scope.lastTraceTime) {
$scope.traces.push(traces[i]);
}
}
if (traces.length > 0) {
$scope.lastTraceTime = traces[traces.length - 1].timestamp;
}
})
.catch(function (error) {
$scope.error = error;
$scope.refresh = function() {
application.getTraces().then(function(traces) {
var oldestTrace = traces[traces.length - 1];
var olderTraces = $scope.traces.filter(function(trace) {
return trace.timestamp < oldestTrace.timestamp;
});
$scope.traces = traces.concat(olderTraces);
}).catch(function(error) {
$scope.error = error;
});
};
$scope.toggleAutoRefresh = function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment