Skip to content

Commit

Permalink
Merge _uploadFtp functionality between collection and default uploads.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Jan 13, 2020
1 parent 66ab5c8 commit f6dbd24
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 30 deletions.
3 changes: 2 additions & 1 deletion client/galaxy/scripts/components/Upload/Collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ export default {
/** Success */
_eventSuccess: function(index, message) {
// var hdaId = message["outputs"][0]["id"];
var hids = _.pluck(message["outputs"], "hid");
var it = this.collection.get(index);
it.set({ percentage: 100, status: "success", hids: hids });
Expand Down Expand Up @@ -281,6 +280,8 @@ export default {
this.appModel.set({ percentage: 0, status: "success" });
this.counterRunning = this.counterAnnounce;
this.history_id = this.app.currentHistory();
// package ftp files separately, and remove them from queue
this._uploadFtp();
this.uploadbox.start();
this._updateStateForCounters();
},
Expand Down
29 changes: 0 additions & 29 deletions client/galaxy/scripts/components/Upload/Default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
<script>
import _l from "utils/localization";
import _ from "underscore";
import $ from "jquery";
import { getGalaxyInstance } from "app";
import UploadRow from "mvc/upload/default/default-row";
import UploadBoxMixin from "./UploadBoxMixin";
Expand Down Expand Up @@ -264,34 +263,6 @@ export default {
this.appModel.set("percentage", 0);
this._updateStateForCounters();
}
},
/** Package and upload ftp files in a single request */
_uploadFtp: function() {
var self = this;
var list = [];
this.collection.each(model => {
if (model.get("status") == "queued" && model.get("file_mode") == "ftp") {
self.uploadbox.remove(model.id);
list.push(model);
}
});
if (list.length > 0) {
$.uploadpost({
data: this.app.toData(list),
url: this.app.uploadPath,
success: function(message) {
_.each(list, model => {
self._eventSuccess(model.id);
});
},
error: function(message) {
_.each(list, model => {
self._eventError(model.id, message);
});
}
});
}
}
}
};
Expand Down
26 changes: 26 additions & 0 deletions client/galaxy/scripts/components/Upload/UploadBoxMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,32 @@ export default {
uploadSelect: function() {
this.uploadbox.select();
},
/** Package and upload ftp files in a single request */
_uploadFtp: function() {
const list = [];
this.collection.each(model => {
if (model.get("status") == "queued" && model.get("file_mode") == "ftp") {
this.uploadbox.remove(model.id);
list.push(model);
}
});
if (list.length > 0) {
$.uploadpost({
data: this.app.toData(list),
url: this.app.uploadPath,
success: message => {
_.each(list, model => {
this._eventSuccess(model.id, message);
});
},
error: message => {
_.each(list, model => {
self._eventError(model.id, message);
});
}
});
}
},
renderNewModel: function(model) {
// Turn backbone upload model into row model and place in table,
// render in next tick so table can respond first and dynamic
Expand Down

0 comments on commit f6dbd24

Please sign in to comment.