Skip to content

Commit

Permalink
added progress for non-computable requests
Browse files Browse the repository at this point in the history
  • Loading branch information
anvaka committed Mar 18, 2020
1 parent ab12db4 commit 26260eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/galaxy/service/graphLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,15 @@ function loadGraph(name, progress) {

function reportProgress(name, file) {
return function(e) {
progress({
let progressInfo = {
message: name + ': downloading ' + file,
completed: Math.round(e.percent * 100) + '%'
});
};
if (e.percent !== undefined) {
progressInfo.completed = Math.round(e.percent * 100) + '%'
} else {
progressInfo.completed = Math.round(e.loaded) + ' bytes'
}
progress(progressInfo);
};
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/galaxy/service/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ function request(url, options) {
total: e.total,
percent: e.loaded / e.total
});
} else {
options.progress({
loaded: e.loaded,
});
}
}

Expand Down

0 comments on commit 26260eb

Please sign in to comment.