mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Remove schedules from DB when deleting a server.
Add better messaging for support log prep. Add english translation for notify. Chnage dep to 4.0 for tzlocal
This commit is contained in:
parent
ebfd0b1b12
commit
0d3fc43931
@ -197,13 +197,19 @@ class TasksManager:
|
||||
for item in jobs:
|
||||
logger.info("JOB: {}".format(item))
|
||||
|
||||
def remove_all_server_tasks(self, server_id):
|
||||
schedules = management_helper.get_schedules_by_server(server_id)
|
||||
for schedule in schedules:
|
||||
self.remove_job(schedule.schedule_id)
|
||||
|
||||
def remove_job(self, sch_id):
|
||||
job = management_helper.get_scheduled_task_model(sch_id)
|
||||
management_helper.delete_scheduled_task(sch_id)
|
||||
if job.enabled:
|
||||
self.scheduler.remove_job(str(sch_id))
|
||||
logger.info("Job with ID {} was deleted.".format(sch_id))
|
||||
else:
|
||||
logger.info("Job with ID {} was deleted from DB, but was not enabled. Not going to try removing something that doesn't exist from active schedules.")
|
||||
logger.info("Job with ID {} was deleted from DB, but was not enabled. Not going to try removing something that doesn't exist from active schedules.".format(sch_id))
|
||||
|
||||
def update_job(self, sch_id, job_data):
|
||||
management_helper.update_scheduled_task(sch_id, job_data)
|
||||
|
@ -407,6 +407,16 @@ class AjaxHandler(BaseHandler):
|
||||
server_id = self.get_argument('id', None)
|
||||
logger.info(
|
||||
"Removing server from panel for server: {}".format(self.controller.servers.get_server_friendly_name(server_id)))
|
||||
|
||||
server_data = self.controller.get_server_data(server_id)
|
||||
server_name = server_data['server_name']
|
||||
|
||||
self.controller.management.add_to_audit_log(exec_user_id,
|
||||
"Deleted server {} named {}".format(server_id, server_name),
|
||||
server_id,
|
||||
self.get_remote_ip())
|
||||
|
||||
self.tasks_manager.remove_all_server_tasks(server_id)
|
||||
self.controller.remove_server(server_id, False)
|
||||
|
||||
elif page == "delete_server_files":
|
||||
@ -417,6 +427,16 @@ class AjaxHandler(BaseHandler):
|
||||
server_id = self.get_argument('id', None)
|
||||
logger.info(
|
||||
"Removing server and all associated files for server: {}".format(self.controller.servers.get_server_friendly_name(server_id)))
|
||||
|
||||
server_data = self.controller.get_server_data(server_id)
|
||||
server_name = server_data['server_name']
|
||||
|
||||
self.controller.management.add_to_audit_log(exec_user_id,
|
||||
"Deleted server {} named {}".format(server_id, server_name),
|
||||
server_id,
|
||||
self.get_remote_ip())
|
||||
|
||||
self.tasks_manager.remove_all_server_tasks(server_id)
|
||||
self.controller.remove_server(server_id, True)
|
||||
|
||||
@tornado.web.authenticated
|
||||
|
@ -126,28 +126,6 @@ class PanelHandler(BaseHandler):
|
||||
elif page == 'contribute':
|
||||
template = "panel/contribute.html"
|
||||
|
||||
elif page == "remove_server":
|
||||
server_id = self.get_argument('id', None)
|
||||
|
||||
if not exec_user['superuser']:
|
||||
self.redirect("/panel/error?error=Unauthorized access: not superuser")
|
||||
return
|
||||
elif server_id is None:
|
||||
self.redirect("/panel/error?error=Invalid Server ID")
|
||||
return
|
||||
|
||||
server_data = self.controller.get_server_data(server_id)
|
||||
server_name = server_data['server_name']
|
||||
|
||||
self.controller.management.add_to_audit_log(exec_user_data['user_id'],
|
||||
"Deleted server {} named {}".format(server_id, server_name),
|
||||
server_id,
|
||||
self.get_remote_ip())
|
||||
|
||||
self.controller.remove_server(server_id)
|
||||
self.redirect("/panel/dashboard")
|
||||
return
|
||||
|
||||
elif page == 'dashboard':
|
||||
if exec_user['superuser'] == 1:
|
||||
try:
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
<!-- Plugin css for this page -->
|
||||
<link rel="stylesheet" href="/static/assets/vendors/jvectormap/jquery-jvectormap.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<!-- End Plugin css for this page -->
|
||||
|
||||
<!-- Layout styles -->
|
||||
@ -139,7 +140,6 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/5.4.0/bootbox.min.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
$.extend($.fn.dataTable.defaults, {
|
||||
language: {% raw translate('datatables', 'i18n', data['lang']) %}
|
||||
})
|
||||
@ -247,8 +247,8 @@ if (webSocket) {
|
||||
if(x){
|
||||
x.remove()}
|
||||
bootbox.alert({
|
||||
title: 'Download Support Logs?',
|
||||
message: "We've finished preparing your support logs. Please click download to download",
|
||||
title: "{{ translate('notify', 'downloadLogs', data['lang']) }}",
|
||||
message: "{{ translate('notify', 'finishedPreparing', data['lang']) }}",
|
||||
buttons: {
|
||||
ok: {
|
||||
label: 'Download',
|
||||
@ -388,6 +388,19 @@ if (webSocket) {
|
||||
}
|
||||
webSocket.on('notification', notify);
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#support_logs').click(function(){
|
||||
var dialog = bootbox.dialog({
|
||||
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i>{{ translate('notify', 'preparingLogs', data['lang']) }}</p>',
|
||||
closeButton: false
|
||||
});
|
||||
setTimeout(function(){
|
||||
location.href="/panel/support_logs";
|
||||
}, 6000);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{% block js %}
|
||||
|
@ -29,11 +29,11 @@
|
||||
{% end %}
|
||||
<p class="font-weight-light text-muted mb-0">Email: {{ data['user_data']['email'] }}</p>
|
||||
</div>
|
||||
<a class="dropdown-item" href="/panel/support_logs"><i class="dropdown-item-icon mdi mdi-download-outline text-primary"></i> Support Logs</i></a>
|
||||
<a class="dropdown-item" id="support_logs" ><i class="dropdown-item-icon mdi mdi-download-outline text-primary"></i>{{ translate('notify', 'supportLogs', data['lang']) }}</i></a>
|
||||
{% if "Super User" in data['user_role'] %}
|
||||
<a class="dropdown-item" href="/panel/activity_logs"><i class="dropdown-item-icon mdi mdi-calendar-check-outline text-primary"></i> Activity</a>
|
||||
<a class="dropdown-item" href="/panel/activity_logs"><i class="dropdown-item-icon mdi mdi-calendar-check-outline text-primary"></i>{{ translate('notify', 'activityLog', data['lang']) }}</a>
|
||||
{% end %}
|
||||
<a class="dropdown-item" href="/public/logout"><i class="dropdown-item-icon mdi mdi-power text-primary"></i>Sign Out</a>
|
||||
<a class="dropdown-item" href="/public/logout"><i class="dropdown-item-icon mdi mdi-power text-primary"></i>{{ translate('notify', 'logout', data['lang']) }}</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
@ -180,7 +180,14 @@
|
||||
"cannotSee": "Not seeing everything?",
|
||||
"cannotSeeOnMobile": "Try clicking on a scheduled task for full details."
|
||||
},
|
||||
|
||||
"notify":{
|
||||
"supportLogs": "Support Logs",
|
||||
"activityLog": "Activity Logs",
|
||||
"logout": "Logout",
|
||||
"preparingLogs": " Please wait while we prepare your logs... We`ll send a notification when they`re ready. This may take a while for large deployments.",
|
||||
"downloadLogs": "Download Support Logs?",
|
||||
"finishedPreparing": "We've finished preparing your support logs. Please click download to download"
|
||||
},
|
||||
"serverBackups": {
|
||||
"backupNow": "Backup Now!",
|
||||
"backupAtMidnight": "Auto-backup at midnight?",
|
||||
|
@ -1,18 +1,18 @@
|
||||
cryptography~=3.4
|
||||
argon2-cffi~=20.1
|
||||
bleach~=3.1
|
||||
colorama~=0.4
|
||||
cryptography~=3.4
|
||||
libgravatar~=1.0.0
|
||||
peewee~=3.13
|
||||
pexpect~=4.8
|
||||
psutil~=5.7
|
||||
pyOpenSSL~=19.1.0
|
||||
cryptography==3.4
|
||||
argon2-cffi==20.1
|
||||
bleach==3.1
|
||||
colorama==0.4
|
||||
cryptography==3.4
|
||||
libgravatar==1.0.0
|
||||
peewee==3.13
|
||||
pexpect==4.8
|
||||
psutil==5.7
|
||||
pyOpenSSL==19.1.0
|
||||
PyYAML==5.3.1
|
||||
requests~=2.26
|
||||
termcolor~=1.1
|
||||
tornado~=6.0
|
||||
requests==2.26
|
||||
termcolor==1.1
|
||||
tornado==6.0
|
||||
cached_property==1.5.2
|
||||
apscheduler~=3.8.1
|
||||
cron-validator~=1.0.3
|
||||
tzlocal==3.0
|
||||
apscheduler==3.8.1
|
||||
cron-validator==1.0.3
|
||||
tzlocal==4.0
|
Loading…
Reference in New Issue
Block a user