This commit is contained in:
kyg516 2016-10-03 17:29:08 +09:00
parent f5a11b5485
commit 538f37d4cc
2 changed files with 164 additions and 69 deletions

View File

@ -156,6 +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? %>
<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">
@ -207,6 +208,14 @@
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<% else %>
<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>
<% end %>
</div> </div>
</div> </div>
@ -229,6 +238,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? %>
<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">
@ -263,6 +273,14 @@
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<% else %>
<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 volume. Please add volumes to do something in this page.</span>
</div>
</div>
<% end %>
</div> </div>
</div> </div>
</div> </div>

View File

@ -9,6 +9,83 @@
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Datatable functions -->
<script>
function draw_datatable(){
$('#file_manager_table').dataTable( {
"bSort": false,
initComplete: function(){
$('#file_manager_table_filter').detach().appendTo("#file_manager_title_div").css({
'width':'250px'
});
$('#file_manager_table_length').detach().appendTo("#file_manager_title_div").css({
'width':'150px',
'float':'right'
});
$('#file_manager_title_div').css({
'width':'100%',
'height':'48px',
});
$('#file_manager_title_div input').css({
'width':'70%',
'height':'70%',
'font-size':'14px',
'padding':'5px'
});
}
});
$('#disk_usage_tile_table').dataTable({
"bSort":false,
"bFilter":false,
"bInfo":false,
initComplete: function(){
$('#disk_usage_tile_table_length').detach().appendTo("#disk_usage_title_div").css({
'width':'150px',
'float':'right'
});
$('#disk_usage_title_div').css({
'width':'100%',
'height':'48px',
});
}
});
}
function draw_chart(du){
var options = {
legend: false,
responsive: false
};
var colors = ["#3498DB", "#26B99A", "#E74C3C", "#9B59B6", "#BDC3C7"];
var labels = [];
var data = [];
var backgroundColor = [];
var hoverBackgroundColor = [];
for(var i = 0; i < du.length; i++){
labels.push(du[i]['file_name']);
data.push(du[i]['usage']);
backgroundColor.push(colors[i % colors.length]);
hoverBackgroundColor.push(colors[i % colors.length]);
}
new Chart(document.getElementById("disk_usage_table_canvas"), {
type: 'doughnut',
tooltipFillColor: "rgba(51, 51, 51, 0.55)",
data: {
labels: labels,
datasets: [{
data: data,
backgroundColor: backgroundColor,
hoverBackgroundColor: hoverBackgroundColor
}]
},
options: options
});
}
</script>
<!-- /Datatable functions -->
</head> </head>
<script> <script>
function loading(){ function loading(){