Merge branch 'master' of https://github.com/oss2016summer/gluster-web-interface
This commit is contained in:
commit
52e51fa3a2
1
Gemfile
1
Gemfile
@ -1,6 +1,7 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
gem 'carrierwave'
|
gem 'carrierwave'
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
|
gem 'net-ping'
|
||||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||||
gem 'rails', '4.2.4'
|
gem 'rails', '4.2.4'
|
||||||
# Use sqlite3 as the database for Active Record
|
# Use sqlite3 as the database for Active Record
|
||||||
|
@ -96,6 +96,7 @@ GEM
|
|||||||
mini_portile2 (2.0.0)
|
mini_portile2 (2.0.0)
|
||||||
minitest (5.8.4)
|
minitest (5.8.4)
|
||||||
multi_json (1.11.2)
|
multi_json (1.11.2)
|
||||||
|
net-ping (2.0.1)
|
||||||
nokogiri (1.6.7.2)
|
nokogiri (1.6.7.2)
|
||||||
mini_portile2 (~> 2.0.0.rc2)
|
mini_portile2 (~> 2.0.0.rc2)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
@ -183,6 +184,7 @@ DEPENDENCIES
|
|||||||
font-awesome-rails
|
font-awesome-rails
|
||||||
jbuilder (~> 2.0)
|
jbuilder (~> 2.0)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
|
net-ping
|
||||||
rails (= 4.2.4)
|
rails (= 4.2.4)
|
||||||
sass-rails (~> 5.0)
|
sass-rails (~> 5.0)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
|
@ -52,3 +52,6 @@
|
|||||||
//= require js/datatables/dataTables.responsive.min.js
|
//= require js/datatables/dataTables.responsive.min.js
|
||||||
//= require js/datatables/responsive.bootstrap.min.js
|
//= require js/datatables/responsive.bootstrap.min.js
|
||||||
//= require js/datatables/dataTables.scroller.min.js
|
//= require js/datatables/dataTables.scroller.min.js
|
||||||
|
|
||||||
|
|
||||||
|
//= require js/switchery/switchery.min.js
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
@import "css/ion.rangeSlider";
|
@import "css/ion.rangeSlider";
|
||||||
@import "css/ion.rangeSlider.skinFlat";
|
@import "css/ion.rangeSlider.skinFlat";
|
||||||
@import "css/colorpicker/bootstrap-colorpicker.min";
|
@import "css/colorpicker/bootstrap-colorpicker.min";
|
||||||
|
@import "css/switchery/switchery.min";
|
||||||
@import "pace";
|
@import "pace";
|
||||||
|
|
||||||
//DataTable
|
//DataTable
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
class NodeController < ApplicationController
|
class NodeController < ApplicationController
|
||||||
before_action :require_login
|
before_action :require_login
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@hosts = Array.new
|
@hosts = Array.new
|
||||||
@nodes = Node.all.order("id asc")
|
@nodes = Node.all.order("id asc")
|
||||||
@ -30,4 +29,16 @@ class NodeController < ApplicationController
|
|||||||
one_node.destroy
|
one_node.destroy
|
||||||
redirect_to '/node/index'
|
redirect_to '/node/index'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def node_prove
|
||||||
|
one_node = Node.find(params[:node_id])
|
||||||
|
puts "gluster peer probe #{one_node.host_name}"
|
||||||
|
redirect_to '/node/index'
|
||||||
|
end
|
||||||
|
|
||||||
|
def node_detach
|
||||||
|
one_node = Node.find(params[:node_id])
|
||||||
|
puts "gluster peer detach #{one_node.host_name}"
|
||||||
|
redirect_to '/node/index'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,2 +1,7 @@
|
|||||||
module NodeHelper
|
module NodeHelper
|
||||||
|
require 'net/ping'
|
||||||
|
def ping_test?(host)
|
||||||
|
check = Net::Ping::External.new(host)
|
||||||
|
check.ping?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-sm-6 col-xs-6">
|
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||||
<div class="x_panel">
|
<div class="x_panel">
|
||||||
<div class="x_title">
|
<div class="x_title">
|
||||||
<h2><i class="fa fa-plus-square-o"></i> Add Node</h2>
|
<h2><i class="fa fa-plus-square-o"></i> Add Node</h2>
|
||||||
@ -25,8 +25,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="close-link"><i class="fa fa-close"></i></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -77,7 +75,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-sm-6 col-xs-6">
|
<div class="col-md-12 col-sm-12 col-xs-12">
|
||||||
<div class="x_panel">
|
<div class="x_panel">
|
||||||
<div class="x_title">
|
<div class="x_title">
|
||||||
<h2><i class="fa fa-align-left"></i> Node List <small>Try hovering over the rows</small></h2>
|
<h2><i class="fa fa-align-left"></i> Node List <small>Try hovering over the rows</small></h2>
|
||||||
@ -93,8 +91,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="close-link"><i class="fa fa-close"></i></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -102,121 +98,67 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>Ping</th> <!-- Ping-->
|
||||||
|
<th>Status</th>
|
||||||
<th>Host Name</th>
|
<th>Host Name</th>
|
||||||
<th>Host IP</th>
|
<th>Host IP</th>
|
||||||
<th>User Name</th>
|
<th>User Name</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<!-- <th></th>-->
|
<th></th> <!-- Delete-->
|
||||||
<th></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<%@nodes.each do |t|%>
|
<%@nodes.each do |t|%>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><%=t.id%></th>
|
<%if ping_test?(t.host_ip)%>
|
||||||
<td><%=t.host_name%></td>
|
<td><i class="fa fa-circle-o green"></i></a></td>
|
||||||
|
<td><input type="checkbox" class="js-switch prove" value="<%=t.id%>" checked/>Attached</td>
|
||||||
|
<%else%>
|
||||||
|
<td><i class="fa fa-close red"></i></a></td>
|
||||||
|
<td><input type="checkbox" class="js-switch" disabled/></td>
|
||||||
|
<%end%>
|
||||||
|
<th scope="row"><%=t.host_name%></th>
|
||||||
<td><%=t.host_ip%></td>
|
<td><%=t.host_ip%></td>
|
||||||
<td><%=t.user_name%></td>
|
<td><%=t.user_name%></td>
|
||||||
<td><%=t.created_at%></td>
|
<td><%=t.created_at%></td>
|
||||||
<!-- <td><i class="fa fa-pencil"></i></td>-->
|
|
||||||
<td><a href="/node/delete/<%=t.id%>"><i class="fa fa-trash"></i></a></td>
|
<td><a href="/node/delete/<%=t.id%>"><i class="fa fa-trash"></i></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%end%>
|
<%end%>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6 col-sm-6 col-xs-6">
|
|
||||||
<div class="x_panel">
|
|
||||||
<div class="x_title">
|
|
||||||
<h2><i class="fa fa-align-left"></i> Node List</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">
|
|
||||||
|
|
||||||
<!-- start accordion -->
|
|
||||||
<div class="accordion" id="accordion1" role="tablist" aria-multiselectable="true">
|
|
||||||
<div class="panel">
|
|
||||||
<a class="panel-heading" role="tab" id="headingOne1" data-toggle="collapse" data-parent="#accordion1" href="#collapseOne1" aria-expanded="true" aria-controls="collapseOne">
|
|
||||||
<h4 class="panel-title">Collapsible Group Item #1</h4>
|
|
||||||
</a>
|
|
||||||
<div id="collapseOne1" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
|
|
||||||
<div class="panel-body">
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>#</th>
|
|
||||||
<th>First Name</th>
|
|
||||||
<th>Last Name</th>
|
|
||||||
<th>Username</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">1</th>
|
|
||||||
<td>Mark</td>
|
|
||||||
<td>Otto</td>
|
|
||||||
<td>@mdo</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">2</th>
|
|
||||||
<td>Jacob</td>
|
|
||||||
<td>Thornton</td>
|
|
||||||
<td>@fat</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">3</th>
|
|
||||||
<td>Larry</td>
|
|
||||||
<td>the Bird</td>
|
|
||||||
<td>@twitter</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel">
|
|
||||||
<a class="panel-heading collapsed" role="tab" id="headingTwo1" data-toggle="collapse" data-parent="#accordion1" href="#collapseTwo1" aria-expanded="false" aria-controls="collapseTwo">
|
|
||||||
<h4 class="panel-title">Collapsible Group Item #2</h4>
|
|
||||||
</a>
|
|
||||||
<div id="collapseTwo1" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
|
|
||||||
<div class="panel-body">
|
|
||||||
<p><strong>Collapsible Item 2 data</strong>
|
|
||||||
</p>
|
|
||||||
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor,
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- end of accordion -->
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /page content -->
|
<!-- /page content -->
|
||||||
<script>
|
<script>
|
||||||
|
$('.prove').change(function() {
|
||||||
|
$(location).attr('href',"#loading");
|
||||||
|
if($(this).is(":checked")) {
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "/node/prove",
|
||||||
|
data: { node_id : this.value },
|
||||||
|
success : function(result){
|
||||||
|
$(location).attr('href',"#");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "/node/detach",
|
||||||
|
data: { node_id : this.value },
|
||||||
|
success : function(result){
|
||||||
|
$(location).attr('href',"#");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// initialize the validator function
|
// initialize the validator function
|
||||||
validator.message['date'] = 'not a real date';
|
validator.message['date'] = 'not a real date';
|
||||||
|
|
||||||
|
@ -6,31 +6,32 @@ Rails.application.routes.draw do
|
|||||||
# You can have the root of your site routed with "root"
|
# You can have the root of your site routed with "root"
|
||||||
root 'home#index'
|
root 'home#index'
|
||||||
|
|
||||||
|
post 'application/changeDir' => 'application#checkDir'
|
||||||
|
|
||||||
get 'index' => 'plainpage#index'
|
get 'index' => 'plainpage#index'
|
||||||
|
|
||||||
#Home
|
#Home
|
||||||
get 'file_download' => 'home#file_download'
|
get 'file_download' => 'home#file_download'
|
||||||
get 'home/index' => 'home#index'
|
get 'home/index' => 'home#index'
|
||||||
post 'home/mkdir' => 'home#make_directory'
|
post 'home/mkdir' => 'home#make_directory'
|
||||||
post 'home/chdir' => 'home#chdir'
|
post 'home/delete' => 'home#delete_file'
|
||||||
post 'home/rmdir' => 'home#rmdir'
|
|
||||||
|
|
||||||
#Volume
|
#Volume
|
||||||
get 'volume/index' => 'volume#index'
|
get 'volume/index' => 'volume#index'
|
||||||
|
post 'file_upload/:volume_name' => 'volume#file_upload'
|
||||||
|
post 'volume/mount' => "volume#volume_mount"
|
||||||
|
post 'volume/create' => "volume#volume_create"
|
||||||
get 'volume/unmount/:volume_name' => "volume#volume_unmount"
|
get 'volume/unmount/:volume_name' => "volume#volume_unmount"
|
||||||
get 'volume/start/:volume_name' => "volume#volume_start"
|
get 'volume/start/:volume_name' => "volume#volume_start"
|
||||||
get 'volume/stop/:volume_name' => "volume#volume_stop"
|
get 'volume/stop/:volume_name' => "volume#volume_stop"
|
||||||
get 'volume/delete/:volume_name' => "volume#volume_delete"
|
get 'volume/delete/:volume_name' => "volume#volume_delete"
|
||||||
post 'file_upload/:volume_name' => 'volume#file_upload'
|
|
||||||
post 'volume/mount' => "volume#volume_mount"
|
|
||||||
post 'volume/create' => "volume#volume_create"
|
|
||||||
post 'volume/chdir' => 'volume#chdir'
|
|
||||||
|
|
||||||
|
|
||||||
#Node
|
#Node
|
||||||
get 'node/index' => 'node#index'
|
get 'node/index' => 'node#index'
|
||||||
post 'node/add' => "node#node_add"
|
post 'node/add' => "node#node_add"
|
||||||
get 'node/delete/:node_id' => "node#node_delete"
|
get 'node/delete/:node_id' => "node#node_delete"
|
||||||
|
post 'node/prove' => "node#node_prove"
|
||||||
|
post 'node/detach' => "node#node_detach"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user