Skip to content

Commit

Permalink
start work on workflow tool cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
anatskiy committed Nov 28, 2017
1 parent 68795e4 commit 4d94fb5
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 72 deletions.
38 changes: 38 additions & 0 deletions client/galaxy/scripts/mvc/workflow/workflow-node.js
@@ -1,3 +1,4 @@
import Utils from "utils/utils";
import NodeView from "mvc/workflow/workflow-view-node";
var Node = Backbone.Model.extend({
initialize: function(app, attr) {
Expand Down Expand Up @@ -129,6 +130,43 @@ var Node = Backbone.Model.extend({
t.redraw();
});
},
clone: function() {
var self = this;
var copiedData = {
name: this.name,
label: this.label,
annotation: this.annotation,
post_job_actions: this.post_job_actions,
tool_state: this.tool_state
};
var node = this.workflow.create_node(
this.type, this.name, this.content_id
);

// console.log('node', this);

Utils.request({
type: "POST",
url: `${Galaxy.root}api/workflows/build_module`,
data: {
type: this.type,
tool_id: this.content_id,
_: "true"
},
success: function(data) {
var newData = Object.assign({}, data, copiedData);
newData.config_form.state_inputs = copiedData.tool_state;

// console.log('data', data);
// console.log('copiedData', copiedData);
// console.log('newData', newData);

node.init_field_data(newData);
node.update_field_data(newData);
self.workflow.activate_node(node);
}
});
},
destroy: function() {
$.each(this.input_terminals, (k, t) => {
t.destroy();
Expand Down
7 changes: 7 additions & 0 deletions client/galaxy/scripts/mvc/workflow/workflow-view.js
Expand Up @@ -763,6 +763,13 @@ export default Backbone.View.extend({
// Fix width to computed width
// Now add floats
var buttons = $("<div class='buttons' style='float: right;'></div>");
buttons.append(
$("<div/>")
.addClass("fa-icon-button fa fa-files-o")
.click(e => {
node.clone();
})
);
buttons.append(
$("<div/>")
.addClass("fa-icon-button fa fa-times")
Expand Down
86 changes: 17 additions & 69 deletions client/yarn.lock
Expand Up @@ -2245,11 +2245,7 @@ ee-first@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"

electron-to-chromium@^1.2.7:
version "1.3.27"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d"

electron-to-chromium@^1.3.24:
electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.24:
version "1.3.25"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz#453b21009836d0997d86035601ff6cae4791c460"

Expand Down Expand Up @@ -2478,9 +2474,9 @@ espower-location-detector@^1.0.0:
source-map "^0.5.0"
xtend "^4.0.0"

esprima@^1.0.3:
version "1.2.5"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.2.5.tgz#0993502feaf668138325756f30f9a51feeec11e9"
esprima@^1.0.3, "esprima@~ 1.0.2", esprima@~1.0.2:
version "1.0.4"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad"

esprima@^2.6.0:
version "2.7.3"
Expand All @@ -2490,10 +2486,6 @@ esprima@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804"

"esprima@~ 1.0.2", esprima@~1.0.2:
version "1.0.4"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad"

esprima@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.1.1.tgz#5b6f1547f4d102e670e140c509be6771d6aeb549"
Expand Down Expand Up @@ -4787,18 +4779,14 @@ minimatch@~0.2.11, minimatch@~0.2.12:
lru-cache "2"
sigmund "~1.0.0"

minimist@0.0.8:
minimist@0.0.8, minimist@~0.0.1:
version "0.0.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"

minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"

minimist@~0.0.1:
version "0.0.10"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"

mkdirp@0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.0.tgz#1d73076a6df986cd9344e15e71fcc05a4c9abf12"
Expand Down Expand Up @@ -5214,7 +5202,7 @@ os-locale@^2.0.0:
lcid "^1.0.0"
mem "^1.1.0"

os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.1, os-tmpdir@~1.0.2:
os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"

Expand Down Expand Up @@ -5898,11 +5886,7 @@ preserve@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"

prettier@^1.7.0:
version "1.8.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.8.1.tgz#91064d778c08c85ac1cbe6b23195c34310d039f9"

prettier@^1.7.4:
prettier@^1.7.0, prettier@^1.7.4:
version "1.8.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.8.2.tgz#bff83e7fd573933c607875e5ba3abbdffb96aeb8"

Expand Down Expand Up @@ -6067,16 +6051,7 @@ raw-body@2.3.2:
iconv-lite "0.4.19"
unpipe "1.0.0"

rc@^1.0.1, rc@^1.1.6:
version "1.2.2"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.2.tgz#d8ce9cb57e8d64d9c7badd9876c7c34cbe3c7077"
dependencies:
deep-extend "~0.4.0"
ini "~1.3.0"
minimist "^1.2.0"
strip-json-comments "~2.0.1"

rc@^1.1.7:
rc@^1.0.1, rc@^1.1.6, rc@^1.1.7:
version "1.2.1"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.1.tgz#2e03e8e42ee450b8cb3dce65be1bf8974e1dfd95"
dependencies:
Expand Down Expand Up @@ -6137,7 +6112,7 @@ read-pkg@^2.0.0:
normalize-package-data "^2.3.2"
path-type "^2.0.0"

readable-stream@1.1:
readable-stream@1.1, readable-stream@~1.1.9:
version "1.1.13"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.13.tgz#f6eef764f514c89e2b9e23146a75ba106756d23e"
dependencies:
Expand Down Expand Up @@ -6167,15 +6142,6 @@ readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable
string_decoder "~1.0.3"
util-deprecate "~1.0.1"

readable-stream@~1.1.9:
version "1.1.14"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9"
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.1"
isarray "0.0.1"
string_decoder "~0.10.x"

readdirp@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78"
Expand Down Expand Up @@ -6410,13 +6376,7 @@ resolve@1.3.2:
dependencies:
path-parse "^1.0.5"

resolve@^1.1.6, resolve@^1.1.7:
version "1.4.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86"
dependencies:
path-parse "^1.0.5"

resolve@^1.4.0:
resolve@^1.1.6, resolve@^1.1.7, resolve@^1.4.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36"
dependencies:
Expand Down Expand Up @@ -6714,7 +6674,11 @@ source-map@0.1.34:
dependencies:
amdefine ">=0.0.4"

source-map@0.X, "source-map@>= 0.1.2", source-map@^0.6.1:
source-map@0.X, source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"

"source-map@>= 0.1.2", source-map@^0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"

Expand All @@ -6724,10 +6688,6 @@ source-map@^0.1.38, source-map@^0.1.40, source-map@~0.1.33, source-map@~0.1.7:
dependencies:
amdefine ">=0.0.4"

source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"

source-map@~0.4.1:
version "0.4.4"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
Expand Down Expand Up @@ -6980,18 +6940,12 @@ supports-color@^3.1.0, supports-color@^3.2.3:
dependencies:
has-flag "^1.0.0"

supports-color@^4.0.0, supports-color@^4.4.0:
supports-color@^4.0.0, supports-color@^4.2.1, supports-color@^4.4.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b"
dependencies:
has-flag "^2.0.0"

supports-color@^4.2.1:
version "4.4.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e"
dependencies:
has-flag "^2.0.0"

svgo@^0.7.0:
version "0.7.2"
resolved "https://registry.yarnpkg.com/svgo/-/svgo-0.7.2.tgz#9f5772413952135c6fefbf40afe6a4faa88b4bb5"
Expand Down Expand Up @@ -7140,18 +7094,12 @@ tiny-lr-fork@0.0.5:
noptify "~0.0.3"
qs "~0.5.2"

tmp@0.0.31:
tmp@0.0.31, tmp@0.0.x:
version "0.0.31"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7"
dependencies:
os-tmpdir "~1.0.1"

tmp@0.0.x:
version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
dependencies:
os-tmpdir "~1.0.2"

to-array@0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/to-array/-/to-array-0.1.4.tgz#17e6c11f73dd4f3d74cda7a4ff3238e9ad9bf890"
Expand Down
2 changes: 1 addition & 1 deletion static/scripts/bundled/workflow.bundled.js

Large diffs are not rendered by default.

0 comments on commit 4d94fb5

Please sign in to comment.