rbbt-rest 1.8.2 → 1.8.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9db115f33017c66595437648ad05997d452733a6
4
- data.tar.gz: abda02054f71c7d38d6024524d755bcc2fb1dff6
3
+ metadata.gz: 8bc8c84dbe3d17dfa0f63f7a513da1d52ed7e150
4
+ data.tar.gz: fc73cf5e1d13d176ab35fa2e5f065d9756033cc7
5
5
  SHA512:
6
- metadata.gz: ea5dbd2c6b35d1de6975818ac8916a2ea7430680ad5a17bf73be7b5d01c5b3136360a2ff138654593a7cefe97d51120fa1b87972265f8bb7d7b7cfdb3331546d
7
- data.tar.gz: 15a3cbed98f5c0b531df9aa0b56936c644dca35b17676bb88bab6f0ea61ef8b4e8b7838c551f78f674ac25e2aa8d5d4a44d77c592dc91143d9c2fdfae555b02b
6
+ metadata.gz: 384ceaf737b835b8cba9e49b631b78f2d4b8b2d16c0f1d74b9cb532912daf6599491e22f67d63ddd6c6eb276501d43eb323233daf0c17d54f4544fe632a9b610
7
+ data.tar.gz: e96e260ef7ee2bfc4f78d46367c3a2a6f1785991a4978dab3b974ebf92a954472d57fa2bcfd72ed847cc46a398b35daff9c9ab3b38a075b7dd940774db740c15
@@ -54,8 +54,10 @@ module KnowledgeBaseRESTHelpers
54
54
  def get_knowledge_base(name=:user, namespace = nil)
55
55
  kb = case name.to_s
56
56
  when 'step'
57
- dir = cookies[:step_path] + '.files/knowledge_base'
58
- iii dir
57
+ step_path = cookies[:step_path]
58
+ step_path = params[:step_path] if step_path.nil?
59
+ raise "No step_path" if step_path.nil?
60
+ dir = step_path + '.files/knowledge_base'
59
61
  KnowledgeBase.load(dir)
60
62
  when "user"
61
63
  user_kb(user)
@@ -1,20 +1,33 @@
1
- .error
2
- %h5 Error on #{format_name File.basename(job.name)}
1
+ .error.ui.segment.error.message
2
+ %h5.ui.header Error on #{format_name File.basename(job.name)}
3
3
  - if job.messages and job.messages.any?
4
- %span.error_message
5
- %pre= CGI.escapeHTML(job.messages[-1] || "")
4
+ %pre.error_message.ui.basic.segment.content
5
+ = CGI.escapeHTML(job.messages[-1] || "")
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
9
  - clean_url = add_GET_param(request.env["REQUEST_URI"], "_update", "clean")
10
- %a(href=clean_url) Clean
10
+ %a.ui.button.blue(href=clean_url) Clean
11
11
  - else
12
12
  - clean_url = add_GET_param(request.env["REQUEST_URI"], "_update", "reload")
13
- %a(href=clean_url) Reload
13
+ %a.ui.blue.button(href=clean_url) Reload
14
14
 
15
- - backtrace = job.info[:backtrace]
16
- - if backtrace and backtrace.any?
17
- %hr
18
- %ul.error_backtrace.clean_list
15
+ - backtrace = job.info[:backtrace]
16
+ - if backtrace and backtrace.any?
17
+
18
+ %ul.error_backtrace.clean_list.ui.segment
19
+ .ui.header Backtrace
20
+ %pre.ui.content
21
+ - require 'rbbt/util/colorize'
22
+ - pallete = {}
23
+ - matches = %w(views workflows rbbt).collect{|w| /\/#{w}/ }
24
+ - colors = Colorize.distinct(matches)
19
25
  - backtrace.each do |line|
20
- %li= line
26
+ - color = nil
27
+ - matches.each_with_index do |m,i|
28
+ - if m.match(line)
29
+ - color = colors[i].darken(0.3).to_s
30
+ - break
31
+
32
+ - style = color ? ';color:'+color : ""
33
+ %li(style="font-size:0.9em;font-family:monospace#{style}")= line.sub('`',"'")
@@ -18,12 +18,15 @@ rbbt.exception.report = function(err){
18
18
  }
19
19
  }
