This commit is contained in:
kyg516 2016-10-02 13:19:10 +09:00
parent a37d4b6051
commit 1b5864a7c1
5 changed files with 97 additions and 81 deletions

View File

@ -3,11 +3,10 @@ class NodeController < ApplicationController
def index
@hosts = Array.new
@nodes = Node.all.order("id asc")
@node_connects = Array.new
node_info = Hash.new
begin
one_node = Node.take
node_info["Hostname"] = one_node.host_name
node_info["State"] = "Peer in Cluster Disconnected"
node_info = Hash.new
@ -39,10 +38,9 @@ class NodeController < ApplicationController
else
@hosts = get_hosts
end
rescue => ex
puts ex
end
def get_hosts
return ['2', 'aaa', 'bbb', 'ccc']
end
def node_add

View File

@ -1,4 +1,5 @@
module ApplicationHelper
require 'net/ping'
def get_df
df = Array.new
@ -136,4 +137,8 @@ module ApplicationHelper
return files
end
def ping_test?(host)
check = Net::Ping::External.new(host)
return check.ping?
end
end

View File

@ -1,7 +1,2 @@
module NodeHelper
require 'net/ping'
def ping_test?(host)
check = Net::Ping::External.new(host)
check.ping?
end
end

View File

@ -105,7 +105,7 @@
<!-- file manager -->
<div class="col-md-8 col-sm-8 col-xs-12">
<div class="panel panel-body">
<div id="pagecontent" class="panel panel-body">
<div class="x_title" id="file_manager_title_div">
<h2 style="width:130px">File Manager</h2>
</div>
@ -353,6 +353,9 @@ $(document).on("click", "#file_manager_div .chdir", function(){
method : "post",
url : "/home/chdir",
data : { next_dir : next_dir },
beforeSend : function(){
Pace.start();
},
success : function(result){
$("#current_dir").val(next_dir);
$("#file_manager_title_div").empty().append("<h2 style='width:130px'>File manager</h2>");
@ -362,6 +365,7 @@ $(document).on("click", "#file_manager_div .chdir", function(){
draw_datatable();
draw_chart(result.du);
Pace.stop();
}
})
})
@ -379,6 +383,9 @@ $(document).on("click", "#file_manager_div .chupper", function(){
method : "POST",
url : "/home/chdir",
data : { next_dir : next_dir },
beforeSend : function(){
Pace.start();
},
success : function(result){
$("#current_dir").val(next_dir);
$("#file_manager_title_div").empty().append("<h2 style='width:130px'>File manager</h2>");
@ -388,6 +395,7 @@ $(document).on("click", "#file_manager_div .chupper", function(){
draw_datatable();
draw_chart(result.du);
Pace.stop();
}
})
})

View File

@ -87,11 +87,21 @@
</div>
</div>
<div class="clearfix"></div>
<% nodes = Node.all %>
<% if nodes.length == 0 %>
<div class="row animated flipInX col-md-6 col-sm-9 col-xs-12">
<div class="alert alert-info" role="alert">
<span class="glyphicon glyphicon-bell" area-hidden="true"></span>
<span class="glyphicon-class">You don't have a node. Please add nodes to do something in this page.</span>
</div>
</div>
<% else %>
<div class="row">
<% volumes.each_with_index do |volume, index| %>
<%= raw volume_info(volume, index) %>
<% end %>
</div>
<% end %>
</div>
<!-- /page content -->