diff options
author | Christopher Baines <mail@cbaines.net> | 2018-06-01 20:43:49 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-06-01 20:43:49 +0100 |
commit | 9953ee2af581fc676a7ea7d308b691186aea6638 (patch) | |
tree | ffd5332c3ef440a1d5181425ed01eb38a6b46a9c | |
parent | 1c842f372f9f46232551a62af2a8b6218054b432 (diff) | |
download | govuk-mini-environment-admin-9953ee2af581fc676a7ea7d308b691186aea6638.tar govuk-mini-environment-admin-9953ee2af581fc676a7ea7d308b691186aea6638.tar.gz |
Support selecting a data snapshot on the services page
-rw-r--r-- | app/models/backends/terraform_libvirt.rb | 4 | ||||
-rw-r--r-- | app/views/mini_environments/services.html.erb | 43 |
2 files changed, 47 insertions, 0 deletions
diff --git a/app/models/backends/terraform_libvirt.rb b/app/models/backends/terraform_libvirt.rb index 4344801..4a37a3b 100644 --- a/app/models/backends/terraform_libvirt.rb +++ b/app/models/backends/terraform_libvirt.rb @@ -103,6 +103,10 @@ class Backends::TerraformLibvirt < ApplicationRecord end end + def available_data_snapshots + GovukGuix::DataSnapshot.where(backend: nil) + end + def terraform_state_id "backend/terraform_libvirt/#{id}" end diff --git a/app/views/mini_environments/services.html.erb b/app/views/mini_environments/services.html.erb index 78cdeff..89c3f7c 100644 --- a/app/views/mini_environments/services.html.erb +++ b/app/views/mini_environments/services.html.erb @@ -74,6 +74,49 @@ License along with the GOV.UK Mini Environment Admin. If not, see </div> </div> + <br> + <div class="panel panel-default"> + <div class="panel-heading"> + <h3 style="margin-top: 10px;">Data for the services</h3> + </div> + <div class="panel-body"> + <p> + If you want to use the applications with data, select a data + snapshot below. + </p> + </div> + <ul class="list-group"> + <li class="list-group-item"> + <div class="panel-body"> + + <div class="form-group form-group-lg"> + <%= f.label :data_snapshot, class: 'col-sm-2 control-label' %> + + <div class="col-sm-10"> + <%= f.collection_select( + :data_snapshot, + @mini_environment.backend.available_data_snapshots, + :id, + :description, + { + include_blank: 'No data snapshot' + }, + { + class: 'form-control', + }, + ) %> + <span id="helpBlock" class="help-block"> + Select the data snapshot you wish to use. If you don't + wish to populate the mini environment with data, + select 'No data snapshot'. + </span> + </div> + </div> + </div> + </li> + </ul> + </div> + <% ( @mini_environment.govuk_guix_revision.available_services || [] ).each do |group| %> |