diff options
author | Christopher Baines <mail@cbaines.net> | 2018-06-20 06:42:54 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-06-20 06:42:54 +0100 |
commit | 7dbc313632ecebd638bd464bdc430292218d4c9e (patch) | |
tree | bd2e06e5a6aa2ccf24ff8ab049500f1ee79df715 | |
parent | 4adfe630b29a85d02cc575533f20623edc935a24 (diff) | |
download | govuk-mini-environment-admin-7dbc313632ecebd638bd464bdc430292218d4c9e.tar govuk-mini-environment-admin-7dbc313632ecebd638bd464bdc430292218d4c9e.tar.gz |
Add a view raw JSON link to the Terraform state page
-rw-r--r-- | app/views/terraform_http_backend/show.html.erb | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/app/views/terraform_http_backend/show.html.erb b/app/views/terraform_http_backend/show.html.erb index e167541..9a99d52 100644 --- a/app/views/terraform_http_backend/show.html.erb +++ b/app/views/terraform_http_backend/show.html.erb @@ -26,6 +26,12 @@ License along with the GOV.UK Mini Environment Admin. If not, see View all terraform states </a> +<% historical_states = TerraformState + .where(state_id: @state.state_id) + .order(:id) + .to_a +%> + <div class="row"> <div class="col-md-8"> <h1> @@ -35,7 +41,14 @@ License along with the GOV.UK Mini Environment Admin. If not, see </span> </h1> - <br> + <a class="pull-right" + href="<%= terraform_http_backend_show_by_index_path( + @state.state_id, + historical_states.find_index { |x| x.id == @state.id } + ) + %>.json"> + View raw JSON + </a> <table class="table"> <tbody> <tr> @@ -48,16 +61,9 @@ License along with the GOV.UK Mini Environment Admin. If not, see </tr> </tbody> </table> - </div> <div class="col-md-4" style="max-height: 400px; overflow-y: auto;"> - <% historical_states = TerraformState - .where(state_id: @state.state_id) - .order(:id) - .to_a - %> - <h3>History (<%= pluralize(historical_states.count, 'states') %>)</h3> <table class="table"> |