This commit is contained in:
bee0005
2016-09-20 12:14:13 +00:00
parent 37538b5112
commit e9d72c6fc5
9 changed files with 204 additions and 14 deletions

View File

@@ -1,7 +1,8 @@
class NodeController < ApplicationController
def index
@hosts = Array.new
@nodes = Node.all.order("id asc")
if get_hosts.blank?
flash[:danger] = "Check Server"
else
@@ -12,4 +13,21 @@ class NodeController < ApplicationController
def get_hosts
return ['2', 'aaa', 'bbb', 'ccc']
end
def node_add
new_node = Node.new
new_node.host_name = params[:host_name]
new_node.host_ip = params[:host_ip]
new_node.host_port = params[:host_port]
new_node.user_name = params[:user_name]
new_node.user_password = params[:user_password]
new_node.save
redirect_to '/node/index'
end
def node_delete
one_node = Node.find(params[:node_id])
one_node.destroy
redirect_to '/node/index'
end
end