rbbt-rest 1.6.8 → 1.6.9

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: 07494c877ee9a075de3fce9b8aef3eb6dcc3e656
4
- data.tar.gz: a1c87e5660c3a48564a4f370674df4e8115e37a6
3
+ metadata.gz: 05c447d083fa7c7d20eb9ec6b35fd40def102fac
4
+ data.tar.gz: 223225ff89f70995dc1f0adef68da27519513630
5
5
  SHA512:
6
- metadata.gz: cb8234dbc93b45f713bc20988a50c613e317b2d7356be78dbd9b0ee7c5c0034d00985dace331c8b53b54350e2734d53f67d28b699e5d68d04a34e0fa621f96f5
7
- data.tar.gz: d56098eb977c566fa52734ae424944f4e23c3071fe9beb2f91bb8ab3f3279f97dabd499d1ba73f5b684be85ea47803fe01981500ca2a93e97722099dece7774f
6
+ metadata.gz: 45eb8f221717d239d99e2d55b8952c02c13e16a973d7a2e1fb2a2cd9ea90f95bad7fb7f86e7f2930717d1742742e52be5f4a0f768d487cda3de6c870f760bdb9
7
+ data.tar.gz: 80ca57f493f3d6460053c4a5f775658b6d7bac446c8b95a3023b7d7451e070d234e3c4077ad7012f7f3eec5c2cd40b106ccb0ce5351d7410eee19044c5ab8fde
@@ -160,17 +160,23 @@ module RbbtRESTHelpers
160
160
 
161
161
  else
162
162
  # check for problems
163
- if File.exists?(step.info_file) and Time.now - File.atime(step.info_file) > 60
164
- Log.debug{ "Checking on #{step.info_file}" }
165
- running = (not step.done?) and step.running?
166
- if FalseClass === running
167
- Log.debug{ "Aborting zombie #{step.info_file}" }
168
- step.abort unless step.done?
169
- raise RbbtRESTHelpers::Retry
170
- end
171
- FileUtils.touch(step.info_file)
163
+ begin
164
+ check_step step
165
+ rescue Aborted
166
+ raise RbbtRESTHelpers::Retry
172
167
  end
173
168
 
169
+ #if File.exists?(step.info_file) and Time.now - File.atime(step.info_file) > 60
170
+ # Log.debug{ "Checking on #{step.info_file}" }
171
+ # running = (not step.done?) and step.running?
172
+ # if FalseClass === running
173
+ # Log.debug{ "Aborting zombie #{step.info_file}" }
174
+ # step.abort unless step.done?
175
+ # raise RbbtRESTHelpers::Retry
176
+ # end
177
+ # FileUtils.touch(step.info_file)
178
+ #end
179
+
174
180
  wait_on step, false
175
181
  end
176
182
  end
@@ -3,6 +3,23 @@ require 'rbbt/util/misc'
3
3
  module RbbtRESTHelpers
4
4
  class Retry < Exception; end
5
5
 
6
+ def check_step(step)
7
+ if File.exists?(step.info_file) and Time.now - File.atime(step.info_file) > 60
8
+ Log.debug{ "Checking on #{step.info_file}" }
9
+ running = (not step.done?) and step.running?
10
+ if FalseClass === running
11
+ if step.done?
12
+ Log.debug{ "Not aborting zombie #{step.info_file}: it is done" }
13
+ else
14
+ Log.debug{ "Aborting zombie #{step.info_file}" }
15
+ step.abort
16
+ raise Aborted, "Zombie job aborted"
17
+ end
18
+ end
19
+ FileUtils.touch(step.info_file)
20
+ end
21
+ end
22
+
6
23
  PAGE_SIZE = 20
7
24
 
8
25
  def log(status, message = nil)
@@ -259,4 +276,5 @@ module Haml::Filters::Documentation
259
276
 
260
277
  Haml::Engine.new(doc_text).to_html
261
278
  end
279
+
262
280
  end
