2016-09-04 06:17:44 +00:00
|
|
|
<!-- create overlay page -->
|
2016-09-24 09:00:27 +00:00
|
|
|
|
2016-09-19 10:57:10 +00:00
|
|
|
<div id="popup_mkdir" class="overlay">
|
|
|
|
<div class="popup">
|
|
|
|
<h2> Make Directory </h2>
|
|
|
|
<a class="close" href="#">×</a>
|
|
|
|
<form id="form_make_directory" data-parsley-validate class="form-horizontal form-label-left" action="/home/mkdir" method="post">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="current-dir">Current Directory <span class="required">*</span>
|
|
|
|
</label>
|
|
|
|
<div class="col-md-6 col-sm-6 col-xs-12">
|
|
|
|
<input type="text" id="current-dir" required="required" class="form-control col-md-7 col-xs-12" name="current_dir" value="<%=@current_dir%>" readonly/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="directory-name">Directory Name<span class="required">*</span>
|
|
|
|
</label>
|
|
|
|
<div class="col-md-6 col-sm-6 col-xs-12">
|
|
|
|
<input type="text" id="directory-name" required="required" class="form-control col-md-7 col-xs-12" name="directory_name" placeholder="Directory name"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="ln_solid"></div>
|
|
|
|
<div class="form-group">
|
|
|
|
<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
|
|
|
|
<button type="submit" class="btn btn-success">Submit</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-04 06:17:44 +00:00
|
|
|
|
2016-08-20 06:41:37 +00:00
|
|
|
<!-- page content -->
|
|
|
|
<div class="right_col" role="main">
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="page-title">
|
|
|
|
</div>
|
|
|
|
<div class="clearfix"></div>
|
2016-09-24 09:00:27 +00:00
|
|
|
|
|
|
|
<!-- top tiles -->
|
|
|
|
<div class="row tile_count">
|
2016-09-24 10:31:27 +00:00
|
|
|
<div class="animated flipInY col-md-2 col-sm-6 col-xs-6 tile_stats_count">
|
2016-09-24 09:00:27 +00:00
|
|
|
<div class="left"></div>
|
|
|
|
<div class="right">
|
|
|
|
<span class="count_top"><i class="fa fa-clock-o"></i> Current signed in</span>
|
|
|
|
<div class="count"><%= current_user.current_sign_in_at.strftime("%a, %H:%M") %></div>
|
2016-09-24 10:31:27 +00:00
|
|
|
<span class="count_bottom"> From <i class="blue"><%= current_user.current_sign_in_ip %></i></span>
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
2016-09-24 09:00:27 +00:00
|
|
|
</div>
|
2016-09-24 10:31:27 +00:00
|
|
|
<div class="animated flipInY col-md-2 col-sm-6 col-xs-6 tile_stats_count">
|
2016-09-24 09:00:27 +00:00
|
|
|
<div class="left"></div>
|
|
|
|
<div class="right">
|
|
|
|
<span class="count_top"><i class="fa fa-clock-o"></i> Last signed in</span>
|
|
|
|
<div class="count"><%= current_user.last_sign_in_at.strftime("%a, %H:%M") %></div>
|
|
|
|
<span class="count_bottom"> From <i class="red"><%= current_user.last_sign_in_ip %></i></span>
|
2016-09-23 09:28:53 +00:00
|
|
|
</div>
|
2016-09-24 09:00:27 +00:00
|
|
|
</div>
|
2016-09-24 10:31:27 +00:00
|
|
|
<div class="animated flipInY col-md-2 col-sm-6 col-xs-6 tile_stats_count">
|
2016-09-24 09:00:27 +00:00
|
|
|
<div class="left"></div>
|
|
|
|
<div class="right">
|
|
|
|
<span class="count_top"><i class="fa fa-user"></i> Members</span>
|
2016-09-24 10:31:27 +00:00
|
|
|
<div class="count"><%= User.all.length %></div>
|
|
|
|
<span class="count_bottom"><i class="green"><%= User.where(:last_sign_in_at => Date.today..Date.tomorrow).length %></i> user signed Today</span>
|
2016-09-23 09:28:53 +00:00
|
|
|
</div>
|
2016-09-24 09:00:27 +00:00
|
|
|
</div>
|
2016-09-24 10:31:27 +00:00
|
|
|
<div class="animated flipInY col-md-2 col-sm-6 col-xs-6 tile_stats_count">
|
2016-09-24 09:00:27 +00:00
|
|
|
<div class="left"></div>
|
|
|
|
<div class="right">
|
|
|
|
<span class="count_top"><i class="fa fa-cubes"></i> Total Nodes</span>
|
2016-09-24 10:31:27 +00:00
|
|
|
<div class="count"><%= Node.all.length %></div>
|
|
|
|
<span class="count_bottom"><i class="green"><%= Node.where(:created_at => Date.today..Date.tomorrow).length %></i> Node added Today</span>
|
2016-09-23 09:28:53 +00:00
|
|
|
</div>
|
2016-09-24 09:00:27 +00:00
|
|
|
</div>
|
2016-09-24 10:31:27 +00:00
|
|
|
<div class="animated flipInY col-md-2 col-sm-6 col-xs-6 tile_stats_count">
|
2016-09-24 09:00:27 +00:00
|
|
|
<div class="left"></div>
|
|
|
|
<div class="right">
|
|
|
|
<span class="count_top"><i class="fa fa-database"></i> Total volumes</span>
|
2016-09-24 10:31:27 +00:00
|
|
|
<% v = volumes %>
|
|
|
|
<div class="count"><%= v.length %></div>
|
|
|
|
<span class="count_bottom">
|
|
|
|
<i class="blue"><%= v.count{|x| x['Status'].eql? " Started"} %></i> started /
|
|
|
|
<i class="green"><%= v.count{|x| x['Mount State'].eql? "mounted"} %></i> mounted
|
|
|
|
</span>
|
2016-09-23 09:28:53 +00:00
|
|
|
</div>
|
2016-09-24 09:00:27 +00:00
|
|
|
</div>
|
2016-09-24 10:31:27 +00:00
|
|
|
<div class="animated flipInY col-md-2 col-sm-6 col-xs-6 tile_stats_count">
|
2016-09-24 09:00:27 +00:00
|
|
|
<div class="left"></div>
|
|
|
|
<div class="right">
|
|
|
|
<span class="count_top"><i class="fa fa-user"></i> Total Connections</span>
|
2016-09-24 10:31:27 +00:00
|
|
|
<div class="count"><%= User.sum("sign_in_count") %></div>
|
|
|
|
<span class="count_bottom"><i class="green"><%= User.where(:last_sign_in_at => Date.today..Date.tomorrow).sum("sign_in_count") %></i> connected today</span>
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-24 09:00:27 +00:00
|
|
|
</div>
|
|
|
|
<!-- /top tiles -->
|
2016-09-19 10:57:10 +00:00
|
|
|
|
2016-09-24 09:00:27 +00:00
|
|
|
<div class="row">
|
2016-09-23 09:28:53 +00:00
|
|
|
<!-- file manager -->
|
2016-09-24 09:00:27 +00:00
|
|
|
<div class="col-md-8 col-sm-8 col-xs-12">
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="x_panel">
|
|
|
|
<div class="x_title">
|
|
|
|
<h2>File Manager</h2>
|
|
|
|
<ul class="nav navbar-right panel_toolbox">
|
|
|
|
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
|
|
|
|
</li>
|
|
|
|
<li class="dropdown">
|
|
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
|
|
|
|
<ul class="dropdown-menu" role="menu">
|
|
|
|
<li><a href="#">Settings 1</a>
|
|
|
|
</li>
|
|
|
|
<li><a href="#">Settings 2</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
</div>
|
|
|
|
<div class="x_content">
|
|
|
|
<div class="col-md-12 col-sm-12 col-xs-12" id="table_div">
|
|
|
|
<table id="datatable" class="table table-striped table-bordered jambo_table">
|
|
|
|
<thead>
|
|
|
|
<tr class="headings">
|
|
|
|
<th>Name</th>
|
|
|
|
<th>auth</th>
|
|
|
|
<th>Size</th>
|
|
|
|
<th>Date</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody id="datatable_body">
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<a style='cursor: pointer' onclick="change_upper('<%=@current_dir%>')"><i class="fa fa-reply"></i></a>
|
|
|
|
<%= @current_dir %>
|
|
|
|
<a class='pull-right' href="#popup_mkdir"><i class="fa fa-plus"></i><i class="fa fa-folder"></i></a>
|
|
|
|
</td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
<td></td>
|
|
|
|
</tr>
|
2016-09-24 16:24:28 +00:00
|
|
|
<% (files @current_dir).each do |t| %>
|
2016-09-23 09:28:53 +00:00
|
|
|
<tr class="dir_delete">
|
|
|
|
<% if t["auth"][0]=='d'%>
|
|
|
|
<td style="color:#0d8ade;"><i class="fa fa-folder-open-o"></i>
|
|
|
|
<a style="cursor: pointer" onclick="change_directory('<%=@current_dir + "/" + t["name"]%>')"> <%=t["name"]%></a>
|
|
|
|
</td>
|
|
|
|
<% else %>
|
|
|
|
<td><i class="fa fa-file-o"></i>
|
|
|
|
<a href="/file_download?file_name=<%=(@current_dir+'/'+t['name']).gsub("/", "+")%>"><%=t['name']%></a>
|
|
|
|
</td>
|
|
|
|
<% end %>
|
|
|
|
<td><%=t["auth"]%></td>
|
|
|
|
<td><%=t["size"]%></td>
|
2016-09-23 13:45:20 +00:00
|
|
|
<td>
|
|
|
|
<%=t["date"]%>
|
|
|
|
<a class='pull-right' onclick="delete_file('<%=@current_dir + "/" + t["name"]%>')" href="#"><i class="fa fa-trash"></i></a>
|
|
|
|
</td>
|
2016-09-23 09:28:53 +00:00
|
|
|
</tr>
|
|
|
|
<% end %>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- /file manager -->
|
2016-09-19 10:57:10 +00:00
|
|
|
|
2016-09-23 09:28:53 +00:00
|
|
|
<!-- disk usage -->
|
2016-09-24 09:00:27 +00:00
|
|
|
<div class="col-md-4 col-sm-4 col-xs-12">
|
|
|
|
<div class="panel panel-body">
|
|
|
|
<div class="x_title">
|
2016-09-24 16:24:28 +00:00
|
|
|
<h4>Disk usage</h4>
|
2016-09-24 09:00:27 +00:00
|
|
|
</div>
|
|
|
|
<div class="row">
|
2016-09-24 16:24:28 +00:00
|
|
|
<table class="" style="width:100%">
|
|
|
|
<tr>
|
|
|
|
<th style="width:37%;">
|
|
|
|
<p>Chart</p>
|
|
|
|
</th>
|
|
|
|
<th>
|
|
|
|
<div class="col-lg-7 col-md-7 col-sm-7 col-xs-7">
|
|
|
|
<p class="">Name</p>
|
|
|
|
</div>
|
|
|
|
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5">
|
|
|
|
<p class="">Usage</p>
|
|
|
|
</div>
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<canvas id="canvas1" height="140" width="140" style="margin: 15px 10px 10px 0"></canvas>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<table class="tile_info">
|
|
|
|
<% (get_du(@current_dir)).each_with_index do |t, index| %>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<p>
|
|
|
|
<i class="fa fa-square <%= ["blue", "green", "red", "purple", "grey"][index % 5] %>"></i>
|
|
|
|
<%= t['file_name'] %>
|
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<p>
|
|
|
|
<%= format("%.2f", t['usage']*100) %>%
|
|
|
|
</p>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<% end %>
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2016-09-24 09:00:27 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- /disk usage -->
|
2016-09-24 16:24:28 +00:00
|
|
|
|
2016-09-24 09:00:27 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class ="row">
|
|
|
|
<!-- node status -->
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="col-md-4 col-sm-4 col-xs-12">
|
|
|
|
<div class="x_panel tile fixed_height_320">
|
|
|
|
<div class="x_title">
|
2016-09-24 09:00:27 +00:00
|
|
|
<h2>Nodes</h2>
|
2016-09-23 09:28:53 +00:00
|
|
|
<ul class="nav navbar-right panel_toolbox">
|
|
|
|
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
|
|
|
|
</li>
|
|
|
|
<li class="dropdown">
|
|
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
|
|
|
|
<ul class="dropdown-menu" role="menu">
|
|
|
|
<li><a href="#">Settings 1</a>
|
|
|
|
</li>
|
|
|
|
<li><a href="#">Settings 2</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
</div>
|
|
|
|
<div class="x_content">
|
|
|
|
<h4>App Usage across versions</h4>
|
|
|
|
<div class="widget_summary">
|
|
|
|
<div class="w_left w_25">
|
|
|
|
<span>0.1.5.2</span>
|
|
|
|
</div>
|
|
|
|
<div class="w_center w_55">
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar bg-green" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 66%;">
|
|
|
|
<span class="sr-only">60% Complete</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="w_right w_20">
|
|
|
|
<span>123k</span>
|
|
|
|
</div>
|
2016-09-19 10:57:10 +00:00
|
|
|
<div class="clearfix"></div>
|
|
|
|
</div>
|
2016-09-23 09:28:53 +00:00
|
|
|
|
|
|
|
<div class="widget_summary">
|
|
|
|
<div class="w_left w_25">
|
|
|
|
<span>0.1.5.3</span>
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="w_center w_55">
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar bg-green" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 45%;">
|
|
|
|
<span class="sr-only">60% Complete</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="w_right w_20">
|
|
|
|
<span>53k</span>
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="clearfix"></div>
|
|
|
|
</div>
|
|
|
|
<div class="widget_summary">
|
|
|
|
<div class="w_left w_25">
|
|
|
|
<span>0.1.5.4</span>
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="w_center w_55">
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar bg-green" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 25%;">
|
|
|
|
<span class="sr-only">60% Complete</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="w_right w_20">
|
|
|
|
<span>23k</span>
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="clearfix"></div>
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="widget_summary">
|
|
|
|
<div class="w_left w_25">
|
|
|
|
<span>0.1.5.5</span>
|
|
|
|
</div>
|
|
|
|
<div class="w_center w_55">
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar bg-green" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 5%;">
|
|
|
|
<span class="sr-only">60% Complete</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="w_right w_20">
|
|
|
|
<span>3k</span>
|
|
|
|
</div>
|
2016-09-19 10:57:10 +00:00
|
|
|
<div class="clearfix"></div>
|
|
|
|
</div>
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="widget_summary">
|
|
|
|
<div class="w_left w_25">
|
|
|
|
<span>0.1.5.6</span>
|
|
|
|
</div>
|
|
|
|
<div class="w_center w_55">
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar bg-green" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 2%;">
|
|
|
|
<span class="sr-only">60% Complete</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="w_right w_20">
|
|
|
|
<span>1k</span>
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
2016-09-23 09:28:53 +00:00
|
|
|
<div class="clearfix"></div>
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
2016-09-23 09:28:53 +00:00
|
|
|
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-24 09:00:27 +00:00
|
|
|
<!-- /node status -->
|
2016-09-19 10:57:10 +00:00
|
|
|
</div>
|
2016-09-24 09:00:27 +00:00
|
|
|
|
|
|
|
</div>
|
2016-08-20 06:41:37 +00:00
|
|
|
</div>
|
|
|
|
<!-- /page content -->
|
2016-09-19 10:57:10 +00:00
|
|
|
|
2016-09-23 09:28:53 +00:00
|
|
|
<!-- File manager functions -->
|
2016-09-19 10:57:10 +00:00
|
|
|
<script>
|
2016-09-23 13:45:20 +00:00
|
|
|
function delete_file(directory){
|
|
|
|
if (confirm("Are you sure you want to delete '"+ directory+"' ?")) {
|
|
|
|
$.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "/home/delete",
|
|
|
|
data: { file_name: directory },
|
|
|
|
success : function(result){
|
|
|
|
location.reload(true);
|
|
|
|
}
|
|
|
|
})
|
2016-09-24 09:00:27 +00:00
|
|
|
}
|
2016-09-23 13:45:20 +00:00
|
|
|
//alert(directory);
|
|
|
|
}
|
2016-09-19 10:57:10 +00:00
|
|
|
function change_upper(directory){
|
|
|
|
if(directory == "/") return;
|
|
|
|
var lastindex = directory.lastIndexOf("/");
|
|
|
|
if(lastindex == 0) lastindex++;
|
|
|
|
change_directory(directory.substring(0, lastindex));
|
|
|
|
}
|
|
|
|
function change_directory(directory){
|
|
|
|
$.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "/application/changeDir",
|
|
|
|
data: { path: directory },
|
|
|
|
success : function(result){
|
|
|
|
$("#current-dir").val(directory);
|
|
|
|
$("#table_div").empty();
|
|
|
|
var new_table = "";
|
|
|
|
new_table += "<table id='datatable' class='table table-striped table-bordered jambo_table'>";
|
|
|
|
new_table += "<thead>";
|
|
|
|
new_table += "<tr class='headings'>";
|
|
|
|
new_table += "<th>Name</th>";
|
|
|
|
new_table += "<th>Auth</th>";
|
|
|
|
new_table += "<th>Size</th>";
|
|
|
|
new_table += "<th>Date</th>";
|
|
|
|
new_table += "</tr>";
|
|
|
|
new_table += "</thead>";
|
|
|
|
new_table += "<tbody id='datatable_body'>";
|
|
|
|
|
|
|
|
var new_tr = "";
|
2016-09-23 09:28:53 +00:00
|
|
|
new_tr += "<tr role='row' class='odd'>";
|
|
|
|
new_tr += "<td><a style='cursor: pointer' onclick='change_upper(" + '"' + directory + '"' +")'><i class='fa fa-reply'></i></a>";
|
|
|
|
new_tr += " " + directory
|
|
|
|
new_tr += "<a class='pull-right' href='#popup_mkdir'><i class='fa fa-plus'></i><i class='fa fa-folder'></i></a></td>";
|
|
|
|
new_tr += "<td></td> <td></td> <td></td>"
|
|
|
|
new_tr += "</tr>";
|
2016-09-24 16:24:28 +00:00
|
|
|
|
2016-09-19 10:57:10 +00:00
|
|
|
for( var i = 0; i < result.file.length; i++){
|
|
|
|
var row_class = i % 2 == 0 ? 'odd' : 'even';
|
|
|
|
var cur = result.current != "/" ? result.current : '';
|
|
|
|
new_tr += "<tr role='row' class='dir_delete' class='" + row_class + "'>";
|
|
|
|
if(result.file[i].auth[0] == "d"){
|
|
|
|
new_tr += "<td style='color:#0d8ade;' class='sorting_1'><i class='fa fa-folder-open-o'></i> ";
|
2016-09-23 13:45:20 +00:00
|
|
|
new_tr += "<a style='cursor: pointer' onclick='change_directory(" +'"' + cur + "/" + result.file[i].name +'"'+ ")'>" + result.file[i].name + "</a></td>";
|
2016-09-19 10:57:10 +00:00
|
|
|
}else{
|
|
|
|
new_tr += "<td>";
|
2016-09-21 09:42:33 +00:00
|
|
|
new_tr += "<i class='fa fa-file-o'></i>"
|
|
|
|
new_tr += "<a href='/file_download?file_name="+ (cur + "/" + result.file[i].name).replace(/\//, "+") + "'> " + result.file[i].name + "</a>"
|
2016-09-19 10:57:10 +00:00
|
|
|
new_tr += "</td>";
|
|
|
|
}
|
2016-09-24 09:00:27 +00:00
|
|
|
|
2016-09-19 10:57:10 +00:00
|
|
|
new_tr += "<td>"+result.file[i].auth+"</td>";
|
|
|
|
new_tr += "<td>"+result.file[i].size+"</td>";
|
2016-09-23 13:45:20 +00:00
|
|
|
new_tr += "<td>"+result.file[i].date+" <a class='pull-right' onclick='delete_file(" +'"' + cur + "/" + result.file[i].name +'"'+ ")' href='#'><i class='fa fa-trash'></i></a></td>";
|
2016-09-19 10:57:10 +00:00
|
|
|
new_tr += "</tr>";
|
|
|
|
}
|
2016-09-24 16:24:28 +00:00
|
|
|
|
2016-09-19 10:57:10 +00:00
|
|
|
new_table += new_tr;
|
|
|
|
new_table += "</tbody></table>"
|
|
|
|
$("#table_div").append(new_table);
|
2016-09-23 09:28:53 +00:00
|
|
|
$('#datatable').dataTable( {"bSort": false});
|
2016-09-24 16:24:28 +00:00
|
|
|
|
|
|
|
// disk usage
|
|
|
|
$("table .tile_info").empty();
|
|
|
|
var new_tr = "";
|
|
|
|
<% (get_du @current_dir).each_with_index do |t, index| %>
|
|
|
|
new_tr += "<tr><td>";
|
|
|
|
new_tr += "<p><i class='fa fa-square <%= ["blue", "green", "red", "purple", "grey"][index % 5] %>''></i>";
|
|
|
|
new_tr += "<%= t['file_name'] %></td><td>";
|
|
|
|
new_tr += "<p><%= format("%.2f", t['usage']*100) %>%</p>"
|
|
|
|
new_tr += "</p></td></tr>"
|
|
|
|
<% end %>
|
|
|
|
$("table .tile_info").append(new_tr);
|
|
|
|
draw_chart();
|
2016-09-19 10:57:10 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
</script>
|
2016-09-24 09:00:27 +00:00
|
|
|
|
2016-09-23 09:28:53 +00:00
|
|
|
<!-- On document ready -->
|
2016-09-19 10:57:10 +00:00
|
|
|
<script>
|
2016-09-24 16:24:28 +00:00
|
|
|
$('document').ready(function() {
|
2016-09-23 09:28:53 +00:00
|
|
|
$('#datatable').dataTable( {"bSort": false});
|
2016-09-24 16:24:28 +00:00
|
|
|
draw_chart();
|
2016-09-19 10:57:10 +00:00
|
|
|
});
|
|
|
|
</script>
|
2016-09-24 09:00:27 +00:00
|
|
|
|
2016-09-24 16:24:28 +00:00
|
|
|
<!-- Doughnut Chart -->
|
2016-09-24 09:00:27 +00:00
|
|
|
<script>
|
2016-09-24 16:24:28 +00:00
|
|
|
function draw_chart() {
|
|
|
|
var options = {
|
|
|
|
legend: false,
|
|
|
|
responsive: false
|
|
|
|
};
|
2016-09-24 09:00:27 +00:00
|
|
|
|
2016-09-24 16:24:28 +00:00
|
|
|
var colors = ["#3498DB", "#26B99A", "#E74C3C", "#9B59B6", "#BDC3C7"];
|
|
|
|
var labels = [];
|
|
|
|
var data = [];
|
|
|
|
var backgroundColor = [];
|
|
|
|
var hoverBackgroundColor = [];
|
2016-09-24 09:00:27 +00:00
|
|
|
|
2016-09-24 16:24:28 +00:00
|
|
|
<% (get_du(@current_dir)).each_with_index do |t, index| %>
|
|
|
|
labels.push("<%= t['file_name'] %>");
|
|
|
|
data.push("<%= t['usage'] %>");
|
|
|
|
backgroundColor.push(colors[<%= index % 5 %>]);
|
|
|
|
hoverBackgroundColor.push(colors[<%= index % 5 %>]);
|
|
|
|
<% end %>
|
2016-09-24 09:00:27 +00:00
|
|
|
|
2016-09-24 16:24:28 +00:00
|
|
|
new Chart(document.getElementById("canvas1"), {
|
|
|
|
type: 'doughnut',
|
|
|
|
tooltipFillColor: "rgba(51, 51, 51, 0.55)",
|
|
|
|
data: {
|
|
|
|
labels: labels,
|
|
|
|
datasets: [{
|
|
|
|
data: data,
|
|
|
|
backgroundColor: backgroundColor,
|
|
|
|
hoverBackgroundColor: hoverBackgroundColor
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
options: options
|
2016-09-24 09:00:27 +00:00
|
|
|
});
|
2016-09-24 16:24:28 +00:00
|
|
|
};
|
2016-09-24 09:00:27 +00:00
|
|
|
</script>
|
2016-09-24 16:24:28 +00:00
|
|
|
<!-- /Doughnut Chart -->
|