[ARVADOS] updated: 590cc75e138c891b2608d14ac5678035bc89e363
git at public.curoverse.com
git at public.curoverse.com
Fri Dec 5 20:02:43 EST 2014
Summary of changes:
.../app/assets/javascripts/arvados_client.js | 2 +-
.../app/assets/javascripts/upload_to_collection.js | 75 +++++++++++++++-------
.../app/views/collections/_show_upload.html.erb | 20 +++---
apps/workbench/app/views/projects/show.html.erb | 5 +-
4 files changed, 68 insertions(+), 34 deletions(-)
via 590cc75e138c891b2608d14ac5678035bc89e363 (commit)
via f74392126de1e4871d953fd5de7057c99fa30574 (commit)
via d013a55fb81f2dc7bdd521988b862cc54b7fabb5 (commit)
via f08c7181ff8a90060c8184f04d7d3da1e856c336 (commit)
from 254bd074877ddc11a0ff846e2eb740dbfaa059fe (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 590cc75e138c891b2608d14ac5678035bc89e363
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Dec 5 20:02:28 2014 -0500
3781: Add Uploaded state, fix handling of Pause during appendToCollection.
diff --git a/apps/workbench/app/assets/javascripts/upload_to_collection.js b/apps/workbench/app/assets/javascripts/upload_to_collection.js
index 7c31c6d..9e20542 100644
--- a/apps/workbench/app/assets/javascripts/upload_to_collection.js
+++ b/apps/workbench/app/assets/javascripts/upload_to_collection.js
@@ -177,11 +177,10 @@ function UploadToCollection($scope, $filter, $q, $timeout,
function FileUploader(file) {
$.extend(this, {
- committed: false,
file: file,
locators: [],
progress: 0.0,
- state: 'Queued', // Queued, Uploading, Paused, Done
+ state: 'Queued', // Queued, Uploading, Paused, Uploaded, Done
statistics: null,
go: go,
stop: stop // User wants to stop.
@@ -201,13 +200,13 @@ function UploadToCollection($scope, $filter, $q, $timeout,
function go() {
if (_deferred)
_deferred.reject({textStatus: 'restarted'});
- _deferred = $q.defer();
+ _deferred = $.Deferred();
that.state = 'Uploading';
_startTime = Date.now();
_startByte = _readPos;
setProgress();
goSlice();
- return _deferred.promise;
+ return _deferred.promise().always(function() { _deferred = null; });
}
function stop() {
if (_deferred) {
@@ -225,7 +224,10 @@ function UploadToCollection($scope, $filter, $q, $timeout,
// here is fulfilled.
_currentSlice = nextSlice();
if (!_currentSlice) {
- that.state = 'Done';
+ // All slices have been uploaded, but the work won't
+ // be truly Done until the target collection has been
+ // updated by the QueueUploader. This state is called:
+ that.state = 'Uploaded';
setProgress(_readPos);
_currentUploader = null;
_deferred.resolve([that]);
@@ -295,14 +297,20 @@ function UploadToCollection($scope, $filter, $q, $timeout,
new Date(
Date.now() + (that.file.size - bytesDone) / kBps),
'shortTime')
- } else {
- that.statistics += ', finished ' +
- $filter('date')(Date.now(), 'shortTime');
- _finishTime = Date.now();
}
} else {
that.statistics = that.state;
}
+ if (that.state === 'Uploading' || that.state === 'Uploaded') {
+ // 'Uploaded' gets reported as 'finished', which is a
+ // little misleading because the collection hasn't
+ // been updated yet. But FileUploader's portion of the
+ // work (and the time when it makes sense to show
+ // speed and ETA) is finished.
+ that.statistics += ', finished ' +
+ $filter('date')(Date.now(), 'shortTime');
+ _finishTime = Date.now();
+ }
_deferred.notify();
}
}
@@ -317,9 +325,11 @@ function UploadToCollection($scope, $filter, $q, $timeout,
});
////////////////////////////////
var that = this;
- var _deferred;
+ var _deferred; // the one we promise to go()'s caller
+ var _deferredAppend; // tracks current appendToCollection
function go() {
- if (that.state === 'Running') return _deferred.promise;
+ if (_deferred) return _deferred.promise();
+ if (_deferredAppend) return _deferredAppend.promise();
_deferred = $.Deferred();
that.state = 'Running';
ArvadosClient.apiPromise(
@@ -327,12 +337,19 @@ function UploadToCollection($scope, $filter, $q, $timeout,
{filters: [['service_type','=','proxy']]}).
then(doQueueWithProxy);
onQueueProgress();
- return _deferred.promise();
+ return _deferred.promise().always(function() { _deferred = null; });
}
function stop() {
that.state = 'Stopped';
+ if (_deferred) {
+ _deferred.reject({});
+ }
+ if (_deferredAppend) {
+ _deferredAppend.reject({});
+ }
for (var i=0; i<$scope.uploadQueue.length; i++)
$scope.uploadQueue[i].stop();
+ onQueueProgress();
}
function doQueueWithProxy(data) {
keepProxy = data.items[0];
@@ -346,7 +363,10 @@ function UploadToCollection($scope, $filter, $q, $timeout,
return doQueueWork();
}
function doQueueWork() {
- that.state = 'Running';
+ if (!_deferred) {
+ // Queue work has been stopped.
+ return;
+ }
that.stateReason = null;
// If anything is not Done, do it.
if ($scope.uploadQueue.length > 0 &&
@@ -359,10 +379,10 @@ function UploadToCollection($scope, $filter, $q, $timeout,
return onQueueResolve();
}
function onQueueReject(reason) {
- if (that.state !== 'Stopped') {
- that.state = 'Error';
+ if (!_deferred) {
+ // Outcome has already been decided (by stop()).
+ return;
}
- // (else it's not really an error, just a consequence of stop())
that.stateReason = (
(reason.textStatus || 'Error') +
@@ -387,8 +407,8 @@ function UploadToCollection($scope, $filter, $q, $timeout,
$timeout(function(){$scope.$apply();});
}
function appendToCollection(uploads) {
- var deferred = $q.defer();
- return ArvadosClient.apiPromise(
+ _deferredAppend = $.Deferred();
+ ArvadosClient.apiPromise(
'collections', 'get',
{ uuid: $scope.uuid }).
then(function(collection) {
@@ -409,14 +429,15 @@ function UploadToCollection($scope, $filter, $q, $timeout,
collection:
{ manifest_text:
collection.manifest_text }
- }).
- then(deferred.resolve);
- }, onQueueReject).then(function() {
- // Push the completed upload(s) to the bottom of the queue.
+ });
+ }).
+ then(function() {
+ // Mark the completed upload(s) as Done and push
+ // them to the bottom of the queue.
var i, qLen = $scope.uploadQueue.length;
for (i=0; i<qLen; i++) {
if (uploads.indexOf($scope.uploadQueue[i]) >= 0) {
- $scope.uploadQueue[i].committed = true;
+ $scope.uploadQueue[i].state = 'Done';
$scope.uploadQueue.push.apply(
$scope.uploadQueue,
$scope.uploadQueue.splice(i, 1));
@@ -424,8 +445,13 @@ function UploadToCollection($scope, $filter, $q, $timeout,
--qLen;
}
}
+ }).
+ then(_deferredAppend.resolve,
+ _deferredAppend.reject).
+ always(function() {
+ _deferredAppend = null;
});
- return deferred.promise.then(doQueueWork);
+ return _deferredAppend.promise();
}
}
}
commit f74392126de1e4871d953fd5de7057c99fa30574
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Dec 5 18:00:40 2014 -0500
3781: Do not portray "stopped" state as an error if it was reached by clicking Pause.
diff --git a/apps/workbench/app/assets/javascripts/upload_to_collection.js b/apps/workbench/app/assets/javascripts/upload_to_collection.js
index 4ca5df6..7c31c6d 100644
--- a/apps/workbench/app/assets/javascripts/upload_to_collection.js
+++ b/apps/workbench/app/assets/javascripts/upload_to_collection.js
@@ -330,6 +330,7 @@ function UploadToCollection($scope, $filter, $q, $timeout,
return _deferred.promise();
}
function stop() {
+ that.state = 'Stopped';
for (var i=0; i<$scope.uploadQueue.length; i++)
$scope.uploadQueue[i].stop();
}
@@ -358,7 +359,11 @@ function UploadToCollection($scope, $filter, $q, $timeout,
return onQueueResolve();
}
function onQueueReject(reason) {
- that.state = 'Failed';
+ if (that.state !== 'Stopped') {
+ that.state = 'Error';
+ }
+ // (else it's not really an error, just a consequence of stop())
+
that.stateReason = (
(reason.textStatus || 'Error') +
(reason.xhr && reason.xhr.options
diff --git a/apps/workbench/app/views/collections/_show_upload.html.erb b/apps/workbench/app/views/collections/_show_upload.html.erb
index 0e1f760..be6cf77 100644
--- a/apps/workbench/app/views/collections/_show_upload.html.erb
+++ b/apps/workbench/app/views/collections/_show_upload.html.erb
@@ -23,11 +23,15 @@
</div>
<div ng-show="uploader.state === 'Idle' && uploader.stateReason"
class="alert alert-success"
- ><i class="fa fa-flag-checkered"></i> {{uploader.stateReason}}
+ ><i class="fa fa-fw fa-flag-checkered"></i> {{uploader.stateReason}}
</div>
<div ng-show="uploader.state === 'Failed'"
class="alert alert-danger"
- ><i class="fa fa-warning"></i> {{uploader.stateReason}}
+ ><i class="fa fa-fw fa-warning"></i> {{uploader.stateReason}}
+ </div>
+ <div ng-show="uploader.state === 'Stopped'"
+ class="alert alert-info"
+ ><i class="fa fa-fw fa-info"></i> Paused. Click the Start button to resume uploading.
</div>
</div>
</div>
commit d013a55fb81f2dc7bdd521988b862cc54b7fabb5
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Dec 5 17:45:05 2014 -0500
3781: Tweak link text. Remove redundant title attributes.
diff --git a/apps/workbench/app/views/projects/show.html.erb b/apps/workbench/app/views/projects/show.html.erb
index 070a2a1..0cab117 100644
--- a/apps/workbench/app/views/projects/show.html.erb
+++ b/apps/workbench/app/views/projects/show.html.erb
@@ -18,14 +18,13 @@
action_href: actions_path(id: @object.uuid),
action_method: 'post',
action_data: {selection_param: 'selection[]', copy_selections_into_project: @object.uuid, success: 'page-refresh'}.to_json),
- { remote: true, title: "Copy a collection from another project into this one", data: {'event-after-select' => 'page-refresh', 'toggle' => 'dropdown'} }) do %>
- <i class="fa fa-fw fa-clipboard"></i> Copy data from a different project
+ { remote: true, data: {'event-after-select' => 'page-refresh', 'toggle' => 'dropdown'} }) do %>
+ <i class="fa fa-fw fa-clipboard"></i> Copy data from another project
<% end %>
</li>
<li>
<%= link_to(collections_path(options: {ensure_unique_name: true}, collection: {manifest_text: "", name: "New collection", owner_uuid: @object.uuid}, redirect_to_anchor: 'Upload'), {
method: 'post',
- title: "Upload files into a new collection",
data: {toggle: 'dropdown'}}) do %>
<i class="fa fa-fw fa-upload"></i> Upload files from my computer
<% end %>
commit f08c7181ff8a90060c8184f04d7d3da1e856c336
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Dec 5 13:07:48 2014 -0500
3781: Fix more {==,!=} -> {===,!==}.
diff --git a/apps/workbench/app/assets/javascripts/arvados_client.js b/apps/workbench/app/assets/javascripts/arvados_client.js
index b3f18ad..63f1de1 100644
--- a/apps/workbench/app/assets/javascripts/arvados_client.js
+++ b/apps/workbench/app/assets/javascripts/arvados_client.js
@@ -22,7 +22,7 @@ function ArvadosClient(arvadosApiToken, arvadosDiscoveryUri) {
var meth = discoveryDoc.resources[controller].methods[action];
var data = $.extend({}, params, {_method: meth.httpMethod});
$.each(data, function(k, v) {
- if (typeof(v) == 'object') {
+ if (typeof(v) === 'object') {
data[k] = JSON.stringify(v);
}
});
diff --git a/apps/workbench/app/views/collections/_show_upload.html.erb b/apps/workbench/app/views/collections/_show_upload.html.erb
index d0ef730..0e1f760 100644
--- a/apps/workbench/app/views/collections/_show_upload.html.erb
+++ b/apps/workbench/app/views/collections/_show_upload.html.erb
@@ -8,12 +8,12 @@
<div class="col-sm-4">
<input type="file" multiple ng-model="incoming" onchange="angular.element(this).scope().addFilesToQueue(this.files); $(this).val('');">
<div class="btn-group btn-group-sm" role="group" style="margin-top: 1.5em">
- <button type="button" class="btn btn-default" ng-click="stop()" ng-disabled="uploader.state != 'Running'"><i class="fa fa-fw fa-pause"></i> Pause</button>
- <button type="button" class="btn btn-primary" ng-click="go()" ng-disabled="uploader.state == 'Running' || countInStates(['Paused', 'Queued']) == 0"><i class="fa fa-fw fa-play"></i> Start</button>
+ <button type="button" class="btn btn-default" ng-click="stop()" ng-disabled="uploader.state !== 'Running'"><i class="fa fa-fw fa-pause"></i> Pause</button>
+ <button type="button" class="btn btn-primary" ng-click="go()" ng-disabled="uploader.state === 'Running' || countInStates(['Paused', 'Queued']) === 0"><i class="fa fa-fw fa-play"></i> Start</button>
</div>
</div>
<div class="col-sm-8">
- <div ng-show="uploader.state == 'Running'"
+ <div ng-show="uploader.state === 'Running'"
class="alert alert-info"
><i class="fa fa-gear"></i>
Upload in progress.
@@ -21,11 +21,11 @@
{{countInStates(['Done'])}} file{{countInStates(['Done'])>1?'s':''}} finished.
</span>
</div>
- <div ng-show="uploader.state == 'Idle' && uploader.stateReason"
+ <div ng-show="uploader.state === 'Idle' && uploader.stateReason"
class="alert alert-success"
><i class="fa fa-flag-checkered"></i> {{uploader.stateReason}}
</div>
- <div ng-show="uploader.state == 'Failed'"
+ <div ng-show="uploader.state === 'Failed'"
class="alert alert-danger"
><i class="fa fa-warning"></i> {{uploader.stateReason}}
</div>
@@ -55,7 +55,7 @@
<span class="progress-bar" style="width: {{upload.progress}}%"></span>
</div>
</div>
- <div class="col-sm-4" ng-class="{lighten: upload.state != 'Uploading'}">
+ <div class="col-sm-4" ng-class="{lighten: upload.state !== 'Uploading'}">
{{upload.statistics}}
</div>
</div>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list