rbbt-rest 1.8.20 → 1.8.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/main.rb +0 -1
- data/lib/rbbt/rest/workflow.rb +12 -0
- data/lib/rbbt/rest/workflow/jobs.rb +3 -3
- data/share/views/error.haml +2 -2
- data/share/views/job_info.haml +5 -2
- data/share/views/public/js/rbbt.entity.basic.js +1 -1
- data/share/views/public/js/rbbt.plots/rbbt.plots.aes.js +30 -12
- data/share/views/public/js/rbbt.plots/rbbt.plots.graph.js +22 -2
- data/share/views/tools/nvd3/pie.haml +20 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 185572829398c880b3d6cb1e2a6d4dea0ae6ca9f
|
4
|
+
data.tar.gz: bb37ea54b1cefc0c4802b3d8c45d0ad350ad8cde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fafe374d7bbc2f9100c39d7a9981ae89bd855c29262696c25fc325eadc157a17e443aa2cab0f448f8211d6cefca7ae0115f24607ed4fc32fe4b14325f05c7a92
|
7
|
+
data.tar.gz: 3ded826d68949dbb5e61b9690825ffec277ccbbd488f3dbbbad35a5166c454ecb24ae6198e445d8257ee4235e86937de2f045d3f154ba48f0d781745a90c022c
|
data/lib/rbbt/rest/main.rb
CHANGED
data/lib/rbbt/rest/workflow.rb
CHANGED
@@ -109,6 +109,8 @@ module Sinatra
|
|
109
109
|
|
110
110
|
raise Workflow::TaskNotFoundException.new workflow, task unless workflow.tasks.include? task.to_sym
|
111
111
|
|
112
|
+
execution_type = execution_type(workflow, task)
|
113
|
+
|
112
114
|
task_parameters = consume_task_parameters(workflow, task, params)
|
113
115
|
|
114
116
|
task_parameters[:jobname] = jobname
|
@@ -126,6 +128,8 @@ module Sinatra
|
|
126
128
|
|
127
129
|
raise Workflow::TaskNotFoundException.new workflow, task unless workflow.tasks.include? task.to_sym
|
128
130
|
|
131
|
+
execution_type = execution_type(workflow, task)
|
132
|
+
|
129
133
|
task_parameters = consume_task_parameters(workflow, task, params)
|
130
134
|
|
131
135
|
issue_job(workflow, task, jobname, task_parameters)
|
@@ -137,6 +141,8 @@ module Sinatra
|
|
137
141
|
|
138
142
|
raise Workflow::TaskNotFoundException.new workflow, task unless workflow.tasks.include? task.to_sym
|
139
143
|
|
144
|
+
execution_type = execution_type(workflow, task)
|
145
|
+
|
140
146
|
job = workflow.load_id(File.join(task, job))
|
141
147
|
|
142
148
|
clean_job(workflow, job) and halt 200 if update.to_s == "clean"
|
@@ -176,6 +182,8 @@ module Sinatra
|
|
176
182
|
|
177
183
|
raise Workflow::TaskNotFoundException.new workflow, task unless workflow.tasks.include? task.to_sym
|
178
184
|
|
185
|
+
execution_type = execution_type(workflow, task)
|
186
|
+
|
179
187
|
job = workflow.load_id(File.join(task, job))
|
180
188
|
|
181
189
|
begin
|
@@ -211,6 +219,8 @@ module Sinatra
|
|
211
219
|
|
212
220
|
raise Workflow::TaskNotFoundException.new workflow, task unless workflow.tasks.include? task.to_sym
|
213
221
|
|
222
|
+
execution_type = execution_type(workflow, task)
|
223
|
+
|
214
224
|
job = workflow.load_id(File.join(task, job))
|
215
225
|
|
216
226
|
case format
|
@@ -231,6 +241,8 @@ module Sinatra
|
|
231
241
|
|
232
242
|
raise Workflow::TaskNotFoundException.new workflow, task unless workflow.tasks.include? task.to_sym
|
233
243
|
|
244
|
+
execution_type = execution_type(workflow, task)
|
245
|
+
|
234
246
|
job = workflow.load_id(File.join(task, job))
|
235
247
|
|
236
248
|
require 'mimemagic'
|
@@ -37,7 +37,7 @@ module WorkflowRESTHelpers
|
|
37
37
|
when workflow.asynchronous_exports.include?(task)
|
38
38
|
:asynchronous
|
39
39
|
else
|
40
|
-
raise "
|
40
|
+
raise "Access denied: no known export type for #{ workflow }##{ task }."
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -171,6 +171,8 @@ module WorkflowRESTHelpers
|
|
171
171
|
end
|
172
172
|
|
173
173
|
def issue_job(workflow, task, jobname = nil, params = {})
|
174
|
+
execution_type = execution_type(workflow, task)
|
175
|
+
|
174
176
|
inputs = prepare_job_inputs(workflow, task, params)
|
175
177
|
job = workflow.job(task, jobname, inputs)
|
176
178
|
|
@@ -179,8 +181,6 @@ module WorkflowRESTHelpers
|
|
179
181
|
clean_job(workflow, job) and clean = true if update.to_s == "clean"
|
180
182
|
recursive_clean_job(workflow, job) and clean = true if update.to_s == "recursive_clean"
|
181
183
|
|
182
|
-
execution_type = execution_type(workflow, task)
|
183
|
-
|
184
184
|
case execution_type.to_sym
|
185
185
|
when :exec
|
186
186
|
show_exec_result job.exec(:stream), workflow, task
|
data/share/views/error.haml
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
- if defined? job.info_file and File.exists? job.info_file and request.env["REQUEST_URI"].include? job.name
|
9
|
-
- clean_url = add_GET_param(request.env["REQUEST_URI"], "_update", "clean")
|
9
|
+
- clean_url = add_GET_param(remove_GET_param(request.env["REQUEST_URI"], "_layout"), "_update", "clean")
|
10
10
|
%a.ui.button.blue.clean(href=clean_url) Clean
|
11
11
|
- else
|
12
|
-
- clean_url = add_GET_param(request.env["REQUEST_URI"], "_update", "reload")
|
12
|
+
- clean_url = add_GET_param(remove_GET_param(request.env["REQUEST_URI"], "_layout"), "_update", "reload")
|
13
13
|
%a.ui.blue.button.reload(href=clean_url) Reload
|
14
14
|
|
15
15
|
- backtrace = job.info[:backtrace]
|
data/share/views/job_info.haml
CHANGED
@@ -9,9 +9,12 @@
|
|
9
9
|
- task_exports = workflow.synchronous_exports + workflow.asynchronous_exports
|
10
10
|
- task_exports = task_exports.collect{|t| t.to_s}
|
11
11
|
- info[:dependencies].each do |task,name,path|
|
12
|
-
-
|
12
|
+
- if Open.remote? path
|
13
|
+
- url = path.split("?").first
|
14
|
+
- else
|
15
|
+
- url = "/" + [workflow.to_s, task.to_s, name.to_s] * "/"
|
13
16
|
%li
|
14
|
-
(#{workflow}
|
17
|
+
(#{workflow}##{task})
|
15
18
|
- if task_exports.include? task.to_s
|
16
19
|
%a(href=url) #{ name }
|
17
20
|
- else
|
@@ -29,7 +29,7 @@ rbbt.entity_array.property = function(codes, type, info, name, args){
|
|
29
29
|
}
|
30
30
|
|
31
31
|
rbbt.entity_array.property = function(codes, type, info, name, args){
|
32
|
-
if (info.format && ! type.indexOf(":") < 0){
|
32
|
+
if (undefined !== info && info.format && ! type.indexOf(":") < 0){
|
33
33
|
type = type + ':' + info.format
|
34
34
|
}
|
35
35
|
var url = "/entity_list_property/" + name + "/" + type
|
@@ -41,9 +41,26 @@ rbbt.plots.aes.map_aesthetic = function(aes, mapper, map_obj){
|
|
41
41
|
}
|
42
42
|
}
|
43
43
|
|
44
|
-
rbbt.plots.aes.get_properties = function(list, rules){
|
44
|
+
rbbt.plots.aes.get_properties = function(list, rules, type, namespace){
|
45
|
+
if (undefined !== list.type) type = list.type
|
45
46
|
if (undefined === rules) rules == []
|
46
47
|
if (undefined === list.properties) list.properties = {}
|
48
|
+
|
49
|
+
if (undefined !== list.info){
|
50
|
+
info = list.info
|
51
|
+
}else{
|
52
|
+
info = {}
|
53
|
+
}
|
54
|
+
|
55
|
+
if (list.namespace && undefined === namespace){
|
56
|
+
namespace = list.namespace
|
57
|
+
}
|
58
|
+
|
59
|
+
if (undefined !== namespace && undefined === list.organism){
|
60
|
+
info.organism = namespace
|
61
|
+
info.namespace = namespace
|
62
|
+
}
|
63
|
+
|
47
64
|
var promises = []
|
48
65
|
forArray(rules, function(rule){
|
49
66
|
var name = rule.name
|
@@ -52,7 +69,7 @@ rbbt.plots.aes.get_properties = function(list, rules){
|
|
52
69
|
eval('extract='+extract)
|
53
70
|
}
|
54
71
|
|
55
|
-
if (rule.entity_type && rule.entity_type !=
|
72
|
+
if (rule.entity_type && rule.entity_type != type && rule.entity_type != list.format) return
|
56
73
|
|
57
74
|
if (rule.info){
|
58
75
|
var property = rule.property
|
@@ -60,8 +77,8 @@ rbbt.plots.aes.get_properties = function(list, rules){
|
|
60
77
|
var entry = rule.info
|
61
78
|
if (undefined === name) name = entry
|
62
79
|
|
63
|
-
var value =
|
64
|
-
if (undefined === value && entry == 'type') value =
|
80
|
+
var value = info[entry]
|
81
|
+
if (undefined === value && entry == 'type') value = type
|
65
82
|
if (undefined === value && entry == 'code') value = list.codes
|
66
83
|
|
67
84
|
deferred.resolve(value)
|
@@ -89,7 +106,7 @@ rbbt.plots.aes.get_properties = function(list, rules){
|
|
89
106
|
if (undefined === name) name = property
|
90
107
|
|
91
108
|
var deferred = m.deferred()
|
92
|
-
var tmp_promise = rbbt.entity_array.property(list.codes,
|
109
|
+
var tmp_promise = rbbt.entity_array.property(list.codes, type, info, property, args)
|
93
110
|
|
94
111
|
if (extract){ tmp_promise = tmp_promise.then(function(res){ return res.map(extract)}) }
|
95
112
|
|
@@ -115,13 +132,13 @@ rbbt.plots.aes.get_properties = function(list, rules){
|
|
115
132
|
var database = rule.parents
|
116
133
|
if (undefined === name) name = database
|
117
134
|
|
118
|
-
promise = rbbt.entity_array.parents(list.codes,
|
135
|
+
promise = rbbt.entity_array.parents(list.codes, type, database)
|
119
136
|
}else{
|
120
137
|
kb_type = 'children'
|
121
138
|
var database = rule.children
|
122
139
|
if (undefined === name) name = database
|
123
140
|
|
124
|
-
promise = rbbt.entity_array.children(list.codes,
|
141
|
+
promise = rbbt.entity_array.children(list.codes, type, database)
|
125
142
|
}
|
126
143
|
|
127
144
|
if (rule.field){
|
@@ -184,11 +201,12 @@ rbbt.plots.aes.get_properties = function(list, rules){
|
|
184
201
|
return m.sync(promises)
|
185
202
|
}
|
186
203
|
|
187
|
-
rbbt.plots.aes.set_aes = function(list, aes_rules){
|
204
|
+
rbbt.plots.aes.set_aes = function(list, aes_rules, type){
|
205
|
+
if (undefined !== list.type) type = list.type
|
188
206
|
if (undefined === list.aes) list.aes = {}
|
189
207
|
forArray(aes_rules, function(rule){
|
190
208
|
|
191
|
-
if (rule.entity_type && rule.entity_type !=
|
209
|
+
if (rule.entity_type && rule.entity_type != type) return
|
192
210
|
|
193
211
|
|
194
212
|
var name = rule.name
|
@@ -202,9 +220,9 @@ rbbt.plots.aes.set_aes = function(list, aes_rules){
|
|
202
220
|
return
|
203
221
|
}
|
204
222
|
|
205
|
-
if (undefined === property &&
|
206
|
-
if (undefined === property && name == 'type') property =
|
207
|
-
if (undefined === property && name == 'code') property = list.codes
|
223
|
+
if (undefined === property && undefined !== info && info[name]) property = info[name]
|
224
|
+
if (undefined === property && name == 'type') property = type
|
225
|
+
if (undefined === property && name == 'code') property = list.codes.slice()
|
208
226
|
if (undefined === property) return
|
209
227
|
|
210
228
|
var aes_values = rbbt.plots.aes.map_aesthetic(property, mapper, mapper_obj)
|
@@ -36,14 +36,32 @@ rbbt.plots.graph.get_entities = function(graph_model){
|
|
36
36
|
return graph_model
|
37
37
|
}
|
38
38
|
|
39
|
+
rbbt.plots.aes.complete_source_target = function(list){
|
40
|
+
if (undefined === list.aes.source && undefined === list.aes.source){
|
41
|
+
if (undefined === list.properties.source && undefined === list.properties.source){
|
42
|
+
var source = [];
|
43
|
+
var target = [];
|
44
|
+
forArray(list.codes, function(elem){
|
45
|
+
var parts = elem.split("~")
|
46
|
+
source.push(parts[0])
|
47
|
+
target.push(parts[1])
|
48
|
+
})
|
49
|
+
list.properties.source = source
|
50
|
+
list.properties.target = target
|
51
|
+
}
|
52
|
+
list.aes.source = list.properties.source
|
53
|
+
list.aes.target = list.properties.target
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
39
57
|
rbbt.plots.graph.update_aes = function(graph_model){
|
40
58
|
var data_promises = []
|
41
59
|
forHash(graph_model.entities, function(type, list){
|
42
60
|
data_promises.push(
|
43
61
|
|
44
|
-
rbbt.plots.aes.get_properties(list, graph_model.rules).
|
62
|
+
rbbt.plots.aes.get_properties(list, graph_model.rules, type, graph_model.namespace).
|
45
63
|
then(function(){
|
46
|
-
rbbt.plots.aes.set_aes(list, graph_model.aes_rules)
|
64
|
+
rbbt.plots.aes.set_aes(list, graph_model.aes_rules, type)
|
47
65
|
})
|
48
66
|
|
49
67
|
)
|
@@ -55,6 +73,8 @@ rbbt.plots.graph.update_aes = function(graph_model){
|
|
55
73
|
rbbt.plots.aes.get_properties(list, graph_model.edge_rules).
|
56
74
|
then(function(){
|
57
75
|
rbbt.plots.aes.set_aes(list, graph_model.edge_aes_rules)
|
76
|
+
}).then(function(){
|
77
|
+
rbbt.plots.aes.complete_source_target(list)
|
58
78
|
})
|
59
79
|
|
60
80
|
)
|
@@ -4,8 +4,14 @@
|
|
4
4
|
- resolution ||= 250
|
5
5
|
- title ||= "Piechart"
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
-# data.to_single if data.respond_to? :to_single and data.type != :single
|
8
|
+
-# values = data.collect{|k,v| {:key => k, :y => v} }
|
9
|
+
|
10
|
+
- data.to_single if data.respond_to? :to_single and data.type != :single and data.fields.length == 1
|
11
|
+
- if not data.respond_to? :type or data.type == :single
|
12
|
+
- values = data.collect{|k,v| {:key => k, :y => v} }
|
13
|
+
- else
|
14
|
+
- values = data.collect{|k,vs| i = {:key => k}; vs.zip(data.fields).each{|v,f| i[f] = v}; i }
|
9
15
|
|
10
16
|
- plot_data = values
|
11
17
|
|
@@ -15,10 +21,20 @@
|
|
15
21
|
var graph = nv.models.pieChart()
|
16
22
|
.x(function(d) { return d.key })
|
17
23
|
.y(function(d) { return d.y })
|
18
|
-
|
24
|
+
|
25
|
+
#{if data.respond_to? :fields and data.fields.include? 'color'
|
26
|
+
"graph.color(function(d){ return d.color } )"
|
27
|
+
else
|
28
|
+
"graph.color(d3.scale.category10().range())"
|
29
|
+
end
|
30
|
+
}
|
31
|
+
|
32
|
+
#{if data.respond_to? :fields and data.fields.include? 'url'
|
33
|
+
"graph.pie.dispatch.on('elementClick', function(d){ window.location = d.data.url})"
|
34
|
+
end
|
35
|
+
}
|
19
36
|
|
20
37
|
graph.tooltip.enabled(true)
|
21
38
|
EOF
|
22
39
|
|
23
40
|
= partial_render('tools/nvd3/chart', locals.merge(:plot_data => plot_data, :id => id, :resolution => resolution, :setup => setup))
|
24
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|