Last active
January 27, 2019 14:07
-
-
Save ohadlevy/10cbdbcec46d104b7c635cd398a73942 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/app/controllers/audits_controller.rb b/app/controllers/audits_controller.rb | |
| index 4c8ecb34e..ae8ee85de 100644 | |
| --- a/app/controllers/audits_controller.rb | |
| +++ b/app/controllers/audits_controller.rb | |
| @@ -4,8 +4,13 @@ class AuditsController < ReactController | |
| before_action :setup_search_options, :only => :index | |
| def index | |
| - @audits = resource_base_search_and_page.preload(:user) | |
| - @host = resource_finder(Host.authorized(:view_hosts), params[:host_id]) if params[:host_id] | |
| + respond_to do |format| | |
| + format.html | |
| + format.json { | |
| + @audits = resource_base_search_and_page.preload(:user) | |
| + @host = resource_finder(Host.authorized(:view_hosts), params[:host_id]) if params[:host_id] | |
| + } | |
| + end | |
| end | |
| private | |
| diff --git a/app/views/audits/index.html.erb b/app/views/audits/index.html.erb | |
| index c635e015f..b4c0fe83f 100644 | |
| --- a/app/views/audits/index.html.erb | |
| +++ b/app/views/audits/index.html.erb | |
| @@ -2,7 +2,5 @@ | |
| <%= mount_react_component('AuditsPage', '#audits_page', { | |
| searchProps: get_search_props, | |
| docURL: documentation_url('4.1.4Auditing'), | |
| - audits: {audits: construct_additional_info(@audits)}, | |
| - pagination: react_pagination_props(@audits, "audits-pagination"), | |
| - searchable: true | |
| + url: url_for() | |
| }.to_json) %> | |
| diff --git a/app/views/audits/index.json.erb b/app/views/audits/index.json.erb | |
| new file mode 100644 | |
| index 000000000..aa6c4a84f | |
| --- /dev/null | |
| +++ b/app/views/audits/index.json.erb | |
| @@ -0,0 +1 @@ | |
| +<%= {audits: construct_additional_info(@audits)}.to_json.html_safe %> | |
| \ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment