rbbt-rest 1.4.2 → 1.4.3

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: e8d9b16fc1e559f1ea8bcf38a58768634327f9c1
4
- data.tar.gz: c7c9548194b885e097a8d2429ef0ab846939c3f8
3
+ metadata.gz: 8812343a2a8345c1f58516ea3564d9f7c69a242c
4
+ data.tar.gz: 0a82376a6d54a79d43e0dec28a621c042648ccdd
5
5
  SHA512:
6
- metadata.gz: 3d108573834a36a21719721c7b7d87bef951a34f4671d01aa59aa054a8a892489c90ae3ef90537271586e84da45092175851b4ca5cdf5ad83736e006cf7bbc1b
7
- data.tar.gz: 6637db025c1ce3f51b2c48974ee6dd5a2153944d3aeb85609b0d52a8610eb3e3e85a0b8dda02f9f03e9bad3d8e41159f0152aed4b36a04a56147406a93af1f29
6
+ metadata.gz: ea16ac1a23c93d58ca5d8c808a7b4c650022fa250e7831403203c75b8e0e25474bf19232343102e0b07a4af397a39ee9c192924f5d1b0dc3222ef869f933ad08
7
+ data.tar.gz: 6fb04bf125f9cdccefa1db06f0723133f60b65e8761314aaba1288e14ad9bbfd3f4441e5bfc65bd0968e9dc10a8510f952e44a3489f086197c83658013126e23
@@ -15,7 +15,7 @@ module RbbtRESTHelpers
15
15
 
16
16
  def cache(name, params = {}, &block)
17
17
  @cache_type ||= params[:cache_type] if params[:cache_type]
18
- return yield if name.nil? or cache_type.nil? or cache_type == :none
18
+ return yield if name.nil? or @cache_type.nil? or @cache_type == :none
19
19
 
20
20
  send_file = consume_parameter(:_send_file, params)
21
21
 
@@ -77,7 +77,7 @@ module RbbtRESTHelpers
77
77
 
78
78
  def template_render(template, locals = {}, cache = nil, cache_options = {})
79
79
  template_file = locate_template(template)
80
- layout_file = layout ? locate_template("layout") : nil
80
+ layout_file = @layout ? locate_template("layout") : nil
81
81
 
82
82
  render(template_file, locals, layout_file, cache, cache_options)
83
83
  end
@@ -149,7 +149,7 @@ module RbbtRESTHelpers
149
149
  text ||= filename
150
150
 
151
151
  filename = Misc.sanitize_filename(filename)
152
- f = File.join(settings.file_dir, filename)
152
+ f = settings.file_dir[filename].find
153
153
  FileUtils.mkdir_p(File.dirname(f))
154
154
  yield(f)
155
155
 
@@ -215,9 +215,9 @@ module RbbtRESTHelpers
215
215
 
216
216
  entity_options = options[:entity_options]
217
217
 
218
- Misc.prepare_entity(value, type, entity_options) if Entity.formats.include? type and not options[:unnamed]
218
+ Misc.prepare_entity(value, type, entity_options) if Entity.formats.include?(type) and not options[:unnamed]
219
219
 
220
- value = value.link if value.respond_to? :link
220
+ value = value.link if value.respond_to? :link and not options[:unnamed]
221
221
 
222
222
  Array === value ? value.collect{|v| v.to_s} * ", " : value
223
223
  end
@@ -25,7 +25,7 @@ module Entity
25
25
  Entity.entity_list_cache[entity_type.to_s][user.to_s][id]
26
26
  end
27
27
 
28
- path.exists? ? path.find : nil
28
+ path.find
29
29
  end
30
30
 
31
31
  def self.list_files(user = nil)
@@ -60,8 +60,7 @@ module Entity
60
60
  path = list_file(entity_type, id, :public) unless path != nil and File.exists? path
61
61
  path = list_file(entity_type, id) unless path != nil and File.exists? path
62
62
 
63
- iii path
64
- raise "List not found: #{ id }" if path.nil?
63
+ raise "List not found: #{ id }" if path.nil? or not File.exists? path
65
64
 
66
65
  begin
67
66
  list = Annotated.load_tsv TSV.open(path)
@@ -175,7 +175,7 @@ module Entity
175
175
  reuse = options.delete("reuse") if reuse.nil?
176
176
  reuse = true if reuse.nil?
177
177
 
178
- Entity::List.save_list(entity_type.to_s, id, self) unless reuse and File.exists? Entity::List.list_file(entity_type.to_s, id, self)
178
+ Entity::List.save_list(entity_type.to_s, id, self) unless reuse and File.exists?(Entity::List.list_file(entity_type.to_s, id, self))
179
179
 
180
180
  klasses = self.klasses
181
181
  klasses << 'entity_list'
@@ -1,7 +1,11 @@
1
1
  require 'rbbt/util/misc'
2
2
  require 'rbbt/knowledge_base'
3
+ require 'rbbt/rest/knowledge_base/helpers'
3
4
 
4
5
  class KnowledgeBaseRESTQuery < Sinatra::Application
6
+ include RbbtRESTHelpers
7
+ include KnowledgeBaseRESTHelpers
8
+ register Sinatra::RbbtAuth
5
9
 
6
10
  get '/knowledge_base/:name/:database/children/:entity' do
7
11
  name = consume_parameter :name
@@ -205,6 +209,7 @@ class KnowledgeBaseRESTQuery < Sinatra::Application
205
209
  acc
