* devops setting
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
$(function()
|
||||
{
|
||||
$(".form-time").datetimepicker({
|
||||
weekStart: 1,
|
||||
todayBtn: 1,
|
||||
autoclose: 1,
|
||||
todayHighlight: 1,
|
||||
startView: 1,
|
||||
minView: 0,
|
||||
maxView: 1,
|
||||
forceParse: 0,
|
||||
format: 'hh:ii'
|
||||
});
|
||||
|
||||
$("input[type=checkbox][name='autoBackup[]']").on('change', function(event)
|
||||
{
|
||||
var enabled = $("input[type=checkbox][name='autoBackup[]']:checked").length > 0;
|
||||
if(enabled)
|
||||
{
|
||||
$('.backup-settings').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.backup-settings').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("input[type=checkbox][name='autoBackup[]']").change();
|
||||
|
||||
$("#keepDays").on('input', function(event)
|
||||
{
|
||||
console.log(event,event.target.value);
|
||||
event.target.value = event.target.value.replace(/[^\d]+/g,'');
|
||||
if(Number(event.target.value) < 1)
|
||||
{
|
||||
event.target.value = 1;
|
||||
}
|
||||
|
||||
if(Number(event.target.value) > 30)
|
||||
{
|
||||
event.target.value = 30;
|
||||
}
|
||||
});
|
||||
|
||||
$('#backupSettingForm #saveSetting').on('click', function()
|
||||
{
|
||||
var settings = $('#backupSettingForm').serialize();
|
||||
$.post(createLink('instance', 'backupSettings', 'id=' + instanceID), settings).done(function(response)
|
||||
{
|
||||
var res = JSON.parse(response);
|
||||
|
||||
if(res.result == 'success')
|
||||
{
|
||||
parent.window.$.closeModal();
|
||||
parent.window.bootAlert({title: instanceNotices.success, message:res.message});
|
||||
}
|
||||
else
|
||||
{
|
||||
var errMsg = res.message instanceof Array ? res.message.join('<br/>') : res.message;
|
||||
parent.window.bootAlert({title: instanceNotices.fail, message: errMsg});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
$(function()
|
||||
{
|
||||
$('input[type=number]').on('change', function(event)
|
||||
{
|
||||
if($(event.target).val() <= 1) $(event.target).val(1);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
$(function()
|
||||
{
|
||||
$('#installForm').on('submit', function(event)
|
||||
{
|
||||
event.preventDefault();
|
||||
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.installing + '</div>',
|
||||
});
|
||||
|
||||
$.post($('#installForm').attr('action'), $('#installForm').serializeArray()).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
|
||||
let res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
config.onlybody = 'no';
|
||||
window.parent.$.apps.open(res.locate, 'space');
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(res.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("input[type=radio][name='dbType']").on('change', function(event)
|
||||
{
|
||||
if(event.target.value == 'sharedDB')
|
||||
{
|
||||
$("select[name=dbService]").closest('td').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("select[name=dbService]").closest('td').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$(".advanced a").on('click', function(event)
|
||||
{
|
||||
let downArrow = $(".advanced a .icon-chevron-double-down");
|
||||
let upArrow = $(".advanced a .icon-chevron-double-up");
|
||||
if(downArrow.length >0 ) downArrow.removeClass('icon-chevron-double-down').addClass('icon-chevron-double-up');
|
||||
if(upArrow.length >0 ) upArrow.removeClass('icon-chevron-double-up').addClass('icon-chevron-double-down');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
$(function()
|
||||
{
|
||||
$(".form-time").datetimepicker({
|
||||
weekStart: 1,
|
||||
todayBtn: 1,
|
||||
autoclose: 1,
|
||||
todayHighlight: 1,
|
||||
startView: 1,
|
||||
minView: 0,
|
||||
maxView: 1,
|
||||
forceParse: 0,
|
||||
format: 'hh:ii'
|
||||
});
|
||||
|
||||
$("input[type=checkbox][name='autoRestore[]']").on('change', function(event)
|
||||
{
|
||||
var enabled = $("input[type=checkbox][name='autoRestore[]']:checked").length > 0;
|
||||
if(enabled)
|
||||
{
|
||||
$('.restore-settings').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.restore-settings').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("input[type=checkbox][name='autoRestore[]']").change();
|
||||
|
||||
$('#restoreSettingForm #saveSetting').on('click', function()
|
||||
{
|
||||
var settings = $('#restoreSettingForm').serialize();
|
||||
$.post(createLink('instance', 'restoreSettings', 'id=' + instanceID), settings).done(function(response)
|
||||
{
|
||||
var res = JSON.parse(response);
|
||||
|
||||
if(res.result == 'success')
|
||||
{
|
||||
parent.window.$.closeModal();
|
||||
parent.window.bootAlert({title: instanceNotices.success, message:res.message});
|
||||
}
|
||||
else
|
||||
{
|
||||
var errMsg = res.message instanceof Array ? res.message.join('<br/>') : res.message;
|
||||
parent.window.bootAlert({title: instanceNotices.fail, message: errMsg});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
$(function(){
|
||||
$("#toSeniorForm input#readtrue").on('change', function()
|
||||
{
|
||||
if($('#toSeniorForm input#readtrue:checked').length > 0)
|
||||
{
|
||||
$('#toSeniorForm button[type=submit]').attr('disabled', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#toSeniorForm button[type=submit]').attr('disabled', true);
|
||||
}
|
||||
});
|
||||
$("#toSeniorForm input#readtrue").change();
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
$(function()
|
||||
{
|
||||
$('#upgradeForm').on('submit', function(event)
|
||||
{
|
||||
event.preventDefault();
|
||||
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.upgrading + '</div>',
|
||||
});
|
||||
|
||||
$.post($('#upgradeForm').attr('action'), $('#upgradeForm').serializeArray()).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
window.parent.$('#triggerModal').modal('hide');
|
||||
|
||||
let res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
config.onlybody = 'no';
|
||||
window.parent.$.apps.reload('space', createLink('space', 'browse'), 'space');
|
||||
window.parent.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(res.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,502 @@
|
||||
$(function()
|
||||
{
|
||||
$('#memBtn').on('click', function(event)
|
||||
{
|
||||
bootbox.confirm(instanceNotices.adjustMemory, function(result)
|
||||
{
|
||||
if(!result) return;
|
||||
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.adjusting + '</div>',
|
||||
});
|
||||
|
||||
var id = $(event.target).closest('button').attr('instance-id');
|
||||
var url = createLink('instance', 'ajaxAdjustMemory', 'id=' + id, 'json');
|
||||
var adjustData = {memory_kb: $('select[name=memory_kb]').val()};
|
||||
$.post(url, adjustData).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
window.parent.$.apps.open(createLink('instance', 'view', 'id=' + id), 'space');
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.fail,
|
||||
message: res.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$('#ldapBtn').on('click', function(event)
|
||||
{
|
||||
bootbox.confirm(instanceNotices.switchLDAP, function(result)
|
||||
{
|
||||
if(!result) return;
|
||||
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.switching + '</div>',
|
||||
});
|
||||
|
||||
var id = $(event.target).closest('button').attr('instance-id');
|
||||
var url = createLink('instance', 'ajaxSwitchLDAP', 'id=' + id, 'json');
|
||||
var postData = {enableLDAP: $("[name='enableLDAP[]']:checked").length > 0};
|
||||
$.post(url, postData).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
window.parent.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.fail,
|
||||
message: res.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#smtpBtn').on('click', function(event)
|
||||
{
|
||||
bootbox.confirm(instanceNotices.switchSMTP, function(result)
|
||||
{
|
||||
if(!result) return;
|
||||
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.switching + '</div>',
|
||||
});
|
||||
|
||||
var id = $(event.target).closest('button').attr('instance-id');
|
||||
var url = createLink('instance', 'ajaxSwitchSMTP', 'id=' + id, 'json');
|
||||
var postData = {enableSMTP: $("[name='enableSMTP[]']:checked").length > 0};
|
||||
$.post(url, postData).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
window.parent.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.fail,
|
||||
message: res.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#customBtn').on('click', function(event)
|
||||
{
|
||||
var errors = '';
|
||||
$("#customForm").find("input[type=text]").each(function(index, item)
|
||||
{
|
||||
if($(item).val().trim().length == 0)
|
||||
{
|
||||
errors += $(item).attr('placeholder') + instanceNotices.required + '<br/>';
|
||||
}
|
||||
});
|
||||
if(errors.length > 0)
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.error,
|
||||
message: errors,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
bootbox.confirm(instanceNotices.confirmCustom, function(result)
|
||||
{
|
||||
if(!result) return;
|
||||
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.setting + '</div>',
|
||||
});
|
||||
|
||||
var id = $(event.target).closest('button').attr('instance-id');
|
||||
var url = createLink('instance', 'ajaxUpdateCustom', 'id=' + id, 'json');
|
||||
var formData = $('#customForm').serializeArray();
|
||||
var customData = {};
|
||||
formData.forEach(function(item, index){
|
||||
customData[item.name] = item.value;
|
||||
});
|
||||
|
||||
$.post(url, customData).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
window.parent.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.fail,
|
||||
message: res.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$('.btn-uninstall').on('click', function(event)
|
||||
{
|
||||
bootbox.confirm(instanceNotices.confirmUninstall, function(result)
|
||||
{
|
||||
if(!result) return;
|
||||
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.uninstalling + '</div>',
|
||||
});
|
||||
|
||||
var id = $(event.target).closest('button').attr('instance-id');
|
||||
var url = createLink('instance', 'ajaxUninstall', 'id=' + id, 'json');
|
||||
$.post(url).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
window.parent.$.apps.open(createLink('space', 'browse'), 'space');
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.fail,
|
||||
message: res.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('.btn-start').on('click', function(event)
|
||||
{
|
||||
bootbox.confirm(instanceNotices.confirmStart, function(result)
|
||||
{
|
||||
if(!result) return;
|
||||
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.starting + '</div>',
|
||||
});
|
||||
|
||||
var id = $(event.target).closest('button').attr('instance-id');
|
||||
var url = createLink('instance', 'ajaxStart', 'id=' + id, 'json');
|
||||
$.post(url).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
window.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.fail,
|
||||
message: res.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('.btn-stop').on('click', function(event)
|
||||
{
|
||||
bootbox.confirm(instanceNotices.confirmStop, function(result)
|
||||
{
|
||||
if(!result) return;
|
||||
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.stopping + '</div>',
|
||||
});
|
||||
|
||||
var id = $(event.target).closest('button').attr('instance-id');
|
||||
var url = createLink('instance', 'ajaxStop', 'id=' + id, 'json');
|
||||
$.post(url).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
window.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.fail,
|
||||
message: res.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('.btn-backup').on('click', function(event)
|
||||
{
|
||||
$('#confirmRestore').modal('hide');
|
||||
bootbox.confirm(instanceNotices.confirmBackup, function(result)
|
||||
{
|
||||
if(!result) return;
|
||||
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.backuping + '</div>',
|
||||
});
|
||||
|
||||
var id = $(event.target).closest('button').attr('instance-id');
|
||||
var url = createLink('instance', 'ajaxBackup', 'id=' + id, 'json');
|
||||
$.post(url).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.success,
|
||||
message: res.message,
|
||||
callback: function(){window.location.reload();}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.fail,
|
||||
message: res.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('.btn-restore').click(function()
|
||||
{
|
||||
let backupName = $(this).attr('backup-name');
|
||||
let instanceID = $(this).attr('instance-id');
|
||||
$('#confirmRestore #submitRestore').data('backup-name', backupName);
|
||||
$('#confirmRestore #submitRestore').data('instance-id', instanceID);
|
||||
$('#confirmRestore').modal('show');
|
||||
});
|
||||
|
||||
$('#submitRestore').on('click', function(event)
|
||||
{
|
||||
$('#confirmRestore').modal('hide');
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.restoring + '</div>',
|
||||
});
|
||||
|
||||
var instanceID = $(event.target).closest('button').data('instance-id');
|
||||
var backupName = $(event.target).closest('button').data('backup-name');
|
||||
var url = createLink('instance', 'ajaxRestore', '', 'json');
|
||||
$.post(url, { instanceID, backupName }).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.success,
|
||||
message: res.message,
|
||||
callback: function(){window.location.reload();}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.fail,
|
||||
message: res.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.btn-delete-backup').on('click', function(event)
|
||||
{
|
||||
bootbox.confirm(instanceNotices.confirmDelete, function(result)
|
||||
{
|
||||
if(!result) return;
|
||||
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.deleting + '</div>',
|
||||
});
|
||||
|
||||
var id = $(event.target).closest('button').attr('backup-id');
|
||||
var url = createLink('instance', 'ajaxDeleteBackup', 'id=' + id, 'json');
|
||||
$.post(url).done(function(response)
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.success,
|
||||
message: res.message,
|
||||
callback: function(){window.location.reload();}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.fail,
|
||||
message: res.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('button.db-login').on('click', function(event)
|
||||
{
|
||||
var dbName = $(event.target).data('db-name');
|
||||
var dbType = $(event.target).data('db-type');
|
||||
var instanceID = $(event.target).data('id');
|
||||
|
||||
$.post(createLink('instance', 'ajaxDBAuthUrl'), {dbName, dbType, instanceID}).done(function(res)
|
||||
{
|
||||
var response = JSON.parse(res);
|
||||
if(response.result == 'success')
|
||||
{
|
||||
window.parent.open(response.data.url, 'Adminer');
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(response.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var enableTimer = true;
|
||||
window.parent.$(window.parent.document).on('showapp', function(event, app)
|
||||
{
|
||||
enableTimer = app.code == 'space';
|
||||
});
|
||||
|
||||
setInterval(function()
|
||||
{
|
||||
if(!enableTimer) return;
|
||||
|
||||
var statusURL = createLink('instance', 'ajaxStatus');
|
||||
$.post(statusURL, {idList: instanceIdList}).done(function(response)
|
||||
{
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success' && res.data instanceof Array)
|
||||
{
|
||||
res.data.forEach(function(instance)
|
||||
{
|
||||
if($(".instance-status[instance-id=" + instance.id + "]").data('status') != instance.status) window.location.reload();
|
||||
});
|
||||
}
|
||||
if(res.locate) window.parent.location.href = res.locate;
|
||||
});
|
||||
}, 1000 * 5);
|
||||
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
||||
/* Count down for demo instance. */
|
||||
setInterval(function()
|
||||
{
|
||||
var nowSeconds = Math.round((new Date).getTime() / 1000);
|
||||
$('.count-down').each(function(index, item)
|
||||
{
|
||||
var createdAt = $(item).data('created-at');
|
||||
var passSeconds = nowSeconds - createdAt;
|
||||
var leftSeconds = (demoAppLife ? demoAppLife : 30) * 60 - passSeconds;
|
||||
|
||||
if(leftSeconds < 0)
|
||||
{
|
||||
window.parent.location.href = createLink('space', 'browse');
|
||||
}
|
||||
else
|
||||
{
|
||||
var minutes = Math.floor(leftSeconds / 60);
|
||||
var seconds = Math.round(leftSeconds % 60);
|
||||
$(item).find('.left-time').text(('0' + minutes).slice(-2) + ':' + ('0' + seconds).slice(-2));
|
||||
}
|
||||
|
||||
})
|
||||
}, 1000)
|
||||
|
||||
$('#replicas-edit').on('click', function()
|
||||
{
|
||||
$('#replicas-input').show()
|
||||
$('#replicas-text').hide()
|
||||
$('#replicas-save').show()
|
||||
$('#replicas-edit').hide()
|
||||
})
|
||||
|
||||
$('#replicas-save').on('click', function()
|
||||
{
|
||||
var loadingDialog = bootbox.dialog(
|
||||
{
|
||||
message: '<div class="text-center"><i class="icon icon-spinner-indicator icon-spin"></i> ' + instanceNotices.adjusting + '</div>',
|
||||
});
|
||||
|
||||
var id = $(event.target).closest('button').attr('instance-id');
|
||||
var url = createLink('instance', 'replicas', 'id=' + id, 'json');
|
||||
var adjustData = {replicas: $('#replicas-input').val()};
|
||||
$.post(url, adjustData).done(function(response)
|
||||
{
|
||||
|
||||
var res = JSON.parse(response);
|
||||
if(res.result == 'success')
|
||||
{
|
||||
window.parent.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
loadingDialog.modal('hide');
|
||||
bootbox.alert(
|
||||
{
|
||||
title: instanceNotices.fail,
|
||||
message: res.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,43 @@
|
||||
window.openAdminer = 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 reloadTimes = 0;
|
||||
window.afterPageUpdate = function()
|
||||
{
|
||||
setTimeout(function()
|
||||
{
|
||||
if(reloadTimes > 20) return;
|
||||
if($('#statusTD').data('reload') === true || $('#memoryRate').data('load') == true)
|
||||
{
|
||||
reloadTimes++;
|
||||
fetchContent({url: $.createLink('instance', 'view', 'id=' + instanceID),
|
||||
selector: '#instanceInfoContainer',
|
||||
id: 'instanceInfoContainer',
|
||||
target: '#instanceInfoContainer',
|
||||
});
|
||||
}
|
||||
}, 4000);
|
||||
}
|
||||
Reference in New Issue
Block a user