gluster-web-interface/app/views/volume/index.html.erb

266 lines
10 KiB
Plaintext
Raw Normal View History

2016-09-03 08:25:09 +00:00
<!-- create overlay page -->
<div id="popup_create" class="overlay">
<div class="popup">
<h2> Choose mount point </h2>
<a class="close" href="#">&times;</a>
2016-09-03 08:25:09 +00:00
<form id="form_volume_create" data-parsley-validate class="form-horizontal form-label-left">
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="volume-name">Volume Name <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" id="volume-name" required="required" class="form-control col-md-7 col-xs-12">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Volume Type <span class="required">*</span>
</label>
<div class="col-md-9 col-sm-9 col-xs-12">
<select class="form-control">
<option>Distribute</option>
<option>Stripe</option>
<option>Replica</option>
<option>Arbiter</option>
<option>Disperse</option>
<option>Disperse-data</option>
<option>Redundancy</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Bricks <span class="required">*</span>
</label>
<div class="col-md-3 col-sm-3 col-xs-3">
<select class="form-control">
<option><%=@config['server_name']%></option>
</select>
</div>
<div class="col-md-5 col-sm-5 col-xs-5">
<input type="text" id="bricks" required="required" class="form-control col-md-7 col-xs-12">
</div>
<div class="col-md-1 col-sm-1 col-xs-1">
<a href="#/plus" class="form-control"><i class="fa fa-plus"></i></a>
</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-primary">Cancel</button>
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
</div>
</div>
<!-- mount overlay page -->
<div id="popup_mount" 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>
2016-09-03 10:03:45 +00:00
<tbody id="datatable_body">
<tr>
2016-09-03 08:25:09 +00:00
<td><i class="fa fa-reply"></i> <a style="cursor: pointer" 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>
2016-09-03 08:25:09 +00:00
<td>
2016-09-03 10:03:45 +00:00
<button class="btn btn-primary pull-right" onclick="volume_mount('<%=@current_dir + "/" + t["name"]%>')">select</botton>
2016-09-03 08:25:09 +00:00
</td>
</tr>
<%end%>
<%end%>
</tbody>
</table>
</div>
2016-09-02 08:36:10 +00:00
</div>
2016-08-30 11:22:26 +00:00
<!-- page content -->
<div class="right_col" role="main">
2016-08-20 06:58:04 +00:00
<div class="page-title">
<div class="title_left">
2016-08-30 11:22:26 +00:00
<h3>Volume</h3>
2016-08-20 06:58:04 +00:00
</div>
<div class="title_right">
<div class="col-md-5 col-sm-5 col-xs-12 pull-right">
2016-09-03 08:25:09 +00:00
<a class="btn btn-success btn-lg pull-right" href="#popup_create">Create Volume</a>
2016-08-20 06:58:04 +00:00
</div>
</div>
</div>
2016-08-22 08:35:24 +00:00
2016-08-20 06:58:04 +00:00
<div class="clearfix"></div>
2016-08-30 11:22:26 +00:00
<div class="row">
2016-08-20 12:02:16 +00:00
<%@volumes.each do |t|%>
2016-08-22 09:41:25 +00:00
<div class="col-md-12 col-sm-12 col-xs-12">
2016-08-22 08:35:24 +00:00
<div class="x_panel">
<div class="x_title">
<h2>Infomation <small><%=t["Volume Name"]%></small></h2>
<ul class="nav navbar-right panel_toolbox">
2016-08-30 11:22:26 +00:00
<li><a class="collapse-link"><i <%if t!=@volumes[0]%> class="fa fa-chevron-down" <%else%> class="fa fa-chevron-up" <%end%> ></i></a>
2016-08-22 08:35:24 +00:00
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
2016-08-22 08:35:24 +00:00
<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>
2016-08-22 08:35:24 +00:00
</li>
</ul>
<div class="clearfix"></div>
</div>
2016-08-30 11:22:26 +00:00
<div class="x_content" <%if t!=@volumes[0]%> style="display: none;" <%end%> >
2016-08-22 08:35:24 +00:00
2016-09-03 08:25:09 +00:00
<!-- left content -->
2016-08-22 09:41:25 +00:00
<div class="col-md-4 col-sm-4 col-xs-4">
2016-09-03 08:25:09 +00:00
<div>
<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"]%>
2016-09-05 10:45:59 +00:00
mount state: <%=t["Mount State"]%> <br>
2016-09-03 08:25:09 +00:00
<br><br><br>
</div>
2016-09-01 10:10:57 +00:00
<% if t["Status"] == " Stopped" %>
2016-09-02 08:36:10 +00:00
<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']%>">
2016-09-01 09:02:00 +00:00
<i class="fa fa-trash"></i> Delete
2016-09-02 08:36:10 +00:00
</a>
2016-08-31 14:42:14 +00:00
<% else %>
2016-09-02 08:36:10 +00:00
<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>
2016-09-03 04:46:25 +00:00
<!-- mount button push : popup event and post mount point -->
2016-09-03 08:25:09 +00:00
<a class="btn btn-app" href="/volume/index?volume_name=<%=t['Volume Name'].delete(' ')%>#popup_mount"><i class="fa fa-upload"></i> Mount</a>
2016-08-31 14:42:14 +00:00
<% end %>
</div>
2016-08-22 08:35:24 +00:00
2016-09-03 08:25:09 +00:00
<!-- right content -->
2016-08-22 09:41:25 +00:00
<div class="col-md-8 col-sm-8 col-xs-8">
2016-08-28 14:19:04 +00:00
<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;">
2016-08-22 09:00:01 +00:00
</form>
2016-08-22 09:41:25 +00:00
<br/>
2016-08-22 08:35:24 +00:00
</div>
2016-08-20 06:58:04 +00:00
</div>
</div>
2016-08-22 08:35:24 +00:00
</div>
2016-08-20 12:02:16 +00:00
<%end%>
2016-08-20 06:58:04 +00:00
</div>
</div>
2016-08-30 11:22:26 +00:00
<!-- /page content -->
2016-08-25 10:22:48 +00:00
<!-- volume functions -->
<script>
function volume_create() {
}
2016-09-03 10:03:45 +00:00
function volume_mount(mnt_point) {
var url = window.location + '';
var vol_name = url.match(/volume_name=([^#]+)/)[1];
$.ajax({
type: 'post',
url: '/volume/mount',
data: {mount_point: mnt_point, volume_name: vol_name},
success: function(data){
console.log("mount success");
window.location.replace(url.split("?")[0]);
}
});
}
2016-08-31 13:34:09 +00:00
</script>
<!-- data table handler -->
2016-09-02 08:36:10 +00:00
<script type="text/javascript">
$(document).ready(function() {
$('#datatable').dataTable();
});
</script>
<!-- file manager functions -->
<script>
function change_upper(directory){
2016-09-03 10:03:45 +00:00
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){
2016-09-03 10:03:45 +00:00
$("#datatable_body").empty();
var new_tr = "";
new_tr += "<tr role='row' class='odd'> <td><i class='fa fa-reply'></i>";
2016-09-03 08:25:09 +00:00
new_tr += "<a style='cursor: pointer' onclick='change_upper(" + '"' + directory + '"' +")'> ..</a>";
new_tr += "</td><td> </td><td> </td><td> </td></tr>";
for( var i = 0; i < result.file.length; i++){
2016-09-03 10:03:45 +00:00
if(result.file[i].auth[0] != "d") continue;
var row_class = i % 2 == 0 ? 'odd' : 'even';
var cur = result.current != "/" ? result.current : '';
new_tr += "<tr role='row' class='" + row_class + "'>";
new_tr += "<td style='color:#0d8ade;' class='sorting_1'><i class='fa fa-folder-open-o'></i> ";
new_tr += "<a style='cursor: pointer' onclick='change_directory(" +'"' + cur + "/" + result.file[i].name +'"'+ ")'>" + result.file[i].name + "</a></td>";
new_tr += "<td>"+result.file[i].auth+"</td>";
new_tr += "<td><button class='btn btn-primary pull-right'>select</botton></td>";
new_tr += "</tr>";
}
2016-09-03 10:03:45 +00:00
$("#datatable_body").append(new_tr);
$('#datatable').dataTable();
}
2016-09-02 08:36:10 +00:00
})
}
</script>
2016-09-03 08:25:09 +00:00
<script>
$("#form_volume_create").change(function (){
console.log($("#form_volume_create option:selected").val());
2016-09-02 08:36:10 +00:00
})
</script>