diff options
author | Christopher Baines <mail@cbaines.net> | 2018-03-21 07:41:20 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-03-29 07:59:01 +0100 |
commit | 54b28b0c0ee3f71e8f4997d22aea19adeedcb11a (patch) | |
tree | b53d75658dd3199379892d4254c6d41f7651b0e7 /app/views | |
parent | cd8e1dad2f8c73b9d35f5bc997c44470bd2268ae (diff) | |
download | govuk-mini-environment-admin-54b28b0c0ee3f71e8f4997d22aea19adeedcb11a.tar govuk-mini-environment-admin-54b28b0c0ee3f71e8f4997d22aea19adeedcb11a.tar.gz |
Improve AWS backend support
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/backends/terraform_aws/show.html.erb | 124 |
1 files changed, 122 insertions, 2 deletions
diff --git a/app/views/backends/terraform_aws/show.html.erb b/app/views/backends/terraform_aws/show.html.erb index e112d7d..a9324fc 100644 --- a/app/views/backends/terraform_aws/show.html.erb +++ b/app/views/backends/terraform_aws/show.html.erb @@ -1,2 +1,122 @@ -<h1>Backends::TerraformAws#show</h1> -<p>Find me in app/views/backends/terraform_aws/show.html.erb</p> +<a href="<%= setup_path %>" class="btn btn-lg btn-primary pull-right"> + Back to Setup +</a> + +<h1>Backend: <%= @backend.label %></h1> + +<div class="row"> + <div class="col-md-8"> + <h3>Update details</h3> + <br> + + <%= form_with(model: @backend, + url: { action: "update" }, + html: { class: "form-horizontal" }) do |f| + %> + + <div class="form-group form-group-lg"> + <%= f.label :label, class: 'col-sm-4 control-label' %> + <div class="col-sm-8"> + <%= f.text_field( + :label, + class: 'form-control', + placeholder: 'Label for this backend' + ) %> + </div> + </div> + + <div class="form-group form-group-lg"> + <%= f.label :aws_region, 'AWS Region', class: 'col-sm-4 control-label' %> + <div class="col-sm-8"> + <%= f.text_field( + :aws_region, + class: 'form-control', + placeholder: 'What region to use' + ) %> + </div> + </div> + + <div class="form-group form-group-lg"> + <%= f.label :aws_access_key_id, 'AWS Access Key ID', class: 'col-sm-4 control-label' %> + <div class="col-sm-8"> + <%= f.text_field( + :aws_access_key_id, + class: 'form-control', + ) %> + </div> + </div> + + <div class="form-group form-group-lg"> + <%= f.label :aws_secret_access_key, 'AWS Secret Access Key', class: 'col-sm-4 control-label' %> + <div class="col-sm-8"> + <%= f.password_field( + :aws_secret_access_key, + class: 'form-control', + placeholder: 'Secret key hidden', + ) %> + <span id="helpBlock" class="help-block"> + The AWS Secret Access Key is not accessible once entered. + </span> + </div> + </div> + + + <div class="form-group form-group-lg"> + <div class="col-sm-offset-2 col-sm-10"> + <%= f.submit "Save", class: 'btn btn-lg btn-success' %> + </div> + </div> + <% end %> + </div> + <div class="col-md-4"> + <h3>Delete backend</h3> + <br> + + <% unless @backend.mini_environments.empty? %> + <p> + Unable to delete backend, as mini environments using this + backend still exist. + </p> + + <p> + To delete this backend, first delete all the mini environments + using it. + </p> + <% end %> + + <%= form_with(model: @backend, + url: { action: "destroy" }, + html: { class: "form-horizontal", method: :delete }) do |f| + %> + <%= f.submit( + "Delete", + class: ( + 'btn btn-lg btn-danger' + + (@backend.mini_environments.empty? ? '' : ' disabled') + ) + ) %> + <% end %> + + </div> +</div> + +<h3>Mini environments</h3> + +<table class="table table-striped"> + <tr> + <th>Name</th> + <th></th> + </tr> + <% @backend.mini_environments.each do |mini_environment| %> + <tr> + <td><%= mini_environment.name %></td> + <td> + <a class="btn btn-default btn-lg pull-right" + role="button" + href="<%= mini_environment_path(mini_environment) %>"> + Show details + </a> + </td> + </tr> + <% end %> +</table> |