rbbt-rest 1.8.95 → 1.8.96

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b9fc8304ee87e46f7d53b1807e0de225632bd9b
4
- data.tar.gz: e9f65fd208eca9c0c18e1c47c6f5f08c0ffdf8e7
3
+ metadata.gz: '0429c45627c2177b14bb51e6a648f162394873db'
4
+ data.tar.gz: c96ed9340c6998578a371cdcf899a39bf1ae9434
5
5
  SHA512:
6
- metadata.gz: b236b0cc741d0f47b0772761f1814578905dff43658545ff1220c04654f458fadef836ec5618b8cd380dd7e82cb2646987546c2cb25cb4cd0082c34c9926520b
7
- data.tar.gz: 8500666f11d539c3281836e3168be7d5b0d5a9cb0d79e2024b0816902846f9ae4b0cda89a8604c92fc44a1c894d4ce35623005514fb75c7f61246007f431caae
6
+ metadata.gz: 93ecbc69ba55b7607a092fa84ec846dff70970cda74580e52c7538737df3be15478229cdb2b527cee4dbbced7afda99246c5c0e66ad39a788b0a57b6e1147447
7
+ data.tar.gz: 8a1c4ecc6ba94b28348f7f0f784bca9d702415baf36b6aad0580a387e6e986a6788c94345caee5e1d9c4dafaa13f5d533fdf3c6fc0a70df632ffd65be5fc9d6e
@@ -183,6 +183,19 @@ module RbbtRESTHelpers
183
183
  excel_file = TmpFile.tmp_file
184
184
  tsv.excel(excel_file, :sort_by => @excel_sort_by, :sort_by_cast => @excel_sort_by_cast, :name => true, :remove_links => true)
185
185
  send_file excel_file, :type => 'application/vnd.ms-excel', :filename => 'table.xls'
186
+ when "heatmap"
187
+ tsv, tsv_options = load_tsv(fragment_file)
188
+ content_type "text/html"
189
+ data = nil
190
+ png_file = TmpFile.tmp_file
191
+ width = tsv.fields.length * 10 + 500
192
+ height = tsv.size * 10 + 500
193
+ width = 10000 if width > 10000
194
+ height = 10000 if height > 10000
195
+ tsv.R <<-EOF
196
+ rbbt.pheatmap(file='#{png_file}', data, width=#{width}, height=#{height})
197
+ EOF
198
+ send_file png_file, :type => 'image/png', :filename => fragment_file + ".heatmap.png"
186
199
  else
187
200
  content_type "text/html"
188
201
 
@@ -451,10 +451,13 @@ module RbbtRESTHelpers
451
451
  tsv, table_options = load_tsv(file)
452
452
  end
453
453
 
454
- content_type "text/html"
455
- rows, length = tsv_rows(tsv)
454
+ table_options[:heatmap] = tsv.cast && %w(to_i to_f).include?(tsv.cast.to_s) unless table_options.include? :heatmap
456
455
 
457
456
  table_options = default_table_options.merge(table_options)
457
+
458
+ content_type "text/html"
459
+ rows, length = tsv_rows(tsv, @page || table_options[:page], @filter || table_options[:filter], @column || table_options[:column])
460
+
458
461
  partial_render('partials/table', {:total_size => length, :rows => rows, :header => tsv.all_fields, :table_options => table_options})
459
462
  end
460
463
  end
@@ -166,6 +166,19 @@ module WorkflowRESTHelpers
166
166
  result = job.load
167
167
  result.excel(excel_file, :name => @excel_use_name,:sort_by => @excel_sort_by, :sort_by_cast => @excel_sort_by_cast, :remove_links => true)
168
168
  send_file excel_file, :type => 'application/vnd.ms-excel', :filename => job.clean_name + '.xls'
169
+ when :heatmap
170
+ tsv = job.load
171
+ content_type "text/html"
172
+ data = nil
173
+ png_file = TmpFile.tmp_file
174
+ width = tsv.fields.length * 10 + 500
175
+ height = tsv.size * 10 + 500
176
+ width = 10000 if width > 10000
177
+ height = 10000 if height > 10000
178
+ tsv.R <<-EOF
179
+ rbbt.pheatmap(file='#{png_file}', data, width=#{width}, height=#{height})
180
+ EOF
181
+ send_file png_file, :type => 'image/png', :filename => job.name + ".heatmap.png"
169
182
  else
170
183
  raise "Unsupported format: #{ format }"
171
184
  end
@@ -59,3 +59,29 @@
59
59
  return false
60
60
  })
61
61
  })
62
+
63
+ :deferjs
64
+ var autofill = rbbt.LS.load('autofill')
65
+ var workflow = '#{workflow}'
66
+ var task_name = '#{task}'
67
+ var key = [workflow, task_name].join("#")
68
+
69
+ if (autofill != undefined && autofill[key]){
70
+ var inputs = autofill[key]
71
+ var form = $('.workflow_task[id=#{id}] > .form > form')
72
+ forHash(inputs, function(name,value){
73
+ var input = form.find('[name=' + name + ']');
74
+ if (input.length > 0 && typeof value == 'string' && value.match(/TRUNCATED/)){
75
+ var err= "Error loading input " + name + ". It was truncated due to it length.";
76
+ rbbt.modal.controller.error(m('.ui.error.message', [m('.header', err), m('.description', m('pre', m.trust(value)))]), "Form entry not loaded correctly")
77
+ }
78
+ if (input.is('[type=checkbox]')){
79
+ input.prop('checked', value);
80
+ }else{
81
+ input.val(value);
82
+ }
83
+ })
84
+ }
85
+ rbbt.LS.delete('autofill')
86
+
87
+
@@ -14,8 +14,24 @@
14
14
  .ui.header
15
15
  %h3 Inputs (recursive)
16
16
  .ui.content
17
+ - inputs = job.recursive_inputs
18
+ - autofill_id = "autofill_" << Misc.digest(job.name)
19
+ .ui.button.autofill(id=autofill_id) Auto-fill form with inputs
20
+ :deferjs
21
+ $('##{autofill_id}').click(function(){
22
+ var inputs = #{inputs.to_hash.to_json};
23
+ inputs['jobname'] = '#{job.clean_name}';
24
+ var workflow = '#{job.workflow.to_s}';
25
+ var task_name = '#{job.task_name.to_s}';
26
+ var key = [workflow, task_name].join("#");
27
+
28
+ var info = {};
29
+ info[key] = inputs;
30
+ rbbt.LS.store('autofill', info);
31
+ var url = '/' + workflow + '/' + task_name;
32
+ window.location = rbbt.url_add_script_name(url);
33
+ })
17
34
  %dl
18
- - inputs = job.recursive_inputs
19
35
  - inputs.zip(inputs.fields).each do |i,f|
20
36
  %dt= f
21
37
  %dd
@@ -1,16 +1,22 @@
1
1
  - if result.any?
2
2
  - table_id = [workflow.to_s, task, jobname] * "_"
3
3
  - table_class = 'workflow_tsv_result'
4
- - begin
5
- - page = result.size > 50 ? "1" : nil
6
- - rescue
7
- - page = "1"
4
+ - page = result.size > 50 ? "1" : nil
8
5
 
9
- - rows, total_size = tsv_rows(result, page)
10
- - header = result.all_fields
6
+ = table :table_id => table_id, :page => page, :table_class => table_class, :row_ids => :use, :table_url => jobname ? to(File.join('/', workflow.to_s, task, jobname)) : nil do
7
+ - result
11
8
 
12
- = workflow_partial('partials/table', workflow, task,
13
- locals.merge(:table_id => table_id, :page => page, :table_class => table_class, :rows => rows, :total_size => total_size, :header => result.all_fields, :row_ids => :use, :table_url => jobname ? to(File.join('/', workflow.to_s, task, jobname)) : nil))
9
+ -#
10
+ - begin
11
+ - page = result.size > 50 ? "1" : nil
12
+ - rescue
13
+ - page = "1"
14
+
15
+ - rows, total_size = tsv_rows(result, page)
16
+ - header = result.all_fields
17
+
18
+ = workflow_partial('partials/table', workflow, task,
19
+ locals.merge(:table_id => table_id, :page => page, :table_class => table_class, :rows => rows, :total_size => total_size, :header => result.all_fields, :row_ids => :use, :table_url => jobname ? to(File.join('/', workflow.to_s, task, jobname)) : nil))
14
20
 
15
21
  - else
16
22
 
@@ -11,6 +11,7 @@
11
11
  - total_size = table_options[:total_size] unless defined? total_size and total_size
12
12
  - filters = table_options[:filters] unless defined? filters and filters
13
13
  - span = table_options[:span] unless defined? span and not span.nil?
14
+ - heatmap = table_options[:heatmap] unless defined? heatmap and not heatmap.nil?
14
15
 
15
16
  - list_links = table_options[:list_links] unless defined? list_links and list_links
16
17
 
@@ -76,7 +77,7 @@
76
77
 
77
78
  = partial_render('partials/table/column', :table_url => table_url, :header => header, :entity_headers => entity_headers)
78
79
 
79
- = partial_render('partials/table/files', :table_url => table_url)
80
+ = partial_render('partials/table/files', :table_url => table_url, :heatmap => heatmap)
80
81
 
81
82
 
82
83
 
@@ -2,3 +2,6 @@
2
2
  %a(href="#{add_GET_param(table_url, "_format", "tsv")}") tsv
3
3
  .excel.ui.wrap.compact.button
4
4
  %a(href="#{add_GET_param(table_url, "_format", "excel")}") excel
5
+ - if heatmap
6
+ .excel.ui.wrap.compact.button
7
+ %a(href="#{add_GET_param(table_url, "_format", "heatmap")}") heatmap
@@ -168,7 +168,11 @@ rbbt.LS.load = function(key){
168
168
  }
169
169
 
170
170
  rbbt.LS.store = function(key, value){
171
- localStorage[key] = JSON.stringify(value)
171
+ localStorage[key] = JSON.stringify(value);
172
+ }
173
+
174
+ rbbt.LS.delete = function(key){
175
+ delete(localStorage[key]);
172
176
  }
173
177
 
174
178
 
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.95
4
+ version: 1.8.96
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-04 00:00:00.000000000 Z
11
+ date: 2018-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake