diff options
author | Christopher Baines <mail@cbaines.net> | 2018-06-23 22:33:15 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-06-23 22:33:15 +0100 |
commit | ad2ba8e414cf7201546b6ab3d3f0106112122cc0 (patch) | |
tree | 315c8d7d192ff9eb0fed81d20c5485f0838fafe2 /app | |
parent | 7932da468f41e7c2c3fdeb44cc92b0eb8a9e9267 (diff) | |
download | govuk-mini-environment-admin-ad2ba8e414cf7201546b6ab3d3f0106112122cc0.tar govuk-mini-environment-admin-ad2ba8e414cf7201546b6ab3d3f0106112122cc0.tar.gz |
Redesign the mini environment show page
With similar changes to the backend pages.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/mini_environments_controller.rb | 6 | ||||
-rw-r--r-- | app/views/mini_environments/show.html.erb | 92 |
2 files changed, 73 insertions, 25 deletions
diff --git a/app/controllers/mini_environments_controller.rb b/app/controllers/mini_environments_controller.rb index 5081801..4dc8f39 100644 --- a/app/controllers/mini_environments_controller.rb +++ b/app/controllers/mini_environments_controller.rb @@ -148,10 +148,14 @@ class MiniEnvironmentsController < ApplicationController MiniEnvironmentJob.enqueue(@mini_environment.id, :destroy) flash[:notice] = 'Destroying mini environment' - when 'Start the mini environment' + when 'Start' MiniEnvironmentJob.enqueue(@mini_environment.id, :start) flash[:notice] = 'Starting mini environment' + when 'Refresh' + MiniEnvironmentJob.enqueue(@mini_environment.id, :refresh) + + flash[:notice] = 'Refreshing the mini environment state information' else flash[:error] = "Unknown action #{action}" end diff --git a/app/views/mini_environments/show.html.erb b/app/views/mini_environments/show.html.erb index bfb9a54..0184749 100644 --- a/app/views/mini_environments/show.html.erb +++ b/app/views/mini_environments/show.html.erb @@ -33,30 +33,74 @@ License along with the GOV.UK Mini Environment Admin. If not, see <div class="col-md-3"> <% status = @mini_environment.status %> - <% if status[:running] %> - <a class="btn btn-primary btn-lg" - href="<%= @mini_environment.backend.signon_url(@mini_environment) %>"> - View - </a> - - <%= form_with(url: mini_environment_perform_action_path(@mini_environment), - local: true, - method: "post") do %> - <%= submit_tag("Destroy", - role: 'button', - class: 'btn btn-lg btn-danger') - %> - <% end %> - <% else %> - <%= form_with(url: mini_environment_perform_action_path(@mini_environment), - local: true, - method: "post") do %> - <%= submit_tag('Start the mini environment', - disabled: !@mini_environment.backend_data.present?, - role: 'button', - class: 'btn btn-lg btn-success') - %> - <% end %> + <div class="panel panel-default"> + <div class="panel-heading"> + Current Status<br> + <small>updated at <%= status[:updated_at] %></small> + </div> + <div class="panel-body"> + <% if status[:running] %> + <div class="alert alert-success text-center" + role="alert" + style="margin-bottom: 0px;"> + Mini environment running + </div> + <% else %> + <div class="alert alert-warning text-center" + role="alert" + style="margin-bottom: 0px;"> + Mini environment down + </div> + <% end %> + + <% if status[:running] %> + <br> + <a class="btn btn-primary btn-lg btn-block" + href="<%= @mini_environment.backend.signon_url(@mini_environment) %>"> + View + </a> + <% end %> + + <br> + <a href="<%= terraform_http_backend_show_history_path( + "mini_environment/#{@mini_environment.id}" + ) %>"> + View Terraform state information + </a> + </div> + </div> + + <%= form_with(url: mini_environment_perform_action_path(@mini_environment), + local: true, + method: "post") do %> + <div class="panel panel-default"> + <div class="panel-heading">Actions</div> + + <ul class="list-group"> + <% if status[:running] %> + <li class="list-group-item"> + <%= submit_tag("Destroy", + role: 'button', + class: 'btn btn-lg btn-danger btn-block') + %> + </li> + <% else %> + <li class="list-group-item"> + <%= submit_tag('Start', + disabled: !@mini_environment.backend_data.present?, + role: 'button', + class: 'btn btn-lg btn-success btn-block') + %> + </li> + <% end %> + <li class="list-group-item"> + <%= submit_tag('Refresh', + role: 'button', + class: 'btn btn-lg btn-info btn-block') + %> + </li> + </ul> + </div> <% end %> </div> <div class="col-md-9"> |