rbbt-rest 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/config.ru +3 -0
- data/lib/rbbt/rest/client.rb +9 -10
- data/lib/rbbt/rest/common/cache.rb +32 -7
- data/lib/rbbt/rest/common/forms.rb +33 -0
- data/lib/rbbt/rest/common/locate.rb +4 -0
- data/lib/rbbt/rest/common/misc.rb +24 -0
- data/lib/rbbt/rest/common/render.rb +26 -9
- data/lib/rbbt/rest/common/resources.rb +1 -1
- data/lib/rbbt/rest/common/table.rb +87 -26
- data/lib/rbbt/rest/common/users.rb +5 -1
- data/lib/rbbt/rest/entity.rb +300 -95
- data/lib/rbbt/rest/entity/action_controller.rb +6 -1
- data/lib/rbbt/rest/entity/entity_list_card.rb +1 -1
- data/lib/rbbt/rest/entity/entity_map_card.rb +15 -0
- data/lib/rbbt/rest/entity/favourites.rb +57 -1
- data/lib/rbbt/rest/entity/finder.rb +1 -1
- data/lib/rbbt/rest/entity/helpers.rb +40 -7
- data/lib/rbbt/rest/entity/list.rb +8 -0
- data/lib/rbbt/rest/entity/locate.rb +114 -0
- data/lib/rbbt/rest/entity/map.rb +99 -0
- data/lib/rbbt/rest/entity/render.rb +25 -0
- data/lib/rbbt/rest/entity/rest.rb +33 -4
- data/lib/rbbt/rest/main.rb +27 -4
- data/lib/rbbt/rest/workflow.rb +7 -1
- data/lib/rbbt/rest/workflow/jobs.rb +21 -1
- data/share/views/compass/app.sass +17 -9
- data/share/views/compass/entity_card.sass +16 -3
- data/share/views/compass/favourites.sass +44 -2
- data/share/views/compass/form.sass +11 -0
- data/share/views/compass/list_container.sass +1 -1
- data/share/views/compass/reveal.sass +31 -0
- data/share/views/compass/style.sass +29 -1
- data/share/views/compass/style_mixins.sass +18 -6
- data/share/views/compass/table.sass +19 -3
- data/share/views/compass/topbar.sass +8 -2
- data/share/views/entity_map/Default.haml +5 -0
- data/share/views/entity_partials/action_card.haml +2 -0
- data/share/views/entity_partials/action_controller.haml +8 -1
- data/share/views/entity_partials/entity_list_card.haml +8 -6
- data/share/views/entity_partials/entity_map_card.haml +63 -0
- data/share/views/entity_partials/list_container.haml +3 -2
- data/share/views/error.haml +14 -10
- data/share/views/help.haml +34 -0
- data/share/views/help/entity.haml +193 -0
- data/share/views/help/workflow.haml +77 -0
- data/share/views/job_result/tsv.haml +3 -2
- data/share/views/layout.haml +33 -3
- data/share/views/layout/favourites.haml +14 -4
- data/share/views/layout/header.haml +4 -0
- data/share/views/partials/form.haml +3 -1
- data/share/views/partials/table.haml +16 -52
- data/share/views/partials/table/column.haml +10 -0
- data/share/views/partials/table/files.haml +4 -0
- data/share/views/partials/table/filters.haml +11 -0
- data/share/views/partials/table/page.haml +37 -0
- data/share/views/public/favicon.gif +0 -0
- data/share/views/public/js/_ajax_replace.js +76 -4
- data/share/views/public/js/_fix_tablesorter_science.js +13 -0
- data/share/views/public/js/actions.js +8 -2
- data/share/views/public/js/base.js +12 -1
- data/share/views/public/js/entities.js +39 -7
- data/share/views/public/js/favourites.js +308 -77
- data/share/views/public/js/helpers.js +9 -5
- data/share/views/public/js/lists.js +12 -12
- data/share/views/public/js/maps.js +17 -0
- data/share/views/public/js/reveal.js +48 -0
- data/share/views/public/js/tables.js +110 -51
- data/share/views/public/js/workflow.js +4 -16
- data/share/views/public/plugins/underscore/js/underscore.js +1227 -0
- data/share/views/tasks.haml +12 -1
- data/share/views/wait.haml +7 -0
- metadata +17 -2
@@ -0,0 +1,77 @@
|
|
1
|
+
.row.help
|
2
|
+
.column.small-12
|
3
|
+
:markdown
|
4
|
+
|
5
|
+
The Workflow subsystem
|
6
|
+
===================
|
7
|
+
|
8
|
+
The workflow subsystem is used to package related functionalities and
|
9
|
+
offer a common, flexible, interface. Each workflow is composed of a
|
10
|
+
number of tasks. Each task represents a step taken towards the completion
|
11
|
+
of a workflow, and thus, tasks may depend on other tasks, yet this is
|
12
|
+
often not the case and tasks are often stand-alone.
|
13
|
+
|
14
|
+
Tasks are design to be isolated or self-contained, meaning that executing
|
15
|
+
a particular task with the same values for the input parameters should
|
16
|
+
render the same identical result. This is not an imposition, but it is
|
17
|
+
encouraged, and almost all, if not all, tasks behave this way. The
|
18
|
+
consequence of this predictability is that results can be cached.
|
19
|
+
|
20
|
+
## Accessing workflow functionalities
|
21
|
+
|
22
|
+
You may access a workflow functionalities on three ways: using a
|
23
|
+
web-browser, remotely using web services, or locally. Local execution
|
24
|
+
requires the installation of the Rbbt framework and the workflow source
|
25
|
+
and it is out of the scope of this document.
|
26
|
+
|
27
|
+
### Using the Browser
|
28
|
+
|
29
|
+
To use the web browser you just point your browser to the workflow page.
|
30
|
+
Check at the bottom of this page for a list of workflows available in
|
31
|
+
this server. The workflow page presents a description of the software
|
32
|
+
along with the tasks it includes and their descriptions (descriptions are
|
33
|
+
optional for workflow development and may be missing). Each task has its
|
34
|
+
own page, which contains the input form. Submitting the form takes you to
|
35
|
+
the results page. Form and result pages follow a general template, which
|
36
|
+
we shall review bellow.
|
37
|
+
|
38
|
+
Workflow and task pages, like any other page in this system, are subject
|
39
|
+
to being redefined; in this case by the workflow author. This makes it
|
40
|
+
possible to make both the input and the results page fit more closely the
|
41
|
+
user needs. This option, however, is rarely necessary, and most workflows
|
42
|
+
use the default templates.
|
43
|
+
|
44
|
+
### Using the Web Server
|
45
|
+
|
46
|
+
The browser interface follows the REST protocol (mostly) so that it can
|
47
|
+
be used as a web server. Any user familiar with 'curl' or 'wget' should
|
48
|
+
have little problems using it. The Rbbt all-purpose command 'rbbt' can
|
49
|
+
also be used to execute remote workflow. See the documentation on the
|
50
|
+
rbbt site (once it is available.)
|
51
|
+
|
52
|
+
.row.help
|
53
|
+
.column.small-12
|
54
|
+
|
55
|
+
%table
|
56
|
+
%caption Available workflows on this site
|
57
|
+
%thead
|
58
|
+
%tr
|
59
|
+
%th Workflow
|
60
|
+
%th Description
|
61
|
+
%tbody
|
62
|
+
- Sinatra::RbbtRESTWorkflow::WORKFLOWS.each do |workflow|
|
63
|
+
- next if workflow.asynchronous_exports.empty? and workflow.synchronous_exports.empty? and workflow.exec_exports.empty?
|
64
|
+
%tr
|
65
|
+
%th
|
66
|
+
%a(href="#{'/' << workflow.to_s}")= Misc.humanize(workflow.to_s)
|
67
|
+
%td
|
68
|
+
- description = workflow.workflow_description || ""
|
69
|
+
|
70
|
+
- case
|
71
|
+
- when description.empty?
|
72
|
+
No description
|
73
|
+
- else
|
74
|
+
= description.split("\n\n").first
|
75
|
+
|
76
|
+
|
77
|
+
|
@@ -1,7 +1,8 @@
|
|
1
1
|
- table_id = [workflow.to_s, task, jobname] * "_"
|
2
2
|
- table_class = 'workflow_tsv_result'
|
3
|
-
- rows = tsv_rows(result)
|
3
|
+
- rows, total_size = tsv_rows(result)
|
4
4
|
- header = result.all_fields
|
5
|
+
- page = total_size > 50 ? "1" : nil
|
5
6
|
|
6
7
|
= workflow_partial('partials/table', workflow, task,
|
7
|
-
locals.merge(:table_id => table_id, :
|
8
|
+
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 => File.join('/', workflow.to_s, task, jobname)))
|
data/share/views/layout.haml
CHANGED
@@ -15,12 +15,27 @@
|
|
15
15
|
|
16
16
|
%link{:rel => "icon", :type => "image/gif", :href => "/favicon.gif"}/
|
17
17
|
|
18
|
-
|
18
|
+
- title = $title.dup || "Genome Scout"
|
19
|
+
- case page_type.to_s
|
20
|
+
- when "entity"
|
21
|
+
- title << ": " << (entity.respond_to?(:name) ? entity.name || entity : entity)
|
22
|
+
- when "entity_list"
|
23
|
+
- title << ": " << list_id
|
24
|
+
- when "entity_map"
|
25
|
+
- title << ": " << map_id
|
26
|
+
- when "entity_action"
|
27
|
+
- title << ": " << "[#{page_action}]" # << (entity.respond_to?(:name) ? entity.name || entity : entity)
|
28
|
+
- when "entity_list_action"
|
29
|
+
- title << ": " << "[#{page_action}]" << list_id
|
30
|
+
- when "entity_map_action"
|
31
|
+
- title << ": " << "[#{page_action}]" << map_id
|
32
|
+
|
33
|
+
|
34
|
+
%title= title
|
19
35
|
- record_css '/stylesheets/app'
|
20
36
|
|
21
37
|
- record_css '/plugins/zurb-icons/foundation_icons_general/stylesheets/general_foundicons.css'
|
22
38
|
|
23
|
-
|
24
39
|
- if $zepto
|
25
40
|
- record_js "/js/zepto"
|
26
41
|
- record_js '/js/deffer'
|
@@ -32,6 +47,7 @@
|
|
32
47
|
- record_js File.join('/plugins/jquery/js/', jquery_file)
|
33
48
|
|
34
49
|
|
50
|
+
- record_js "/plugins/underscore/js/underscore.js"
|
35
51
|
-# %w(foundation foundation.alerts foundation.cookie foundation.forms foundation.reveal foundation.tooltips foundation.clearing foundation.dropdown foundation.joyride foundation.magellan foundation.placeholder foundation.section foundation.topbar custom.modernizr).each do |file|
|
36
52
|
- %w(foundation foundation.cookie foundation.reveal foundation.dropdown foundation.section foundation.topbar custom.modernizr).each do |file|
|
37
53
|
- record_js "/js/#{ file }"
|
@@ -39,7 +55,7 @@
|
|
39
55
|
- record_js '/plugins/jquery.tablesorter/jquery.tablesorter'
|
40
56
|
- record_js '/plugins/jquery.scrollTo/jquery.scrollTo'
|
41
57
|
|
42
|
-
- %w(_foundation _md5 _fix_tablesorter_science helpers
|
58
|
+
- %w(_ajax_replace _foundation _md5 _fix_tablesorter_science helpers _dom_update _ellipsis entities favourites offcanvas actions lists maps tables tabs reveal base workflow app).each do |file|
|
43
59
|
- record_js "/js/#{ file }"
|
44
60
|
|
45
61
|
|
@@ -88,5 +104,19 @@
|
|
88
104
|
|
89
105
|
|
90
106
|
#modal1.reveal-modal
|
107
|
+
.header
|
108
|
+
.title
|
109
|
+
.controls
|
110
|
+
%a(class='link-reveal-modal')
|
111
|
+
%i.foundicon-right-arrow
|
112
|
+
%a(class='close-reveal-modal') x
|
113
|
+
.content
|
91
114
|
#modal2.reveal-modal
|
115
|
+
.header
|
116
|
+
.title
|
117
|
+
.controls
|
118
|
+
%a(class='link-reveal-modal')
|
119
|
+
%i.foundicon-right-arrow
|
120
|
+
%a(class='close-reveal-modal') x
|
121
|
+
.content
|
92
122
|
|
@@ -1,6 +1,4 @@
|
|
1
1
|
|
2
|
-
%li.divider
|
3
|
-
|
4
2
|
%li#top-favourites.has-dropdown
|
5
3
|
%a(href="#") Fav. Entities
|
6
4
|
|
@@ -13,8 +11,6 @@
|
|
13
11
|
%li
|
14
12
|
= entity.link
|
15
13
|
|
16
|
-
%li.divider
|
17
|
-
|
18
14
|
%li#top-favourite_lists.has-dropdown
|
19
15
|
%a(href="#") Fav. Entity Lists
|
20
16
|
|
@@ -26,6 +22,20 @@
|
|
26
22
|
- lists.each do |list_id|
|
27
23
|
%li
|
28
24
|
%a(href="#{Entity::REST.entity_list_url(list_id, type)}")= list_id
|
25
|
+
|
26
|
+
%li#top-favourite_maps.has-dropdown
|
27
|
+
%a(href="#") Fav. Entity Maps
|
28
|
+
|
29
|
+
%ul.favourite_entity_maps.dropdown
|
30
|
+
- favourite_entity_maps.each do |type, columns|
|
31
|
+
- columns.each do |column, maps|
|
32
|
+
%li.type.has-dropdown(entity_type=type entity_column=column)
|
33
|
+
%a(href="#")= [type, column] * " - "
|
34
|
+
%ul.dropdown
|
35
|
+
- maps.each do |map_id|
|
36
|
+
%li
|
37
|
+
%a(href="#{Entity::REST.entity_map_url(map_id, type, column)}")= map_id
|
38
|
+
|
29
39
|
|
30
40
|
%li#top-favourite_lists.has-dropdown
|
31
41
|
%a(href="#") New Entity List
|
@@ -20,7 +20,9 @@
|
|
20
20
|
- input_id = id.nil? ? nil : id + "__" << input.to_s
|
21
21
|
- hide = (options[input] != nil and options[input][:hide])
|
22
22
|
%div(class="input #{types[input]} #{input} #{hide ? 'hide' : ''}")
|
23
|
-
|
23
|
+
- input_options = options[input]
|
24
|
+
- input_options = input_options.dup unless input_options.nil?
|
25
|
+
!= form_input(input, types[input], defaults[input], values[input], descriptions[input], input_id, input_options)
|
24
26
|
|
25
27
|
.input.submit
|
26
28
|
%input(type="submit")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
- table_options = {} unless defined? table_options and table_options
|
2
|
+
- entity_options = table_options[:tsv_entity_options] unless defined? entity_options and entity_options
|
2
3
|
- headers = table_options[:headers]
|
3
|
-
|
4
4
|
- table_id = table_options[:table_id] unless defined? table_id and table_id
|
5
5
|
- table_class = table_options[:table_class] unless defined? table_class and table_class
|
6
6
|
- header = table_options[:header] unless defined? header and header
|
@@ -9,7 +9,7 @@
|
|
9
9
|
- total_size = table_options[:total_size] unless defined? total_size and total_size
|
10
10
|
- filters = table_options[:filters] unless defined? filters and filters
|
11
11
|
|
12
|
-
- list_links = table_options[:list_links]
|
12
|
+
- list_links = table_options[:list_links] unless defined? list_links and list_links
|
13
13
|
|
14
14
|
- page = @page unless defined? page and not page.nil?
|
15
15
|
|
@@ -40,64 +40,28 @@
|
|
40
40
|
- row.each_with_index do |value, i|
|
41
41
|
- list_id = "#{ Misc.humanize(table_id) }: #{header[i]} for #{row.first}" if list_links and table_id and header and AnnotatedArray === value
|
42
42
|
- field = header ? header[i] : nil
|
43
|
-
|
44
|
-
|
45
|
-
%td= table_value(value, field, :list_id => list_id)
|
43
|
+
- val = table_value(value, field, :list_id => list_id, :unnamed => table_options[:unnamed], :entity_options => entity_options)
|
44
|
+
%td= Float === val ? "%.5g" % val : val.to_s
|
46
45
|
|
47
46
|
|
48
47
|
-#{{{ TFOOT
|
49
48
|
%tfoot
|
50
49
|
%tr
|
51
50
|
%th(colspan="#{header ? header.length : 100}")
|
52
|
-
- if page
|
53
|
-
- num, size, field = parse_page(page)
|
54
|
-
- num = num.to_i
|
55
|
-
- total_nums = total_size.to_i / size.to_i
|
56
|
-
- total_nums += 1 if total_size.to_i % size.to_i > 0
|
57
|
-
- start = [1, num - 2].max
|
58
|
-
- eend = [total_nums, num + 2].min
|
59
|
-
%ul.table_pagination.pagination
|
60
|
-
%li(class="arrow")
|
61
|
-
%a.prev(href="#") «
|
62
|
-
|
63
|
-
- if num - 2 > 1
|
64
|
-
%li(class="num")
|
65
|
-
%a(href="#") 1
|
66
|
-
|
67
|
-
- if num - 2 > 2
|
68
|
-
%li(class="inactive")
|
69
|
-
%a(href="#") ...
|
70
|
-
|
71
|
-
- (start..eend).each do |p|
|
72
|
-
%li(class="num#{p.to_s == num.to_s ? " active" : "" }")
|
73
|
-
%a(href="#")= p
|
74
|
-
|
75
|
-
- if num + 3 < total_nums
|
76
|
-
%li(class="inactive")
|
77
|
-
%a(href="#") ...
|
78
|
-
|
79
|
-
- if num + 2 < total_nums
|
80
|
-
%li(class="num")
|
81
|
-
%a(href="#")= total_nums
|
82
|
-
|
83
|
-
%li(class="arrow")
|
84
|
-
%a.next(href="#") »
|
85
|
-
|
86
|
-
%li(class="all")
|
87
|
-
%a.all(href="#") all
|
88
51
|
|
52
|
+
- if page
|
53
|
+
= partial_render('partials/table/page', :page => page, :total_size => total_size)
|
89
54
|
|
90
55
|
- if table_url
|
91
56
|
%ul.table_actions
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
%a(href="#{add_GET_param(table_url, "_format", "excel")}") excel
|
57
|
+
|
58
|
+
= partial_render('partials/table/filters', :table_url => table_url, :header => header, :id => "rbbt_reveal_" << Misc.digest(table_url))
|
59
|
+
|
60
|
+
= partial_render('partials/table/column', :table_url => table_url, :header => header)
|
61
|
+
|
62
|
+
= partial_render('partials/table/files', :table_url => table_url)
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
103
67
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
- table_columns_id = "rbbt_table_columns_" << (rand * 1000).to_i.to_s
|
2
|
+
%li.table_column
|
3
|
+
= reveal :column do
|
4
|
+
%ul.table_column_selector.clean_list
|
5
|
+
- header.each do |field|
|
6
|
+
%li
|
7
|
+
%span.field= field
|
8
|
+
%a.save_column_map(href="#") save map
|
9
|
+
- if Entity.formats.include? field and Entity.formats[field].include? Entity::REST
|
10
|
+
%a.save_column_list(href="#") save list
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%li.filter
|
2
|
+
= reveal :filter, id do
|
3
|
+
- if @filter
|
4
|
+
- filter_values = Hash[*@filter.split(";;").collect{|f| f.split("~")}.flatten]
|
5
|
+
- else
|
6
|
+
- filter_values = {}
|
7
|
+
|
8
|
+
.filters()
|
9
|
+
= action_parameters nil, :class => 'filter_controls' do
|
10
|
+
- header.each do |field|
|
11
|
+
- input field, :string, "Filter for #{ field }", filter_values[field]
|
@@ -0,0 +1,37 @@
|
|
1
|
+
- num, size, field = parse_page(page)
|
2
|
+
- num = num.to_i
|
3
|
+
- total_nums = total_size.to_i / size.to_i
|
4
|
+
- total_nums += 1 if total_size.to_i % size.to_i > 0
|
5
|
+
- start = [1, num - 2].max
|
6
|
+
- eend = [total_nums, num + 2].min
|
7
|
+
%ul.table_pagination.pagination
|
8
|
+
%li(class="arrow")
|
9
|
+
%a.prev(href="#") «
|
10
|
+
|
11
|
+
- if num - 2 > 1
|
12
|
+
%li(class="num")
|
13
|
+
%a(href="#") 1
|
14
|
+
|
15
|
+
- if num - 2 > 2
|
16
|
+
%li(class="inactive")
|
17
|
+
%a(href="#") ...
|
18
|
+
|
19
|
+
- (start..eend).each do |p|
|
20
|
+
%li(class="num#{p.to_s == num.to_s ? " active" : "" }")
|
21
|
+
%a(href="#")= p
|
22
|
+
|
23
|
+
- if num + 3 < total_nums
|
24
|
+
%li(class="inactive")
|
25
|
+
%a(href="#") ...
|
26
|
+
|
27
|
+
- if num + 2 < total_nums
|
28
|
+
%li(class="num")
|
29
|
+
%a(href="#")= total_nums
|
30
|
+
|
31
|
+
%li(class="arrow")
|
32
|
+
%a.next(href="#") »
|
33
|
+
|
34
|
+
%li(class="all")
|
35
|
+
%a.all(href="#") all
|
36
|
+
|
37
|
+
|
Binary file
|
@@ -1,5 +1,38 @@
|
|
1
1
|
var reload_seconds_for_try = {0: 1, 1: 1, 2: 2, 3: 2, 4: 3, 5: 7, 6: 7, 7: 7, 8: 7, 9: 7, 10: 30, 11: 30, 12: 60, 13: 120, 14: 120, 15: 120, 16: "STOP"}
|
2
2
|
|
3
|
+
var ajax_processes = []
|
4
|
+
function update_ajax_counter(){
|
5
|
+
$('#ajax_processes').html(ajax_processes.length)
|
6
|
+
}
|
7
|
+
function add_ajax(url){
|
8
|
+
ajax_processes.push(url)
|
9
|
+
update_ajax_counter();
|
10
|
+
}
|
11
|
+
|
12
|
+
function remove_ajax(url){
|
13
|
+
ajax_processes.splice( $.inArray(url, ajax_processes), 1 );
|
14
|
+
update_ajax_counter();
|
15
|
+
}
|
16
|
+
|
17
|
+
$.old_ajax = $.ajax;
|
18
|
+
$.ajax = function(url, options){
|
19
|
+
if (typeof url == 'string'){
|
20
|
+
options['url'] = url;
|
21
|
+
}else{
|
22
|
+
options = url;
|
23
|
+
url = options['url'];
|
24
|
+
}
|
25
|
+
|
26
|
+
add_ajax(url);
|
27
|
+
|
28
|
+
complete = options['complete'];
|
29
|
+
if (undefined === complete){ options['complete'] = function(){ remove_ajax(url)} }
|
30
|
+
if (typeof complete == 'function'){ options['complete'] = [complete, function(){ remove_ajax(url)}] }
|
31
|
+
if (typeof complete == 'array'){ options['complete'].push(function(){ remove_ajax(url)}) }
|
32
|
+
|
33
|
+
return $.old_ajax(options);
|
34
|
+
}
|
35
|
+
|
3
36
|
function reload_time(object){
|
4
37
|
var tries = object.attr('reload-attempts');
|
5
38
|
if (undefined === tries){ tries = 0 };
|
@@ -11,9 +44,42 @@ function reload_time(object){
|
|
11
44
|
return reload_seconds_for_try[tries];
|
12
45
|
}
|
13
46
|
|
47
|
+
function get_ajax(options, complete){
|
48
|
+
options.success = function( data, stat, req ) {
|
49
|
+
if (req.status == 202){
|
50
|
+
href = options.url
|
51
|
+
href = remove_parameter(href, '_update');
|
52
|
+
href = remove_parameter(href, '_');
|
53
|
+
options.url = href
|
54
|
+
window.setTimeout(function(){ get_ajax(options, complete)}, 3 * 1000);
|
55
|
+
}else{
|
56
|
+
if (undefined !== complete){
|
57
|
+
return complete(data)
|
58
|
+
}else{
|
59
|
+
return(data)
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
console.log(options.data)
|
65
|
+
response = $.ajax(options)
|
66
|
+
if (undefined !== response.responseText){
|
67
|
+
if (response.status == 202){
|
68
|
+
href = options.url
|
69
|
+
href = remove_parameter(href, '_update');
|
70
|
+
href = remove_parameter(href, '_');
|
71
|
+
options.url = href
|
72
|
+
return get_ajax(options, complete);
|
73
|
+
}else{
|
74
|
+
return response.responseText;
|
75
|
+
}
|
76
|
+
}else{
|
77
|
+
return response;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
14
81
|
function replace_object(object, href, embedd, complete){
|
15
82
|
if (embedd === undefined){ embedd = false; }
|
16
|
-
//if (complete === undefined){ complete = []; }
|
17
83
|
|
18
84
|
$.ajax({
|
19
85
|
url : href,
|
@@ -24,7 +90,9 @@ function replace_object(object, href, embedd, complete){
|
|
24
90
|
href = remove_parameter(href, '_update');
|
25
91
|
href = remove_parameter(href, '_');
|
26
92
|
error_span = $('<span>').html(error).addClass('error')
|
27
|
-
|
93
|
+
error_message = $(req.responseText).find('span.error_message')
|
94
|
+
error = $('<div>').append(error_span).append(error_message)
|
95
|
+
object.removeClass("reloading").addClass("error").css('height', 0).html(error).css('height', 'auto').attr('target-href', href);
|
28
96
|
},
|
29
97
|
success: function( data, stat, req ) {
|
30
98
|
object.removeClass('error');
|
@@ -42,8 +110,12 @@ function replace_object(object, href, embedd, complete){
|
|
42
110
|
}else{
|
43
111
|
object.removeClass("reloading").attr('reload-attempts', 0);
|
44
112
|
if (embedd){
|
45
|
-
|
46
|
-
|
113
|
+
if (undefined !== req.getResponseHeader("URI")){
|
114
|
+
href = req.getResponseHeader("URI")
|
115
|
+
}else{
|
116
|
+
href = remove_parameter(href, '_update');
|
117
|
+
href = remove_parameter(href, '_');
|
118
|
+
}
|
47
119
|
object.html(data).addClass("embedded").attr('target-href', href);
|
48
120
|
capture_embedded_form(object);
|
49
121
|
update_rbbt();
|