rbbt-rest 1.8.55 → 1.8.56
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/render.rb +27 -0
- data/share/views/layout/header.haml +1 -1
- data/share/views/public/js/rbbt.basic.js +18 -0
- data/share/views/public/js/rbbt.js +5 -0
- data/share/views/public/js/rbbt.plots/rbbt.plots.aes.js +2 -2
- data/share/views/public/js/rbbt.plots/rbbt.plots.graph.js +2 -0
- data/share/views/public/js/rbbt.plots/rbbt.plots.graph.model.js +94 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dd743dca60e774ca984f6e9cf2a29e845f82e7b
|
4
|
+
data.tar.gz: 0305b01777c639f34029045ac8f5f4660acb9bd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7465076f534758427cfeda60d7ef6356d992c139e503dabb4f9f40ce5d93774af34dfea822ec10c246e230a733bde3ca5aeb9fd9fa66389421d63091a12bb53
|
7
|
+
data.tar.gz: 045bb3d3fcc692f9202de5dbeecd820b5685c3b6823746bdc624d2fdbfee8f2997d0e1bfddaf03b28842c32afe3be105bde53e52de63328025c83a01bca4064a
|
@@ -247,6 +247,33 @@ module RbbtRESTHelpers
|
|
247
247
|
end
|
248
248
|
end
|
249
249
|
|
250
|
+
def json_resource(object, filename = nil, promise = true)
|
251
|
+
filename = File.basename(TmpFile.tmp_file) if filename.nil?
|
252
|
+
|
253
|
+
if @step
|
254
|
+
url = add_GET_param(remove_GET_param(@fullpath, ["_update", "_"]), "_fragment", "json_resources/#{ filename }")
|
255
|
+
f = @step.file(:json_resources)[filename].find
|
256
|
+
else
|
257
|
+
url = "/files/#{ filename }"
|
258
|
+
f = settings.file_dir[filename].find
|
259
|
+
end
|
260
|
+
|
261
|
+
FileUtils.mkdir_p(File.dirname(f))
|
262
|
+
|
263
|
+
Open.write(f, object.to_json)
|
264
|
+
|
265
|
+
if promise
|
266
|
+
"rbbt.get('#{url}')"
|
267
|
+
else
|
268
|
+
url
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
def sync_json_resources(objects)
|
273
|
+
gets = objects.collect{|object| json_resource(object) }
|
274
|
+
"m.sync([#{gets * ", "}])"
|
275
|
+
end
|
276
|
+
|
250
277
|
def reveal(text, id = nil, options = nil, &block)
|
251
278
|
id ||= "rbbt_reveal_" << (rand * 10000).to_i.to_s
|
252
279
|
|
@@ -69,7 +69,7 @@
|
|
69
69
|
- %w(rbbt.knowledge_base).each do |file|
|
70
70
|
- record_js "/js-find/#{ file }"
|
71
71
|
|
72
|
-
- %w(rbbt.plots.basic rbbt.plots.aes rbbt.plots.graph rbbt.plots.graph.kb rbbt.plots.graph.mithril rbbt.plots.graph.adapters rbbt.plots.aesthetics rbbt.plots.list).each do |file|
|
72
|
+
- %w(rbbt.plots.basic rbbt.plots.aes rbbt.plots.graph rbbt.plots.graph.kb rbbt.plots.graph.mithril rbbt.plots.graph.adapters rbbt.plots.graph.model rbbt.plots.aesthetics rbbt.plots.list).each do |file|
|
73
73
|
- record_js "/js-find/rbbt.plots/#{ file }"
|
74
74
|
|
75
75
|
- record_js "/js-find/app"
|
@@ -85,6 +85,24 @@ rbbt.insist_request = function(params, deferred, timeout, missing){
|
|
85
85
|
return deferred.promise
|
86
86
|
}
|
87
87
|
|
88
|
+
rbbt.get = function(url, params){
|
89
|
+
var request_params
|
90
|
+
if (typeof url === 'object'){
|
91
|
+
request_params = url
|
92
|
+
}else{
|
93
|
+
|
94
|
+
if (undefined === params) params = {}
|
95
|
+
if (undefined === params.url) params.url = url
|
96
|
+
|
97
|
+
request_params = {url: url, method: "GET"}
|
98
|
+
forHash(params, function(k,v){request_params[k] = v})
|
99
|
+
}
|
100
|
+
|
101
|
+
if (undefined === request_params.method) request_params.method = 'GET'
|
102
|
+
|
103
|
+
return rbbt.insist_request(request_params)
|
104
|
+
}
|
105
|
+
|
88
106
|
rbbt.post = function(url, data, params){
|
89
107
|
var request_params
|
90
108
|
if (typeof url === 'object'){
|
@@ -15,7 +15,7 @@ rbbt.plots.aes.map_aesthetic = function(aes, mapper, map_obj){
|
|
15
15
|
aes = map_obj[aes]
|
16
16
|
}
|
17
17
|
}
|
18
|
-
return get_gradient(aes, '
|
18
|
+
return get_gradient(aes, '#EABD5D', '#40324F')
|
19
19
|
case 'sign-gradient':
|
20
20
|
if (map_obj){
|
21
21
|
if (typeof aes == 'object')
|
@@ -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, '
|
26
|
+
return get_sign_gradient(aes, '#EABD5D', 'grey', '#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] })
|
@@ -0,0 +1,94 @@
|
|
1
|
+
rbbt.graph_model = function(){
|
2
|
+
var obj = {}
|
3
|
+
|
4
|
+
obj.entities = {}
|
5
|
+
obj.associations = {}
|
6
|
+
obj.rules = []
|
7
|
+
obj.aes_rules = []
|
8
|
+
obj.edge_rules = []
|
9
|
+
obj.edge_aes_rules = []
|
10
|
+
|
11
|
+
var prot = {}
|
12
|
+
|
13
|
+
prot._collect_values = function(values, codes){
|
14
|
+
var res = [];
|
15
|
+
forArray(codes, function(code){
|
16
|
+
if (typeof values === 'function'){
|
17
|
+
res.push(values(code))
|
18
|
+
}else{
|
19
|
+
res.push(values[code])
|
20
|
+
}
|
21
|
+
})
|
22
|
+
return res
|
23
|
+
}
|
24
|
+
|
25
|
+
//{{{ Add elements
|
26
|
+
|
27
|
+
prot.set_entities = function(codes, type, info){
|
28
|
+
if (undefined === type) type = "Entity"
|
29
|
+
if (undefined === info) info = {}
|
30
|
+
|
31
|
+
this.entities[type] = {codes: codes, info: info, properties: {}, aes: {}}
|
32
|
+
}
|
33
|
+
|
34
|
+
prot.set_associations = function(codes, db, info){
|
35
|
+
if (undefined === db) db = "network"
|
36
|
+
if (undefined === info) info = {}
|
37
|
+
|
38
|
+
var list = {codes: codes, info: info}
|
39
|
+
this.associations[db] = rbbt.plots.aes.complete_source_target(list)
|
40
|
+
}
|
41
|
+
|
42
|
+
//{{{ Add rules
|
43
|
+
|
44
|
+
prot.add_rule = function(rule){
|
45
|
+
this.rules.push(rule)
|
46
|
+
}
|
47
|
+
|
48
|
+
prot.add_aes_rule = function(rule){
|
49
|
+
this.aes_rules.push(rule)
|
50
|
+
}
|
51
|
+
|
52
|
+
prot.add_edge_rule = function(rule){
|
53
|
+
this.edge_rules.push(rule)
|
54
|
+
}
|
55
|
+
|
56
|
+
prot.add_edge_aes_rule = function(rule){
|
57
|
+
this.edge_aes_rules.push(rule)
|
58
|
+
}
|
59
|
+
|
60
|
+
//{{{ Add info
|
61
|
+
|
62
|
+
prot.add_property = function(values, name, type){
|
63
|
+
if (undefined === type) type = "Entity"
|
64
|
+
if (undefined === this.entities[type].properties) this.entities[type].properties = {}
|
65
|
+
|
66
|
+
this.entities[type].properties[name] = this._collect_values(values, this.entities[type].codes)
|
67
|
+
}
|
68
|
+
|
69
|
+
prot.add_aes = function(values, name, type){
|
70
|
+
if (undefined === type) type = "Entity"
|
71
|
+
if (undefined === this.entities[type].aes) this.entities[type].aes = {}
|
72
|
+
|
73
|
+
this.entities[type].aes[name] = this._collect_values(values, this.entities[type].codes)
|
74
|
+
}
|
75
|
+
|
76
|
+
prot.add_edge_property = function(values, name, db){
|
77
|
+
if (undefined === db) db = "network"
|
78
|
+
if (undefined === this.associations[db].properties) this.associations[db].properties = {}
|
79
|
+
|
80
|
+
this.associations[db].properties[name] = this._collect_values(values, this.associations[db].codes)
|
81
|
+
}
|
82
|
+
|
83
|
+
prot.add_edge_aes = function(values, name, db){
|
84
|
+
if (undefined === db) db = "network"
|
85
|
+
if (undefined === this.associations[db].aes) this.associations[db].aes = {}
|
86
|
+
|
87
|
+
this.associations[db].aes[name] = this._collect_values(values, this.associations[db].codes)
|
88
|
+
}
|
89
|
+
|
90
|
+
obj.__proto__ = prot
|
91
|
+
|
92
|
+
return obj
|
93
|
+
}
|
94
|
+
|
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.56
|
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-
|
11
|
+
date: 2017-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -325,6 +325,7 @@ files:
|
|
325
325
|
- share/views/public/js/rbbt.plots/rbbt.plots.graph.js
|
326
326
|
- share/views/public/js/rbbt.plots/rbbt.plots.graph.kb.js
|
327
327
|
- share/views/public/js/rbbt.plots/rbbt.plots.graph.mithril.js
|
328
|
+
- share/views/public/js/rbbt.plots/rbbt.plots.graph.model.js
|
328
329
|
- share/views/public/js/rbbt.plots/rbbt.plots.list.js
|
329
330
|
- share/views/public/js/rbbt.views.js
|
330
331
|
- share/views/public/js/rbbt/actions.js
|