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/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

View File

@ -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

View File

@ -29,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

View File

@ -112,10 +112,10 @@
<tr> <tr>
<%if ping_test?(t.host_ip)%> <%if ping_test?(t.host_ip)%>
<td><i class="fa fa-circle-o green"></i></a></td> <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%> <%else%>
<td><i class="fa fa-close red"></i></a></td> <td><i class="fa fa-close red"></i></a></td>
<td>-</td> <td><input type="checkbox" class="js-switch" disabled/></td>
<%end%> <%end%>
<th scope="row"><%=t.host_name%></th> <th scope="row"><%=t.host_name%></th>
<td><%=t.host_ip%></td> <td><%=t.host_ip%></td>
@ -126,6 +126,9 @@
<%end%> <%end%>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
@ -133,6 +136,29 @@
</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';

View File

@ -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"