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

402 lines
15 KiB
Plaintext
Raw Normal View History

2016-09-05 16:10:04 +00:00
<!-- right click menu -->
2016-09-04 14:49:29 +00:00
<div class="contextmenu Del_dir">
<ul>
2016-09-04 15:57:43 +00:00
<li class="menuitem"><i class="fa fa-trash"></i>Delete</li>
2016-09-05 15:44:30 +00:00
<input id="delete_name" type="hidden"></input>
2016-09-04 14:49:29 +00:00
</ul>
</div>
2016-09-04 06:17:44 +00:00
<!-- create overlay page -->
<div id="popup_mkdir" class="overlay">
<div class="popup">
<h2> Make Directory </h2>
<a class="close" href="#">&times;</a>
<form id="form_make_directory" data-parsley-validate class="form-horizontal form-label-left" action="/home/mkdir" method="post">
<div class="form-group">
2016-09-04 06:29:32 +00:00
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="current-dir">Current Directory <span class="required">*</span>
2016-09-04 06:17:44 +00:00
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
2016-09-04 06:29:32 +00:00
<input type="text" id="current-dir" required="required" class="form-control col-md-7 col-xs-12" name="current_dir" value="<%=@current_dir%>" readonly/>
2016-09-04 06:17:44 +00:00
</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-08-20 06:41:37 +00:00
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Dash Board</h3>
</div>
<div class="title_right">
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
2016-09-03 04:46:25 +00:00
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
2016-08-20 06:41:37 +00:00
</div>
</div>
</div>
</div>
2016-09-03 04:46:25 +00:00
2016-08-20 06:41:37 +00:00
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12">
2016-09-02 06:11:57 +00:00
<div class="x_panel">
2016-09-03 04:46:25 +00:00
<div class="x_title">
<h2>Input knob</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>
<li><a class="close-link"><i class="fa fa-close"></i></a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="col-md-2">
<p>Display value</p>
<input class="knob" data-width="100" data-height="120" data-min="-100" data-displayPrevious=true data-fgColor="#26B99A" value="44">
</div>
<div class="col-md-2">
<p>&#215; 'cursor' mode</p>
<input class="knob" data-width="100" data-height="120" data-cursor=true data-fgColor="#34495E" value="29">
</div>
<div class="col-md-2">
<p>Step 0.1</p>
<input class="knob" data-width="100" data-height="120" data-min="-10000" data-displayPrevious=true data-fgColor="#26B99A" data-max="10000" data-step=".1" value="0">
</div>
<div class="col-md-2">
<p>Angle arc</p>
<input class="knob" data-width="100" data-height="120" data-angleOffset=-125 data-angleArc=250 data-fgColor="#34495E" data-rotation="anticlockwise" value="35">
</div>
<div class="col-md-2">
<p>Alternate design</p>
<input class="knob" data-width="110" data-height="120" data-displayPrevious=true data-fgColor="#26B99A" data-skin="tron" data-thickness=".2" value="75">
</div>
<div class="col-md-2">
<p>Angle offset</p>
<input class="knob" data-width="100" data-height="120" data-angleOffset=90 data-linecap=round data-fgColor="#26B99A" value="35">
</div>
</div>
</div>
2016-09-02 06:11:57 +00:00
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
2016-08-20 06:41:37 +00:00
<div class="x_title">
2016-09-02 07:20:14 +00:00
<h2>File Manager</h2>
2016-08-20 06:41:37 +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>
<li><a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul>
<div class="clearfix"></div>
</div>
2016-09-02 05:36:33 +00:00
2016-09-02 05:47:18 +00:00
<div class="x_content">
2016-09-02 05:36:33 +00:00
<div class="col-md-12 col-sm-12 col-xs-12" id="table_div">
2016-09-04 06:17:44 +00:00
<p class="text-muted font-13 m-b-30"> <code> Current directory : <span id="select_dir"><%=@current_dir%></span></code></p>
<p style="text-align:right;" >
<a class="btn btn-default" href="#popup_mkdir"><i class="fa fa-plus"></i> Make Directory</a>
2016-09-05 16:10:04 +00:00
<a class="btn btn-default" href="#loading"><i class="fa fa-plus"></i> Loading Test</a>
2016-09-02 07:20:14 +00:00
</p>
2016-09-02 05:36:33 +00:00
<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>
2016-09-03 10:03:45 +00:00
<tbody id="datatable_body">
2016-09-02 05:36:33 +00:00
<tr>
<td><i class="fa fa-reply"></i>
2016-09-03 10:03:45 +00:00
<a style='cursor: pointer' onclick="change_upper('<%=@current_dir%>')"> ..</a>
2016-09-02 05:36:33 +00:00
</td>
<td></td>
<td></td>
<td></td>
</tr>
<%@files.each do |t|%>
2016-09-04 15:57:43 +00:00
<tr class="dir_delete">
2016-09-02 05:36:33 +00:00
<% if t["auth"][0]=='d'%>
<td style="color:#0d8ade;"><i class="fa fa-folder-open-o"></i>
2016-09-02 06:18:45 +00:00
<a style="cursor: pointer" onclick="change_directory('<%=@current_dir + "/" + t["name"]%>')"> <%=t["name"]%></a>
2016-09-02 05:36:33 +00:00
</td>
<% else %>
<td><i class="fa fa-file-o"></i>
<a style="cursor: pointer"><%=t["name"]%></a>
</td>
<% end %>
<td><%=t["auth"]%></td>
<td><%=t["size"]%></td>
2016-09-04 05:37:33 +00:00
<td><%=t["date"]%></td>
2016-09-02 05:36:33 +00:00
</tr>
<%end%>
</tbody>
</table>
</div>
</div>
2016-08-20 06:41:37 +00:00
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
2016-09-02 05:36:33 +00:00
<script type="text/javascript">
$(document).ready(function() {
$('#datatable').dataTable();
2016-09-04 15:57:43 +00:00
right_click();
});
</script>
<script>
function right_click(){
/* right click */
$(".menuitem").mouseover(function(e){
var $el = $(this);
if ( !$el.hasClass('hover'))
$el.addClass('hover');
}).mouseout(function(e){
var $el = $(this);
if($el.hasClass('hover'))
$el.removeClass('hover');
});
//Contextmenu
$(".dir_delete").on('contextmenu', function(event) {
ShowContextMenu("Del_dir");
var Row = this;
var Cells = Row.getElementsByTagName("td");
2016-09-04 16:10:49 +00:00
var file_name = Cells[0].innerText;
file_name = file_name.replace(' ', '');
$("#delete_name").val($("#select_dir").text() + "/" + file_name);
2016-09-04 15:57:43 +00:00
CheckLocation();
return false;
});
}
$(".Del_dir").click(function(e){
2016-09-05 16:10:04 +00:00
$(location).attr('href', "#loading");
2016-09-04 16:10:49 +00:00
$.ajax({
method: "POST",
url: "/home/delete",
data: { file_name: $("#delete_name").val() },
success : function(result){
2016-09-05 15:44:30 +00:00
change_directory($("#select_dir").text());
2016-09-04 16:10:49 +00:00
}
})
2016-09-04 15:57:43 +00:00
$(".contextmenu").hide();
$(document).unbind('mousedown');
2016-09-05 16:10:04 +00:00
$(location).attr('href', "#");
2016-09-02 05:36:33 +00:00
});
</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));
2016-09-02 05:36:33 +00:00
}
function change_directory(directory){
$.ajax({
method: "POST",
2016-09-02 06:02:43 +00:00
url: "/application/changeDir",
2016-09-02 05:36:33 +00:00
data: { path: directory },
success : function(result){
2016-09-04 06:29:32 +00:00
$("#current-dir").val(directory);
2016-09-02 05:36:33 +00:00
$("#table_div").empty();
2016-09-03 10:03:45 +00:00
var new_table = "";
2016-09-04 06:17:44 +00:00
new_table += "<p class='text-muted font-13 m-b-30'><code>Current directory : <span id='select_dir'>" + directory+"</span></code></p>";
new_table += "<p style='text-align:right;'><a class='btn btn-default' href='#popup_mkdir'><i class='fa fa-plus'></i> Make Directory</a></p>";
2016-09-02 05:36:33 +00:00
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>";
2016-09-03 10:03:45 +00:00
new_table += "<tbody id='datatable_body'>";
2016-09-02 05:36:33 +00:00
2016-09-03 10:03:45 +00:00
var new_tr = "";
new_tr += "<tr role='row' class='odd'> <td><i class='fa fa-reply'></i>";
new_tr += "<a style='cursor: pointer' onclick='change_upper(" + '"' + directory + '"' +")'> ..</a>";
2016-09-02 05:36:33 +00:00
new_tr += "</td><td> </td><td> </td><td> </td></tr>";
for( var i = 0; i < result.file.length; i++){
2016-09-04 06:29:32 +00:00
var row_class = i % 2 == 0 ? 'odd' : 'even';
var cur = result.current != "/" ? result.current : '';
2016-09-04 15:57:43 +00:00
new_tr += "<tr role='row' class='dir_delete' class='" + row_class + "'>";
2016-09-02 05:36:33 +00:00
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-04 06:29:32 +00:00
new_tr += "<a style='cursor: pointer' onclick='change_directory(" +'"' + cur + "/" + result.file[i].name +'"'+ ")'>" + result.file[i].name + "</a></td>";
2016-09-02 05:36:33 +00:00
}else{
2016-09-02 07:20:14 +00:00
new_tr += "<td><i class='fa fa-file-o'></i><a style='cursor: pointer'> " + result.file[i].name + "</a></td>";
2016-09-02 05:36:33 +00:00
}
new_tr += "<td>"+result.file[i].auth+"</td>";
new_tr += "<td>"+result.file[i].size+"</td>";
new_tr += "<td>"+result.file[i].date+"</td>";
new_tr += "</tr>";
}
new_table += new_tr;
new_table += "</tbody></table>"
$("#table_div").append(new_table);
$('#datatable').dataTable();
2016-09-04 15:57:43 +00:00
right_click();
2016-09-02 05:36:33 +00:00
}
})
}
2016-09-04 15:57:43 +00:00
2016-09-02 05:36:33 +00:00
</script>
2016-09-04 15:57:43 +00:00
2016-09-02 05:36:33 +00:00
2016-08-20 06:41:37 +00:00
<!--Test Page specific JS -->
<script type="text/javascript">
//alert ('Test Page specific JS')
$(function($) {
$(".knob").knob({
change: function(value) {
//console.log("change : " + value);
},
release: function(value) {
//console.log(this.$.attr('value'));
console.log("release : " + value);
},
cancel: function() {
console.log("cancel : ", this);
},
/*format : function (value) {
return value + '%';
},*/
draw: function() {
// "tron" case
if (this.$.data('skin') == 'tron') {
this.cursorExt = 0.3;
var a = this.arc(this.cv) // Arc
,
pa // Previous arc
, r = 1;
this.g.lineWidth = this.lineWidth;
if (this.o.displayPrevious) {
pa = this.arc(this.v);
this.g.beginPath();
this.g.strokeStyle = this.pColor;
this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, pa.s, pa.e, pa.d);
this.g.stroke();
}
this.g.beginPath();
this.g.strokeStyle = r ? this.o.fgColor : this.fgColor;
this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, a.s, a.e, a.d);
this.g.stroke();
this.g.lineWidth = 2;
this.g.beginPath();
this.g.strokeStyle = this.o.fgColor;
this.g.arc(this.xy, this.xy, this.radius - this.lineWidth + 1 + this.lineWidth * 2 / 3, 0, 2 * Math.PI, false);
this.g.stroke();
return false;
}
}
});
// Example of infinite knob, iPod click wheel
var v, up = 0,
down = 0,
i = 0,
$idir = $("div.idir"),
$ival = $("div.ival"),
incr = function() {
i++;
$idir.show().html("+").fadeOut();
$ival.html(i);
},
decr = function() {
i--;
$idir.show().html("-").fadeOut();
$ival.html(i);
};
$("input.infinite").knob({
min: 0,
max: 20,
stopper: false,
change: function() {
if (v > this.cv) {
if (up) {
decr();
up = 0;
} else {
up = 1;
down = 0;
}
} else {
if (v < this.cv) {
if (down) {
incr();
down = 0;
} else {
down = 1;
up = 0;
}
}
}
v = this.cv;
}
});
});
</script>