rbbt-rest 1.8.145 → 1.8.146

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
  SHA256:
3
- metadata.gz: 312766692a55969cc09bb092ff4b7e6d4984187c968585b8e704c883fa2f69f9
4
- data.tar.gz: 4e6dcbe9238daea5ad9296067526086bc31a01b2b16f1f2cd35127b4e6ad8f44
3
+ metadata.gz: 70de3a851bb361a775fa933d6a72992bddf25bcf6936a8b46b88afd764138337
4
+ data.tar.gz: dd39b1ab852febb1102fdc71b7614c5f9e610f987bb9c39e922f359f47cadb4f
5
5
  SHA512:
6
- metadata.gz: e7b72817fa8b7a3480891c71e7b3bf0333eddf1c8332a6893bed82e8d351d2c86b3a26f9803d830d722975a204d3a40b62a094716d919d22589fce82e2978e1e
7
- data.tar.gz: 5b94f09eba05284b878a87e5908d05efc30bf6bbde1297e8dbecdd62929b4ef03208dc328243da72795a770d1cb3bda4ada8a41b61aa08e94f9616ab4e0a24b2
6
+ metadata.gz: b826421f184bdd68b4ded24cb87c51594880ef6f189ba1d86dbe089f1a6488c298939190c124183bd8a2a9dca890dba2dd5324935057b896b131c9bfa387bb2e
7
+ data.tar.gz: eb7a5c2c67998fd0ea16c75f31baaa4c5976073dd01f7b78b02d43e7bf203c013280a53473dda9fc54a7b9182e31eae0f0134529f457bb702e49e7d7f763749b
@@ -38,7 +38,12 @@ module RbbtRESTHelpers
38
38
  path = if params[:cache_file]
39
39
  params[:cache_file]
40
40
  else
41
- name = name.gsub("/",'>') << "_" << Misc.obj2digest(params) if params.any?
41
+ if post_hash = params["__post_hash_id"]
42
+ name = name.gsub("/",'>') << "_" << post_hash
43
+ elsif params
44
+ param_hash = Misc.obj2digest(params)
45
+ name = name.gsub("/",'>') << "_" << param_hash
46
+ end
42
47
  settings.cache_dir[name].find
43
48
  end
44
49
 
@@ -56,6 +61,12 @@ module RbbtRESTHelpers
56
61
 
57
62
  # Clean/update job
58
63
 
64
+ clean_url = request.url
65
+ clean_url = remove_GET_param(clean_url, :_update)
66
+ clean_url = remove_GET_param(clean_url, :_)
67
+
68
+ clean_url = add_GET_param(clean_url, "__post_hash_id", params["__post_hash_id"]) if params.include?("__post_hash_id") && @is_method_post
69
+
59
70
  if not @fragment and (old_cache(step.path, check) or update == :reload)
60
71
  begin
61
72
  pid = step.info[:pid]
@@ -65,11 +76,10 @@ module RbbtRESTHelpers
65
76
  Log.medium{$!.message}
66
77
  end
67
78
  step.clean
79
+
80
+ redirect remove_GET_param(clean_url, "__post_hash_id")
68
81
  end
69
82
 
70
- clean_url = request.url
71
- clean_url = remove_GET_param(clean_url, :_update)
72
- clean_url = remove_GET_param(clean_url, :_)
73
83
 
74
84
  class << step
75
85
  def url
@@ -78,6 +88,8 @@ module RbbtRESTHelpers
78
88
 
79
89
  end
80
90
 
91
+ #step.instance_variable_set(:@url, clean_url)
92
+ #step.instance_variable_set(:@url_path, URI(clean_url).path)
81
93
  step.instance_variable_set(:@url, clean_url)
82
94
  step.instance_variable_set(:@url_path, URI(clean_url).path)
83
95
  step.clean if step.error? || step.aborted?
@@ -95,6 +107,8 @@ module RbbtRESTHelpers
95
107
  step.set_info :template_file, params[:_template_file].to_s
96
108
  end
97
109
 
110
+ redirect clean_url if params.include?("__post_hash_id") && @is_method_post
111
+
98
112
  # Return fragment
99
113
 
100
114
  if @fragment
@@ -274,10 +288,6 @@ data = NULL
274
288
  end
275
289
  end
276
290
 
277
- if update == :reload
278
- redirect to(clean_url)
279
- end
280
-
281
291
  # Monitor
282
292
 
283
293
  begin
@@ -57,15 +57,20 @@ module RbbtRESTHelpers
57
57
 
58
58
  def process_common_parameters
59
59
  @ajax = request.xhr?
60
- @ajax_url = headers["AJAX-URL"]
61
60
 
62
61
  @uri = request.env["REQUEST_URI"]
62
+ @uri = remove_GET_param(@uri, ["_update", "_", "_layout"])
63
+ @request_method = request.env["REQUEST_METHOD"]
64
+ @is_method_post = @request_method.to_s.downcase == 'post'
65
+
66
+ @uri = post_uri if @is_method_post
67
+
63
68
  @path = request.env["PATH_INFO"]
64
69
  @query = request.env["QUERY_STRING"]
65
-
66
- #@fullpath = request.fullpath
67
70
  @fullpath = (@query && ! @query.empty?) ? @path + "?" + @query : @path
68
- @fullpath = remove_GET_param(@fullpath, ["_update", "_"])
71
+ @fullpath = remove_GET_param(@fullpath, ["_update", "_", "_layout"])
72
+
73
+ @ajax_url = @uri
69
74
 
70
75
  @layout = consume_parameter(:_layout)
71
76
 
@@ -42,15 +42,15 @@ module RbbtRESTHelpers
42
42
  end
43
43
 
44
44
  def wait_on(job, layout = nil)
45
+ layout = @layout if layout.nil?
46
+
45
47
  3.times do |rep|
46
48
  raise RbbtRESTHelpers::Retry if job.done? or job.error?
47
49
  sleep 1
48
- end
50
+ end if layout
49
51
 
50
52
  raise RbbtRESTHelpers::Retry if job.done? or job.error?
51
53
 
52
- layout = @layout if layout.nil?
53
-
54
54
  layout_file = (layout ? locate_template('layout') : nil)
55
55
  template_file = locate_template('wait')
56
56
 
@@ -232,7 +232,7 @@ module RbbtRESTHelpers
232
232
  filename = Misc.sanitize_filename(Misc.name2basename(filename))
233
233
 
234
234
  if @step
235
- url = add_GET_param(remove_GET_param(@fullpath, ["_update", "_"]), "_fragment", "html_resources/#{ filename }")
235
+ url = add_GET_param(remove_GET_param(@uri, ["_update", "_"]), "_fragment", "html_resources/#{ filename }")
236
236
  f = @step.file(:html_resources)[filename].find
237
237
  else
238
238
  url = "/files/#{ filename }"
@@ -270,7 +270,7 @@ module RbbtRESTHelpers
270
270
  filename = File.basename(TmpFile.tmp_file) if filename.nil?
271
271
 
272
272
  if @step
273
- url = add_GET_param(remove_GET_param(@fullpath, ["_update", "_"]), "_fragment", "json_resources/#{ filename }")
273
+ url = add_GET_param(remove_GET_param(@uri, ["_update", "_"]), "_fragment", "json_resources/#{ filename }")
274
274
  f = @step.file(:json_resources)[filename].find
275
275
  else
276
276
  url = "/files/#{ filename }"
@@ -402,7 +402,7 @@ module RbbtRESTHelpers
402
402
  if @step
403
403
  table_file = @step.file(table_code) if @step
404
404
 
405
- url = add_GET_param(@fullpath, "_fragment", File.basename(table_file))
405
+ url = add_GET_param(@uri, "_fragment", File.basename(table_file))
406
406
  url = remove_GET_param(url, "_update")
407
407
  url = remove_GET_param(url, "_layout")
408
408
  url = remove_GET_param(url, "_")
@@ -12,7 +12,7 @@ module Sinatra
12
12
 
13
13
  def authorize!
14
14
  return true if authorized?
15
- target_url = request.env["REQUEST_URI"]
15
+ target_url = @uri
16
16
  Log.warn{ "Unauthorized access to #{target_url}" }
17
17
  session[:target_url] = target_url
18
18
  redirect to('/login')
@@ -1,5 +1,31 @@
1
1
  module Sinatra
2
2
  module RbbtMiscHelpers
3
+ def param_file(name)
4
+ name = name.to_s
5
+ if @params[name + '__param_file']
6
+ @params[name + '__param_file']['tempfile']
7
+ elsif @params[name]
8
+ StringIO.new @params[name]
9
+ else
10
+ nil
11
+ end
12
+ end
13
+
14
+ def post_uri
15
+ new_params = {}
16
+ @params.each do |k,v|
17
+ if m = k.match(/(.*)__param_file/)
18
+ new_params[m[1]] = v['filename']
19
+ else
20
+ new_params[k] = v
21
+ end
22
+ end
23
+ hash = Misc.obj2digest(new_params)
24
+ params["__post_hash_id"] = hash
25
+ @uri + "?__post_hash_id=#{hash}"
26
+ end
27
+
28
+
3
29
  def file_mimetype(path)
4
30
  require 'mimemagic'
5
31
  mime = nil
@@ -123,10 +123,10 @@ module Sinatra
123
123
  dir = settings.file_dir
124
124
  FileUtils.mkdir_p dir unless File.exists? dir
125
125
  printer.print(:path => dir, :profile => 'profile')
126
- Log.info{ "Profile saved at #{ dir }: #{request.env["REQUEST_URI"]}" }
126
+ Log.info{ "Profile saved at #{ dir }: #{@uri}" }
127
127
  end
128
128
 
129
- response.header["URI"] = request.env["REQUEST_URI"]
129
+ response.header["URI"] = @uri
130
130
  end
131
131
 
132
132
  add_sass_load_path Rbbt.views.compass.find
@@ -186,6 +186,12 @@ module Sinatra
186
186
  template_render(template, params, name, :cache_type => :asynchronous)
187
187
  end
188
188
 
189
+ post '/main/*' do |file|
190
+ template = File.join 'main', file
191
+ name = template.gsub(/\//,' - ')
192
+ template_render(template, params, name, :cache_type => :asynchronous)
193
+ end
194
+
189
195
  get '/help/?:section?' do
190
196
  if params[:section]
191
197
  section = params[:section]
@@ -9,7 +9,7 @@ class StreamWorkflowTask
9
9
  EOL = "\r\n"
10
10
 
11
11
  def parse_uri(env)
12
- uri = env["REQUEST_URI"]
12
+ uri = @uri
13
13
  _n, workflow, task = uri.split("/")
14
14
  workflow = begin
15
15
  Kernel.const_get(workflow)
@@ -195,9 +195,9 @@ class StreamWorkflowTask
195
195
  end
196
196
 
197
197
  def do_stream(env)
198
- uri = env["REQUEST_URI"]
198
+ uri = @uri
199
199
 
200
- post = env["REQUEST_METHOD"]
200
+ post = @request_method
201
201
  return false unless post == "POST"
202
202
 
203
203
  hijack = !!env["rack.hijack"]
@@ -94,9 +94,21 @@ table
94
94
  .caption, .title
95
95
  color: $subtle-font
96
96
 
97
+ // USED?
97
98
  .info > .meta dt
98
99
  font-weight: bold
99
100
 
101
+ //
102
+ .card_sidebar .meta
103
+ & dt
104
+ font-weight: bold
105
+
106
+ & dd
107
+ min-height: 1em
108
+ &:empty
109
+ width: 3em
110
+ background-color: #eee
111
+
100
112
  dd > ul
101
113
  margin-top: 0px
102
114
 
@@ -49,7 +49,7 @@
49
49
 
50
50
  .action_content
51
51
  - if require_parameters
52
- %p Please configure the parameters to execute the action
52
+ .ui.message.warning Please configure the parameters to execute the action
53
53
  - else
54
54
  = capture_haml &block
55
55
 
@@ -25,6 +25,7 @@
25
25
  - if info.any? or card.meta or card.list_container
26
26
  .meta
27
27
  - if info.any?
28
+ - empty = false
28
29
  %h3 Meta data
29
30
  .entity_info
30
31
  = hash2dl(info)
@@ -21,7 +21,7 @@
21
21
  %input(type='submit')
22
22
 
23
23
  - if (%w(pvalue p.value p-value pvalues p.values p-values qvalue q.value q-value qvalues q.values q-values) & map.fields.first.downcase.split(/\s+/)).any? and map.fields.first.downcase !~ /score$/
24
- - url = add_GET_param(@fullpath, '_format', 'pvalue_score')
24
+ - url = add_GET_param(@uri, '_format', 'pvalue_score')
25
25
  %a.ui.small.button(href=url) Pvalue score
26
26
 
27
27
  = reveal "QQ-plot", nil, :class => 'ui small button plot' do
@@ -56,16 +56,16 @@
56
56
 
57
57
  - if Gene == Entity.formats[map.key_field]
58
58
  - if map.key_field != "Ensembl Gene ID"
59
- - url = add_GET_param(@fullpath, '_format', 'ensembl')
59
+ - url = add_GET_param(@uri, '_format', 'ensembl')
60
60
  %a.ensembl.ui.small.button(href=url) Ensembl
61
61
  - if map.key_field != "Associated Gene Name"
62
- - url = add_GET_param(@fullpath, '_format', 'name')
62
+ - url = add_GET_param(@uri, '_format', 'name')
63
63
  %a.name.ui.small.button(href=url) Name
64
64
  - if "Rank" == map.fields.first
65
- - url = add_GET_param(@fullpath, '_format', 'invert_ranks')
65
+ - url = add_GET_param(@uri, '_format', 'invert_ranks')
66
66
  %a.invert_ranks.ui.small.button(href=url) Invert ranks
67
67
  - else
68
- - url = add_GET_param(@fullpath, '_format', 'ranks')
68
+ - url = add_GET_param(@uri, '_format', 'ranks')
69
69
  %a.ranks.ui.small.button(href=url) Ranks
70
70
  - if NumericValue == Entity.formats[map.fields.first] or (map.entity_templates[map.fields.first] and map.entity_templates[map.fields.first].annotation_types.include? NumericValue)
71
71
  - $page_entity_base_type = page_entity_base_type
@@ -20,19 +20,19 @@
20
20
 
21
21
 
22
22
 
23
- - if defined? job.info_file and Open.exists? job.info_file and request.env["REQUEST_URI"].include? job.name
24
- - clean_url = add_GET_param(remove_GET_param(request.env["REQUEST_URI"], "_layout"), "_update", "clean")
23
+ - if defined? job.info_file and Open.exists? job.info_file and @uri.include? job.name
24
+ - clean_url = add_GET_param(remove_GET_param(@uri, "_layout"), "_update", "clean")
25
25
  %a.ui.button.blue.clean(href=clean_url) Clean
26
26
  - else
27
- - clean_url = add_GET_param(remove_GET_param(request.env["REQUEST_URI"], "_layout"), "_update", "reload")
27
+ - clean_url = add_GET_param(remove_GET_param(@uri, "_layout"), "_update", "reload")
28
28
  %a.ui.blue.button.reload(href=clean_url) Reload
29
29
 
30
- - info_url = request.env["REQUEST_URI"].sub(/\?.*/,'') + '/info'
31
- - if request.env["REQUEST_URI"].include? job.name
30
+ - info_url = @uri.sub(/\?.*/,'') + '/info'
31
+ - if @uri.include? job.name
32
32
  %a.ui.blue.button.reload(href=info_url) Info
33
33
 
34
- - if job.files.any? and request.env["REQUEST_URI"].include? job.name
35
- - files_url = request.env["REQUEST_URI"].sub(/\?.*/,'') + '/files'
34
+ - if job.files.any? and @uri.include? job.name
35
+ - files_url = @uri.sub(/\?.*/,'') + '/files'
36
36
  %a.ui.blue.button.reload(href=files_url) Files
37
37
 
38
38
 
@@ -25,7 +25,7 @@
25
25
  - autofill_id = "autofill_" << Misc.digest(job.name)
26
26
  .ui.button.autofill(id=autofill_id) Auto-fill form with inputs
27
27
  .ui.button.autofill(id=autofill_id)
28
- %a(href="#{@ajax_path}?_format=input_bundle") Download input bundle
28
+ %a(href="#{@ajax_url}?_format=input_bundle") Download input bundle
29
29
  :deferjs
30
30
  $('##{autofill_id}').click(function(){
31
31
  var inputs = #{inputs.to_hash.to_json};
@@ -9,6 +9,7 @@
9
9
 
10
10
  - klass = "#{klass} custom"
11
11
 
12
+ - action = remove_GET_param(action, '__post_hash_id') if action
12
13
  - if defined?(description) and description
13
14
  .form_description
14
15
  =description
@@ -66,7 +67,7 @@
66
67
  - input_options = options[input]
67
68
  - input_options = input_options.dup unless input_options.nil?
68
69
  - description = descriptions[input]
69
- - if use[input]
70
+ - if use[input] && description
70
71
  - description += "\n\nUsed in:\n"
71
72
  - uses.each do |workflow, tasks|
72
73
  - tasks.each do |task|
@@ -113,14 +113,14 @@ function replace_object(object, href, embedd, complete){
113
113
  href = remove_parameter(href, '_update');
114
114
  href = remove_parameter(href, '_');
115
115
 
116
-
117
- if (req.responseText.match('error_message') != null){
118
- error_message = $(req.responseText).find('.error_message').html()
116
+ text = req.responseText
117
+ if (text.match('error_message') != null){
118
+ error_message = $(text).find('.error_message').html()
119
119
  }else{
120
- if (req.responseText.match('summary') != null){
121
- error_message = $(req.responseText).find('#summary').text()
120
+ if (text.match('summary') != null){
121
+ error_message = $(text).find('#summary').text()
122
122
  }else{
123
- error_message = req.responseText.split("\n")[0]
123
+ error_message = text.split("\n")[0]
124
124
  }
125
125
  }
126
126
 
@@ -204,7 +204,7 @@ function update_embedded(object, reload, complete){
204
204
 
205
205
 
206
206
  function capture_embedded_form(object){
207
-
207
+ object = $(object)
208
208
  object.find('form').submit(function(){
209
209
  var form = $(this);
210
210
  var embedded = object;
@@ -59,6 +59,13 @@ ModalComponent = function(element){
59
59
  })
60
60
  }
61
61
 
62
+ ctrl.capture_embedded_form = function(){
63
+ var content = $(this.vm.element).find('> .content')
64
+ content.attr('target-href', this.vm.url)
65
+ console.log(content)
66
+ capture_embedded_form(content)
67
+ }
68
+
62
69
  ctrl.close = function(){
63
70
  ctrl.vm.visible(false)
64
71
  ctrl.vm.url = undefined
@@ -6,7 +6,7 @@
6
6
 
7
7
  - extra = "" unless defined? extra
8
8
 
9
- - url = @fullpath
9
+ - url = @uri
10
10
 
11
11
  %svg.nvd3(id=id)
12
12
 
@@ -66,21 +66,21 @@
66
66
  $('.step.progress').progress({label: 'ratio',text:{ratio: '{value}'}})
67
67
 
68
68
  %hr
69
- - if defined? job.info_file and File.exists? job.info_file and request.env["REQUEST_URI"].include? job.name
70
- - abort_url = add_GET_param(remove_GET_param(request.env["REQUEST_URI"], "_layout"), "_update", "abort")
69
+ - if defined? job.info_file and File.exists? job.info_file and @uri.include? job.name
70
+ - abort_url = add_GET_param(remove_GET_param(@uri, "_layout"), "_update", "abort")
71
71
  %a.ui.button.red.abort(href=abort_url) Abort
72
- -#- clean_url = add_GET_param(remove_GET_param(request.env["REQUEST_URI"], "_layout"), "_update", "clean")
72
+ -#- clean_url = add_GET_param(remove_GET_param(@uri, "_layout"), "_update", "clean")
73
73
  -#%a.ui.button.blue.clean(href=clean_url) Clean
74
74
  - else
75
- - clean_url = add_GET_param(remove_GET_param(request.env["REQUEST_URI"], "_layout"), "_update", "reload")
75
+ - clean_url = add_GET_param(remove_GET_param(@uri, "_layout"), "_update", "reload")
76
76
  %a.ui.blue.button.reload(href=clean_url) Reload
77
77
 
78
- - if request.env["REQUEST_URI"].include? job.name
79
- - info_url = request.env["REQUEST_URI"].sub(/\?.*/,'') + '/info'
78
+ - if @uri.include? job.name
79
+ - info_url = @uri.sub(/\?.*/,'') + '/info'
80
80
  %a.ui.blue.button.reload(href=info_url) Info
81
81
 
82
- - if job.files.any? and request.env["REQUEST_URI"].include? job.name
83
- - files_url = request.env["REQUEST_URI"].sub(/\?.*/,'') + '/files'
82
+ - if job.files.any? and @uri.include? job.name
83
+ - files_url = @uri.sub(/\?.*/,'') + '/files'
84
84
  %a.ui.blue.button.reload(href=files_url) Files
85
85
 
86
86
  - if ! progress
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.145
4
+ version: 1.8.146
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-24 00:00:00.000000000 Z
11
+ date: 2021-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -1881,7 +1881,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1881
1881
  - !ruby/object:Gem::Version
1882
1882
  version: '0'
1883
1883
  requirements: []
1884
- rubygems_version: 3.0.6
1884
+ rubygems_version: 3.1.4
1885
1885
  signing_key:
1886
1886
  specification_version: 4
1887
1887
  summary: Rbbt Web and REST interfaces