gluster-web-interface/app/views/volume/index.html.erb
2016-09-03 04:46:25 +00:00

218 lines
7.5 KiB
Plaintext

<div id="popup" class="overlay">
<div class="popup">
<h2> Choose mount point </h2>
<a class="close" href="#">&times;</a>
<table id="datatable" class="table table-striped jambo_table">
<thead>
<tr class="headings">
<th>Name</th>
<th>auth</th>
<th></th>
</tr>
</thead>
<tbody id="tbody_volume1">
<tr>
<td><i class="fa fa-reply"></i> <a onclick="change_upper('<%=@current_dir%>')"> ..</a></td>
<td></td>
<td></td>
</tr>
<%@files.each do |t|%>
<% if t["auth"][0]=='d'%>
<tr>
<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>
<td><%=t["auth"]%></td>
<td><button id="mount_select_btn" class="btn btn-primary pull-right">select</botton></td>
</tr>
<%end%>
<%end%>
</tbody>
</table>
</div>
</div>
<!-- page content -->
<div class="right_col" role="main">
<div class="page-title">
<div class="title_left">
<h3>Volume</h3>
</div>
<div class="title_right">
<div class="col-md-5 col-sm-5 col-xs-12 pull-right">
<button class="btn btn-primary pull-right" onclick="volume_create">
Create
</button>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<%@volumes.each do |t|%>
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Infomation <small><%=t["Volume Name"]%></small></h2>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i <%if t!=@volumes[0]%> class="fa fa-chevron-down" <%else%> class="fa fa-chevron-up" <%end%> ></i></a>
</li>
<li class="dropdown">
<a 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>
<li><a class="close-link" style="display:none;"><i class="fa fa-close"></i></a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content" <%if t!=@volumes[0]%> style="display: none;" <%end%> >
<div class="col-md-4 col-sm-4 col-xs-4">
<p class="text-muted font-13 m-b-30"><code>Volume Info</code></p>
Type : <%=t["Type"]%> <br>
Volume ID : <%=t["Volume ID"]%> <br>
Status : <%=t["Status"]%> <br>
Number of Bricks : <%=t["Number of Bricks"]%> <br>
Transport-type : <%=t["Transport-type"]%> <br>
Bricks : <%=t["Bricks"]%> <br>
Bricks1 : <%=t["Brick1"]%> <br>
Options Reconfigured : <%=t["Options Reconfigured"]%> <br>
performance.readdir-ahead : <%=t["performance.readdir-ahead"]%>
<br><br><br>
<% if t["Status"] == " Stopped" %>
<a class="btn btn-app" href="/volume/start/<%=t['Volume Name']%>">
<i class="fa fa-play" style="color:#26B99A;"></i>
<p style="color:#26B99A;">Start</p>
</a>
<a class="btn btn-app" href="/volume/delete/<%=t['Volume Name']%>">
<i class="fa fa-trash"></i> Delete
</a>
<% else %>
<a class="btn btn-app" href="/volume/stop/<%=t['Volume Name']%>">
<i class="fa fa-pause" style="color:#d9534f;"></i>
<p style="color:#d9534f;">Stop</p>
</a>
<!-- mount button push : popup event and post mount point -->
<a class="btn btn-app" href="#popup"><i class="fa fa-upload"></i> Mount</a>
<% end %>
</div>
<div class="col-md-8 col-sm-8 col-xs-8">
<p>Drag multiple files to the box below for multi upload or click to select files.</p>
<form action="/file_upload" method="post" enctype="multipart/form-data" class="dropzone" style="border: 1px solid #e5e5e5; height: 300px; overflow:auto;">
</form>
<br/>
</div>
</div>
</div>
</div>
<%end%>
</div>
</div>
<!-- /page content -->
<!-- volume functions -->
<script>
function volume_create() {
}
</script>
<!-- data table handler -->
<script type="text/javascript">
$(document).ready(function() {
$('#datatable').dataTable();
});
</script>
<!-- file manager functions -->
<script>
function change_upper(directory){
if(directory != "/"){
var path = directory.split("/");
var upper_path = "";
if(path.length == 2){
change_directory("/");
} else {
for(var i = 1; i < path.length - 1 ; i++){
if(path[i] != "")
upper_path += "/" + path[i];
}
change_directory(upper_path);
}
}
}
function change_directory(directory){
$.ajax({
method: "POST",
url: "/application/changeDir",
data: { path: directory },
success : function(result){
$("#tbody_volume1").empty();
var new_tr = "<tr role='row' class='odd'> <td><i class='fa fa-reply'></i>";
new_tr += "<a onclick='change_upper(" + '"' + directory + '"' +")'> ..</a>";
new_tr += "</td><td> </td><td> </td><td> </td></tr>";
for( var i = 0; i < result.file.length; i++){
if(i % 2 == 0)
new_tr += "<tr role='row' class='odd'>";
else
new_tr += "<tr role='row' class='even'>";
if(result.file[i].auth[0] == "d"){
new_tr += "<td style='color:#0d8ade;' class='sorting_1'><i class='fa fa-folder-open-o'></i> ";
if(result.current != "/")
new_tr += "<a style='cursor: pointer' onclick='change_directory(" +'"' + result.current + "/" + result.file[i].name +'"'+ ")'>" + result.file[i].name + "</a></td>";
else
new_tr += "<a style='cursor: pointer' onclick='change_directory(" +'"' + "/" + result.file[i].name +'"'+ ")'>" + result.file[i].name + "</a></td>";
new_tr += "<td>"+result.file[i].auth+"</td>";
new_tr += "<td><button id='mount_select_btn' class='btn btn-primary pull-right'>select</botton></td>";
new_tr += "</tr>";
}
}
$("#tbody_volume1").append(new_tr);
$('#datatable').dataTable();
}
})
}
</script>
<script>
$('#mount_select_btn').click(function(){
$.ajax({
type: 'post',
url: '/volume/mount',
data: {mount_point:'/mnt/test2', volume_name:'dist-volume2'},
success: function(data){
alert(data);
}
});
})
</script>