Merge branch 'master' of https://github.com/oss2016summer/gluster-web-interface
This commit is contained in:
commit
896c80f1cb
@ -32,17 +32,17 @@ class ApplicationController < ActionController::Base
|
|||||||
file = Hash.new
|
file = Hash.new
|
||||||
|
|
||||||
@total_list = parsing_list[0]
|
@total_list = parsing_list[0]
|
||||||
for t in 1..(parsing_list.length-1)
|
for t in 1..(parsing_list.length-1)
|
||||||
parsing_file = parsing_list[t].split(" ")
|
parsing_file = parsing_list[t].split(" ")
|
||||||
file["auth"] = parsing_file[0]
|
file["auth"] = parsing_file[0]
|
||||||
file["size"] = parsing_file[4]
|
file["size"] = parsing_file[4]
|
||||||
file["date"] = parsing_file[5] + " " + parsing_file[6] + " " + parsing_file[7]
|
file["date"] = parsing_file[5] + " " + parsing_file[6] + " " + parsing_file[7]
|
||||||
file["name"] = parsing_file[8]
|
file["name"] = parsing_file[8]
|
||||||
@files << file
|
@files << file
|
||||||
file = Hash.new
|
file = Hash.new
|
||||||
end
|
end
|
||||||
puts @files
|
puts @files
|
||||||
return @files
|
return @files
|
||||||
end
|
end
|
||||||
|
|
||||||
def checkDir
|
def checkDir
|
||||||
|
@ -1,33 +1,49 @@
|
|||||||
class VolumeController < ApplicationController
|
class VolumeController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@config = get_conf
|
file_directory("/mnt")
|
||||||
@volumes = Array.new
|
get_conf
|
||||||
volume = Hash.new
|
info = get_info.split("\n")
|
||||||
|
|
||||||
file_directory(@config["project_path"])
|
if info.blank?
|
||||||
|
|
||||||
if get_info.blank?
|
|
||||||
flash[:danger] = "Check Server"
|
flash[:danger] = "Check Server"
|
||||||
else
|
else
|
||||||
output = get_info.split("\n")
|
parse_info(info)
|
||||||
for t in 1..(output.length-1)
|
|
||||||
if output[t].include? ":"
|
|
||||||
temp = output[t].split(":")
|
|
||||||
volume[temp[0]] = temp[1]
|
|
||||||
else
|
|
||||||
@volumes << volume
|
|
||||||
volume = Hash.new
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@volumes << volume
|
|
||||||
# puts @volumes
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def parse_info(info)
|
||||||
|
@volumes = Array.new
|
||||||
|
volume = Hash.new
|
||||||
|
df = get_df
|
||||||
|
|
||||||
|
info.each do |t|
|
||||||
|
next if t.equal? info.first
|
||||||
|
|
||||||
|
if t.include? ":"
|
||||||
|
temp = t.split(":")
|
||||||
|
volume[temp[0]] = temp[1]
|
||||||
|
else
|
||||||
|
if df.include? volume['Volume Name'].delete(' ')
|
||||||
|
volume['Mount State'] = "Mounted"
|
||||||
|
else
|
||||||
|
volume['Mount State'] = "UnMounted"
|
||||||
|
end
|
||||||
|
puts volume['Volume Name'] + ": " + volume['Mount State']
|
||||||
|
|
||||||
|
@volumes << volume
|
||||||
|
volume = Hash.new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@volumes << volume
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_df
|
||||||
|
return `df -P`
|
||||||
|
end
|
||||||
|
|
||||||
def get_info
|
def get_info
|
||||||
@config = get_conf
|
|
||||||
return `sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume info`
|
return `sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume info`
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -44,9 +60,7 @@ class VolumeController < ApplicationController
|
|||||||
mount_point = params[:mount_point]
|
mount_point = params[:mount_point]
|
||||||
volume_name = volume_name.delete(' ')
|
volume_name = volume_name.delete(' ')
|
||||||
puts "mount -t glusterfs " + @config["host_ip"] + ":/" + volume_name + " " + mount_point
|
puts "mount -t glusterfs " + @config["host_ip"] + ":/" + volume_name + " " + mount_point
|
||||||
|
|
||||||
`mount -t glusterfs #{@config["host_ip"]}:/#{volume_name} #{mount_point}`
|
`mount -t glusterfs #{@config["host_ip"]}:/#{volume_name} #{mount_point}`
|
||||||
|
|
||||||
redirect_to '/volume/index'
|
redirect_to '/volume/index'
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -74,7 +88,7 @@ class VolumeController < ApplicationController
|
|||||||
volume_name = params[:volume_name]
|
volume_name = params[:volume_name]
|
||||||
volume_name = volume_name.delete(' ')
|
volume_name = volume_name.delete(' ')
|
||||||
puts "gluster volume delete " + volume_name
|
puts "gluster volume delete " + volume_name
|
||||||
#output = `sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume delete #{volume_name}`
|
output = `yes | sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume delete #{volume_name}`
|
||||||
redirect_to '/volume/index'
|
redirect_to '/volume/index'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,64 +9,61 @@
|
|||||||
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
|
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" class="form-control" placeholder="Search for...">
|
<input type="text" class="form-control" placeholder="Search for...">
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button class="btn btn-default" type="button">Go!</button>
|
<button class="btn btn-default" type="button">Go!</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="x_panel">
|
<div class="x_panel">
|
||||||
<div class="x_title">
|
<div class="x_title">
|
||||||
<h2>Input knob</h2>
|
<h2>Input knob</h2>
|
||||||
<ul class="nav navbar-right panel_toolbox">
|
<ul class="nav navbar-right panel_toolbox">
|
||||||
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
|
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
|
||||||
</li>
|
<li class="dropdown">
|
||||||
<li class="dropdown">
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
|
||||||
<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">
|
||||||
<ul class="dropdown-menu" role="menu">
|
<li><a href="#">Settings 1</a></li>
|
||||||
<li><a href="#">Settings 1</a>
|
<li><a href="#">Settings 2</a></li>
|
||||||
</li>
|
</ul>
|
||||||
<li><a href="#">Settings 2</a>
|
</li>
|
||||||
</li>
|
<li><a class="close-link"><i class="fa fa-close"></i></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
<div class="clearfix"></div>
|
||||||
<li><a class="close-link"><i class="fa fa-close"></i></a>
|
</div>
|
||||||
</li>
|
<div class="x_content">
|
||||||
</ul>
|
<div class="col-md-2">
|
||||||
<div class="clearfix"></div>
|
<p>Display value</p>
|
||||||
</div>
|
<input class="knob" data-width="100" data-height="120" data-min="-100" data-displayPrevious=true data-fgColor="#26B99A" value="44">
|
||||||
<div class="x_content">
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<p>Display value</p>
|
<p>× 'cursor' mode</p>
|
||||||
<input class="knob" data-width="100" data-height="120" data-min="-100" data-displayPrevious=true data-fgColor="#26B99A" value="44">
|
<input class="knob" data-width="100" data-height="120" data-cursor=true data-fgColor="#34495E" value="29">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<p>× 'cursor' mode</p>
|
<p>Step 0.1</p>
|
||||||
<input class="knob" data-width="100" data-height="120" data-cursor=true data-fgColor="#34495E" value="29">
|
<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>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<p>Step 0.1</p>
|
<p>Angle arc</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">
|
<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>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<p>Angle arc</p>
|
<p>Alternate design</p>
|
||||||
<input class="knob" data-width="100" data-height="120" data-angleOffset=-125 data-angleArc=250 data-fgColor="#34495E" data-rotation="anticlockwise" value="35">
|
<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>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
<p>Alternate design</p>
|
<p>Angle offset</p>
|
||||||
<input class="knob" data-width="110" data-height="120" data-displayPrevious=true data-fgColor="#26B99A" data-skin="tron" data-thickness=".2" value="75">
|
<input class="knob" data-width="100" data-height="120" data-angleOffset=90 data-linecap=round data-fgColor="#26B99A" value="35">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
</div>
|
||||||
<p>Angle offset</p>
|
</div>
|
||||||
<input class="knob" data-width="100" data-height="120" data-angleOffset=90 data-linecap=round data-fgColor="#26B99A" value="35">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||||
<div class="x_panel">
|
<div class="x_panel">
|
||||||
@ -112,10 +109,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody id="tbody_volume1">
|
<tbody id="datatable_body">
|
||||||
<tr>
|
<tr>
|
||||||
<td><i class="fa fa-reply"></i>
|
<td><i class="fa fa-reply"></i>
|
||||||
<a onclick="change_upper('<%=@current_dir%>')"> ..</a>
|
<a style='cursor: pointer' onclick="change_upper('<%=@current_dir%>')"> ..</a>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -148,40 +145,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /page content -->
|
<!-- /page content -->
|
||||||
<!-- data table handler -->
|
|
||||||
<script>
|
|
||||||
var handleDataTableButtons = function() {
|
|
||||||
"use strict";
|
|
||||||
0 !== $("#datatable-buttons").length && $("#datatable-buttons").DataTable({
|
|
||||||
dom: "Bfrtip",
|
|
||||||
buttons: [{
|
|
||||||
extend: "copy",
|
|
||||||
className: "btn-sm"
|
|
||||||
}, {
|
|
||||||
extend: "csv",
|
|
||||||
className: "btn-sm"
|
|
||||||
}, {
|
|
||||||
extend: "excel",
|
|
||||||
className: "btn-sm"
|
|
||||||
}, {
|
|
||||||
extend: "pdf",
|
|
||||||
className: "btn-sm"
|
|
||||||
}, {
|
|
||||||
extend: "print",
|
|
||||||
className: "btn-sm"
|
|
||||||
}],
|
|
||||||
responsive: !0
|
|
||||||
})
|
|
||||||
},
|
|
||||||
TableManageButtons = function() {
|
|
||||||
"use strict";
|
|
||||||
return {
|
|
||||||
init: function() {
|
|
||||||
handleDataTableButtons()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* right click */
|
/* right click */
|
||||||
@ -189,25 +152,15 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#datatable').dataTable();
|
$('#datatable').dataTable();
|
||||||
});
|
});
|
||||||
TableManageButtons.init();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- file manager functions -->
|
<!-- file manager functions -->
|
||||||
<script>
|
<script>
|
||||||
function change_upper(directory){
|
function change_upper(directory){
|
||||||
if(directory != "/"){
|
if(directory == "/") return;
|
||||||
var path = directory.split("/");
|
var lastindex = directory.lastIndexOf("/");
|
||||||
var upper_path = "";
|
if(lastindex == 0) lastindex++;
|
||||||
if(path.length == 2){
|
change_directory(directory.substring(0, lastindex));
|
||||||
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){
|
function change_directory(directory){
|
||||||
@ -217,7 +170,8 @@
|
|||||||
data: { path: directory },
|
data: { path: directory },
|
||||||
success : function(result){
|
success : function(result){
|
||||||
$("#table_div").empty();
|
$("#table_div").empty();
|
||||||
var new_table = "<p class='text-muted font-13 m-b-30'><code>File Manager</code></p>";
|
var new_table = "";
|
||||||
|
new_table += "<p class='text-muted font-13 m-b-30'><code>File Manager</code></p>";
|
||||||
new_table += "<p>Current directory : " + directory + "</p></br>";
|
new_table += "<p>Current directory : " + directory + "</p></br>";
|
||||||
new_table += "<p style='text-align:right;'><a class='btn btn-app' href='/home/mkdir/<%=@current_dir%>'><i class='fa fa-plus'></i>Make Directory</a></p>"
|
new_table += "<p style='text-align:right;'><a class='btn btn-app' href='/home/mkdir/<%=@current_dir%>'><i class='fa fa-plus'></i>Make Directory</a></p>"
|
||||||
new_table += "<table id='datatable' class='table table-striped table-bordered jambo_table'>";
|
new_table += "<table id='datatable' class='table table-striped table-bordered jambo_table'>";
|
||||||
@ -229,10 +183,11 @@
|
|||||||
new_table += "<th>Date</th>";
|
new_table += "<th>Date</th>";
|
||||||
new_table += "</tr>";
|
new_table += "</tr>";
|
||||||
new_table += "</thead>";
|
new_table += "</thead>";
|
||||||
new_table += "<tbody id='tbody_volume1'>";
|
new_table += "<tbody id='datatable_body'>";
|
||||||
|
|
||||||
var new_tr = "<tr role='row' class='odd'> <td><i class='fa fa-reply'></i>";
|
var new_tr = "";
|
||||||
new_tr += "<a onclick='change_upper(" + '"' + directory + '"' +")'> ..</a>";
|
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>";
|
||||||
new_tr += "</td><td> </td><td> </td><td> </td></tr>";
|
new_tr += "</td><td> </td><td> </td><td> </td></tr>";
|
||||||
|
|
||||||
for( var i = 0; i < result.file.length; i++){
|
for( var i = 0; i < result.file.length; i++){
|
||||||
@ -240,6 +195,7 @@
|
|||||||
new_tr += "<tr role='row' class='odd'>";
|
new_tr += "<tr role='row' class='odd'>";
|
||||||
else
|
else
|
||||||
new_tr += "<tr role='row' class='even'>";
|
new_tr += "<tr role='row' class='even'>";
|
||||||
|
|
||||||
if(result.file[i].auth[0] == "d"){
|
if(result.file[i].auth[0] == "d"){
|
||||||
new_tr += "<td style='color:#0d8ade;' class='sorting_1'><i class='fa fa-folder-open-o'></i> ";
|
new_tr += "<td style='color:#0d8ade;' class='sorting_1'><i class='fa fa-folder-open-o'></i> ";
|
||||||
if(result.current != "/")
|
if(result.current != "/")
|
||||||
@ -258,9 +214,7 @@
|
|||||||
new_table += new_tr;
|
new_table += new_tr;
|
||||||
new_table += "</tbody></table>"
|
new_table += "</tbody></table>"
|
||||||
$("#table_div").append(new_table);
|
$("#table_div").append(new_table);
|
||||||
|
|
||||||
$('#datatable').dataTable();
|
$('#datatable').dataTable();
|
||||||
TableManageButtons.init();
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -12,20 +12,22 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="nav-md">
|
<body class="nav-md">
|
||||||
<div class="container body">
|
|
||||||
<% flash.each do |key, value| %>
|
|
||||||
<div align="center" id="flash" class="alert alert-<%= key %>"><%= value %>
|
|
||||||
<a href="#" data-dismiss="alert" class="close">×</a>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= render "partials/sidenav" %>
|
<div class="container body">
|
||||||
<%= render "partials/topnav" %>
|
|
||||||
|
|
||||||
<%= yield %>
|
<% flash.each do |key, value| %>
|
||||||
|
<div align="center" id="flash" class="alert alert-<%= key %>"><%= value %>
|
||||||
|
<a href="#" data-dismiss="alert" class="close">×</a>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= render "partials/footer" %>
|
<%= render "partials/sidenav" %>
|
||||||
<%= javascript_include_tag 'footermanifest', 'data-turbolinks-track' => false %>
|
<%= render "partials/topnav" %>
|
||||||
|
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
<%= render "partials/footer" %>
|
||||||
|
<%= javascript_include_tag 'footermanifest', 'data-turbolinks-track' => false %>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a><i class="fa fa-desktop"></i> Brick <span class="fa fa-chevron-down"></span></a>
|
<li><a><i class="fa fa-desktop"></i> Node <span class="fa fa-chevron-down"></span></a>
|
||||||
<ul class="nav child_menu" style="display: none">
|
<ul class="nav child_menu" style="display: none">
|
||||||
<li><a href="#">Add-brick</a>
|
<li><a href="#">Add-brick</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -1,3 +1,103 @@
|
|||||||
|
<!-- create overlay page -->
|
||||||
|
<div id="popup_create" class="overlay">
|
||||||
|
<div class="popup">
|
||||||
|
<h2> Choose mount point </h2>
|
||||||
|
<a class="close" href="#">×</a>
|
||||||
|
|
||||||
|
<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="#">×</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="datatable_body">
|
||||||
|
<tr>
|
||||||
|
<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>
|
||||||
|
<td>
|
||||||
|
<button class="btn btn-primary pull-right" onclick="volume_mount('<%=@current_dir + "/" + t["name"]%>')">select</botton>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<%end%>
|
||||||
|
<%end%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- page content -->
|
<!-- page content -->
|
||||||
<div class="right_col" role="main">
|
<div class="right_col" role="main">
|
||||||
|
|
||||||
@ -7,9 +107,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="title_right">
|
<div class="title_right">
|
||||||
<div class="col-md-5 col-sm-5 col-xs-12 pull-right">
|
<div class="col-md-5 col-sm-5 col-xs-12 pull-right">
|
||||||
<button class="btn btn-primary pull-right" onclick="volume_create">
|
<a class="btn btn-success btn-lg pull-right" href="#popup_create">Create Volume</a>
|
||||||
Create
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -42,43 +140,43 @@
|
|||||||
|
|
||||||
<div class="x_content" <%if t!=@volumes[0]%> style="display: none;" <%end%> >
|
<div class="x_content" <%if t!=@volumes[0]%> style="display: none;" <%end%> >
|
||||||
|
|
||||||
|
<!-- left content -->
|
||||||
<div class="col-md-4 col-sm-4 col-xs-4">
|
<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-round btn-success btn-lg" href="/volume/start/<%=t['Volume Name']%>">
|
|
||||||
<i class="fa fa-play"></i> Start
|
|
||||||
</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-round btn-danger btn-lg" href="/volume/stop/<%=t['Volume Name']%>">
|
|
||||||
<i class="fa fa-pause"></i> Stop
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<form class="form-horizontal form-label-left" action="/volume/mount" method="post">
|
<div>
|
||||||
<div class="form-group">
|
<p class="text-muted font-13 m-b-30"><code>Volume Info</code></p>
|
||||||
<label class="control-label col-md-3 col-sm-3 col-xs-3" for="mount_point">Mount Point</label>
|
Type : <%=t["Type"]%> <br>
|
||||||
<div class="col-md-6 col-sm-6 col-xs-12"><input type="text" name="mount_point" required="required" class="form-control"></div>
|
Volume ID : <%=t["Volume ID"]%> <br>
|
||||||
</div>
|
Status : <%=t["Status"]%> <br>
|
||||||
<input type="hidden" name="volume_name" value="<%=t['Volume Name']%>" />
|
Number of Bricks : <%=t["Number of Bricks"]%> <br>
|
||||||
<button class="btn btn-app" type="submit">
|
Transport-type : <%=t["Transport-type"]%> <br>
|
||||||
<i class="fa fa-upload"></i> Mount
|
Bricks : <%=t["Bricks"]%> <br>
|
||||||
</button>
|
Bricks1 : <%=t["Brick1"]%> <br>
|
||||||
</form>
|
Options Reconfigured : <%=t["Options Reconfigured"]%> <br>
|
||||||
|
performance.readdir-ahead : <%=t["performance.readdir-ahead"]%>
|
||||||
|
<br><br><br>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% 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="/volume/index?volume_name=<%=t['Volume Name'].delete(' ')%>#popup_mount"><i class="fa fa-upload"></i> Mount</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- right content -->
|
||||||
<div class="col-md-8 col-sm-8 col-xs-8">
|
<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>
|
<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 action="/file_upload" method="post" enctype="multipart/form-data" class="dropzone" style="border: 1px solid #e5e5e5; height: 300px; overflow:auto;">
|
||||||
@ -99,4 +197,69 @@
|
|||||||
function volume_create() {
|
function volume_create() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- data table handler -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#datatable').dataTable();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- file manager functions -->
|
||||||
|
<script>
|
||||||
|
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){
|
||||||
|
$("#datatable_body").empty();
|
||||||
|
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>";
|
||||||
|
new_tr += "</td><td> </td><td> </td><td> </td></tr>";
|
||||||
|
for( var i = 0; i < result.file.length; i++){
|
||||||
|
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>";
|
||||||
|
}
|
||||||
|
$("#datatable_body").append(new_tr);
|
||||||
|
$('#datatable').dataTable();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$("#form_volume_create").change(function (){
|
||||||
|
console.log($("#form_volume_create option:selected").val());
|
||||||
|
})
|
||||||
</script>
|
</script>
|
@ -5345,3 +5345,57 @@ ul.notifications {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 2px;
|
height: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.7);
|
||||||
|
transition: opacity 500ms;
|
||||||
|
visibility: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
z-index:20000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay:target {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup {
|
||||||
|
margin: 70px auto;
|
||||||
|
padding: 20px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
position: relative;
|
||||||
|
width:30%;
|
||||||
|
transition: all 5s ease-in-out;
|
||||||
|
overflow:auto;
|
||||||
|
z-index:20001;
|
||||||
|
}
|
||||||
|
.popup h2 {
|
||||||
|
margin-top: 0;
|
||||||
|
color: #333;
|
||||||
|
font-family: Tahoma, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
.popup .close {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
right: 30px;
|
||||||
|
transition: all 200ms;
|
||||||
|
font-size: 30px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #333;
|
||||||
|
z-index:20001;
|
||||||
|
}
|
||||||
|
.popup .close:hover {
|
||||||
|
color: #06D85F;
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 700px){
|
||||||
|
.popup{
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user