diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/backends/index.html.erb | 8 | ||||
-rw-r--r-- | app/views/backends/terraform_aws/new.html.erb | 63 | ||||
-rw-r--r-- | app/views/backends/terraform_aws/show.html.erb | 2 | ||||
-rw-r--r-- | app/views/backends/terraform_libvirt/new.html.erb | 43 | ||||
-rw-r--r-- | app/views/backends/terraform_libvirt/show.html.erb | 89 | ||||
-rw-r--r-- | app/views/govuk_guix/revisions/index.html.erb | 10 | ||||
-rw-r--r-- | app/views/govuk_guix/revisions/show.html.erb | 5 | ||||
-rw-r--r-- | app/views/layouts/application.html.erb | 9 | ||||
-rw-r--r-- | app/views/mini_environments/index.html.erb | 28 | ||||
-rw-r--r-- | app/views/mini_environments/new.html.erb | 71 | ||||
-rw-r--r-- | app/views/mini_environments/show.html.erb | 52 | ||||
-rw-r--r-- | app/views/setup/show.html.erb | 73 |
12 files changed, 412 insertions, 41 deletions
diff --git a/app/views/backends/index.html.erb b/app/views/backends/index.html.erb new file mode 100644 index 0000000..99ec1b8 --- /dev/null +++ b/app/views/backends/index.html.erb @@ -0,0 +1,8 @@ + +<h1>Backends</h1> + +<% Backends.classes.each do |backend_class| %> + <h2> - <%= backend_class.label %></h2> + + +<% end %> diff --git a/app/views/backends/terraform_aws/new.html.erb b/app/views/backends/terraform_aws/new.html.erb new file mode 100644 index 0000000..0d33fcf --- /dev/null +++ b/app/views/backends/terraform_aws/new.html.erb @@ -0,0 +1,63 @@ +<a href="<%= setup_path %>" class="btn btn-lg btn-primary pull-right"> + Back to setup +</a> + +<h1>Create a new AWS backend</h1> + +<div class="row"> + <div class="col-md-10"> + <%= form_with(model: @backend, + url: { action: "create" }, + 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', + ) %> + </div> + </div> + + <div class="form-group form-group-lg"> + <div class="col-sm-offset-4 col-sm-8"> + <%= f.submit "Create", class: 'btn btn-lg btn-success' %> + </div> + </div> + <% end %> + </div> +</div> diff --git a/app/views/backends/terraform_aws/show.html.erb b/app/views/backends/terraform_aws/show.html.erb new file mode 100644 index 0000000..e112d7d --- /dev/null +++ b/app/views/backends/terraform_aws/show.html.erb @@ -0,0 +1,2 @@ +<h1>Backends::TerraformAws#show</h1> +<p>Find me in app/views/backends/terraform_aws/show.html.erb</p> diff --git a/app/views/backends/terraform_libvirt/new.html.erb b/app/views/backends/terraform_libvirt/new.html.erb new file mode 100644 index 0000000..ead1f74 --- /dev/null +++ b/app/views/backends/terraform_libvirt/new.html.erb @@ -0,0 +1,43 @@ +<a href="<%= setup_path %>" class="btn btn-lg btn-primary pull-right"> + Back to setup +</a> + +<h1>Create a new libvirt backend</h1> + +<div class="row"> + <div class="col-md-8"> + <%= form_with(model: @backend, + url: { action: "create" }, + html: { class: "form-horizontal" }) do |f| + %> + + <div class="form-group form-group-lg"> + <%= f.label :label, class: 'col-sm-2 control-label' %> + <div class="col-sm-10"> + <%= f.text_field( + :label, + class: 'form-control', + placeholder: 'Label for this backend' + ) %> + </div> + </div> + + <div class="form-group form-group-lg"> + <%= f.label :uri, 'URI', class: 'col-sm-2 control-label' %> + <div class="col-sm-10"> + <%= f.text_field( + :uri, + class: 'form-control', + placeholder: 'Specify what driver to use, and how to connect to it' + ) %> + </div> + </div> + + <div class="form-group form-group-lg"> + <div class="col-sm-offset-2 col-sm-10"> + <%= f.submit "Create", class: 'btn btn-lg btn-success' %> + </div> + </div> + <% end %> + </div> +</div> diff --git a/app/views/backends/terraform_libvirt/show.html.erb b/app/views/backends/terraform_libvirt/show.html.erb new file mode 100644 index 0000000..14b02dc --- /dev/null +++ b/app/views/backends/terraform_libvirt/show.html.erb @@ -0,0 +1,89 @@ +<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-2 control-label' %> + <div class="col-sm-10"> + <%= f.text_field :label, class: 'form-control' %> + </div> + </div> + + <div class="form-group form-group-lg"> + <%= f.label :uri, class: 'col-sm-2 control-label' %> + <div class="col-sm-10"> + <%= f.text_field :uri, class: 'form-control' %> + </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> diff --git a/app/views/govuk_guix/revisions/index.html.erb b/app/views/govuk_guix/revisions/index.html.erb deleted file mode 100644 index 54f9e4a..0000000 --- a/app/views/govuk_guix/revisions/index.html.erb +++ /dev/null @@ -1,10 +0,0 @@ - -<% GovukGuix::Revision.all.each do |revision| %> - - <div> - - <%= revision.inspect %> - - </div> - -<% end %> diff --git a/app/views/govuk_guix/revisions/show.html.erb b/app/views/govuk_guix/revisions/show.html.erb new file mode 100644 index 0000000..5f2b70d --- /dev/null +++ b/app/views/govuk_guix/revisions/show.html.erb @@ -0,0 +1,5 @@ +<a href="<%= setup_path %>" class="btn btn-lg btn-primary pull-right"> + Back to Setup +</a> + +<h1>Revision: <%= @revision.commit_hash %></h1> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 35ea5ff..c37b5f9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -4,4 +4,13 @@ <%= yield :extra_headers %> <% end %> +<% content_for :navbar_items do %> + <li> + <a href="<%= mini_environments_path %>">Mini Environments</a> + </li> + <li> + <a href="<%= setup_path %>">Setup</a> + </li> +<% end %> + <%= render template: 'layouts/govuk_admin_template' %> diff --git a/app/views/mini_environments/index.html.erb b/app/views/mini_environments/index.html.erb index 5e131c6..b74fe73 100644 --- a/app/views/mini_environments/index.html.erb +++ b/app/views/mini_environments/index.html.erb @@ -5,10 +5,30 @@ Create a new mini environment </a> - +<h1>Your mini environments</h1> +<br> <% MiniEnvironment.all.each do |mini_environment| %> - <a href="<%= mini_environment_path mini_environment %>"> - <h2><%= mini_environment.name %></h2> - </a> + <div class="panel panel-default"> + <div class="panel-heading"> + <div class="row"> + <div class="col-md-8"> + <h2><%= mini_environment.name %></h2> + </div> + <div class="col-md-2"> + <div class="alert alert-success text-center" role="alert" style="margin-bottom: 0px;"> + Mini environment running + </div> + </div> + <div class="col-md-2"> + <a class="btn btn-lg btn-primary pull-right" role="button" href="<%= mini_environment_path mini_environment %>"> + Show details + </a> + </div> + </div> + </div> + </div> <% end %> + +<h1>Other mini environments</h1> +<br> diff --git a/app/views/mini_environments/new.html.erb b/app/views/mini_environments/new.html.erb index 7d3f2f2..33cb354 100644 --- a/app/views/mini_environments/new.html.erb +++ b/app/views/mini_environments/new.html.erb @@ -1,28 +1,81 @@ +<a href="<%= mini_environments_path %>" class="btn btn-lg btn-primary pull-right"> + Back to list +</a> + +<h1>Create a new mini environment</h1> + <div class="row"> <div class="col-md-8"> <%= form_with(model: @mini_environment, url: { action: "create" }, html: { class: 'form-horizontal' }) do |f| %> - <div class="form-group"> + <div class="form-group form-group-lg"> <%= f.label :name, class: 'col-sm-2 control-label' %> <div class="col-sm-10"> <%= f.text_field :name, class: 'form-control' %> + <span id="helpBlock" class="help-block"> + Choose a name for your mini environment. This will form + part of the URL used to access it. + </span> </div> </div> - <div class="form-group"> - <%= f.label :govuk_guix_revision_id, class: 'col-sm-2 control-label' %> - <div class="col-sm-10"> - <%= f.collection_select :govuk_guix_revision_id, GovukGuix::Revision.all, :commit_hash, :commit_hash %> - </div> - </div> - - <div class="form-group"> + <div class="form-group form-group-lg"> <div class="col-sm-offset-2 col-sm-10"> <%= f.submit "Create", class: 'btn btn-lg btn-success' %> </div> </div> + + <div class="panel panel-default"> + <div class="panel-heading"> + <h3 style="margin-top: 10px;">Advanced options</h3> + </div> + <div class="panel-body"> + <div class="form-group form-group-lg"> + <%= f.label :govuk_guix_revision_id, 'Revision', class: 'col-sm-2 control-label' %> + <div class="col-sm-10"> + <%= f.collection_select( + :govuk_guix_revision_id, + GovukGuix::Revision.all, + :commit_hash, + :commit_hash, + {}, + { + class: 'form-control' + }, + ) %> + <span id="helpBlock" class="help-block"> + By default the latest set of software is used. If you + want to use specific versions of services, select a + different revision here. + </span> + </div> + </div> + + <div class="form-group form-group-lg"> + <%= f.label :backend, class: 'col-sm-2 control-label' %> + <div class="col-sm-10"> + <%= f.grouped_collection_select( + :backend, + Backends.classes_with_backends, + :all, + :label, + :type_and_id, + :label, + {}, + { + class: 'form-control' + }, + ) %> + <span id="helpBlock" class="help-block"> + Choose the backend to use. This controls the resources + used to run the mini environment. + </span> + </div> + </div> + </div> + </div> <% end %> </div> </div> diff --git a/app/views/mini_environments/show.html.erb b/app/views/mini_environments/show.html.erb index a852e6c..2895330 100644 --- a/app/views/mini_environments/show.html.erb +++ b/app/views/mini_environments/show.html.erb @@ -1,22 +1,39 @@ -<h1>Name: <%= @mini_environment.name %></h1> +<a href="<%= mini_environments_path %>" class="btn btn-lg btn-primary pull-right"> + Back to list +</a> -<%= form_with(url: mini_environment_perform_action_path(@mini_environment), - local: true, - method: "post") do %> - <%= submit_tag('Start', - disabled: !@mini_environment.start_command.present?, - role: 'button', - class: 'btn btn-lg btn-success') - %> +<h1>Name: <%= @mini_environment.name %></h1> - <%= submit_tag("Destroy", - #disabled: !@mini_environment.start_command.present?, - role: 'button', - class: 'btn btn-lg btn-danger') - %> -<% end %> +<div class="row"> + <div class="col-md-9"> + <a class="btn btn-primary btn-lg" + href="https://signon.<%= @mini_environment.name.parameterize %>.aws.cbaines.net"> + View + </a> -<a href="https://signon.<%= @mini_environment.name.parameterize %>.aws.cbaines.net">View</a> + <div class="list-group" style="margin-top: 20px;"> + <%= form_with(url: mini_environment_perform_action_path(@mini_environment), + local: true, + method: "post") do %> + <%= submit_tag('Start', + disabled: !@mini_environment.backend_data.present?, + role: 'button', + class: 'list-group-item btn btn-lg btn-success btn-block') + %> + <% end %> + <%= form_with(url: mini_environment_perform_action_path(@mini_environment), + local: true, + method: "post") do %> + <%= submit_tag("Destroy", + disabled: @mini_environment.backend_data.present?, + role: 'button', + class: 'list-group-item btn btn-lg btn-danger btn-block', + style: 'margin-top: 5px;') + %> + <% end %> + </div> + </div> +</div> <h2>Finished jobs</h2> @@ -69,6 +86,5 @@ </div> </div> </div> -<% end %> - + <% end %> </div> diff --git a/app/views/setup/show.html.erb b/app/views/setup/show.html.erb new file mode 100644 index 0000000..6f8be35 --- /dev/null +++ b/app/views/setup/show.html.erb @@ -0,0 +1,73 @@ + +<h1>Backends</h1> + +<% Backends.classes.each do |backend_class| %> + <div class="panel panel-default"> + <!-- Default panel contents --> + <div class="panel-heading"> + <h2><%= backend_class.label %></h2> + </div> + <ul class="list-group"> + <% backend_class.all.each do |backend| %> + <a class="list-group-item" href="<%= show_backend_path(backend) %>"> + <%= backend.label %> + </a> + <% end %> + <a class="list-group-item text-center" + href="<%= new_backend_path(backend_class) %>"> + New <%= backend_class.label %> backend + </a> + </ul> + </div> +<% end %> + +<h1>Revisions</h1> + +<%= form_with(url: enqueue_fetch_govuk_guix_revision_path, + method: "post") do %> + <div class="input-group input-group-lg"> + <%= text_field_tag( + :revision, + 'origin/master', + class: 'form-control', + placeholder: 'Git revision' + ) %> + <span class="input-group-btn"> + <%= submit_tag("Fetch Revision", + role: 'button', + class: 'btn btn-lg btn-success') + %> + </span> + </div> +<% end %> + +<br> +<div class="list-group"> + <% if fetch_revision_jobs.count %> + <% fetch_revision_jobs.each do |job| %> + <a href="#" class="list-group-item disabled"> + Fetching + <span style="font-family: monospace;"> + <%= job["args"].first %> + </span> + + <div class="progress pull-right" style="width: 21.2em"> + <div class="progress-bar progress-bar-striped active" role="progressbar" style="width: 100%"> + <span class="sr-only">Fetching revision in progress</span> + </div> + </div> + </a> + <% end %> + <% end %> + + <% GovukGuix::Revision.order(:created_at).reverse_order.each do |revision| %> + <a href="<%= govuk_guix_revision_path(revision) %>" class="list-group-item"> + <span class="badge" style="font-family: monospace;"> + <%= revision.commit_hash %> + </span> + + <%= revision.created_at %> + </a> + <% end %> +</div> + |