From ad2ba8e414cf7201546b6ab3d3f0106112122cc0 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 23 Jun 2018 22:33:15 +0100 Subject: Redesign the mini environment show page With similar changes to the backend pages. --- app/controllers/mini_environments_controller.rb | 6 +- app/views/mini_environments/show.html.erb | 92 ++++++++++++++++++------- 2 files changed, 73 insertions(+), 25 deletions(-) (limited to 'app') 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
<% status = @mini_environment.status %> - <% if status[:running] %> - - View - - - <%= 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 %> +
+
+ Current Status
+ updated at <%= status[:updated_at] %> +
+
+ <% if status[:running] %> + + <% else %> + + <% end %> + + <% if status[:running] %> +
+ + View + + <% end %> + +
+ "> + View Terraform state information + +
+
+ + <%= form_with(url: mini_environment_perform_action_path(@mini_environment), + local: true, + method: "post") do %> +
+
Actions
+ +
    + <% if status[:running] %> +
  • + <%= submit_tag("Destroy", + role: 'button', + class: 'btn btn-lg btn-danger btn-block') + %> +
  • + <% else %> +
  • + <%= submit_tag('Start', + disabled: !@mini_environment.backend_data.present?, + role: 'button', + class: 'btn btn-lg btn-success btn-block') + %> +
  • + <% end %> +
  • + <%= submit_tag('Refresh', + role: 'button', + class: 'btn btn-lg btn-info btn-block') + %> +
  • +
+
<% end %>
-- cgit v1.2.3