@@ -5,7 +5,7 @@ module Entity
5
5
  module REST
6
6
  USE_ENSEMBL = true
7
7
 
8
- REST_ENTITIES = []
8
+ REST_ENTITIES = Set.new
9
9
 
10
10
  def self.included(base)
11
11
  REST_ENTITIES << base
@@ -172,6 +172,11 @@ module Sinatra
172
172
 
173
173
  job = workflow.load_id(File.join(task, job))
174
174
 
175
+ begin
176
+ check_step job
177
+ rescue Aborted
178
+ end
179
+
175
180
  case format
176
181
  when :html
177
182
  workflow_render('job_info', workflow, task, :info => job.info)
@@ -65,8 +65,29 @@ $subtle-font: rgba(0,0,0,0.30)
65
65
  float: left
66
66
 
67
67
  =small_screen
68
+ form.workflow_task
69
+ .input.field.submit
70
+ input, select
71
+ width: 100% !important
72
+ select
73
+ float: left
74
+ span.file_or_text_area
75
+ display: block
76
+ clear: both
77
+ #top_menu
78
+ position: relative !important
79
+ > .favourite
80
+ display: block
81
+ width: 100%
82
+ clear: both
83
+ > .item
84
+ float: left
85
+
86
+ .dropdown.item .dropdown.item > .menu
87
+ max-height: 300px
88
+
68
89
  #content
69
- padding: 64px 4px
90
+ padding: 64px 8px
70
91
 
71
92
  .entity_card, .entity_list_card
72
93
  > .content
@@ -258,9 +279,9 @@ span.bullet
258
279
  @extend .pointer
259
280
  &:hover
260
281
  border: 1px solid rgba(0,0,0,0.12)
261
- width: 1.5em
262
- height: 1.5em
263
- margin-top: 0.5em
282
+ width: 2em
283
+ height: 2.5em
284
+ line-height: 2.5em
264
285
  text-align: center
265
286
  position: absolute
266
287
  left: 0
@@ -268,6 +289,14 @@ span.bullet
268
289
  color: red
269
290
  &.green
270
291
  color: green
292
+ &+a
293
+ margin-left: 2em
294
+ padding-left: 0em
295
+ width: calc(100% - 2em) !important
296
+
297
+ .dropdown.item .dropdown.item > .menu
298
+ overflow-y: auto
299
+ max-height: 500px
271
300
 
272
301
  label[title]
273
302
  cursor: help
@@ -276,3 +305,10 @@ label[title]
276
305
  margin-top: 8px
277
306
  .progress.ui.message:empty
278
307
  display: none
