diff --git a/app/controllers/node_controller.rb b/app/controllers/node_controller.rb index 81e4657..c9c7294 100644 --- a/app/controllers/node_controller.rb +++ b/app/controllers/node_controller.rb @@ -5,7 +5,17 @@ class NodeController < ApplicationController end def detail @node_id = params[:node_id] - #@detail_node = Node.find(params[:node_id]) + end + + def node_update + one_node = Node.find(params[:node_id]) + one_node.host_name = params[:host_name] + one_node.host_ip = params[:host_ip] + one_node.user_name = params[:user_name] + one_node.user_password = params[:user_password] + one_node.save + + redirect_to '/node/detail/' + params[:node_id] end diff --git a/app/views/node/detail.html.erb b/app/views/node/detail.html.erb index 2350811..2865bda 100644 --- a/app/views/node/detail.html.erb +++ b/app/views/node/detail.html.erb @@ -149,19 +149,40 @@
<% nodes.each do |node| %> <% if (node["id"].to_s).eql?(@node_id.to_s)%> -

<%=node["created_at"]%>

-

<%=node["updated_at"]%>

- <% if node["ping"].eql? "true" %> -

True

-

<%=node["ssh"]%>

-

<%=node["gluster"]%>

- <% if node["ssh"].eql?("on") && node["gluster"].eql?("on")%> -

<%=node["number_of_peers"]%>

- <%end%> - <% else %> -

False

- <% end %> -
+ + "/> + +
+ +
+ +
+
+ <% if node["ping"].eql? "true" %> +
+ +
+ +
+
+
+ +
+ +
+
+ + <% if node["ssh"].eql?("on") && node["gluster"].eql?("on")%> +
+ +
+ +
+
+ <%end%> + <% end %> + +
@@ -193,11 +214,22 @@ data-toggle="tooltip" data-placement="top" title="Put user password for ssh connection. client must have ssh key">
+
+ +
+ +
+
+
+ +
+ +
+
- - +
diff --git a/config/routes.rb b/config/routes.rb index 41ac06d..df90872 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,6 +31,7 @@ Rails.application.routes.draw do post 'node/add' => "node#node_add" get 'node/delete/:node_id' => "node#node_delete" get 'node/detail/:node_id' => "node#detail" + post 'node/update' => "node#node_update" post 'node/probe' => "node#node_probe" post 'node/detach' => "node#node_detach"