Update top, footer

This commit is contained in:
kyg516 2016-09-23 18:28:53 +09:00
parent a4c983a7e0
commit eb8e6a64b4
10 changed files with 659 additions and 740 deletions

View File

@ -4,35 +4,52 @@ class ApplicationController < ActionController::Base
# protect_from_forgery with: :exception
def get_conf
@config = Hash.new
config = Hash.new
one_node = Node.take
if !one_node.nil?
@config["host_name"] = one_node.host_name
@config["host_ip"] = one_node.host_ip
@config["user_name"] = one_node.user_name
@config["user_password"] = one_node.user_password
config["host_name"] = one_node.host_name
config["host_ip"] = one_node.host_ip
config["user_name"] = one_node.user_name
config["user_password"] = one_node.user_password
end
return config
end
# output = `cat configure.conf`.split("\n")
# output.each do |t|
# if t.include? "project_path="
# @config["project_path"] = t.split("project_path=")[1]
# elsif t.include? "server_name="
# @config["server_name"] = t.split("server_name=")[1]
# elsif t.include? "host_user="
# @config["host_user"] = t.split("host_user=")[1]
# elsif t.include? "host_ip="
# @config["host_ip"] = t.split("host_ip=")[1]
# elsif t.include? "host_port=" and !t.split("host_port=")[1].nil?
# @config["host_port"] = t.split("host_port=")[1] + " "
# elsif t.include? "host_password="
# @config["host_password"] = t.split("host_password=")[1]
# end
# end
def get_conf_all
config = Array.new
config_each = Hash.new
all_node = Node.all
all_node.each do |one_node|
config_each["host_name"] = one_node.host_name
config_each["host_ip"] = one_node.host_ip
config_each["user_name"] = one_node.user_name
config_each["user_password"] = one_node.user_password
config << config_each
config_each = Hash.new
end
return config
end
return @config
def get_df
df = Array.new
df_each = Hash.new
command = String.new
command << "df -hP"
puts command
output = `#{command}`.split("\n")
output.each do |t|
next if t.equal? output.first
s = t.split(' ')
df_each['Filesystem'] = s[0]
df_each['Size'] = s[1]
df_each['Used'] = s[2]
df_each['Avail'] = s[3]
df_each['Use%'] = s[4]
df_each['Mounted on'] = s[5]
df << df_each
df_each = Hash.new
end
return df
end
def file_directory(dir)

View File

@ -1,4 +1,5 @@
class HomeController < ApplicationController
def index
@current_dir = "/mnt"
file_directory(@current_dir)
@ -17,15 +18,21 @@ class HomeController < ApplicationController
def make_directory
current_dir = params[:current_dir]
directory_name = params[:directory_name]
puts "mkdir #{current_dir}/#{directory_name}"
`sudo mkdir #{current_dir}/#{directory_name}`
# make directory
command = String.new
command << "sudo mkdir #{current_dir}/#{directory_name}"
puts command
`#{command}`
redirect_to '/home/index'
end
def delete_file
file_name = params[:file_name]
puts "rm #{file_name} -rf"
`sudo rm #{file_name} -rf`
# delete file
command = String.new
command << "sudo rm -rf #{file_name}"
puts command
`#{command}`
redirect_to '/home/index'
end
end

View File

@ -2,11 +2,6 @@ class VolumeController < ApplicationController
def index
file_directory("/mnt")
get_conf
end
def get_df
return `df -P`
end
def file_upload
@ -14,64 +9,71 @@ class VolumeController < ApplicationController
mnt_dir = String.new
mnt_dest = String.new
file = params[:file]
s = df.split("\n")
s.each do |t|
if t.include? params[:volume_name]
mnt_dir = t.split(" ")[5]
df.each do |t|
if t['Filesystem'].include? params[:volume_name]
mnt_dir = t['Mounted on']
end
end
mnt_dest = mnt_dir + "/" + file.original_filename
# change permission
command = String.new
command << "sudo chmod 777 " + mnt_dir
command << "sudo chmod 777 #{mnt_dir}"
puts command
`#{command}`
# upload file
u = AvatarUploader.new(mnt_dir)
u.store!(file)
redirect_to '/volume/index'
end
def volume_mount
get_conf
conf = get_conf
volume_name = params[:volume_name]
mount_point = params[:mount_point]
# make command string
command = String.new
command << "sudo mount -t glusterfs " + @config["host_ip"].to_s + ":/" + volume_name + " " + mount_point
command << "sudo mount -t glusterfs #{conf['host_ip']}:/#{volume_name} #{mount_point}"
puts command
`#{command}`
redirect_to '/volume/index'
end
def volume_unmount
get_conf
conf = get_conf
volume_name = params[:volume_name]
# make command string
command = String.new
command << "sudo umount " + @config["host_ip"].to_s + ":/" + volume_name
command << "sudo umount #{conf['host_ip']}:/#{volume_name}"
puts command
`#{command}`
redirect_to '/volume/index'
end
def volume_create
get_conf
conf = get_conf
volume_name = params[:volume_name]
volume_type = params[:volume_type]
num_of_brick = params[:num_of_brick]
bricks = params[:bricks]
# make command string
command = String.new
command << "sshpass -p" + @config["user_password"].to_s
command << " ssh "
command << @config["user_name"].to_s + "@" + @config["host_ip"].to_s
command << " gluster volume create " + volume_name + " "
command << "sshpass -p#{conf['user_password']} "
command << "ssh #{conf['user_name']}@#{conf['host_ip']} "
command << "gluster volume create #{volume_name} "
if !volume_type.include? "Distribute"
command << volume_type.downcase + " " + num_of_brick + " "
command << "#{volume_type.downcase} #{num_of_brick}"
end
conf_all = get_conf_all
bricks.each do |t|
command << t + " "
host_name = t.split(":/")[0]
brick_name = t.split(":/")[1]
host_ip = ""
conf_all.each do |u|
next if !u['host_name'].eql? host_name
host_ip = u['host_ip']
end
brick = "#{host_ip}:/#{brick_name}"
command << "#{brick} "
end
command << "force"
puts command
@ -80,45 +82,39 @@ class VolumeController < ApplicationController
end
def volume_stop
get_conf
conf = get_conf
volume_name = params[:volume_name]
# make command string
command = String.new
command << "yes | sshpass -p" + @config["user_password"].to_s
command << " ssh "
command << @config["user_name"].to_s + "@" + @config["host_ip"].to_s
command << " gluster volume stop " + volume_name
command << "yes | sshpass -p#{conf['user_password']} "
command << "ssh #{conf['user_name']}@#{conf['host_ip']} "
command << "gluster volume stop #{volume_name}"
puts command
`#{command}`
redirect_to '/volume/index'
end
def volume_start
get_conf
conf = get_conf
volume_name = params[:volume_name]
# make command string
command = String.new
command << "sshpass -p" + @config["user_password"].to_s
command << " ssh "
command << @config["user_name"].to_s + "@" + @config["host_ip"].to_s
command << " gluster volume start " + volume_name.to_s
command << "sshpass -p#{conf['user_password']} "
command << "ssh #{conf['user_name']}@#{conf['host_ip']} "
command << " gluster volume start #{volume_name}"
puts command
`#{command}`
redirect_to '/volume/index'
end
def volume_delete
get_conf
conf = get_conf
volume_name = params[:volume_name]
# make command string
command = String.new
command << "yes | sshpass -p" + @config["user_password"].to_s
command << " ssh "
command << @config["user_name"].to_s + "@" + @config["host_ip"].to_s
command << " gluster volume delete " + volume_name
command << "yes | sshpass -p#{conf['user_password']} "
command << "ssh #{conf['user_name']}@#{conf['host_ip']} "
command << " gluster volume delete #{volume_name}"
puts command
`#{command}`
redirect_to '/volume/index'

View File

@ -1,2 +1,52 @@
module ApplicationHelper
def get_conf
config = Hash.new
one_node = Node.take
if !one_node.nil?
config["host_name"] = one_node.host_name
config["host_ip"] = one_node.host_ip
config["user_name"] = one_node.user_name
config["user_password"] = one_node.user_password
end
return config
end
def get_conf_all
config = Array.new
config_each = Hash.new
all_node = Node.all
all_node.each do |one_node|
config_each["host_name"] = one_node.host_name
config_each["host_ip"] = one_node.host_ip
config_each["user_name"] = one_node.user_name
config_each["user_password"] = one_node.user_password
config << config_each
config_each = Hash.new
end
return config
end
def get_df
df = Array.new
df_each = Hash.new
command = String.new
command << "df -hP"
puts command
output = `#{command}`.split("\n")
output.each do |t|
next if t.equal? output.first
s = t.split(' ')
df_each['Filesystem'] = s[0]
df_each['Size'] = s[1]
df_each['Used'] = s[2]
df_each['Avail'] = s[3]
df_each['Use%'] = s[4]
df_each['Mounted on'] = s[5]
df << df_each
df_each = Hash.new
end
return df
end
end

View File

