projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
3400: Do not fetch API results just for the sake of looking up resource_class.
[arvados.git]
/
apps
/
workbench
/
app
/
controllers
/
application_controller.rb
diff --git
a/apps/workbench/app/controllers/application_controller.rb
b/apps/workbench/app/controllers/application_controller.rb
index 833294b5b0da24d3542ea2070ed78392125ba335..e88d38e2adcd1120f54bf4c49caca07791904c9b 100644
(file)
--- a/
apps/workbench/app/controllers/application_controller.rb
+++ b/
apps/workbench/app/controllers/application_controller.rb
@@
-164,32
+164,31
@@
class ApplicationController < ActionController::Base
def find_objects_for_index
@objects ||= model_class
@objects = @objects.filter(@filters).limit(@limit).offset(@offset)
def find_objects_for_index
@objects ||= model_class
@objects = @objects.filter(@filters).limit(@limit).offset(@offset)
+ @objects.fetch_multiple_pages(false)
end
def render_index
end
def render_index
- if params[:partial]
- respond_to do |f|
- f.json {
- @next_page_href = next_page_href(partial: params[:partial])
+ respond_to do |f|
+ f.json {
+ if params[:partial]
+ @next_page_href = next_page_href(partial: params[:partial]
, filters: @filters.to_json
)
render json: {
render json: {
- content: render_to_string(partial: "show_#{params[:partial]}
.html", formats: [:html])
,
- next_page_href: @next_page_href
-
+ content: render_to_string(partial: "show_#{params[:partial]}
"
,
+ formats: [:html]),
+ next_page_href: @next_page_href
}
}
- }
- end
- else
- respond_to do |f|
- f.json { render json: @objects }
- f.html {
- if params[:tab_pane]
- render_pane params[:tab_pane]
- else
- render
- end
- }
- f.js { render }
- end
+ else
+ render json: @objects
+ end
+ }
+ f.html {
+ if params[:tab_pane]
+ render_pane params[:tab_pane]
+ else
+ render
+ end
+ }
+ f.js { render }
end
end
end
end
@@
-220,6
+219,8
@@
class ApplicationController < ActionController::Base
if !objects
objects = @objects
end
if !objects
objects = @objects
end
+ # result_limit and result_offset won't work until we call #results
+ objects.results
if objects.respond_to?(:result_offset) and
objects.respond_to?(:result_limit) and
objects.respond_to?(:items_available)
if objects.respond_to?(:result_offset) and
objects.respond_to?(:result_limit) and
objects.respond_to?(:items_available)