$(function() {
$('.update').on('click', function(){
$.fn.dataTable.ext.errMode = 'none';
$.ajax({
type: 'post',
url: base_url+"eureka/getInstance",
dataType: "json",
data: {"serviceId":serviceId},
async: false,
success:function (data) {
$("#instance_list").dataTable({
bPaginate:false,
bLengthChange: false,
info: false,
autoWidth: true,
destroy: true,
ordering: false,
searching: false,
data:data,
columns:[
{data:'instance'},
{data: null,"render":function (data,type,row,meta) {
var html = "<button type='button' class='btn btn-success btn-xs oemp-privbtn' οnclick='i_start("+JSON.stringify(row.instance)+")'>启动</button>"+
" <button type='button' class='btn btn-warning btn-xs oemp-privbtn' οnclick='i_stop("+JSON.stringify(row.instance)+")'>停止</button>"+
" <button type='button' class='btn btn-info btn-xs oemp-privbtn' οnclick='i_restart("+JSON.stringify(row.instance)+")'>重启</button>"+
" <button type='button' class='btn btn-primary btn-xs oemp-privbtn' οnclick='i_update("+JSON.stringify(row.instance)+")'>更新包</button>"+
" <button type='button' class='btn btn-danger btn-xs oemp-privbtn' οnclick='i_force("+JSON.stringify(row.instance)+")'>强停</button>"+
" <button type='button' class='btn btn-primary btn-xs oemp-privbtn' οnclick='i_shell("+JSON.stringify(row.instance)+")'>运行shell</button>";
return html;
}}
]
})
}
})
});
$("#updateModal").on('hide.bs.modal', function () {
$("#updateModal .form .form-group").removeClass("has-error");
});
});
function i_start(obj) {
alert(obj);
}
function i_stop(obj) {
alert(obj);
}
function i_restart(obj) {
alert(obj);
}
function i_update(obj) {
alert(obj);
}
function i_force(obj) {
alert(obj);
}
function i_shell(obj) {
alert(obj);
}