rbbt-rest 1.6.28 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/entity.rb +71 -1
- data/lib/rbbt/rest/entity/render.rb +3 -2
- data/lib/rbbt/rest/knowledge_base.rb +81 -28
- data/lib/rbbt/rest/main.rb +3 -0
- data/lib/rbbt/rest/workflow.rb +1 -1
- data/lib/rbbt/rest/workflow/jobs.rb +5 -4
- data/share/views/compass/app.sass +21 -11
- data/share/views/layout/footer.haml +0 -1
- data/share/views/layout/header.haml +9 -6
- data/share/views/layout/top_menu.haml +1 -0
- data/share/views/partials/table.haml +7 -1
- data/share/views/public/js/_ajax_replace.js +2 -0
- data/share/views/public/js/defer.js +1 -1
- data/share/views/public/js/helpers.js +89 -18
- data/share/views/public/js/rbbt.aesthetics.js +145 -34
- data/share/views/public/js/rbbt.basic.js +20 -0
- data/share/views/public/js/rbbt.entity.js +12 -2
- data/share/views/public/js/rbbt.entity_list.js +51 -5
- data/share/views/public/js/rbbt.exception.js +9 -1
- data/share/views/public/js/rbbt.job.js +2 -2
- data/share/views/public/js/rbbt.js +5 -1
- data/share/views/public/js/rbbt.knowledge_base.js +40 -0
- data/share/views/public/js/rbbt.modal.js +82 -75
- data/share/views/public/js/rbbt.plots.js +276 -0
- data/share/views/public/js/rbbt/list.js +2 -2
- data/share/views/public/plugins/cola/js/cola.v3.min.js +3 -0
- data/share/views/public/plugins/d3js/js/d3.js +9503 -0
- data/share/views/public/plugins/d3js/js/d3js.min.js +5 -0
- data/share/views/public/plugins/mithril-node-render/js/index.js +115 -0
- data/share/views/public/plugins/mithril/js/mithril.js +212 -77
- data/share/views/public/plugins/mithril/js/mithril.min.js +2 -2
- data/share/views/public/plugins/mithril/js/mithril.min.js.map +1 -1
- data/share/views/public/plugins/nvd3/css/nv.d3.css +641 -0
- data/share/views/public/plugins/nvd3/js/nv.d3.js +13298 -0
- data/share/views/public/plugins/svg-pan-zoom/js/svg-pan-zoom.js +1861 -0
- data/share/views/tools/nvd3.haml +16 -0
- data/share/views/tools/nvd3/chart.haml +55 -0
- data/share/views/tools/nvd3/histogram.haml +19 -0
- data/share/views/tools/nvd3/pie.haml +24 -0
- data/share/views/tools/nvd3/scatter.haml +33 -0
- data/share/views/wait.haml +2 -2
- metadata +15 -3
- data/share/views/public/plugins/d3js/d3js.min.js +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c26433848653c8f1bd15c43ca516eed2e6d9eaa9
|
4
|
+
data.tar.gz: a92d6b2af8de46ba913ad5cbf8d04da099ff2df1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df25f492e6e7e206899526ffe96b5afcdeb9b96b1dcc119ca491be465c5bb3d512c7beed852171ee8bc4035d2c083d80da8f5fa4d9710d6cb18ea5026ab65c0a
|
7
|
+
data.tar.gz: dcc46801b37da11055bc42e55212884b169f590e90848f7e203e43b5efc6f848554fd6dec6b68008b9fd28633e605930d811180317096240d35f95b1f0fb9b3d
|
data/lib/rbbt/rest/entity.rb
CHANGED
@@ -75,7 +75,7 @@ module Sinatra
|
|
75
75
|
|
76
76
|
@entity = entity
|
77
77
|
|
78
|
-
entity_render(entity)
|
78
|
+
entity_render(entity, @clean_params)
|
79
79
|
end
|
80
80
|
|
81
81
|
get '/entity_action/:entity_type/:action/:entity' do
|
@@ -429,6 +429,76 @@ module Sinatra
|
|
429
429
|
redirect to(Entity::REST.entity_map_url(new_id, entity_type, column))
|
430
430
|
end
|
431
431
|
|
432
|
+
#{{{{{{{{{{{{{{
|
433
|
+
#{{{ PROPERTIES
|
434
|
+
#{{{{{{{{{{{{{{
|
435
|
+
|
436
|
+
get '/entity_property/:property/:entity_type/:entity' do
|
437
|
+
entity_type = consume_parameter :entity_type
|
438
|
+
entity = consume_parameter :entity
|
439
|
+
property = consume_parameter :property
|
440
|
+
args = consume_parameter :args
|
441
|
+
|
442
|
+
if args.nil?
|
443
|
+
args = []
|
444
|
+
else
|
445
|
+
args = begin
|
446
|
+
JSON.parse(args)
|
447
|
+
rescue
|
448
|
+
args
|
449
|
+
end
|
450
|
+
end
|
451
|
+
|
452
|
+
case args
|
453
|
+
when Hash
|
454
|
+
args = [args]
|
455
|
+
when String
|
456
|
+
args = args.split(/[,\|]/)
|
457
|
+
end
|
458
|
+
|
459
|
+
entity_type = Entity::REST.restore_element(entity_type)
|
460
|
+
|
461
|
+
entity = setup_entity(entity_type, entity, @clean_params)
|
462
|
+
|
463
|
+
content_type "application/json"
|
464
|
+
halt 200, entity.send(property,*args).to_json
|
465
|
+
end
|
466
|
+
|
467
|
+
get '/entity_list_property/:property/:entity_type/:list_id' do
|
468
|
+
entity_type = consume_parameter :entity_type
|
469
|
+
list_id = consume_parameter :list_id
|
470
|
+
property = consume_parameter :property
|
471
|
+
|
472
|
+
args = consume_parameter :args
|
473
|
+
|
474
|
+
if args.nil?
|
475
|
+
args = []
|
476
|
+
else
|
477
|
+
args = begin
|
478
|
+
JSON.parse(args)
|
479
|
+
rescue
|
480
|
+
args
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
484
|
+
case args
|
485
|
+
when Hash
|
486
|
+
args = [args]
|
487
|
+
when String
|
488
|
+
args = args.split(/[,\|]/)
|
489
|
+
end
|
490
|
+
|
491
|
+
|
492
|
+
entity_type = Entity::REST.restore_element(entity_type)
|
493
|
+
list_id = Entity::REST.restore_element(list_id)
|
494
|
+
|
495
|
+
list = Entity::List.load_list(entity_type.split(":").first, list_id, user)
|
496
|
+
|
497
|
+
content_type "application/json"
|
498
|
+
halt 200, list.send(property, *args).to_json
|
499
|
+
end
|
500
|
+
|
501
|
+
|
432
502
|
#{{{{{{{{{{{{{{
|
433
503
|
#{{{ FAVOURITES
|
434
504
|
#{{{{{{{{{{{{{{
|
@@ -33,10 +33,11 @@ module EntityRESTHelpers
|
|
33
33
|
entity
|
34
34
|
end
|
35
35
|
|
36
|
-
def entity_render(entity)
|
36
|
+
def entity_render(entity, params = {})
|
37
37
|
template_file = locate_entity_template(entity)
|
38
38
|
|
39
|
-
|
39
|
+
params = {} if params.nil?
|
40
|
+
locals = {:entity => entity}.merge(params)
|
40
41
|
|
41
42
|
layout_file = layout ? locate_template("layout") : nil
|
42
43
|
|
@@ -87,14 +87,44 @@ module Sinatra
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
get '/knowledge_base/:name/:database/subset' do
|
90
|
+
#get '/knowledge_base/:name/:database/subset' do
|
91
|
+
# name = consume_parameter :name
|
92
|
+
# database = consume_parameter :database
|
93
|
+
# source = consume_parameter :source
|
94
|
+
# target = consume_parameter :target
|
95
|
+
|
96
|
+
# source = source == "all" ? :all : source.split(@array_separator) if source
|
97
|
+
# target = target == "all" ? :all : target.split(@array_separator) if target
|
98
|
+
# entities = { :source => source, :target => target }
|
99
|
+
|
100
|
+
# kb = get_knowledge_base name
|
101
|
+
# subset = kb.subset(database, entities)
|
102
|
+
# case @format
|
103
|
+
# when :tsv
|
104
|
+
# content_type "text/tab-separated-values"
|
105
|
+
# halt 200, subset.tsv.to_s
|
106
|
+
# when :html
|
107
|
+
# template_render('knowledge_base_partials/subset', {:subset => subset}, "Subset: #{ [name, database] }")
|
108
|
+
# when :json
|
109
|
+
# content_type :json
|
110
|
+
# halt 200, subset.source.to_json
|
111
|
+
# else
|
112
|
+
# content_type :text
|
113
|
+
# halt 200, subset.source * "\n"
|
114
|
+
# end
|
115
|
+
#end
|
116
|
+
|
117
|
+
route :get, :post, '/knowledge_base/:name/:database/subset' do
|
91
118
|
name = consume_parameter :name
|
92
119
|
database = consume_parameter :database
|
93
120
|
source = consume_parameter :source
|
94
121
|
target = consume_parameter :target
|
95
122
|
|
123
|
+
target = source if target.nil?
|
124
|
+
|
96
125
|
source = source == "all" ? :all : source.split(@array_separator) if source
|
97
126
|
target = target == "all" ? :all : target.split(@array_separator) if target
|
127
|
+
|
98
128
|
entities = { :source => source, :target => target }
|
99
129
|
|
100
130
|
kb = get_knowledge_base name
|
@@ -103,6 +133,9 @@ module Sinatra
|
|
103
133
|
when :tsv
|
104
134
|
content_type "text/tab-separated-values"
|
105
135
|
halt 200, subset.tsv.to_s
|
136
|
+
when :tsv_json
|
137
|
+
content_type :json
|
138
|
+
halt 200, subset.tsv.to_json
|
106
139
|
when :html
|
107
140
|
template_render('knowledge_base_partials/subset', {:subset => subset}, "Subset: #{ [name, database] }")
|
108
141
|
when :json
|
@@ -129,7 +162,14 @@ module Sinatra
|
|
129
162
|
entities = collection[type]
|
130
163
|
entities.each do |entity|
|
131
164
|
_matches = kb.children(database, entity)
|
132
|
-
|
165
|
+
type = _matches.target_type
|
166
|
+
next unless _matches and _matches.any?
|
167
|
+
if (acc[type])
|
168
|
+
acc[type].concat(_matches)
|
169
|
+
else
|
170
|
+
acc[type] = _matches
|
171
|
+
end
|
172
|
+
acc
|
133
173
|
end
|
134
174
|
acc
|
135
175
|
}
|
@@ -138,6 +178,11 @@ module Sinatra
|
|
138
178
|
content_type "text/tab-separated-values"
|
139
179
|
matches = matches.sort_by{|k,list| list.length }.last.last
|
140
180
|
halt 200, matches.tsv.to_s
|
181
|
+
when :tsv_json
|
182
|
+
content_type :json
|
183
|
+
halt 200, {}.to_json if matches.empty?
|
184
|
+
matches = matches.sort_by{|k,list| list.length }.last.last
|
185
|
+
halt 200, matches.tsv.to_json
|
141
186
|
when :html
|
142
187
|
template_render('knowledge_base_partials/matches', {:matches => matches}, "Collection Children: #{ [name, database] }")
|
143
188
|
when :json
|
@@ -166,7 +211,14 @@ module Sinatra
|
|
166
211
|
entities = collection[type]
|
167
212
|
entities.each do |entity|
|
168
213
|
_matches = kb.parents(database, entity)
|
169
|
-
|
214
|
+
type = _matches.target_type
|
215
|
+
next unless _matches and _matches.any?
|
216
|
+
if acc[type]
|
217
|
+
acc[type].concat(_matches)
|
218
|
+
else
|
219
|
+
acc[type] = _matches
|
220
|
+
end
|
221
|
+
acc
|
170
222
|
end
|
171
223
|
acc
|
172
224
|
}
|
@@ -175,6 +227,11 @@ module Sinatra
|
|
175
227
|
content_type "text/tab-separated-values"
|
176
228
|
matches = matches.sort_by{|k,list| list.length }.last.last
|
177
229
|
halt 200, matches.tsv.to_s
|
230
|
+
when :tsv_json
|
231
|
+
content_type :json
|
232
|
+
halt 200, {}.to_json if matches.empty?
|
233
|
+
matches = matches.sort_by{|k,list| list.length }.last.last
|
234
|
+
halt 200, matches.tsv.to_json
|
178
235
|
when :html
|
179
236
|
template_render('knowledge_base_partials/matches', {:matches => matches}, "Collection Parents: #{ [name, database] }")
|
180
237
|
when :json
|
@@ -236,34 +293,32 @@ module Sinatra
|
|
236
293
|
end
|
237
294
|
end
|
238
295
|
|
239
|
-
|
296
|
+
#{{{ Info
|
297
|
+
|
298
|
+
get '/knowledge_base/:name/:database/info' do
|
240
299
|
name = consume_parameter :name
|
241
300
|
database = consume_parameter :database
|
242
|
-
source = consume_parameter :source
|
243
|
-
target = consume_parameter :target
|
244
|
-
|
245
|
-
source = source == "all" ? :all : source.split(@array_separator) if source
|
246
|
-
target = target == "all" ? :all : target.split(@array_separator) if target
|
247
|
-
entities = { :source => source, :target => target }
|
248
301
|
|
249
302
|
kb = get_knowledge_base name
|
250
|
-
subset = kb.subset(database, entities)
|
251
|
-
case @format
|
252
|
-
when :tsv
|
253
|
-
content_type "text/tab-separated-values"
|
254
|
-
halt 200, subset.tsv.to_s
|
255
|
-
when :html
|
256
|
-
template_render('knowledge_base_partials/subset', {:subset => subset}, "Subset: #{ [name, database] }")
|
257
|
-
when :json
|
258
|
-
content_type :json
|
259
|
-
halt 200, subset.source.to_json
|
260
|
-
else
|
261
|
-
content_type :text
|
262
|
-
halt 200, subset.source * "\n"
|
263
|
-
end
|
264
|
-
end
|
265
303
|
|
266
|
-
|
304
|
+
source = kb.source(database)
|
305
|
+
target = kb.target(database)
|
306
|
+
source_type = kb.source_type(database)
|
307
|
+
target_type = kb.target_type(database)
|
308
|
+
source_entity_options = kb.entity_options_for source_type
|
309
|
+
target_entity_options = kb.entity_options_for target_type
|
310
|
+
|
311
|
+
info = {
|
312
|
+
:source => source,
|
313
|
+
:target => target,
|
314
|
+
:source_type => source_type,
|
315
|
+
:target_type => target_type,
|
316
|
+
:source_entity_options => source_entity_options,
|
317
|
+
:target_entity_options => target_entity_options,
|
318
|
+
}
|
319
|
+
|
320
|
+
halt 200, info.to_json
|
321
|
+
end
|
267
322
|
|
268
323
|
get '/knowledge_base/info/:name/:database/:pair' do
|
269
324
|
name = consume_parameter :name
|
@@ -459,7 +514,6 @@ module Sinatra
|
|
459
514
|
found = kb.identify database, entity
|
460
515
|
raise ParameterException, "Entity #{entity} was not found" unless found
|
461
516
|
|
462
|
-
iii kb.children(database, found)
|
463
517
|
list = kb.children(database, found).target_entity
|
464
518
|
|
465
519
|
content_type "application/json"
|
@@ -475,7 +529,6 @@ module Sinatra
|
|
475
529
|
found = kb.identify database, entity
|
476
530
|
raise ParameterException, "Entity #{entity} was not found" unless found
|
477
531
|
|
478
|
-
iii kb.parents(database, found)
|
479
532
|
list = kb.parents(database, found).target_entity
|
480
533
|
|
481
534
|
content_type "application/json"
|
data/lib/rbbt/rest/main.rb
CHANGED
@@ -6,6 +6,7 @@ require 'ruby-prof'
|
|
6
6
|
|
7
7
|
require 'sinatra/base'
|
8
8
|
require 'sinatra/cross_origin'
|
9
|
+
require "sinatra/multi_route"
|
9
10
|
require 'json'
|
10
11
|
|
11
12
|
module Sinatra
|
@@ -36,6 +37,8 @@ module Sinatra
|
|
36
37
|
|
37
38
|
def self.registered(base)
|
38
39
|
base.module_eval do
|
40
|
+
register Sinatra::MultiRoute
|
41
|
+
|
39
42
|
helpers RbbtRESTHelpers
|
40
43
|
register Sinatra::RbbtAuth
|
41
44
|
|
data/lib/rbbt/rest/workflow.rb
CHANGED
@@ -58,10 +58,11 @@ module WorkflowRESTHelpers
|
|
58
58
|
task_inputs
|
59
59
|
end
|
60
60
|
|
61
|
-
def show_result_html(result, workflow, task, jobname = nil, job = nil)
|
61
|
+
def show_result_html(result, workflow, task, jobname = nil, job = nil, params = nil)
|
62
|
+
params ||= {}
|
62
63
|
result_type = workflow.task_info(task)[:result_type]
|
63
64
|
result_description = workflow.task_info(task)[:result_description]
|
64
|
-
workflow_render('job_result', workflow, task, :result => result, :type => result_type, :description => result_description, :jobname => jobname, :job => job)
|
65
|
+
workflow_render('job_result', workflow, task, {:result => result, :type => result_type, :description => result_description, :jobname => jobname, :job => job}.merge(params))
|
65
66
|
end
|
66
67
|
|
67
68
|
def show_exec_result(result, workflow, task)
|
@@ -92,12 +93,12 @@ module WorkflowRESTHelpers
|
|
92
93
|
end
|
93
94
|
end
|
94
95
|
|
95
|
-
def show_result(job, workflow, task)
|
96
|
+
def show_result(job, workflow, task, params = nil)
|
96
97
|
return show_result_html nil, workflow, task, job.name, job if @fragment
|
97
98
|
|
98
99
|
case format.to_sym
|
99
100
|
when :html
|
100
|
-
show_result_html job.load, workflow, task, job.name, job
|
101
|
+
show_result_html job.load, workflow, task, job.name, job, params
|
101
102
|
when :table
|
102
103
|
halt 200, tsv2html(job.path, :url => "/" << [workflow.to_s, task, job.name] * "/")
|
103
104
|
when :entities
|
@@ -18,6 +18,7 @@ $subtle-font: rgba(0,0,0,0.30)
|
|
18
18
|
|
19
19
|
body
|
20
20
|
background: none repeat scroll 0% 0% #F7F7F7
|
21
|
+
font-family: Helvetica
|
21
22
|
|
22
23
|
#content
|
23
24
|
padding: 0px 48px 0 48px
|
@@ -99,7 +100,11 @@ body
|
|
99
100
|
.action_content
|
100
101
|
clear: both
|
101
102
|
|
102
|
-
|
103
|
+
.action_controller > .action_menu
|
104
|
+
width: calc(100% - 48px)
|
105
|
+
& > .button
|
106
|
+
max-width: 25%
|
107
|
+
|
103
108
|
.entity_card, .entity_list_card, .action_card
|
104
109
|
> .content > .ui.basic.segment, > .action_content > .ui.basic.segment
|
105
110
|
padding: 0px
|
@@ -146,14 +151,17 @@ body
|
|
146
151
|
width: 10em
|
147
152
|
display: inline-block
|
148
153
|
|
149
|
-
.figure
|
150
|
-
|
151
|
-
margin-
|
152
|
-
background: white
|
153
|
-
border: 1px solid rgba(0,0,0,0.12)
|
154
|
-
padding: 4px
|
154
|
+
.figure
|
155
|
+
margin-bottom: 1em
|
156
|
+
margin-top: 1em
|
155
157
|
.title
|
156
158
|
color: $subtle-font
|
159
|
+
&.float
|
160
|
+
float: left
|
161
|
+
margin-right: 32px
|
162
|
+
background: white
|
163
|
+
border: 1px solid rgba(0,0,0,0.12)
|
164
|
+
padding: 4px
|
157
165
|
|
158
166
|
.tool_menu
|
159
167
|
margin-bottom: 0px
|
@@ -227,10 +235,6 @@ a.entity.highlight
|
|
227
235
|
@extend .bulleted
|
228
236
|
font-weight: bold
|
229
237
|
|
230
|
-
.figure
|
231
|
-
margin-bottom: 1em
|
232
|
-
margin-top: 1em
|
233
|
-
|
234
238
|
|
235
239
|
a.entity[data-aes-color]:not([data-aes-color=none])
|
236
240
|
@extend .bulleted
|
@@ -412,3 +416,9 @@ body
|
|
412
416
|
|
413
417
|
.list_comparison > li > a
|
414
418
|
margin-left: 1em
|
419
|
+
|
420
|
+
td
|
421
|
+
&.true
|
422
|
+
color: green
|
423
|
+
&.false
|
424
|
+
color: red
|
@@ -10,6 +10,7 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
- record_css '/plugins/semantic-ui/dist/semantic.min.css'
|
13
|
+
- record_css '/plugins/nvd3/css/nv.d3.css'
|
13
14
|
-# record_css '/plugins/jquery-ui/css/custom-theme/jquery-ui-1.8.14.custom.css'
|
14
15
|
- record_css '/stylesheets/app'
|
15
16
|
= serve_css
|
@@ -21,14 +22,11 @@
|
|
21
22
|
var main_url = window.location.toString();
|
22
23
|
var production = #{production? ? "true" : "false"};
|
23
24
|
|
24
|
-
-#= link_js "http://cdnjs.cloudflare.com/ajax/libs/mithril/0.1.28/mithril.min.js"
|
25
|
-
|
26
25
|
- record_js '/js/defer'
|
27
26
|
- record_js "/plugins/mithril/js/mithril.js"
|
28
|
-
|
27
|
+
-# record_js "/plugins/requirejs/js/require.js"
|
29
28
|
= serve_js
|
30
|
-
|
31
|
-
:javascript
|
29
|
+
-#:javascript
|
32
30
|
requirejs.config({baseUrl: '/js-find'})
|
33
31
|
|
34
32
|
|
@@ -41,6 +39,11 @@
|
|
41
39
|
- record_js '/plugins/semantic-ui/dist/semantic.min.js'
|
42
40
|
- record_js '/plugins/FileSaver/js/FileSaver.js'
|
43
41
|
- record_js '/plugins/color-js/color.js'
|
42
|
+
- record_js '/plugins/d3js/js/d3js.min.js'
|
43
|
+
- record_js '/plugins/nvd3/js/nv.d3.js'
|
44
|
+
- record_js '/plugins/svg-pan-zoom/js/svg-pan-zoom.js'
|
45
|
+
- record_js '/plugins/cola/js/cola.v3.min.js'
|
46
|
+
- record_js '/plugins/mithril-node-render/js/index.js'
|
44
47
|
|
45
48
|
- %w(helpers _md5 _ajax_replace _ellipsis).each do |file|
|
46
49
|
- record_js "/js-find/#{ file }"
|
@@ -49,7 +52,7 @@
|
|
49
52
|
- %w(dom_update fragment actions table list map reveal).each do |file|
|
50
53
|
- record_js "/js-find/rbbt/#{ file }"
|
51
54
|
|
52
|
-
- %w(rbbt rbbt.basic rbbt.exception rbbt.job rbbt.page rbbt.entity rbbt.entity_list rbbt.entity_map rbbt.views rbbt.favourites rbbt.knowledge_base rbbt.aesthetics rbbt.modal).each do |file|
|
55
|
+
- %w(rbbt rbbt.basic rbbt.exception rbbt.job rbbt.page rbbt.entity rbbt.entity_list rbbt.entity_map rbbt.views rbbt.favourites rbbt.knowledge_base rbbt.aesthetics rbbt.plots rbbt.modal).each do |file|
|
53
56
|
- record_js "/js-find/#{ file }"
|
54
57
|
|
55
58
|
- record_js "/js-find/app"
|