308
+
309
+ table
310
+ caption
311
+ width: 100%
312
+
313
+ .examples
314
+ clear: both
@@ -37,42 +37,9 @@
37
37
  /{{{ CODA
38
38
  /--------
39
39
  #coda
40
- = link_js "http://cdnjs.cloudflare.com/ajax/libs/mithril/0.1.28/mithril.min.js"
40
+ //= link_js "http://cdnjs.cloudflare.com/ajax/libs/mithril/0.1.28/mithril.min.js"
41
41
  -# ["/js-find/rbbt", "/js-find/rbbt.page", "/js-find/rbbt.entity", "/js-find/rbbt.entity_list", "/js-find/rbbt.knowledge_base", "/js-find/rbbt.favourites"].each do |file|
42
42
  - record_js file
43
43
  =partial_render('layout/coda')
44
44
 
45
45
 
46
- :deferjs
47
- function gene_name(name){
48
- return new Entity({type: "Gene", id: name, name: name, format: "Associated Gene Name", info: { organism: "Hsa/feb2014" }})
49
- }
50
-
51
- function entity_link(entity){
52
- return m('a', {href: entity.url()}, entity.name)
53
- }
54
-
55
- function entity_item(entity){
56
- return m('li', entity_link(entity))
57
- }
58
-
59
- function entity_list(list){
60
- return m('ul.entity_list', list.map(entity_item))
61
- }
62
-
63
- function draw_entity_list(list){
64
- var content_elem = $('#content')[0]
65
- var content = [m("p", {style: 'padding: 3em'}, entity_list(list))]
66
- return m.render(content_elem, content)
67
- }
68
-
69
- function debug(name){
70
- gene = gene_name(name)
71
- gene.children("tfacts@genomics").then(draw_entity_list)
72
- gene.parents("tfacts@genomics").then(draw_entity_list)
73
- }
74
-
75
- require_js(["/js-find/rbbt", "/js-find/rbbt.entity", "/js-find/rbbt.entity_list", "/js-find/rbbt.entity_map", "/js-find/rbbt.knowledge_base", "/js-find/rbbt.page", "/js-find/rbbt.aesthetics", "/js-find/rbbt.favourites"], function(){
76
- //debug("TP53")
77
- })
78
-
@@ -1,19 +1,51 @@
1
1
  = serve_js
2
2
 
3
3
  :javascript
4
- var user = #{user ? '"' + user + '"' : '"none"'}
5
- var main_url = window.location.toString();
6
- var production = #{production? ? "true" : "false"};
7
4
  $('.offcanvas').click(function(e){
8
5
  if( e.target !== this )
9
6
  return;
10
7
  $(this).toggleClass('show')
11
8
  })
12
9
 
13
- requirejs.config({baseUrl: '/js-find'})
14
-
15
10
  start_deferred()
16
11
 
12
+ var known_types = #{Entity::REST::REST_ENTITIES.collect{|m| m.to_s}.to_json}
13
+
14
+ if (user != 'none') fav_module.update()
15
+
16
+ function gene_name(name){
17
+ return new Entity({type: "Gene", id: name, name: name, format: "Associated Gene Name", info: { organism: "Hsa/feb2014" }})
18
+ }
19
+
20
+ function entity_link(entity){
21
+ return m('a', {href: entity.url()}, entity.name)
22
+ }
23
+
24
+ function entity_item(entity){
25
+ return m('li', entity_link(entity))
26
+ }
27
+
28
+ function entity_list(list){
29
+ return m('ul.entity_list', list.map(entity_item))
30
+ }
31
+
32
+ function draw_entity_list(list){
33
+ var content_elem = $('#content')[0]
34
+ var content = [m("p", {style: 'padding: 3em'}, entity_list(list))]
35
+ return m.render(content_elem, content)
36
+ }
37
+
38
+ function debug(name){
39
+ gene = gene_name(name)
40
+ gene.children("tfacts@genomics").then(draw_entity_list)
41
+ gene.parents("tfacts@genomics").then(draw_entity_list)
42
+ }
43
+
44
+ //require_js(["/js-find/rbbt", "/js-find/rbbt.entity", "/js-find/rbbt.entity_list", "/js-find/rbbt.entity_map", "/js-find/rbbt.knowledge_base", "/js-find/rbbt.page", "/js-find/rbbt.aesthetics", "/js-find/rbbt.favourites"], function(){
45
+ // //debug("TP53")
46
+ //})
47
+
48
+
17
49
  - if @reload_page
18
50
  :javascript
19
51
  var wait_timeout = 2000;
@@ -13,25 +13,27 @@
13
13
 
14
14
  - record_css '/plugins/jquery-ui/css/custom-theme/jquery-ui-1.8.14.custom.css'
15
15
 
16
- -# record_css '/stylesheets/layout'
17
- -# record_css '/stylesheets/responsive'
18
- -# record_css '/stylesheets/text'
19
- -# record_css '/stylesheets/cards'
20
- -# record_css '/stylesheets/elements'
21
- -# record_css '/stylesheets/menu'
22
- -# record_css '/stylesheets/color'
23
-
24
16
  - record_css '/stylesheets/app'
25
17
 
26
18
  = serve_css
27
19
 
28
20
  // Third party frameworks
29
21
 
30
- - record_js '/plugins/mithril/js/mithril.js'
31
- - record_js "/plugins/requirejs/js/require.js"
22
+ :javascript
23
+ var user = #{user ? '"' + user + '"' : '"none"'}
24
+ var main_url = window.location.toString();
25
+ var production = #{production? ? "true" : "false"};
26
+
27
+ -#= link_js "http://cdnjs.cloudflare.com/ajax/libs/mithril/0.1.28/mithril.min.js"
28
+
32
29
  - record_js '/js/defer'
30
+ - record_js "/plugins/mithril/js/mithril.js"
31
+ - record_js "/plugins/requirejs/js/require.js"
33
32
  = serve_js
34
33
 
34
+ :javascript
35
+ requirejs.config({baseUrl: '/js-find'})
36
+
35
37
 
36
38
  - %w(jquery-2.1.1 jquery.cookie jquery.form).each do |jquery_file|
37
39
  - record_js File.join('/plugins/jquery/js/', jquery_file)
@@ -41,6 +43,7 @@
41
43
  - record_js '/plugins/jquery.scrollTo/jquery.scrollTo'
42
44
  - record_js '/plugins/semantic-ui/dist/semantic.min.js'
43
45
  - record_js '/plugins/FileSaver/js/FileSaver.js'
46
+ - record_js '/plugins/color-js/color.js'
44
47
 
45
48
  - %w(helpers _md5 _ajax_replace _ellipsis).each do |file|
46
49
  - record_js "/js-find/#{ file }"
@@ -48,4 +51,10 @@
48
51
  - %w(dom_update workflow fragment menu favourites page_type modal reveal actions table list map hide).each do |file|
49
52
  - record_js "/js-find/rbbt/#{ file }"
50
53
 
54
+ - %w(dom_update workflow fragment menu favourites page_type modal reveal actions table list map hide).each do |file|
55
+ - record_js "/js-find/rbbt/#{ file }"
56
+
57
+ - %w(rbbt rbbt.basic rbbt.job rbbt.page rbbt.entity rbbt.entity_list rbbt.entity_map rbbt.views rbbt.favourites rbbt.knowledge_base rbbt.aesthetics rbbt.modal).each do |file|
58
+ - record_js "/js-find/#{ file }"
59
+
51
60
  - record_js "/js-find/app"
@@ -19,14 +19,12 @@
19
19
 
20
20
  - expoted_workflows.compact!
21
21
  - if expoted_workflows.any?
22
- .item.right(style='padding:0px')
23
- .ui.menu
24
- .ui.dropdown.item
25
- %i.icon.dropdown
26
- Workflows
27
- .menu
28
- - expoted_workflows.each do |workflow|
29
- %a.item(href='#{'/' + workflow.to_s}')= workflow.to_s
22
+ .ui.dropdown.item.right
23
+ %i.icon.dropdown
24
+ Workflows
25
+ .menu
26
+ - expoted_workflows.each do |workflow|
27
+ %a.item(href='#{'/' + workflow.to_s}')= workflow.to_s
30
28
 
31
29
  - if settings.respond_to?(:finder) and settings.finder and settings.finder.instances.any?
32
30
  .finder.right.item
@@ -1,5 +1,3 @@
1
- var rbbt = {}
2
-
3
1
  function fit_content(){
4
2
  var height = window.innerHeight - $('footer').outerHeight(true);
5
3
  $('#content').css('min-height', height)
@@ -26,7 +24,7 @@ function update_rbbt(){
26
24
  fit_content()
27
25
  $('.preload').removeClass('preload');
28
26
 
29
- if (undefined !== rbbt.favourites) rbbt.favourites.update()
27
+ if (undefined !== rbbt.favourites && user != 'none') rbbt.favourites.update()
30
28
 
31
29
  if (undefined !== rbbt.aesthetics){
32
30
  rbbt.aesthetics.load()
@@ -64,5 +62,3 @@ $(function(){
64
62
  update_rbbt()
65
63
  })
66
64
 
67
- // Activate tools
68
-
@@ -13,13 +13,20 @@ aes_module.store = function(){
13
13
  }
14
14
 
15
15
  aes_module.add = function(selector, aes, value){
16
- this.aesthetics.push({selector: selector, aes: aes, value: value})
16
+ var mod = this
17
+ if (typeof selector == 'function'){
18
+ return selector.then(function(_selector){
19
+ mod.aesthetics.push({selector: _selector, aes: aes, value: value})
20
+ })
21
+ }else{
22
+ this.aesthetics.push({selector: selector, aes: aes, value: value})
23
+ }
17
24
  }
18
25
 
19
26
  aes_module.clear_aesthetic = function(aes){
20
- var data_key = 'data-aes-' + aesthetic.aes
27
+ var data_key = 'data-aes-' + aesthetic.aes
21
28
 
22
- $('[' + data_key + ']').attr(data_key, 'none')
29
+ $('[' + data_key + ']').attr(data_key, 'none')
23
30
  }
24
31
 
25
32
  aes_module.apply_aesthetic = function(aesthetic){
@@ -28,6 +35,7 @@ aes_module.apply_aesthetic = function(aesthetic){
28
35
  targets = $(aesthetic.selector)
29
36
  }else{
30
37
  var items = aesthetic.selector
38
+ if (typeof items[0] == 'object') items = $.map(items, function(i){return i.id})
31
39
  targets = $('.entity').filter(function(index){
32
40
  var id = $(this).attr('data-entity-id')
33
41
  return items.indexOf(id) >= 0
@@ -40,7 +48,7 @@ aes_module.apply_aesthetic = function(aesthetic){
40
48
 
41
49
  aes_module.apply = function(aesthetic){
42
50
  if (undefined === aesthetic)
43
- this.aesthetics.map(aes_module.apply_aesthetic)
51
+ aes_module.aesthetics.map(aes_module.apply_aesthetic)
44
52
  else
45
53
  aes_module.apply_aesthetic(aesthetic)
46
54
  }
@@ -0,0 +1,51 @@
1
+
2
+ rbbt.mlog = function(data){
3
+ console.log(data)
4
+ }
5
+
6
+ rbbt.insist_request = function(params, deferred, timeout, missing){
7
+ if (undefined === deferred) deferred = m.deferred()
8
+ if (undefined === timeout) timeout = 1000
9
+ if (timeout > 20000) timeout = 20000
10
+
11
+ params.extract = function(xhr, xhrOptions){
12
+ if (xhr.status != '200') throw(xhr)
13
+ return xhr.responseText
14
+ }
15
+
16
+ m.request(params).then(
17
+ function(res){
18
+ deferred.resolve(res)
19
+ },
20
+ function(xhr){
21
+ m.redraw()
22
+ if (xhr.status == '202'){
23
+ if (xhr.responseURL != params.url) params = $.extend(params, {url: xhr.responseURL, method: 'GET', data: params.data})
24
+ if (params.data !== undefined && params.data['_update'] !== undefined) params.data['_update'] = undefined
25
+ setTimeout(function(){ m.redraw(); rbbt.insist_request(params, deferred,timeout*2.5) }, timeout)
26
+ }else{
27
+ deferred.reject(new Error(xhr.statusText))
28
+ }
29
+ }
30
+ )
31
+
32
+ return deferred.promise
33
+ }
34
+
35
+ // LocalStorage
36
+
37
+ rbbt.LS = {}
38
+
39
+ rbbt.LS.load = function(key){
40
+ var content = localStorage[key]
41
+ if (content === undefined)
42
+ return undefined
43
+ else
44
+ return JSON.parse(content)
45
+ }
46
+
47
+ rbbt.LS.store = function(key, value){
48
+ localStorage[key] = JSON.stringify(value)
49
+ }
50
+
51
+