2018-08-12 15:09:47 +02:00
|
|
|
function dropdown(i,e) {
|
|
|
|
document.getElementById(i).innerHTML = e;
|
|
|
|
document.getElementById(i +'h').value = e;
|
|
|
|
}
|
2018-08-13 16:49:49 +02:00
|
|
|
|
|
|
|
function post(path, params, method) {
|
|
|
|
method = method || "post";
|
|
|
|
var form = document.createElement("form");
|
|
|
|
form.setAttribute("method", method);
|
|
|
|
form.setAttribute("action", path);
|
|
|
|
|
|
|
|
for(var key in params) {
|
|
|
|
if(params.hasOwnProperty(key)) {
|
|
|
|
var hiddenField = document.createElement("input");
|
|
|
|
hiddenField.setAttribute("type", "hidden");
|
|
|
|
hiddenField.setAttribute("name", key);
|
|
|
|
hiddenField.setAttribute("value", params[key]);
|
|
|
|
|
|
|
|
form.appendChild(hiddenField);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
document.body.appendChild(form);
|
|
|
|
form.submit();
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#confirm-delete').on('click', '.btn-ok', function(e) {
|
|
|
|
var $modalDiv = $('#confirm-detele'.delegateTarget);
|
|
|
|
var vmname = $(this).data('deleteName');
|
|
|
|
var vmid = $(this).data('deleteVm');
|
|
|
|
post('?', {deletevm: vmid,deletename: vmname});
|
|
|
|
});
|
|
|
|
$('#confirm-delete').on('show.bs.modal', function(e) {
|
|
|
|
var data = $(e.relatedTarget).data();
|
|
|
|
$('.title', this).text(data.deleteVm);
|
|
|
|
document.getElementById('modaltext2').innerHTML = data.deleteText;
|
|
|
|
$('.btn-ok', this).data({'deleteName': data.deleteName,'deleteVm': data.deleteVm});
|
|
|
|
});
|