From 051c8bf612126fa79699c8bf45a661dde127f4a0 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 16 Mar 2018 08:51:54 +0000 Subject: Add backend controllers, models and views Also annotate existing models. --- app/views/backends/index.html.erb | 8 ++ app/views/backends/terraform_aws/new.html.erb | 63 +++++++++++++++ app/views/backends/terraform_aws/show.html.erb | 2 + app/views/backends/terraform_libvirt/new.html.erb | 43 +++++++++++ app/views/backends/terraform_libvirt/show.html.erb | 89 ++++++++++++++++++++++ 5 files changed, 205 insertions(+) create mode 100644 app/views/backends/index.html.erb create mode 100644 app/views/backends/terraform_aws/new.html.erb create mode 100644 app/views/backends/terraform_aws/show.html.erb create mode 100644 app/views/backends/terraform_libvirt/new.html.erb create mode 100644 app/views/backends/terraform_libvirt/show.html.erb (limited to 'app/views/backends') 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 @@ + +

Backends

+ +<% Backends.classes.each do |backend_class| %> +

  - <%= backend_class.label %>

+ + +<% 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 @@ + + Back to setup + + +

Create a new AWS backend

+ +
+
+ <%= form_with(model: @backend, + url: { action: "create" }, + html: { class: "form-horizontal" }) do |f| + %> + +
+ <%= f.label :label, class: 'col-sm-4 control-label' %> +
+ <%= f.text_field( + :label, + class: 'form-control', + placeholder: 'Label for this backend' + ) %> +
+
+ +
+ <%= f.label :aws_region, 'AWS Region', class: 'col-sm-4 control-label' %> +
+ <%= f.text_field( + :aws_region, + class: 'form-control', + placeholder: 'What region to use' + ) %> +
+
+ +
+ <%= f.label :aws_access_key_id, 'AWS Access Key ID', class: 'col-sm-4 control-label' %> +
+ <%= f.text_field( + :aws_access_key_id, + class: 'form-control', + ) %> +
+
+ +
+ <%= f.label :aws_secret_access_key, 'AWS Secret Access Key', class: 'col-sm-4 control-label' %> +
+ <%= f.password_field( + :aws_secret_access_key, + class: 'form-control', + ) %> +
+
+ +
+
+ <%= f.submit "Create", class: 'btn btn-lg btn-success' %> +
+
+ <% end %> +
+
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 @@ +

Backends::TerraformAws#show

+

Find me in app/views/backends/terraform_aws/show.html.erb

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 @@ + + Back to setup + + +

Create a new libvirt backend

+ +
+
+ <%= form_with(model: @backend, + url: { action: "create" }, + html: { class: "form-horizontal" }) do |f| + %> + +
+ <%= f.label :label, class: 'col-sm-2 control-label' %> +
+ <%= f.text_field( + :label, + class: 'form-control', + placeholder: 'Label for this backend' + ) %> +
+
+ +
+ <%= f.label :uri, 'URI', class: 'col-sm-2 control-label' %> +
+ <%= f.text_field( + :uri, + class: 'form-control', + placeholder: 'Specify what driver to use, and how to connect to it' + ) %> +
+
+ +
+
+ <%= f.submit "Create", class: 'btn btn-lg btn-success' %> +
+
+ <% end %> +
+
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 @@ + + Back to Setup + + +

Backend: <%= @backend.label %>

+ +
+
+

Update details

+
+ + <%= form_with(model: @backend, + url: { action: "update" }, + html: { class: "form-horizontal" }) do |f| + %> + +
+ <%= f.label :label, class: 'col-sm-2 control-label' %> +
+ <%= f.text_field :label, class: 'form-control' %> +
+
+ +
+ <%= f.label :uri, class: 'col-sm-2 control-label' %> +
+ <%= f.text_field :uri, class: 'form-control' %> +
+
+ +
+
+ <%= f.submit "Save", class: 'btn btn-lg btn-success' %> +
+
+ <% end %> +
+
+

Delete backend

+
+ + <% unless @backend.mini_environments.empty? %> +

+ Unable to delete backend, as mini environments using this + backend still exist. +

+ +

+ To delete this backend, first delete all the mini environments + using it. +

+ <% 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 %> + +
+
+ +

Mini environments

+ + + + + + + <% @backend.mini_environments.each do |mini_environment| %> + + + + + <% end %> +
Name
<%= mini_environment.name %> + + Show details + +
-- cgit v1.2.3