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

View File

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

View File

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

View File

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

View File

@ -87,11 +87,21 @@
</div> </div>
</div> </div>
<div class="clearfix"></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"> <div class="row">
<% volumes.each_with_index do |volume, index| %> <% volumes.each_with_index do |volume, index| %>
<%= raw volume_info(volume, index) %> <%= raw volume_info(volume, index) %>
<% end %> <% end %>
</div> </div>
<% end %>
</div> </div>
<!-- /page content --> <!-- /page content -->