Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
collect job data from server when moving from running table
Browse files Browse the repository at this point in the history
  • Loading branch information
jmancewicz committed Jun 2, 2016
1 parent 2a93a86 commit a20692f
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions digits/static/js/home_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,24 @@
method : "GET",
url: '/jobs/' + job_id + '/table_data.json',
}).then(function success(response) {
for (var i = 0; i < $scope.jobs.length; i++) {
if ($scope.jobs[i].id == job_id) {
$scope.jobs[i] = Object.assign({}, response.data.job);
return;
}
}
$scope.jobs.push(response.data.job);
});
}

$scope.remove_job = function(job_id) {
for (var i = 0; i < $scope.jobs.length; i++) {
if ($scope.jobs[i].id == job_id) {
$scope.jobs.splice(i,1);
$scope.jobs.splice(i, 1);
return true;
}
}
return false
}

$scope.deselect_all = function() {
Expand Down Expand Up @@ -668,20 +676,30 @@ $(document).ready(function() {
var scope = angular.element(document.getElementById("all-jobs")).scope();
if (false)
return;
if (msg['update'] == 'status') {
if (scope.set_attribute(msg['job_id'], 'status', msg['status']) &&
scope.set_attribute(msg['job_id'], 'status_css', msg['css']))
if (msg.update == 'status') {
if (msg.status == 'Initialized' ||
msg.status == 'Waiting' ||
msg.status == 'Running') {
if (scope.set_attribute(msg.job_id, 'status', msg.status) &&
scope.set_attribute(msg.job_id, 'status_css', msg.css))
scope.$apply();
} else {
// These should be moving from the running table to
// the other tables, so gather all the information to
// be displayed.
scope.add_job(msg.job_id);
scope.$apply();
}
}
else if (msg['update'] == 'progress') {
if (scope.set_attribute(msg['job_id'], 'progress', msg['percentage']))
else if (msg.update == 'progress') {
if (scope.set_attribute(msg.job_id, 'progress', msg.percentage))
scope.$apply();
}
else if (msg['update'] == 'added') {
else if (msg.update == 'added') {
scope.add_job(msg.job_id);
scope.$apply();
}
else if (msg['update'] == 'deleted') {
else if (msg.update == 'deleted') {
scope.remove_job(msg.job_id);
scope.$apply();
}
Expand Down

0 comments on commit a20692f

Please sign in to comment.