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';