@ -1,43 +1,28 @@
module VolumeHelper
def get_conf
@config = Hash.new
one_node = Node.take
if !one_node.nil?
@config["host_name"] = one_node.host_name
@config["host_ip"] = one_node.host_ip
@config["user_name"] = one_node.user_name
@config["user_password"] = one_node.user_password
end
return @config
end
def get_volumes
def volumes
volumes = Array.new
volume = Hash.new
command = "df -P"
df = `#{command}`
conf = get_conf
command = "sshpass -p#{conf['user_password']} ssh #{conf['user_name']}@#{conf['host_ip']} gluster volume info"
info = `#{command}`.split("\n")
info << "\n"
info.each do |t|
next if t.equal? info.first
df = get_df
command = String.new
command << "sshpass -p#{conf['user_password']} "
command << "ssh #{conf['user_name']}@#{conf['host_ip']} "
command << "gluster volume info"
puts command
output = `#{command}`.split("\n")
output << "\n"
output.each do |t|
next if t.equal? output.first
if t.include? ":"
temp = t.split(":")
volume[temp[0]] = temp[1]
else
String state = (df.include? volume['Volume Name'].delete(' ')) ? "mounted" : "unmounted"
volume['Mount State'] = state
if state.eql? "mounted"
s = df.split("\n")
s.each do |t|
if t.include? volume['Volume Name'].delete(' ')
mnt_point = t.split(" ")[5]
volume['Mount Point'] = mnt_point
end
end
volume['Mount State'] = "unmounted"
df.each do |u|
next if !u['Filesystem'].include? volume['Volume Name'].delete(' ')
volume['Mount State'] = "mounted"
volume['Mount Point'] = u['Mounted on']
end
volumes << volume
volume = Hash.new
@ -47,8 +32,7 @@ module VolumeHelper
end
def volume_info(volume)
params = ['Type', 'Volume ID', 'Status', 'Number of Bricks', 'Transport-type',
'Bricks', 'Options Reconfigured', 'Mount State', 'Mount Point']
params = ['Type', 'Volume ID', 'Status', 'Number of Bricks', 'Transport-type', 'Bricks', 'Options Reconfigured', 'Mount State', 'Mount Point']
html = ''
html << "<div>"
params.each do |t|

View File

