Files
EasySoft-ZenTaoPMS/module/instance/js/view.ui.js
T

84 lines
1.9 KiB
JavaScript

$('#mainContent').on('click', '.db-management', function()
{
var dbName = $(this).data('dbname');
var dbType = $(this).data('dbtype');
var instanceID = $(this).data('id');
$.ajaxSubmit
(
{
url: $.createLink('instance', 'ajaxDBAuthUrl'),
method: 'POST', data: {dbName, dbType, instanceID},
onSuccess: (response) =>
{
if(response.result == 'success')
{
window.open(response.data.url, 'Adminer');
}
else
{
zui.Modal.alert(response.message);
}
}
}
);
});
var timer = null;
const postData = new FormData();
postData.append('idList[]', instanceID);
window.afterPageUpdate = function()
{
if(inQuickon)
{
if(timer) clearInterval(timer);
timer = setInterval(refreshStatus, 5000);
}
}
window.onPageUnmount = function()
{
if(timer) clearInterval(timer);
}
function refreshStatus()
{
$.ajaxSubmit({
url: $.createLink('instance', 'ajaxStatus'),
method: 'POST',
data:postData,
onComplete: function(res)
{
if(res.result === 'success')
{
if(res.data.length == 0) return false;
loadPage($.createLink('instance', 'view', `instanceID=${instanceID}`), '#setting,#statusTD,#dbStatusTD,#systemLoad,.float-toolbar');
}
}
});
}
$('.copy-btn').on('click', function()
{
var copyText = $(this).parent().find('input');
copyText.show();
copyText[0].select();
document.execCommand("Copy");
copyText.hide();
var that = this;
$(that).tooltip
({
trigger: 'click',
placement: 'bottom',
title: copied,
tipClass: 'success',
show:true
});
setTimeout(function()
{
$(that).tooltip('hide');
}, 2000)
})