gluster-web-interface/app/controllers/node_controller.rb

35 lines
739 B
Ruby
Raw Normal View History

2016-09-14 08:54:30 +00:00
class NodeController < ApplicationController
2016-09-23 12:53:19 +00:00
before_action :require_login
2016-09-14 08:54:30 +00:00
def index
@hosts = Array.new
2016-09-20 12:14:13 +00:00
@nodes = Node.all.order("id asc")
2016-09-14 08:54:30 +00:00
if get_hosts.blank?
flash[:danger] = "Check Server"
else
@hosts = get_hosts
end
end
def get_hosts
return ['2', 'aaa', 'bbb', 'ccc']
end
2016-09-20 12:14:13 +00:00
def node_add
new_node = Node.new
new_node.host_name = params[:host_name]
new_node.host_ip = params[:host_ip]
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
2016-09-14 08:54:30 +00:00
end