@ -1,19 +1,9 @@
<!-- right click menu -->
<div class="contextmenu Del_dir">
<ul>
<li class="menuitem"><i class="fa fa-trash"></i>Delete</li>
<input id="delete_name" type="hidden"></input>
</ul>
</div>
<!-- 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">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="current-dir">Current Directory <span class="required">*</span>
</label>
@ -35,77 +25,69 @@
</div>
</div>
</form>
</div>
</div>
<!-- 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...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12">
<div class="x_panel">
<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>
<!-- top tiles -->
<div class="row tile_count">
<div class="animated flipInY col-md-2 col-sm-4 col-xs-4 tile_stats_count">
<div class="left"></div>
<div class="right">
<span class="count_top"><i class="fa fa-user"></i> Total Users</span>
<div class="count">2500</div>
<span class="count_bottom"><i class="green">4% </i> From last Week</span>
</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 class="animated flipInY col-md-2 col-sm-4 col-xs-4 tile_stats_count">
<div class="left"></div>
<div class="right">
<span class="count_top"><i class="fa fa-clock-o"></i> Average Time</span>
<div class="count">123.50</div>
<span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>3% </i> From last Week</span>
</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 class="animated flipInY col-md-2 col-sm-4 col-xs-4 tile_stats_count">
<div class="left"></div>
<div class="right">
<span class="count_top"><i class="fa fa-user"></i> Total Males</span>
<div class="count green">2,500</div>
<span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>34% </i> From last Week</span>
</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 class="animated flipInY col-md-2 col-sm-4 col-xs-4 tile_stats_count">
<div class="left"></div>
<div class="right">
<span class="count_top"><i class="fa fa-user"></i> Total Females</span>
<div class="count">4,567</div>
<span class="count_bottom"><i class="red"><i class="fa fa-sort-desc"></i>12% </i> From last Week</span>
</div>
</div>
<div class="animated flipInY col-md-2 col-sm-4 col-xs-4 tile_stats_count">
<div class="left"></div>
<div class="right">
<span class="count_top"><i class="fa fa-user"></i> Total Collections</span>
<div class="count">2,315</div>
<span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>34% </i> From last Week</span>
</div>
</div>
<div class="animated flipInY col-md-2 col-sm-4 col-xs-4 tile_stats_count">
<div class="left"></div>
<div class="right">
<span class="count_top"><i class="fa fa-user"></i> Total Connections</span>
<div class="count">7,325</div>
<span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>34% </i> From last Week</span>
</div>
</div>
</div>
<!-- /top tiles -->
<!-- file manager -->
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
@ -122,19 +104,12 @@
</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-12 col-sm-12 col-xs-12" id="table_div">
<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>
</p>
<table id="datatable" class="table table-striped table-bordered jambo_table">
<thead>
<tr class="headings">
@ -144,11 +119,12 @@
<th>Date</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>
<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>
@ -176,61 +152,124 @@
</div>
</div>
</div>
<!-- /file manager -->
<!-- disk usage -->
<div class="col-md-4 col-sm-4 col-xs-12">
<div class="x_panel tile fixed_height_320">
<div class="x_title">
<h2>App Versions</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">
<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>
<div class="clearfix"></div>
</div>
<div class="widget_summary">
<div class="w_left w_25">
<span>0.1.5.3</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: 45%;">
<span class="sr-only">60% Complete</span>
</div>
</div>
</div>
<div class="w_right w_20">
<span>53k</span>
</div>
<div class="clearfix"></div>
</div>
<div class="widget_summary">
<div class="w_left w_25">
<span>0.1.5.4</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: 25%;">
<span class="sr-only">60% Complete</span>
</div>
</div>
</div>
<div class="w_right w_20">
<span>23k</span>
</div>
<div class="clearfix"></div>
</div>
<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>
<div class="clearfix"></div>
</div>
<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>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
<!-- /disk usage -->
</div>
</div>
<!-- /page content -->
<script type="text/javascript">
$(document).ready(function() {
$('#datatable').dataTable();
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");
var file_name = Cells[0].innerText;
file_name = file_name.replace(' ', '');
$("#delete_name").val($("#select_dir").text() + "/" + file_name);
CheckLocation();
return false;
});
}
$(".Del_dir").click(function(e){
$(location).attr('href', "#loading");
$.ajax({
method: "POST",
url: "/home/delete",
data: { file_name: $("#delete_name").val() },
success : function(result){
change_directory($("#select_dir").text());
$(location).attr('href', "#");
}
})
$(".contextmenu").hide();
$(document).unbind('mousedown');
});
</script>
<!-- file manager functions -->
<!-- File manager functions -->
<script>
function change_upper(directory){
if(directory == "/") return;
@ -238,7 +277,6 @@ function change_upper(directory){
if(lastindex == 0) lastindex++;
change_directory(directory.substring(0, lastindex));
}
function change_directory(directory){
$.ajax({
method: "POST",
@ -248,8 +286,6 @@ function change_directory(directory){
$("#current-dir").val(directory);
$("#table_div").empty();
var new_table = "";
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>";
new_table += "<table id='datatable' class='table table-striped table-bordered jambo_table'>";
new_table += "<thead>";
new_table += "<tr class='headings'>";
@ -262,10 +298,12 @@ function change_directory(directory){
new_table += "<tbody id='datatable_body'>";
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>";
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 += "&nbsp" + 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>";
for( var i = 0; i < result.file.length; i++){
var row_class = i % 2 == 0 ? 'odd' : 'even';
var cur = result.current != "/" ? result.current : '';
@ -287,118 +325,15 @@ function change_directory(directory){
new_table += new_tr;
new_table += "</tbody></table>"
$("#table_div").append(new_table);
$('#datatable').dataTable();
right_click();
$('#datatable').dataTable( {"bSort": false});
}
})
}
</script>
<!-- On document ready -->
<script>
$("document").ready(function(){
})
</script>
<!--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;
}
});
$(document).ready(function() {
$('#datatable').dataTable( {"bSort": false});
});
</script>

View File

@ -2,7 +2,7 @@
<!-- footer content -->
<footer>
<div class="pull-right">
Gentelella - Bootstrap Admin Template by <a href="https://colorlib.com">Colorlib</a>
Gluster Web Interface by <a href="https://github.com/oss2016summer/gluster-web-interface">WEB</a>
</div>
<div class="clearfix"></div>
</footer>
@ -16,4 +16,3 @@
<div class="clearfix"></div>
<div id="notif-group" class="tabbed_notifications"></div>
</div>

View File

@ -1,6 +1,5 @@
<!-- top navigation -->
<div class="top_nav">
<div class="nav_menu">
<nav class="" role="navigation">
<div class="nav toggle">
@ -9,58 +8,11 @@
<ul class="nav navbar-nav navbar-right">
<li class="">
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<%= image_tag "img.jpg" %>John Doe
<span class=" fa fa-angle-down"></span>
</a>
<ul class="dropdown-menu dropdown-usermenu pull-right">
<li><a href="javascript:;"> Profile</a>
</li>
<li>
<a href="javascript:;">
<span class="badge bg-red pull-right">50%</span>
<span>Settings</span>
<a href="javascript:;" class="user-profile" aria-expanded="false">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
Hello, admin!
</a>
</li>
<li>
<a href="javascript:;">Help</a>
</li>
<li><a href="/users/sign_out"><i class="fa fa-sign-out pull-right"></i> Log Out</a>
</li>
</ul>
</li>
<li role="presentation" class="dropdown">
<a href="javascript:;" class="dropdown-toggle info-number" data-toggle="dropdown" aria-expanded="false">
<i class="fa fa-envelope-o"></i>
<span class="badge bg-green">6</span>
</a>
<ul id="menu1" class="dropdown-menu list-unstyled msg_list" role="menu">
<li>
<a>
<span class="image">
<%= image_tag "img.jpg" %>
</span>
<span>
<span>John Smith</span>
<span class="time">3 mins ago</span>
</span>
<span class="message">
Film festivals used to be do-or-die moments for movie makers. They were where...
</span>
</a>
</li>
<li>
<div class="text-center">
<a>
<strong>See All Alerts</strong>
<i class="fa fa-angle-right"></i>
</a>
</div>
</li>
</ul>
</li>
</ul>
</nav>
</div>

View File

@ -39,7 +39,9 @@
</label>
<div class="col-md-3 col-sm-3 col-xs-4">
<select class="form-control">
<option><%=@config["server_name"]%></option>
<% get_conf_all.each do |t| %>
<option><%= t['host_name'] %></option>
<% end %>
</select>
</div>
<div class="col-md-1 col-sm-1 col-xs-1">
@ -115,7 +117,7 @@
</div>
<div class="clearfix"></div>
<div class="row">
<% get_volumes.each_with_index do |t, index| %>
<% volumes.each_with_index do |t, index| %>
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="x_panel">
<div class="x_title">
@ -268,7 +270,7 @@
<!-- On document ready -->
<script>
$("document").ready(function(){
$(document).ready(function(){
// Mount overlay functions
$("#popup_mount #datatable_body form").submit(function(){
var mnt_point = $(this).find("input").val();
@ -292,14 +294,14 @@
alert("Volume name can't contains white spaces");
return;
}
<% get_volumes.each do |t| %>
<% volumes.each do |t| %>
if(volume_name == "<%=t["Volume Name"].delete(' ')%>"){
alert("Already has a volume which name is same");
return;
}
<% end %>
for(var i = 0; i < num_of_brick; i++){
var server_name = $(this).find(".form-group .row").eq(i).find("option:selected").val();
var host_name = $(this).find(".form-group .row").eq(i).find("option:selected").val();
var brick_name = $(this).find(".form-group .row").eq(i).find("input").val();
if(brick_name.indexOf(' ') >= 0) {
alert("Brick name can't contain white spaces");
@ -309,19 +311,10 @@
alert("Brick name can't start with slash");
return;
}
var brick = "";
if(server_name == "<%=@config['server_name']%>"){
brick += "<%=@config['host_ip']%>";
brick += ":/";
brick += brick_name;
var brick = host_name + ":/" + brick_name;
bricks.push(brick);
console.log(brick);
}
else{
alert("Something goes wrong!");
return;
}
}
$.ajax({
method: "POST",
url: "/volume/create",
@ -361,7 +354,9 @@
new_body += "</label>";
new_body += "<div class='col-md-3 col-sm-3 col-xs-4'>";
new_body += "<select class='form-control'>";
new_body += "<option><%=@config['server_name']%></option>";
<% get_conf_all.each do |t| %>
new_body += "<option><%= t['host_name'] %></option>";
<% end %>
new_body += "</select>";
new_body += "</div>";
new_body += "<div class='col-md-1 col-sm-1 col-xs-1'>"

View File

@ -13,19 +13,3 @@ sudo --askpass bower install --allow-root
gem install bundler
bundle install
bin/rake db:migrate
# make configuration file
CONF_PATH=`pwd`/configure.conf
if ls `pwd` | grep configure.conf; then
echo "configure.conf exist"
else
touch $CONF_PATH
echo "project_path=`pwd`" >> $CONF_PATH
echo "server_name=gluster" >> $CONF_PATH
echo "host_ip=127.0.0.1" >> $CONF_PATH
echo "host_port=" >> $CONF_PATH
echo "host_user=root" >> $CONF_PATH
echo "host_password=secret" >> $CONF_PATH
fi