diff --git a/app/controllers/hosts_controller.rb b/app/controllers/hosts_controller.rb index 8e92935..383ee4c 100644 --- a/app/controllers/hosts_controller.rb +++ b/app/controllers/hosts_controller.rb @@ -1,43 +1,44 @@ 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 + redirect_to host_path @host 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 + @host.destroy + redirect_to root_path end private def fetch_host @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/show.html.erb b/app/views/hosts/show.html.erb index 9ef66b5..6d6152f 100644 --- a/app/views/hosts/show.html.erb +++ b/app/views/hosts/show.html.erb @@ -1,23 +1,23 @@

<%= notice %>

- <%= link_to 'Remove host', host_path(@host), method: :delete, + <%= link_to 'Remove host', host_path(@host), method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-danger", role: "button" %>

Configuration for <%= @host.name %>


Host Details

Jobs

<%= render partial: "host_details" %> <%= render partial: "jobs/job_templates" %>