update peer status

This commit is contained in:
bee0005 2016-09-28 10:27:54 +00:00
parent 537921c0ca
commit 510a8a200d
5 changed files with 53 additions and 10 deletions

View File

@ -52,3 +52,6 @@
//= require js/datatables/dataTables.responsive.min.js
//= require js/datatables/responsive.bootstrap.min.js
//= require js/datatables/dataTables.scroller.min.js
//= require js/switchery/switchery.min.js

View File

@ -28,6 +28,7 @@
@import "css/ion.rangeSlider";
@import "css/ion.rangeSlider.skinFlat";
@import "css/colorpicker/bootstrap-colorpicker.min";
@import "css/switchery/switchery.min";
@import "pace";
//DataTable

View File

@ -29,4 +29,16 @@ class NodeController < ApplicationController
one_node.destroy
redirect_to '/node/index'
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

View File

@ -112,10 +112,10 @@
<tr>
<%if ping_test?(t.host_ip)%>
<td><i class="fa fa-circle-o green"></i></a></td>
<td>Prove</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>-</td>
<td><input type="checkbox" class="js-switch" disabled/></td>
<%end%>
<th scope="row"><%=t.host_name%></th>
<td><%=t.host_ip%></td>
@ -126,13 +126,39 @@
<%end%>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- /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
validator.message['date'] = 'not a real date';

View File

@ -6,31 +6,32 @@ Rails.application.routes.draw do
# You can have the root of your site routed with "root"
root 'home#index'
post 'application/changeDir' => 'application#checkDir'
get 'index' => 'plainpage#index'
#Home
get 'file_download' => 'home#file_download'
get 'home/index' => 'home#index'
post 'home/mkdir' => 'home#make_directory'
post 'home/chdir' => 'home#chdir'
post 'home/rmdir' => 'home#rmdir'
post 'home/delete' => 'home#delete_file'
#Volume
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/start/:volume_name' => "volume#volume_start"
get 'volume/stop/:volume_name' => "volume#volume_stop"
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
get 'node/index' => 'node#index'
post 'node/add' => "node#node_add"
get 'node/delete/:node_id' => "node#node_delete"
post 'node/prove' => "node#node_prove"
post 'node/detach' => "node#node_detach"