Update home index

This commit is contained in:
kyg516 2016-10-03 19:20:55 +09:00
parent 73209faf54
commit ea3d034885

View File

@ -36,8 +36,8 @@
<!-- top tiles --> <!-- top tiles -->
<% users = User.all %> <% users = User.all %>
<% nodes = Node.all %> <% nodes = ssh_nodes %>
<% vols = ssh_volume_info %> <% volumes = ssh_volume_info %>
<% today_user = User.where(:last_sign_in_at => Date.today..Date.tomorrow) %> <% today_user = User.where(:last_sign_in_at => Date.today..Date.tomorrow) %>
<% today_node = Node.where(:created_at => Date.today..Date.tomorrow) %> <% today_node = Node.where(:created_at => Date.today..Date.tomorrow) %>
<div class="row tile_count"> <div class="row tile_count">
@ -83,10 +83,10 @@
<div class="left"></div> <div class="left"></div>
<div class="right"> <div class="right">
<span class="count_top"><i class="fa fa-database"></i> Total volumes</span> <span class="count_top"><i class="fa fa-database"></i> Total volumes</span>
<div class="count"><%= vols.nil? ? 0 : vols.length %></div> <div class="count"><%= volumes.nil? ? 0 : volumes.length %></div>
<span class="count_bottom"> <span class="count_bottom">
<i class="blue"><%= vols.count{|x| x['Status'].eql? " Started"} %></i> started / <i class="blue"><%= volumes.count{|x| x['Status'].eql? " Started"} %></i> started /
<i class="green"><%= vols.count{|x| x['Mount State'].eql? "mounted"} %></i> mounted <i class="green"><%= volumes.count{|x| x['Mount State'].eql? "mounted"} %></i> mounted
</span> </span>
</div> </div>
</div> </div>
@ -101,8 +101,8 @@
</div> </div>
<!-- /top tiles --> <!-- /top tiles -->
<!-- first row -->
<div class="row"> <div class="row">
<!-- 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 id="pagecontent" class="panel panel-body"> <div id="pagecontent" class="panel panel-body">
@ -131,9 +131,9 @@
</div> </div>
<!-- /disk usage --> <!-- /disk usage -->
</div> </div>
<!-- /first row -->
<% nodes = ssh_nodes %> <!-- second row -->
<% volumes = ssh_volume_info %>
<div class ="row"> <div class ="row">
<!-- node status --> <!-- node status -->
<div class="col-md-4 col-sm-4 col-xs-12"> <div class="col-md-4 col-sm-4 col-xs-12">
@ -156,7 +156,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="x_content tile fixed_height_160" style="overflow-y:auto;"> <div class="x_content tile fixed_height_160" style="overflow-y:auto;">
<% if nodes.nil? %> <% if !nodes.nil? %>
<div class="widget_summary"> <div class="widget_summary">
<% ping = ((nodes.select{ |node| node["ping"].eql? "true" }.length.to_f / nodes.length.to_f) * 100).to_i %> <% ping = ((nodes.select{ |node| node["ping"].eql? "true" }.length.to_f / nodes.length.to_f) * 100).to_i %>
<div class="w_left w_25"> <div class="w_left w_25">
@ -217,9 +217,8 @@
</div> </div>
<% end %> <% end %>
</div> </div>
</div> </div>
<div class="x_panel">
<div class="x_panel">
<div class="x_title"> <div class="x_title">
<h2>Volumes Status</h2> <h2>Volumes Status</h2>
<ul class="nav navbar-right panel_toolbox"> <ul class="nav navbar-right panel_toolbox">
@ -238,7 +237,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="x_content tile fixed_height_160" style="overflow-y:auto;"> <div class="x_content tile fixed_height_160" style="overflow-y:auto;">
<% if volumes.nil? %> <% if !volumes.nil? %>
<div class="widget_summary"> <div class="widget_summary">
<% start = ((volumes.select{ |volume| volume["Status"].eql? " Started" }.length.to_f / volumes.length.to_f) * 100).to_i %> <% start = ((volumes.select{ |volume| volume["Status"].eql? " Started" }.length.to_f / volumes.length.to_f) * 100).to_i %>
<div class="w_left w_25"> <div class="w_left w_25">
@ -272,23 +271,23 @@
<span><%= volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length %> / <%= volumes.length %></span> <span><%= volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length %> / <%= volumes.length %></span>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<% else %> <% else %>
<div class="row animated flipInX col-md-8 col-sm-8 col-xs-8"> <div class="row animated flipInX col-md-8 col-sm-8 col-xs-8">
<div class="alert alert-warning" role="alert"> <div class="alert alert-warning" role="alert">
<span class="glyphicon glyphicon-bell" area-hidden="true"></span> <span class="glyphicon glyphicon-bell" area-hidden="true"></span>
<span class="glyphicon-class">You don't have a volume. Please add volumes to do something in this page.</span> <span class="glyphicon-class">You don't have a volume. Please add volumes to do something in this page.</span>
</div> </div>
</div> </div>
<% end %> <% end %>
</div> </div>
</div> </div>
</div> </div>
<!-- /node status --> <!-- /node status -->
<!-- node list --> <!-- node list -->
<div class="col-md-4 col-sm-4 col-xs-12"> <div class="col-md-4 col-sm-4 col-xs-12">
<div class="x_panel tile"> <div class="x_panel">
<div class="x_title"> <div class="x_title">
<h2>Nodes List</h2> <h2>Nodes List</h2>
<ul class="nav navbar-right panel_toolbox"> <ul class="nav navbar-right panel_toolbox">
@ -307,8 +306,8 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="x_content fixed_height_320" style="overflow-y:auto;"> <div class="x_content fixed_height_320" style="overflow-y:auto;">
<ul class="list-unstyled top_profiles" > <ul class="list-unstyled top_profiles">
<% if nodes.nil? %> <% if !nodes.nil? %>
<% nodes.each do |node| %> <% nodes.each do |node| %>
<li class="media event"> <li class="media event">
<% if node["ping"].eql? "true" %> <% if node["ping"].eql? "true" %>
@ -340,11 +339,11 @@
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<!-- /node list --> <!-- /node list -->
<!-- disk usage --> <!-- disk usage -->
<div class="col-md-4 col-sm-4 col-xs-12"> <div class="col-md-4 col-sm-4 col-xs-12">
<div class="x_panel"> <div class="x_panel">
<div class="x_title" id="disk_file_title_div"> <div class="x_title" id="disk_file_title_div">
<h2>Mounted usage</h2> <h2>Mounted usage</h2>
@ -363,8 +362,7 @@
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="x_content tile" id="disk_file_div"> <div class="x_content fixed_height_320" style="overflow-y:auto;" id="disk_file_div">
<% if volumes.nil? or ( (volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length) == 0) %> <% if volumes.nil? or ( (volumes.select{ |volume| volume["Mount State"].eql? "mounted" }.length) == 0) %>
<div class="row animated flipInX col-md-8 col-sm-8 col-xs-8"> <div class="row animated flipInX col-md-8 col-sm-8 col-xs-8">
<div class="alert alert-error" role="alert"> <div class="alert alert-error" role="alert">
@ -381,13 +379,11 @@
<% end %> <% end %>
</div> </div>
</div> </div>
</div> </div>
<!-- /disk usage --> <!-- /disk usage -->
</div>
<!-- /second row -->
</div>
<div class ="row">
</div>
</div> </div>
<!-- /page content --> <!-- /page content -->