rbbt-rest 1.8.57 → 1.8.58
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/common/cache.rb +26 -0
- data/lib/rbbt/rest/common/misc.rb +3 -0
- data/lib/rbbt/rest/common/table.rb +8 -6
- data/lib/rbbt/rest/entity/render.rb +0 -3
- data/share/views/public/js/rbbt.basic.js +1 -0
- data/share/views/public/js/rbbt.plots/rbbt.plots.aes.js +30 -1
- data/share/views/public/js/rbbt.plots/rbbt.plots.graph.adapters.js +1 -1
- data/share/views/public/js/rbbt.plots/rbbt.plots.graph.mithril.js +3 -1
- 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: 114a1a6d890aa4e7fe21cb1559197c259dfbd0e9
|
|
4
|
+
data.tar.gz: 9702d3726a39dc13a1ca94bfc4c0c70a8ce5fa5d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e7067cc90ae02fb314db91c478442a8c5623aef250509828419e5b03ab6e9440fdeded8bcb9a7784ad103cd9511e7ba956bc73930d4a5e8c63a470679234360
|
|
7
|
+
data.tar.gz: 3617a5fd71a8418d89e1f2340fe7405d1fb06954b23d3832f3b90e9b36f16b3d448255229cc467086d050a7b080a6e19ea2d7e086c9f53d31294684bbbbcbbc1
|
|
@@ -101,6 +101,32 @@ module RbbtRESTHelpers
|
|
|
101
101
|
fragment_file = step.file(@fragment)
|
|
102
102
|
if File.exists?(fragment_file)
|
|
103
103
|
case @format.to_s
|
|
104
|
+
when "query-entity"
|
|
105
|
+
tsv, table_options = load_tsv(fragment_file, true)
|
|
106
|
+
begin
|
|
107
|
+
res = tsv[@entity].to_json
|
|
108
|
+
content_type "application/json"
|
|
109
|
+
rescue
|
|
110
|
+
res = nil.to_json
|
|
111
|
+
end
|
|
112
|
+
halt 200, res
|
|
113
|
+
when "query-entity-field"
|
|
114
|
+
tsv, table_options = load_tsv(fragment_file, true)
|
|
115
|
+
begin
|
|
116
|
+
res = tsv[@entity]
|
|
117
|
+
res = [res] if tsv.type == :single or tsv.type == :flat
|
|
118
|
+
rescue
|
|
119
|
+
res = nil.to_json
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
fields = tsv.fields
|
|
123
|
+
content_type "application/json"
|
|
124
|
+
hash = {}
|
|
125
|
+
fields.each_with_index do |f,i|
|
|
126
|
+
hash[f] = res.nil? ? nil : res[i]
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
halt 200, hash.to_json
|
|
104
130
|
when "table"
|
|
105
131
|
halt 200, tsv2html(fragment_file)
|
|
106
132
|
when "json"
|
|
@@ -109,6 +109,9 @@ module RbbtRESTHelpers
|
|
|
109
109
|
@filter = consume_parameter :_filter
|
|
110
110
|
@column = consume_parameter :_column
|
|
111
111
|
|
|
112
|
+
# TSV table query
|
|
113
|
+
@entity = consume_parameter :_entity
|
|
114
|
+
|
|
112
115
|
# Fix boolean inputs sumbitted using checkboxes
|
|
113
116
|
params.keys.each do |param|
|
|
114
117
|
if param =~ /(.*)_checkbox_false$/
|
|
@@ -356,10 +356,12 @@ module RbbtRESTHelpers
|
|
|
356
356
|
RbbtRESTHelpers.save_tsv(file)
|
|
357
357
|
end
|
|
358
358
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
359
|
+
def self.load_tsv(file, persist = false)
|
|
360
|
+
if persist
|
|
361
|
+
tsv = TSV.open(Open.open(file), :persist => true, :persist_file => file + '.persist')
|
|
362
|
+
else
|
|
363
|
+
tsv = TSV.open(Open.open(file))
|
|
364
|
+
end
|
|
363
365
|
|
|
364
366
|
table_options = File.exists?(file + '.table_options') ? YAML.load_file(file + '.table_options') : {}
|
|
365
367
|
tsv.entity_options = table_options[:tsv_entity_options]
|
|
@@ -369,8 +371,8 @@ module RbbtRESTHelpers
|
|
|
369
371
|
[tsv, table_options]
|
|
370
372
|
end
|
|
371
373
|
|
|
372
|
-
def load_tsv(
|
|
373
|
-
RbbtRESTHelpers.load_tsv(
|
|
374
|
+
def load_tsv(*args)
|
|
375
|
+
RbbtRESTHelpers.load_tsv(*args)
|
|
374
376
|
end
|
|
375
377
|
|
|
376
378
|
def table(options = {})
|
|
@@ -23,7 +23,7 @@ rbbt.plots.aes.map_aesthetic = function(aes, mapper, map_obj){
|
|
|
23
23
|
else
|
|
24
24
|
aes = map_obj[aes]
|
|
25
25
|
}
|
|
26
|
-
return get_sign_gradient(aes, '#EABD5D', '
|
|
26
|
+
return get_sign_gradient(aes, '#EABD5D', '#DDD', '#40324F')
|
|
27
27
|
case 'map':
|
|
28
28
|
if (typeof aes == 'object')
|
|
29
29
|
return aes.map(function(value){ if (value !== undefined && value != null ) value = value.toString(); return map_obj[value] })
|
|
@@ -94,6 +94,35 @@ rbbt.plots.aes.get_properties = function(list, rules, type, namespace){
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
if (rule.query){
|
|
98
|
+
var fragment = rule.query
|
|
99
|
+
var field = rule.field
|
|
100
|
+
if (undefined === name && ! undefined === field){ name = field }
|
|
101
|
+
if (undefined === name){ name = fragment }
|
|
102
|
+
|
|
103
|
+
var url = main_url
|
|
104
|
+
url = add_parameter(url, '_fragment', fragment)
|
|
105
|
+
|
|
106
|
+
if (field){
|
|
107
|
+
url = add_parameter(url, '_format', 'query-entity-field')
|
|
108
|
+
url = add_parameter(url, '_field', field)
|
|
109
|
+
}else{
|
|
110
|
+
url = add_parameter(url, '_format', 'query-entity')
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
var ajax_promises = list.codes.map(function(code){
|
|
114
|
+
var deferred = m.deferred()
|
|
115
|
+
rbbt.ajax({url: add_parameter(url, '_entity', code)}).then(deferred.resolve)
|
|
116
|
+
return deferred.promise
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
promise = m.sync(ajax_promises)
|
|
120
|
+
|
|
121
|
+
if ('string' === typeof field ){
|
|
122
|
+
promise = promise.then(function(values){ return values.map(function(v){ if (null === v){ return null }else{ return v[field] } }) })
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
97
126
|
if (rule.subset){
|
|
98
127
|
var deferred = m.deferred()
|
|
99
128
|
var inclusion = list.codes.map(function(code){ if (rule.subset.indexOf(code) < 0){ return "false"} else { return "true" } })
|
|
@@ -249,7 +249,7 @@ rbbt.plots.graph.view_d3js_graph = function(graph_model, elem, node_obj){
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
rbbt.plots.graph.view_mithril = function(graph_model, elem, container_obj, produce_obj){
|
|
252
|
-
rbbt.plots.graph.update(graph_model).then(function(updated_model){
|
|
252
|
+
return rbbt.plots.graph.update(graph_model).then(function(updated_model){
|
|
253
253
|
var obj = $(elem)[0]
|
|
254
254
|
var component = {view: rbbt.curry(rbbt.plots.mithril, graph_model, container_obj, produce_obj)}
|
|
255
255
|
rbbt.mount(obj, component)
|
|
@@ -11,5 +11,7 @@ rbbt.plots.mithril = function(graph_model, container_obj, produce_obj){
|
|
|
11
11
|
obj_by_type[type] = objs
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
var container = m('.mitrhil', {config: function(){ update_dom() }}, container_obj(graph_model, obj_by_type))
|
|
15
|
+
|
|
16
|
+
return container
|
|
15
17
|
}
|
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.58
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miguel Vazquez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-06-
|
|
11
|
+
date: 2017-06-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|