20
20
 
21
- rbbt.try = function(func){
21
+ rbbt.try = function(func, catch_function){
22
22
  var f = function(){
23
23
  try {
24
24
  return func.apply(this, arguments)
25
25
  }catch(err){
26
- rbbt.exception.report(err)
26
+ if (catch_function)
27
+ catch_function(err)
28
+ else
29
+ rbbt.exception.report(err)
27
30
  }
28
31
  }
29
32
  return f
@@ -52,7 +52,7 @@ rbbt.plots.aes.get_properties = function(list, rules){
52
52
  eval('extract='+extract)
53
53
  }
54
54
 
55
- if (rule.entity_type && rule.entity_type != list.type) return
55
+ if (rule.entity_type && rule.entity_type != list.type && rule.entity_type != list.format) return
56
56
 
57
57
  if (rule.info){
58
58
  var property = rule.property
@@ -66,6 +66,14 @@ rbbt.plots.aes.get_properties = function(list, rules){
66
66
 
67
67
  deferred.resolve(value)
68
68
  promise = deferred.promise
69
+ if (extract){
70
+ promise = promise.then(function(res){
71
+ if (typeof res == 'object')
72
+ return res.map(function(elem){ return extract.call(null, elem)})
73
+ else
74
+ return extract.call(null, res)
75
+ })
76
+ }
69
77
  }
70
78
 
71
79
  if (rule.value){
@@ -79,8 +87,15 @@ rbbt.plots.aes.get_properties = function(list, rules){
79
87
  var property = rule.property
80
88
  var args = rule.args
81
89
  if (undefined === name) name = property
82
- promise = rbbt.entity_array.property(list.codes, list.type, list.info, property, args)
83
- if (extract){ promise = promise.then(function(res){ return res.map(extract)}) }
90
+
91
+ var deferred = m.deferred()
92
+ var tmp_promise = rbbt.entity_array.property(list.codes, list.type, list.info, property, args)
93
+
94
+ if (extract){ tmp_promise = tmp_promise.then(function(res){ return res.map(extract)}) }
95
+
96
+ tmp_promise.then(deferred.resolve, function(){ deferred.resolve(undefined)})
97
+
98
+ promise = deferred.promise
84
99
  }
85
100
 
86
101
  if (rule.workflow){
@@ -163,7 +178,7 @@ rbbt.plots.aes.get_properties = function(list, rules){
163
178
  }
164
179
  }
165
180
 
166
- promises.push(promise.then(function(res){list.properties[name] = res}))
181
+ promises.push(promise.then(function(res){ if (undefined !== res) list.properties[name] = res}))
167
182
  })
168
183
 
169
184
  return m.sync(promises)
@@ -137,7 +137,7 @@ rbbt.plots.graph.view_cytoscape = function(graph_model, elem, style, layout, ext
137
137
  var dataset = rbbt.plots.graph.build_cytoscape(updated_model)
138
138
 
139
139
  require_js(['/js/cytoscape/js/src/AC_OETags.js', '/js/cytoscape/js/src/cytoscapeweb.js', '/js/cytoscape'], function(){
140
- var tool = $('#plot').cytoscape_tool({
140
+ var tool = $(elem).cytoscape_tool({
141
141
  knowledge_base: 'user',
142
142
  namespace: 'Hsa/feb2014',
143
143
  entities: dataset.nodes,
@@ -159,7 +159,8 @@ rbbt.plots.graph.view_cytoscape = function(graph_model, elem, style, layout, ext
159
159
 
160
160
  var url = target.data.url;
161
161
 
162
- rbbt.modal.controller.show_url(url)
162
+ if (url)
163
+ rbbt.modal.controller.show_url(url)
163
164
  return(false)
164
165
  },
165
166
 
@@ -11,12 +11,14 @@ rbbt.plots.graph.get_entities = function(graph_model){
11
11
  source_entities.codes = unique(list.info.source)
12
12
  source_entities.info = list.source_info
13
13
  source_entities.type = list.source_type
14
+ source_entities.format = list.source_format
14
15
 
15
16
  var target_type = list.target_type
16
17
  var target_entities = {}
17
18
  target_entities.codes = unique(list.info.target)
18
19
  target_entities.info = list.target_info
19
20
  target_entities.type = list.target_type
21
+ target_entities.format = list.target_format
20
22
 
21
23
  if (entities[source_entities.type])
22
24
  entities[source_entities.type].codes = unique(entities[source_entities.type].codes.concat(source_entities.codes))
@@ -11,8 +11,14 @@ rbbt.plots.graph.prepare_associations = function(db, associations, info){
11
11
  var edges = {}
12
12
  edges.codes = []
13
13
  edges.database = db
14
- edges.source_type = info.source
15
- edges.target_type = info.target
14
+
15
+ edges.source_type = info.source_type
16
+ edges.target_type = info.target_type
17
+ edges.source_format = info.source
18
+ edges.target_format = info.target
19
+ if (undefined === edges.source_type || null === edges.source_type) edges.source_type = edges.source_format
20
+ if (undefined === edges.target_type || null === edges.target_type) edges.target_type = edges.target_format
21
+
16
22
  edges.source_info = info.source_entity_options
17
23
  edges.target_info = info.target_entity_options
18
24
  edges.info = {}
@@ -1,32 +1,33 @@
1
1
  - @reload_page = true
2
2
 
3
- .wait
4
- %h5 Waiting on #{format_name File.basename(job.name)}
3
+ .wait.ui.segment.info.message
4
+ %h3.ui.header Waiting on #{format_name File.basename(job.name)}
5
5
 
6
- %span.status= job.status
6
+ %span.ui.basic.segment.content.status= job.status
7
7
 
8
8
 
9
9
  - if job.file(:progress).exists?
10
- - progress = job.file(:progress).yaml
11
- - if progress[:last_percent]
12
- .ui.teal.step.percent.progress.indicating(data-percent="#{progress[:last_percent]}" data-total=100)
13
- .bar
14
- .progress
15
- .label= progress[:desc]
16
- :deferjs
17
- $('.step.progress').progress()
18
- - else
19
- - ticks = progress[:ticks]
20
- - max_ticks = ticks * 1.2
21
- .ui.teal.step.progress(data-value=ticks data-total=max_ticks data-percent="#{ticks.to_f * 100.0 / max_ticks}")
22
- .bar
23
- .progress
24
- .label= progress[:desc]
25
- :deferjs
26
- $('.step.progress').progress({label: 'ratio',text:{ratio: '{value}'}})
27
- - else
28
- %hr
10
+ .footer.ui.basic.segment
11
+ - progress = job.file(:progress).yaml
12
+ - if progress[:last_percent]
13
+ .ui.teal.step.percent.progress.indicating.meta(data-percent="#{progress[:last_percent]}" data-total=100)
14
+ .bar
15
+ .progress
16
+ .label= progress[:desc]
17
+ :deferjs
18
+ $('.step.progress').progress()
19
+ - else
20
+ - ticks = progress[:ticks]
21
+ - max_ticks = ticks * 1.2
22
+ .ui.teal.step.progress.meta(data-value=ticks data-total=max_ticks data-percent="#{ticks.to_f * 100.0 / max_ticks}")
23
+ .bar
24
+ .progress
25
+ .label= progress[:desc]
26
+ :deferjs
27
+ $('.step.progress').progress({label: 'ratio',text:{ratio: '{value}'}})
29
28
 
29
+ .ui.segment
30
+ %h3.ui.header Log
30
31
  %ul.step_messages.clean_list
31
32
  - job.messages.reverse.each do |line|
32
33
  - next if line.nil? or line.strip.empty?
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.2
4
+ version: 1.8.3
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-03-28 00:00:00.000000000 Z
11
+ date: 2016-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake