rbbt-rest 1.8.135 → 1.8.140

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbbt/rest/common/cache.rb +4 -1
  3. data/lib/rbbt/rest/common/misc.rb +6 -1
  4. data/lib/rbbt/rest/common/render.rb +3 -2
  5. data/lib/rbbt/rest/common/table.rb +1 -1
  6. data/lib/rbbt/rest/entity/rest.rb +8 -2
  7. data/share/views/compass/card_templates.sass +14 -0
  8. data/share/views/compass/layout.sass +2 -0
  9. data/share/views/compass/misc.sass +15 -0
  10. data/share/views/entity_partials/entity_card.haml +19 -3
  11. data/share/views/entity_partials/entity_list_card.haml +9 -0
  12. data/share/views/entity_partials/entity_map_card.haml +5 -5
  13. data/share/views/job_result/array.haml +4 -1
  14. data/share/views/layout/footer.haml +2 -15
  15. data/share/views/partials/dependencies.haml +11 -5
  16. data/share/views/partials/footers/bsc.haml +3 -3
  17. data/share/views/partials/tabs.haml +15 -12
  18. data/share/views/public/js/app.js +13 -0
  19. data/share/views/public/js/helpers/helpers.js +2 -2
  20. data/share/views/public/js/rbbt.plots/rbbt.plots.graph.adapters.js +33 -11
  21. data/share/views/public/js/rbbt.plots/rbbt.plots.graph.js +20 -2
  22. data/share/views/public/plugins/cytoscapejs/cytoscape.js +1 -0
  23. data/share/views/public/plugins/cytoscapejs/cytoscape.min.js +22 -56
  24. data/share/views/public/plugins/cytoscapejs/cytoscape.umd.js +32290 -0
  25. data/share/views/tools/nvd3.haml +3 -2
  26. data/share/views/tools/nvd3/chart.haml +7 -2
  27. metadata +3 -4
  28. data/share/views/public/plugins/cytoscapejs/cytoscape.js +0 -24578
  29. data/share/views/public/plugins/cytoscapejs/cytoscape.js.map +0 -1
  30. data/share/views/public/plugins/cytoscapejs/cytoscape.min.js.map +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b24d5bf255e99819325d04fd31b37eea707de16cb7bf686eb0c688df20271e21
4
- data.tar.gz: 53d1400862b7970a92dbdab18f047b9d2e48554bbf555bac689f69aa53463b41
3
+ metadata.gz: 6e5a50362fab94b2e7e8536e08cd547e14a537e3ef9ea74d845b39f7e07f1ec6
4
+ data.tar.gz: 5d1cb0b86d12a2b2ef88432a1c0a6c59cce7981122866e29d6758bde77a1053a
5
5
  SHA512:
6
- metadata.gz: bd77cb58c1ca6f69f222f4ce3e68fdf888f6c11bb270fef9faff6ba2ea8b278cc782426fc3ace48ad8e3fbdb9ee370f25fe5d0a15e3552559cbedeed7ccc5704
7
- data.tar.gz: e36647d2e36eaf9103a07fc08b7ca0362387e9a680ff5ca94263c30b8cac487555ee545590be38d371ba910d00a4320d81e53425aa32dc06ccb973a3e2dc6674
6
+ metadata.gz: 7ad5e6f0c6a576017f4b70e729e567d39b61f30acbd821ed6a1c9229501868328f9127e50530e2d17864489d6853ae322d1d672fa5b68e96978e548b337e263a
7
+ data.tar.gz: a052ddbe5362be74bb1a2b2b76f9098b1d9c546e681f8b6491247c3ca8b9c9edc0c59e688b7d1297136684eca17ba948580bc93a3f90ab8938066e84a7ee6c41
@@ -153,6 +153,7 @@ module RbbtRESTHelpers
153
153
  header "Location", Entity::REST.entity_list_url(list_id, type)
154
154
  url = Entity::REST.entity_list_url(list_id, type)
155
155
  url = url + '?_layout=false' unless @layout
156
+ url = URI.encode(url)
156
157
  redirect to(url)
157
158
  when "map"
158
159
  raw_tsv, tsv_options = load_tsv(fragment_file)
@@ -174,6 +175,7 @@ module RbbtRESTHelpers
174
175
  Entity::Map.save_map(type.to_s, column, map_id, tsv, user)
175
176
  url = Entity::REST.entity_map_url(map_id, type, column)
176
177
  url = url + '?_layout=false' unless @layout
178
+ url = URI.encode(url)
177
179
  redirect to(url)
178
180
  when "excel"
179
181
  require 'rbbt/tsv/excel'
@@ -223,7 +225,8 @@ data = NULL
223
225
 
224
226
  if mime.nil?
225
227
  txt = Open.read(fragment_file)
226
- if txt =~ /<([^> ]+)[^>]*>.*<\/\1>/sm
228
+
229
+ if txt =~ /<([^> ]+)[^>]*>.*?<\/\1>/m
227
230
  mime = "text/html"
228
231
  else
229
232
  begin
@@ -59,8 +59,13 @@ module RbbtRESTHelpers
59
59
  @ajax = request.xhr?
60
60
  @ajax_url = headers["AJAX-URL"]
61
61
 
62
- @fullpath = request.fullpath
63
62
  @uri = request.env["REQUEST_URI"]
63
+ @path = request.env["PATH_INFO"]
64
+ @query = request.env["QUERY_STRING"]
65
+
66
+ #@fullpath = request.fullpath
67
+ @fullpath = (@query && ! @query.empty?) ? @path + "?" + @query : @path
68
+ @fullpath = remove_GET_param(@fullpath, ["_update", "_"])
64
69
 
65
70
  @layout = consume_parameter(:_layout)
66
71
 
@@ -166,9 +166,10 @@ module RbbtRESTHelpers
166
166
  }
167
167
  Open.write(pid_file, pid.to_s)
168
168
 
169
- url = @uri
169
+ url = @fullpath
170
170
  url = remove_GET_param(url, "_update")
171
171
  url = remove_GET_param(url, "_")
172
+
172
173
  fragment_url = add_GET_param(url, "_fragment", fragment_code)
173
174
  if link.nil?
174
175
  html_tag('a', "", :href => fragment_url, :class => 'fragment', "data-text" => text)
@@ -226,7 +227,7 @@ module RbbtRESTHelpers
226
227
  filename = Misc.sanitize_filename(Misc.name2basename(filename))
227
228
 
228
229
  if @step
229
- url = add_GET_param(remove_GET_param(@uri, ["_update", "_"]), "_fragment", "html_resources/#{ filename }")
230
+ url = add_GET_param(remove_GET_param(@fullpath, ["_update", "_"]), "_fragment", "html_resources/#{ filename }")
230
231
  f = @step.file(:html_resources)[filename].find
231
232
  else
232
233
  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(@uri, "_fragment", File.basename(table_file))
405
+ url = add_GET_param(@fullpath, "_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, "_")
@@ -14,11 +14,11 @@ module Entity
14
14
  #{{{ MISC
15
15
 
16
16
  def self.clean_element(elem)
17
- elem.gsub('/', '-..-').gsub("|", '-...-').gsub('%', 'o-o').gsub('[','(.-(').gsub(']',').-)')
17
+ elem.gsub('&', '--AND--').gsub('/', '-..-').gsub("|", '-...-').gsub('%', 'o-o').gsub('[','(.-(').gsub(']',').-)')
18
18
  end
19
19
 
20
20
  def self.restore_element(elem)
21
- CGI.unescape(CGI.unescape(elem.gsub('-..-', '/').gsub('-...-', '|').gsub('o-o', '%').gsub('(.-(','[').gsub(').-)',']')))
21
+ CGI.unescape(CGI.unescape(elem.gsub('--AND--', '&').gsub('-..-', '/').gsub('-...-', '|').gsub('o-o', '%').gsub('(.-(','[').gsub(').-)',']')))
22
22
  end
23
23
 
24
24
  def self.setup(mod)
@@ -146,6 +146,12 @@ module Entity
146
146
  rescue
147
147
  text = self
148
148
  end
149
+
150
+ begin
151
+ attributes[:title] ||= self.respond_to?(:title)? self.title || self : self
152
+ rescue
153
+ end
154
+
149
155
  attributes[:title] = text if attributes[:title].nil?
150
156
 
151
157
  Misc.html_tag('a', text, attributes)
@@ -1,4 +1,13 @@
1
1
 
2
+ .action_controller
3
+ display:flex !important
4
+ & > .action_progress
5
+ flex-width: 100%
6
+ & > .ui.buttons > .button
7
+ flex-height: 3em
8
+ & > .ui.buttons.controls > .button
9
+ max-height: 3em
10
+
2
11
  .action_parameters, .filter_controls
3
12
  form
4
13
  &:after
@@ -41,3 +50,8 @@
41
50
  width: 7em !important
42
51
 
43
52
 
53
+ .card_sidebar, .card_sidebar > *, .card_sidebar > * > *
54
+ text-overflow: ellipsis
55
+ overflow-x: auto
56
+ max-width: 100%
57
+
@@ -2,6 +2,8 @@
2
2
  .preload *
3
3
  +animation-duration(0s !important)
4
4
 
5
+ html, body
6
+ scroll-padding-top: 60px
5
7
  body
6
8
  background: none repeat scroll 0% 0% #F7F7F7
7
9
  margin: 0 !important
@@ -278,3 +278,18 @@ ul.tasks
278
278
 
279
279
  .table > .table_url
280
280
  display: none
281
+
282
+ dl.flex_dl
283
+ display: flex
284
+ flex-flow: row wrap
285
+ & > dt
286
+ flex-basis: 20%
287
+ text-align: right
288
+ padding-right: 2em
289
+ max-width: 20%
290
+ text-overflow: ellipsis
291
+ & > dd
292
+ flex-basis: 80%
293
+ flex-grow: 1
294
+ margin: 0
295
+
@@ -2,21 +2,31 @@
2
2
  - entity_id = "entity__" + entity.id
3
3
  - default = entity.respond_to?(:default)? entity.default || entity.to_s : entity.to_s
4
4
 
5
+ :sass
6
+ .card_sidebar, .card_sidebar > *, .card_sidebar > * > *
7
+ text-overflow: ellipsis
8
+ overflow-x: auto
9
+ max-width: 100%
5
10
 
6
11
  .entity_card.ui.grid(data-entity=entity data-entity-id=default data-entity-type="#{entity.base_type}" data-entity-format="#{entity.respond_to?(:format) ? entity.format : ""}" data-entity-info="#{entity.info.to_json}")
7
12
  /-- card_sidebar --
8
- .ui.four.wide.column.vertical.card_sidebar.menu
13
+ .ui.four.wide.column.vertical.card_sidebar.menu.hidden
14
+ - empty = true
9
15
  - if card.sections.any?
16
+ - empty = false
10
17
  %h3 Sections
11
18
  - card.sections.each do |name,section|
12
19
  %a.item(href="##{Misc.snake_case(name)}")= Misc.humanize(name)
13
- %a.item(href="#entity_actions") Entity actions
20
+ - if card.action_controller
21
+ %a.item(href="#entity_actions") Entity actions
14
22
 
15
23
  - info = card.entity.info
24
+ - info.delete :annotation_types
16
25
  - if info.any? or card.meta or card.list_container
17
- %h3 Meta data
26
+ - empty = false
18
27
  .meta
19
28
  - if info.any?
29
+ %h3 Meta data
20
30
  .entity_info
21
31
  = hash2dl(info)
22
32
 
@@ -28,10 +38,16 @@
28
38
  = fragment :meta, &card.meta
29
39
 
30
40
  - if card.list_container
41
+ - empty = false
31
42
  %h3 Related lists
32
43
  .list_container
33
44
  = list_container_render(card.list_container)
34
45
 
46
+ - if ! empty
47
+ .show_opened
48
+ - else
49
+ .delete_empty
50
+
35
51
 
36
52
  .ui.twelve.wide.column.content
37
53
  .ui.header.basic.segment
@@ -3,7 +3,9 @@
3
3
 
4
4
  .entity_list_card.ui.grid(id="#{ list_id.gsub(/\s/,'_') }_card" data-list=list_id data-list-type="#{list.base_type}")
5
5
  .ui.four.wide.column.vertical.card_sidebar.menu.hidden
6
+ - empty = true
6
7
  - if card.sections.any?
8
+ - empty = false
7
9
  %h3 Sections
8
10
  - card.sections.each do |name,section|
9
11
  %a.item(href="##{Misc.snake_case(name)}")= Misc.humanize(name)
@@ -22,7 +24,10 @@
22
24
  %a.edit_list.ui.button(href="#") Edit
23
25
 
24
26
  - info = card.list.info
27
+ - info.delete :annotation_types
28
+ - info.delete :annotated_array
25
29
  - if info.any? or card.meta or card.list_container
30
+ - empty = false
26
31
  /-- sidebar --
27
32
  %h3 Meta data
28
33
  .meta
@@ -55,10 +60,14 @@
55
60
  %li= link
56
61
 
57
62
  - if card.list_container
63
+ - empty = false
58
64
  %h3 Related lists
59
65
  .list_container
60
66
  = list_container_render(card.list_container)
61
67
 
68
+ - if ! empty
69
+ .show_opened
70
+
62
71
  .ui.twelve.wide.column.content
63
72
  .ui.header.basic.segment
64
73
  .content
@@ -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(@uri, '_format', 'pvalue_score')
24
+ - url = add_GET_param(@fullpath, '_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(@uri, '_format', 'ensembl')
59
+ - url = add_GET_param(@fullpath, '_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(@uri, '_format', 'name')
62
+ - url = add_GET_param(@fullpath, '_format', 'name')
63
63
  %a.name.ui.small.button(href=url) Name
64
64
  - if "Rank" == map.fields.first
65
- - url = add_GET_param(@uri, '_format', 'invert_ranks')
65
+ - url = add_GET_param(@fullpath, '_format', 'invert_ranks')
66
66
  %a.invert_ranks.ui.small.button(href=url) Invert ranks
67
67
  - else
68
- - url = add_GET_param(@uri, '_format', 'ranks')
68
+ - url = add_GET_param(@fullpath, '_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
@@ -1,4 +1,7 @@
1
1
  %ul
2
2
  - result.each do |elem|
3
- %li= elem
3
+ - if elem.respond_to?(:link)
4
+ %li= elem.link
5
+ - else
6
+ %li= elem
4
7
 
@@ -37,24 +37,11 @@
37
37
  a
38
38
  width: 100%
39
39
 
40
- .ui.segment.stackable.bottom.attached.grid.three.column
40
+ .ui.segment.stackable.bottom.attached.grid.two.column
41
41
  .ui.column
42
42
  = partial_render('partials/footers/bsc')
43
+ -#
43
44
  .ui.column
44
45
  = partial_render('partials/footers/ntnu')
45
46
  .ui.column
46
47
  = partial_render('partials/footers/cnio')
47
- -#.ui.segment
48
- .image
49
- %a(href="http://www.cnio.es/")
50
- %img(src="/file/cnio.png" height='115px' width='241px')
51
- .content
52
- .ui.header
53
- CNIO. Centro Nacional de Investigaciones Oncologicas (Spanish National Cancer Research Center)
54
- .description
55
- %span.group Structural Computational Biology Group
56
- %br/
57
- %span.address C/ Melchor Fernandez Almagro, 3, E-28029 Madrid
58
- .meta.contact
59
- %span.who miguel.vazquez
60
- %span.where cnio.es
@@ -7,9 +7,15 @@
7
7
  - dep_workflow ||= dep.task.workflow if dep.task
8
8
  - dep_workflow ||= File.basename(File.dirname(File.dirname(dep.path)))
9
9
  - str = [dep_workflow, dep.task_name, dep.name].compact * " - "
10
- - dep_status = "done" if dep.path.exists?
10
+ - remote = true if Open.remote?(dep.path) || Open.ssh?(dep.path)
11
+
12
+ - if remote
13
+ - dep_status = "done" if dep.done?
14
+ - else
15
+ - dep_status = "done" if dep.path.exists?
16
+
11
17
  - dep_status ||= dep.status
12
- - if dep.file(:progress).exists?
18
+ - if ! remote && dep.file(:progress).exists?
13
19
  - pgr = dep.file(:progress).yaml
14
20
  - if pgr and pgr[:last_percent]
15
21
  - start = pgr[:start]
@@ -57,8 +63,8 @@
57
63
  - elsif Module === dep_workflow
58
64
  - wf = dep_workflow
59
65
 
60
- - if Open.remote? dep.path
61
- - url = path.split("?").first
66
+ - if Open.remote?(dep.path)
67
+ - url = dep.path.split("?").first
62
68
  %a(href=url) #{ name }
63
69
 
64
70
  - elsif wf and Sinatra::RbbtRESTWorkflow::WORKFLOWS.include?(wf) and wf.task_exports.include? dep.task_name.to_sym
@@ -71,7 +77,7 @@
71
77
 
72
78
  %span.status(class="#{dep_status}") [#{status}]
73
79
 
74
- - if dep.dependencies.any?
80
+ - if dep.dependencies && dep.dependencies.any?
75
81
  - if cache[dep.path]
76
82
  = reveal "(deps)", nil, :title => "Dependencies already shown above", "attr-reveal_title" => "#{[dep_workflow, dep.task_name, dep.name] * " &num; "}" do
77
83
  = cache[dep.path]
@@ -2,19 +2,19 @@
2
2
  %a(href="http://www.bsc.es/")
3
3
  %img(src="/file/bsc.svg")
4
4
  .content
5
- .ui.header
5
+ -#.ui.header
6
6
  :sass
7
7
  span.bsc
8
8
  font-weight: bold
9
9
  span.cns
10
10
  font-style: italic
11
11
  font-weight: normal
12
-
12
+ -#
13
13
  %span.bsc Barcelona Supercomputing Center
14
14
  %span.cns Centro Nacional de Supercomputaci&oacute;n
15
15
 
16
16
  .description
17
- %span.group Genome Informatics Unit
17
+ %span.group Genome Informatics Unit. Life sciences Department.
18
18
  %span.address Nexus II Building. C/ Jordi Girona, 29. 08034 Barcelona (Spain)
19
19
 
20
20
  .meta.contact
@@ -2,23 +2,26 @@
2
2
  - id = "tab_menu_" + rand(1000).to_s unless defined? id and not id.nil?
3
3
  - active = false unless defined? active and not active.nil?
4
4
  - active = headers.first if TrueClass === active
5
- .ui.top.attached.tabular.stackable.menu(id=id)
5
+ .tabs(id=id)
6
+ .ui.top.attached.tabular.stackable.menu
7
+ - headers.each do |header|
8
+ - code = codes[header] ||= Misc.digest([header, id]*"-")
9
+ - tab_active = (active and active == header) ? 'active' : ''
10
+ .ui.item(data-tab=code class=tab_active)= header
11
+
6
12
  - headers.each do |header|
7
- - code = codes[header] ||= Misc.digest([header, id]*"-")
13
+ - code = codes[header]
14
+ - next if content[header].nil?
8
15
  - tab_active = (active and active == header) ? 'active' : ''
9
- .ui.item(data-tab=code class=tab_active)= header
10
-
11
- - headers.each do |header|
12
- - code = codes[header]
13
- - next if content[header].nil?
14
- - tab_active = (active and active == header) ? 'active' : ''
15
- .ui.tab.bottom.attached.segment.content(data-tab=code class=tab_active)
16
- = content[header]
16
+ .ui.tab.bottom.attached.segment.content(data-tab=code class=tab_active)
17
+ = content[header]
17
18
 
18
19
  :deferjs
19
- $("##{id} > .item[data-tab]").tab()
20
+ //$("##{id} > .item[data-tab]").tab()
21
+
22
+ $("##{id} > .menu > .item[data-tab]").tab({"context": "##{id}"})
20
23
 
21
- $('##{id} > .item[data-tab=close]').click(function(item){
24
+ $('##{id} > .menu > .item[data-tab=close]').click(function(item){
22
25
  var tool = $(this).parents('.cytoscape_tool').first()
23
26
  tool.find('.tab.active, .item.active').removeClass('active')
24
27
  return false
@@ -39,6 +39,19 @@ if (typeof user === 'undefined') user = 'none'
39
39
 
40
40
  $(function(){
41
41
 
42
+ register_dom_update('.card_sidebar > .show_opened', function(elem){
43
+ elem.parent('.card_sidebar').removeClass('hidden')
44
+ elem.remove()
45
+ })
46
+
47
+ register_dom_update('.card_sidebar > .delete_empty', function(elem){
48
+ console.log('delete')
49
+ elem.parent('.card_sidebar').siblings('.content').find('.controls > .card_sidebar_open').remove()
50
+ elem.parent('.card_sidebar').remove()
51
+ })
52
+
53
+
54
+
42
55
  register_dom_update('.reload_workflow', function(elem){
43
56
  elem.click(function(){
44
57
  console.log('WR')
@@ -48,11 +48,11 @@ function remove_parameter(url, parameter){
48
48
  }
49
49
 
50
50
  function clean_element(elem){
51
- return elem.replace(/\//g, '-..-').replace(/%/g,'o-o').replace(/\[/g,'(.-(').replace(/\]/g,').-)')
51
+ return elem.replace('&','--AND--').replace(/\//g, '-..-').replace(/%/g,'o-o').replace(/\[/g,'(.-(').replace(/\]/g,').-)')
52
52
  }
53
53
 
54
54
  function restore_element(elem){
55
- return unescape(elem.replace(/-\.\.-/g, '/').replace(/o-o/g,'%')).replace(/\(\.-\(/g,'[').replace(/\)\.-\)/g,']');
55
+ return unescape(elem.replace('--AND--','&').replace(/-\.\.-/g, '/').replace(/o-o/g,'%')).replace(/\(\.-\(/g,'[').replace(/\)\.-\)/g,']');
56
56
  }
57
57
 
58
58
  function parse_parameters(params){