206
210
  }
207
211
 
212
+ @format ||= :json
208
213
  case @format
209
214
  when :tsv
210
215
  content_type "text/tab-separated-values"
@@ -115,7 +115,6 @@ ul.list_comparison
115
115
 
116
116
  .wait
117
117
  ul.step_messages
118
- +clean_list(false)
119
118
  li
120
119
  color: darken($color_main, 30)
121
120
  margin-bottom: 1.5em
@@ -1,5 +1,5 @@
1
1
  ul.tasks
2
- margin-top: 2em
2
+ margin-top: 1em
3
3
  li
4
4
  display: block !important
5
5
 
@@ -35,23 +35,30 @@ ul.tasks
35
35
  width: 5em
36
36
  float: right
37
37
  .examples
38
+ margin: 2em 0
38
39
  ul
39
40
  li
40
41
  +rbbt_menu_item($color_bg: $base3, $color_menu_border: $base3)
41
42
 
42
- dd.job_control, dd.job_files
43
- +clear_fix
44
- ul
45
- +rbbt_button_list($color_bg: $color_menu_bg)
46
- +clear_fix
47
- background-color: $color_top_menu
48
- width: auto
49
- float: left
50
- li a
43
+ .job_control
44
+ +clear_fix()
45
+ margin: 1em 0
46
+ dt
47
+ display: none
48
+ //dt, dd
49
+ display: inline-block
50
+ dd.job_control, dd.job_files
51
+ ul
52
+ +rbbt_button_list($color_bg: $color_menu_bg)
53
+ background-color: $color_top_menu
54
+ width: auto
55
+ float: left
56
+ li a
51
57
 
52
58
 
53
59
  .workflow.tasks
54
60
  font-size: 1.2em
55
61
  p
56
62
  max-width: 60em
63
+ margin-left: 1em
57
64
 
@@ -5,12 +5,12 @@
5
5
  .workflow_task(id=id)
6
6
  .title
7
7
  %h3
8
+ %a(href="/#{workflow.to_s}")= workflow
9
+ &mdash;
8
10
  =Misc.humanize task
9
- .workflow_link
10
- %a(href="/#{workflow.to_s}")= workflow
11
11
  .description
12
12
  - if task_info[:description]
13
- .task_description
13
+ %p.task_description
14
14
  :markdown
15
15
  #{task_info[:description]}
16
16
 
@@ -1,5 +1,6 @@
1
1
  - if job
2
- = workflow_partial('job_result/job_control', workflow, task, locals)
2
+ .job_control
3
+ = workflow_partial('job_result/job_control', workflow, task, locals)
3
4
 
4
5
  - case type
5
6
  - when :tsv
@@ -12,8 +12,13 @@
12
12
 
13
13
  - list_links = table_options[:list_links] unless defined? list_links and list_links
14
14
 
15
+ - footer = table_options[:footer] unless defined? footer and footer
16
+ - footer = true if footer.nil?
17
+
15
18
  - page = @page unless defined? page and not page.nil?
16
19
 
20
+ - unnamed = table_options[:unnamed]
21
+
17
22
  %table(id="#{Misc.snake_case(table_id)}" class=table_class attr-url=table_url attr-total_size=total_size attr-page=page)
18
23
 
19
24
  - if table_id
@@ -41,28 +46,29 @@
41
46
  - row.each_with_index do |value, i|
42
47
  - list_id = "#{ Misc.humanize(table_id) }: #{header[i]} for #{row.first}" if list_links and table_id and header and AnnotatedArray === value
43
48
  - field = header ? header[i] : nil
44
- - val = table_value(value, field, :list_id => list_id, :unnamed => table_options[:unnamed], :entity_options => entity_options)
49
+ - val = table_value(value, field, :list_id => list_id, :unnamed => unnamed, :entity_options => entity_options)
45
50
  %td= Float === val ? "%.5g" % val : val.to_s
46
51
 
47
52
 
48
53
  -#{{{ TFOOT
49
- %tfoot
50
- %tr
51
- %th(colspan="#{header ? header.length : 100}")
54
+ - if footer
55
+ %tfoot
56
+ %tr
57
+ %th(colspan="#{header ? header.length : 100}")
52
58
 
53
- - if page
54
- = partial_render('partials/table/page', :page => page, :total_size => total_size)
59
+ - if page
60
+ = partial_render('partials/table/page', :page => page, :total_size => total_size)
55
61
 
56
- - if table_url
57
- %ul.table_actions
62
+ - if table_url
63
+ %ul.table_actions
58
64
 
59
- = partial_render('partials/table/filters', :table_url => table_url, :header => header, :id => "rbbt_reveal_" << Misc.digest(table_url))
60
-
61
- = partial_render('partials/table/column', :table_url => table_url, :header => header)
65
+ = partial_render('partials/table/filters', :table_url => table_url, :header => header, :id => "rbbt_reveal_" << Misc.digest(table_url))
66
+
67
+ = partial_render('partials/table/column', :table_url => table_url, :header => header)
62
68
 
63
- = partial_render('partials/table/files', :table_url => table_url)
64
-
65
-
66
-
67
-
69
+ = partial_render('partials/table/files', :table_url => table_url)
70
+
71
+
72
+
73
+
68
74
 
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.4.2
4
+ version: 1.4.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: 2014-09-16 00:00:00.000000000 Z
11
+ date: 2014-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake