diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index ae6aeae..311b7b6 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,21 +1,27 @@ /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the bottom of the * compiled file so the styles you add here take precedence over styles defined in any styles * defined in the other CSS/SCSS files in this directory. It is generally better to create a new * file per style scope. * *= require bootstrap.min *= require_tree . *= require_self */ /* Make sure navbar does not overlay body */ body { padding-top: 70px; } + +.right { + text-align: right; + margin-right: 0px; + float: right; +} diff --git a/app/controllers/hosts_controller.rb b/app/controllers/hosts_controller.rb index 6937f76..8e92935 100644 --- a/app/controllers/hosts_controller.rb +++ b/app/controllers/hosts_controller.rb @@ -1,43 +1,43 @@ class HostsController < ApplicationController # before_action :fetch_params, only: :create before_action :fetch_host, only: [:show, :edit, :update, :destroy] # GET /hosts def new @host = Host.new end # POST /hosts def create @host = Host.new(fetch_params) if @host.save redirect_to root_path else render :new end end # GET /hosts/1 def show; end # GET /hosts/1/edit def edit; end # PUT /hosts/1 def update;end # DELETE /hosts/1 def destroy #@host.destroy end private def fetch_host - @host = Host.find(params[:id]) + @host = Host.includes(job_templates: [:fileset, :schedule]).find(params[:id]) end def fetch_params params.require(:host).permit(:fqdn, :port, :password) end end diff --git a/app/views/hosts/_host_details.html.erb b/app/views/hosts/_host_details.html.erb new file mode 100644 index 0000000..42408d2 --- /dev/null +++ b/app/views/hosts/_host_details.html.erb @@ -0,0 +1,39 @@ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name<%= @host.name %>
FQDN<%= @host.fqdn %>
FDPort<%= @host.port %>
Password<%= @host.password %>
File Retention<%= @host.file_retention %> days
Job Retention<%= @host.job_retention %> days
Auto Prune<%= @host.auto_prune_human %>
Created<%= I18n.l(@host.created_at, format: :long) %>
+
+ <%= link_to 'Edit', edit_host_path(@host), class: "btn btn-primary", role: "button" %> +
diff --git a/app/views/hosts/show.html.erb b/app/views/hosts/show.html.erb index 2bb738d..9ef66b5 100644 --- a/app/views/hosts/show.html.erb +++ b/app/views/hosts/show.html.erb @@ -1,47 +1,23 @@

<%= notice %>

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name<%= @host.name %>
FQDN<%= @host.fqdn %>
FDPort<%= @host.port %>
Password<%= @host.password %>
File Retention<%= @host.file_retention %> days
Job Retention<%= @host.job_retention %> days
Auto Prune<%= @host.auto_prune_human %>
Created<%= I18n.l(@host.created_at, format: :long) %>
+
+ <%= link_to 'Remove host', host_path(@host), method: :delete, + class: "btn btn-danger", role: "button" %>
-
- <%= link_to 'Edit', edit_host_path(@host), class: "btn btn-primary", role: "button" %> - <%= link_to 'Submit Backup Policy', '#', class: "btn btn-success", role: "button" %> - <%= link_to 'Remove host', host_path(@host), method: :delete, class: "btn btn-danger", role: "button" %> -
+

Configuration for <%= @host.name %>

+
-<%= link_to 'Back to clients', clients_path %> +
+
+

Host Details

+
+
+

Jobs

+
+
+
+ <%= render partial: "host_details" %> + <%= render partial: "jobs/job_templates" %> +
diff --git a/app/views/jobs/_job_template_details.html.erb b/app/views/jobs/_job_template_details.html.erb new file mode 100644 index 0000000..2d8d209 --- /dev/null +++ b/app/views/jobs/_job_template_details.html.erb @@ -0,0 +1,8 @@ + + <%= link_to job.name, host_job_path(@host, job) %> + <%= job.job_type %> + <%= job.fileset.name %> + <%= job.schedule.name %> + <%= job.priority %> + + diff --git a/app/views/jobs/_job_templates.html.erb b/app/views/jobs/_job_templates.html.erb new file mode 100644 index 0000000..58a8a3c --- /dev/null +++ b/app/views/jobs/_job_templates.html.erb @@ -0,0 +1,20 @@ +
+
+ + + + + + + + + + + + + <%= render partial: 'jobs/job_template_details', collection: @host.job_templates, as: :job %> + +
NameTypeFileSetSchedulePriority
+
+ <%= link_to 'Add Job', new_host_job_path(host_id: @host.id), class: "btn btn-success", role: "button" %> +