diff options
author | Christopher Baines <mail@cbaines.net> | 2018-05-24 19:00:47 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-05-24 19:00:47 +0100 |
commit | 502c924653c89e96c5b370cf281da59e3a2b3759 (patch) | |
tree | b1708e1238fdf579826c5047cf0798b299ccd9ff /app | |
parent | 4eb5c0f4703671d81a2a4b536282f2be4169dac8 (diff) | |
download | govuk-mini-environment-admin-502c924653c89e96c5b370cf281da59e3a2b3759.tar govuk-mini-environment-admin-502c924653c89e96c5b370cf281da59e3a2b3759.tar.gz |
Show the available services for each revision
Diffstat (limited to 'app')
-rw-r--r-- | app/jobs/govuk_guix/fetch_revision_job.rb | 14 | ||||
-rw-r--r-- | app/views/govuk_guix/revisions/show.html.erb | 39 |
2 files changed, 51 insertions, 2 deletions
diff --git a/app/jobs/govuk_guix/fetch_revision_job.rb b/app/jobs/govuk_guix/fetch_revision_job.rb index 76e16bd..c2c3c17 100644 --- a/app/jobs/govuk_guix/fetch_revision_job.rb +++ b/app/jobs/govuk_guix/fetch_revision_job.rb @@ -47,7 +47,8 @@ class GovukGuix::FetchRevisionJob < GovukGuix::Job GovukGuix::Revision.create( commit_hash: sha, - store_path: store_path + store_path: store_path, + available_services: available_services(store_path) ) end @@ -61,6 +62,17 @@ class GovukGuix::FetchRevisionJob < GovukGuix::Job end end + def available_services(store_path) + command_output = run_command( + "#{store_path}/bin/govuk", + "system", + "available-services", + "--json" + ) + + JSON.parse(command_output.join) + end + def repository_directory 'tmp/cache/govuk-guix' end diff --git a/app/views/govuk_guix/revisions/show.html.erb b/app/views/govuk_guix/revisions/show.html.erb index 96e3588..fe42dd7 100644 --- a/app/views/govuk_guix/revisions/show.html.erb +++ b/app/views/govuk_guix/revisions/show.html.erb @@ -26,7 +26,6 @@ License along with the GOV.UK Mini Environment Admin. If not, see Back to Setup </a> - <h1>Revision: <%= @revision.commit_hash %></h1> <div class="row"> @@ -54,3 +53,41 @@ License along with the GOV.UK Mini Environment Admin. If not, see <% else %> <h2>There are no mini environments using this revision</h2> <% end %> + +<h2>Available Services</h2> + +<% (@revision.available_services || []).each do |group| %> + <h3><%= group["name"] %></h3> + <p><%= group["description"] %></p> + + <table class="table"> + <thead> + <tr> + <th>Name</th> + <th>Description</th> + <th>Package</th> + </tr> + </thead> + <tbody> + <% group["services"].each do |service| %> + <tr> + <td class="col-md-3"> + <strong><%= service["name"] %></strong> + </td> + + <td class="col-md-6"> + <%= service["description"] %> + </td> + + <% package = service["package"] %> + <td class="col-md-3"> + <a href="<%= package["source"]["uri"] %>"> + <%= package["version"] %> + </a> + <a href="<%= package["homepage"] %>">[homepage]</a> + </td> + </tr> + <% end %> + </tbody> + </table> +<% end %> |