Merge branch 'tweak/password-suggestion' into 'dev'

QOL Fixes

See merge request crafty-controller/crafty-commander!235
This commit is contained in:
Andrew 2022-04-03 01:51:10 +00:00
commit 261a57e034
10 changed files with 829 additions and 692 deletions

View File

@ -72,6 +72,7 @@ class Users_Controller:
up_data[key] = user_data[key]
up_data["last_update"] = helper.get_time_as_string()
up_data["lang"] = user_data["lang"]
up_data["hints"] = user_data["hints"]
logger.debug(f"user: {user_data} +role:{added_roles} -role:{removed_roles}")
for role in added_roles:
users_helper.get_or_create(user_id=user_id, role_id=role)

View File

@ -49,6 +49,7 @@ class Users(Model):
valid_tokens_from = DateTimeField(default=datetime.datetime.now)
server_order = CharField(default="")
preparing = BooleanField(default=False)
hints = BooleanField(default=True)
class Meta:
table_name = "users"

View File

@ -769,6 +769,7 @@ class PanelHandler(BaseHandler):
page_data["user"]["last_ip"] = "N/A"
page_data["user"]["last_update"] = "N/A"
page_data["user"]["roles"] = set()
page_data["user"]["hints"] = True
if Enum_Permissions_Crafty.User_Config not in exec_user_crafty_permissions:
self.redirect(
@ -1734,6 +1735,11 @@ class PanelHandler(BaseHandler):
password1 = bleach.clean(self.get_argument("password1", None))
email = bleach.clean(self.get_argument("email", "default@example.com"))
enabled = int(float(self.get_argument("enabled", "0")))
try:
hints = int(bleach.clean(self.get_argument("hints")))
hints = True
except:
hints = False
lang = bleach.clean(
self.get_argument("language"), helper.get_setting("language")
)
@ -1765,6 +1771,7 @@ class PanelHandler(BaseHandler):
"password": password0,
"email": email,
"lang": lang,
"hints": hints,
}
self.controller.users.update_user(user_id, user_data=user_data)
@ -1806,6 +1813,7 @@ class PanelHandler(BaseHandler):
"roles": roles,
"lang": lang,
"superuser": superuser,
"hints": hints,
}
user_crafty_data = {
"permissions_mask": permissions_mask,
@ -1901,6 +1909,7 @@ class PanelHandler(BaseHandler):
password1 = bleach.clean(self.get_argument("password1", None))
email = bleach.clean(self.get_argument("email", "default@example.com"))
enabled = int(float(self.get_argument("enabled", "0")))
hints = True
lang = bleach.clean(
self.get_argument("lang", helper.get_setting("language"))
)
@ -1942,10 +1951,7 @@ class PanelHandler(BaseHandler):
enabled=enabled,
superuser=new_superuser,
)
user_data = {
"roles": roles,
"lang": lang,
}
user_data = {"roles": roles, "lang": lang, "hints": True}
user_crafty_data = {
"permissions_mask": permissions_mask,
"server_quantity": server_quantity,

View File

@ -24,7 +24,11 @@
<div class="card">
<div class="card-header header-sm d-flex justify-content-between align-items-center">
<h4 class="card-title"><i class="fas fa-history"></i> &nbsp;Audit Logs</h4>
<span class="too_small" title="{{ translate('dashboard', 'cannotSeeOnMobile', data['lang']) }}", data-content="{{ translate('dashboard', 'cannotSeeOnMobile2', data['lang']) }}", data-placement="top"></span>
{% if data['user_data']['hints'] %}
<span class="too_small" title="{{ translate('dashboard', 'cannotSeeOnMobile', data['lang']) }}" ,
data-content="{{ translate('dashboard', 'cannotSeeOnMobile2', data['lang']) }}" ,
data-placement="top"></span>
{% end %}
</div>
<div class="card-body">
@ -60,8 +64,9 @@
</div>
</div>
<style>
.popover-body{
color: white !important;;
.popover-body {
color: white !important;
;
}
</style>
@ -76,37 +81,37 @@
{% block js %}
<script>
$( document ).ready(function() {
$(document).ready(function () {
console.log('ready for JS!')
$('#audit_table').DataTable({
'order': [1, 'desc']
}
);
});
});
</script>
<script>
$(document).ready(function(){
$(document).ready(function () {
$('[data-toggle="popover"]').popover();
if($(window).width() < 1000){
if ($(window).width() < 1000) {
$('.too_small').popover("show");
}
});
$(window).ready(function(){
$('body').click(function(){
$(window).ready(function () {
$('body').click(function () {
$('.too_small').popover("hide");
});
});
$(window).resize(function() {
$(window).resize(function () {
// This will execute whenever the window is resized
if($(window).width() < 1000){
if ($(window).width() < 1000) {
$('.too_small').popover("show");
}
else{
else {
$('.too_small').popover("hide");
} // New width
});
</script>
</script>
{% end %}

View File

@ -15,7 +15,8 @@
<div class="page-header">
<h4 class="page-title">{{ translate('dashboard', 'dashboard', data['lang']) }}
{% if data['server_stats']['running'] != 0 %}
<span id="sync" style="margin-left: 5px;"><i class="fas fa-sync fa-spin"></i></span></h4>
<span id="sync" style="margin-left: 5px;"><i class="fas fa-sync fa-spin"></i></span>
</h4>
{% end %}
</div>
</div>
@ -74,7 +75,8 @@
<h3 class="mb-0 font-weight-semibold" id="total_players">{{ data['num_players'] }}</h3>
</div>
<div class="wrapper my-auto ml-auto ml-lg-4">
<p class="mb-0 text-warning"><span id="max_players">0</span> {{ translate('dashboard', 'max', data['lang']) }}</p>
<p class="mb-0 text-warning"><span id="max_players">0</span> {{ translate('dashboard', 'max',
data['lang']) }}</p>
</div>
</div>
</div>
@ -91,10 +93,12 @@
<h4 class="card-title"><i class="fas fa-server"></i> &nbsp;{{ translate('dashboard', 'allServers',
data['lang']) }}</h4>
{% if len(data['servers']) > 0 %}
{% if data['user_data']['hints'] %}
<span class="too_small" title="{{ translate('dashboard', 'cannotSeeOnMobile', data['lang']) }}" ,
data-content="{{ translate('dashboard', 'cannotSeeOnMobile2', data['lang']) }}" ,
data-placement="top"></span>
{% end %}
{% end %}
<div><a class="nav-link" href="/server/step1"><i class="fas fa-plus-circle"></i> &nbsp; {{
translate('dashboard', 'newServer', data['lang']) }}</a></div>
</div>
@ -136,18 +140,18 @@
<td draggable="false" id="controls{{server['server_data']['server_id']}}" class="actions_serverlist">
{% if server['user_command_permission'] %}
{% if server['stats']['running'] %}
<a data-id="{{server['server_data']['server_id']}}" class="stop_button"
data-toggle="tooltip" title="{{ translate('dashboard', 'stop' , data['lang']) }}">
<a data-id="{{server['server_data']['server_id']}}" class="stop_button" data-toggle="tooltip"
title="{{ translate('dashboard', 'stop' , data['lang']) }}">
<i class="fas fa-stop"></i>
</a> &nbsp;
<a data-id="{{server['server_data']['server_id']}}" class="restart_button"
data-toggle="tooltip" title="{{ translate('dashboard', 'restart' , data['lang']) }}">
<a data-id="{{server['server_data']['server_id']}}" class="restart_button" data-toggle="tooltip"
title="{{ translate('dashboard', 'restart' , data['lang']) }}">
<i class="fas fa-sync"></i>
</a> &nbsp;
<a data-id="{{server['server_data']['server_id']}}" class="kill_button"
data-toggle="tooltip" title="{{ translate('dashboard', 'kill' , data['lang']) }}">
<a data-id="{{server['server_data']['server_id']}}" class="kill_button" data-toggle="tooltip"
title="{{ translate('dashboard', 'kill' , data['lang']) }}">
<i class="fas fa-skull"></i>
</a> &nbsp;
@ -161,19 +165,20 @@
translate('dashboard', 'delay-explained' , data['lang'])}}">{{ translate('dashboard', 'starting',
data['lang']) }}</i></a>
{% elif server['stats']['downloading']%}
<a data-id="{{server['server_data']['server_id']}}" class=""><i class="fa fa-spinner fa-spin"></i> {{ translate('serverTerm', 'downloading',
<a data-id="{{server['server_data']['server_id']}}" class=""><i class="fa fa-spinner fa-spin"></i>
{{ translate('serverTerm', 'downloading',
data['lang']) }}</a>
{% else %}
<a data-id="{{server['server_data']['server_id']}}" class="play_button"
data-toggle="tooltip" title="{{ translate('dashboard', 'start' , data['lang']) }}">
<a data-id="{{server['server_data']['server_id']}}" class="play_button" data-toggle="tooltip"
title="{{ translate('dashboard', 'start' , data['lang']) }}">
<i class="fas fa-play"></i>
</a> &nbsp;
<a data-id="{{server['server_data']['server_id']}}" class="clone_button"
data-toggle="tooltip" title="{{ translate('dashboard', 'clone' , data['lang']) }}">
<a data-id="{{server['server_data']['server_id']}}" class="clone_button" data-toggle="tooltip"
title="{{ translate('dashboard', 'clone' , data['lang']) }}">
<i class="fas fa-clone"></i>
</a> &nbsp;
<a data-id="{{server['server_data']['server_id']}}" class="kill_button"
data-toggle="tooltip" title="{{ translate('dashboard', 'kill' , data['lang']) }}">
<a data-id="{{server['server_data']['server_id']}}" class="kill_button" data-toggle="tooltip"
title="{{ translate('dashboard', 'kill' , data['lang']) }}">
<i class="fas fa-skull"></i>
</a> &nbsp;
{% end %}
@ -228,7 +233,9 @@
data['lang']) }} <br />
{% if server['stats']['desc'] != 'False' %}
<div id="desc_id" style="overflow-wrap: break-word !important; max-width: 85px !important; overflow: scroll;">{{ server['stats']['desc'] }}</div> <br />
<div id="desc_id"
style="overflow-wrap: break-word !important; max-width: 85px !important; overflow: scroll;">{{
server['stats']['desc'] }}</div> <br />
{% end %}
{% if server['stats']['version'] != 'False' %}
@ -242,14 +249,16 @@
<span class="text-success"><i class="fas fa-signal"></i> {{ translate('dashboard', 'online',
data['lang']) }}</span>
{% elif server['stats']['crashed'] %}
<span class="text-danger"><i class="fas fa-exclamation-triangle"></i> {{ translate('dashboard', 'crashed',
<span class="text-danger"><i class="fas fa-exclamation-triangle"></i> {{ translate('dashboard',
'crashed',
data['lang']) }}</span>
{% else %}
<span class="text-warning"><i class="fas fa-ban"></i> {{ translate('dashboard', 'offline',
data['lang']) }}</span>
{% end %}
</td>
<span class="server-player-totals" id="server_players_{{server['server_data']['server_id']}}" data-players="{{ server['stats']['online']}}" data-max="{{ server['stats']['max'] }}"></span>
<span class="server-player-totals" id="server_players_{{server['server_data']['server_id']}}"
data-players="{{ server['stats']['online']}}" data-max="{{ server['stats']['max'] }}"></span>
</tr>
{% end %}
@ -271,15 +280,19 @@
color: white !important;
;
}
#desc_id {
-ms-overflow-style: none; /* for Internet Explorer, Edge */
scrollbar-width: none; /* for Firefox */
overflow-y: scroll;
}
#desc_id::-webkit-scrollbar {
display: none; /* for Chrome, Safari, and Opera */
}
#desc_id {
-ms-overflow-style: none;
/* for Internet Explorer, Edge */
scrollbar-width: none;
/* for Firefox */
overflow-y: scroll;
}
#desc_id::-webkit-scrollbar {
display: none;
/* for Chrome, Safari, and Opera */
}
</style>
@ -296,20 +309,20 @@
};
}
$(document).ready(function() {
$(document).ready(function () {
$('[data-toggle="popover"]').popover();
if ($(window).width() < 1000) {
$('.too_small').popover("show");
}
});
$(window).ready(function() {
$('body').click(function() {
$(window).ready(function () {
$('body').click(function () {
$('.too_small').popover("hide");
});
});
$(window).resize(function() {
$(window).resize(function () {
// This will execute whenever the window is resized
if ($(window).width() < 1000) {
$('.too_small').popover("show");
@ -379,7 +392,7 @@
cpu_status = "bg-warning";
}
server_cpu.innerHTML = `<div class="progress mb-1" data-toggle="tooltip" data-placement="top" title="`+ server.cpu +`"><div class="progress-bar `+ cpu_status + `" role="progressbar" style="width: `+ server.cpu + `%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div></div>`+ server.cpu +`%`;
server_cpu.innerHTML = `<div class="progress mb-1" data-toggle="tooltip" data-placement="top" title="` + server.cpu + `"><div class="progress-bar ` + cpu_status + `" role="progressbar" style="width: ` + server.cpu + `%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div></div>` + server.cpu + `%`;
/* Update Memory */
@ -396,7 +409,7 @@
total_mem = server.mem;
}
server_mem.innerHTML = `<div class="progress mb-1" data-toggle="tooltip" data-placement="top" title="`+ server_mem +`"><div class="progress-bar `+ mem_status + `" role="progressbar" style="width: `+ server.mem_percent + `%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div></div>`+ server.mem_percent +`% - ` + total_mem;
server_mem.innerHTML = `<div class="progress mb-1" data-toggle="tooltip" data-placement="top" title="` + server_mem + `"><div class="progress-bar ` + mem_status + `" role="progressbar" style="width: ` + server.mem_percent + `%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div></div>` + server.mem_percent + `% - ` + total_mem;
/* Update World Infos */
server_world.innerHTML = server.world_size
@ -412,7 +425,7 @@
let servers = document.getElementsByClassName("server-player-totals");
let all_total_players = 0;
let all_total_max_players = 0;
for(let i = 0; i < servers.length; i++) {
for (let i = 0; i < servers.length; i++) {
try {
all_total_players += parseInt(servers[i].getAttribute('data-players'));
all_total_max_players += parseInt(servers[i].getAttribute('data-max'));
@ -461,15 +474,15 @@
try {
update_one_server_status(data[0]);
} catch (e) {
console.log ('Failed to update server stats', e)
console.log('Failed to update server stats', e)
}
display_motd();
}
$(document).ready(function() {
$(document).ready(function () {
console.log('ready for JS!')
$(".play_button").click(function() {
$(".play_button").click(function () {
server_id = $(this).attr("data-id");
send_command(server_id, 'start_server');
bootbox.alert({
@ -479,7 +492,7 @@
});
});
$(".stop_button").click(function() {
$(".stop_button").click(function () {
console.log("stopping server");
server_id = $(this).attr("data-id");
send_command(server_id, 'stop_server');
@ -490,7 +503,7 @@
});
});
$(".restart_button").click(function() {
$(".restart_button").click(function () {
server_id = $(this).attr("data-id");
send_command(server_id, 'restart_server');
bootbox.alert({
@ -499,7 +512,7 @@
message: '<div align="center"><i class="fas fa-spin fa-spinner"></i> &nbsp; {% raw translate("dashboard", "bePatientRestart", data["lang"]) %} </div>'
});
});
$(".kill_button").click(function() {
$(".kill_button").click(function () {
server_id = $(this).attr("data-id");
bootbox.confirm({
message: "This will kill the server process and all it's subprocesses. Killing a process can potentially corrupt files. Only do this in extreme circumstances. Are you sure you would like to continue?",
@ -513,7 +526,7 @@
className: 'btn-secondary'
}
},
callback: function(result) {
callback: function (result) {
if (result) {
send_kill(server_id);
let dialog = bootbox.dialog({
@ -521,8 +534,8 @@
message: '<p><i class="fa fa-spin fa-spinner"></i> Loading...</p>'
});
dialog.init(function() {
setTimeout(function() {
dialog.init(function () {
setTimeout(function () {
location.reload();
}, 15000);
});
@ -537,7 +550,7 @@
mem_percent = document.getElementById('mem_percent');
webSocket.on('update_host_stats', function(hostStats) {
webSocket.on('update_host_stats', function (hostStats) {
let cpuDataTitle = `{% raw translate('dashboard', 'cpuCores', data['lang']) %}: ${hostStats.cpu_cores} <br /> {% raw translate("dashboard", "cpuCurFreq", data['lang']) %}: ${hostStats.cpu_cur_freq} <br /> {% raw translate("dashboard", "cpuMaxFreq", data['lang']) %}: ${hostStats.cpu_max_freq}`;
cpu_data.setAttribute('data-original-title', cpuDataTitle);
cpu_usage.textContent = hostStats.cpu_usage;
@ -547,13 +560,13 @@
}
if (webSocket) {
webSocket.on('send_start_reload', function() {
webSocket.on('send_start_reload', function () {
location.reload()
});
}
if (webSocket) {
webSocket.on('update_button_status', function(updateButton) {
webSocket.on('update_button_status', function (updateButton) {
let serverId = updateButton.server_id;
let message = updateButton.string;
let updating = updateButton.isUpdating;
@ -572,7 +585,7 @@
webSocket.on('update_server_status', update_servers_status);
}
$(".clone_button").click(function() {
$(".clone_button").click(function () {
server_id = $(this).attr("data-id");
send_command(server_id, 'clone_server');
bootbox.alert({
@ -589,21 +602,25 @@
<link rel="stylesheet" href="/static/assets/css/jquery-ui.structure.css">
<style>
@media only screen and (max-width: 760px) {
#mobile { display: none; }
#mobile {
display: none;
}
}
.ui-sortable-handle {
cursor: default;
padding:2px;
padding: 2px;
}
.ui-sortable-handle:hover {
cursor: grab !important;
padding:2px;
padding: 2px;
}
</style>
<script>
/* Search Bar */
$(document).ready(function() {
$(document).ready(function () {
let servers_table = $('#servers_table').DataTable({
"ordering": false, // false to disable sorting (or any other option)
"paging": false
@ -613,9 +630,9 @@
});
/* Search Bar End */
$(document).on("mousedown keyup click", function(event) {
$(document).on("mousedown keyup click", function (event) {
const value = $('.dataTables_filter input').val();
const is_mobile = $('#mobile').css('display')=='none';
const is_mobile = $('#mobile').css('display') === 'none';
if ($("table#servers_table tbody").sortable("toArray").length > 1 && value === '' && !is_mobile) {
$("table#servers_table tbody").sortable("enable");
@ -624,18 +641,18 @@
}
});
$(document).ready(function() {
$(document).ready(function () {
function sendOrder(id_string) {
const token = getCookie("_xsrf")
$.ajax({
type: "POST",
headers: {'X-XSRFToken': token},
url: '/ajax/send_order?order='+id_string,
headers: { 'X-XSRFToken': token },
url: '/ajax/send_order?order=' + id_string,
data: {
order: id_string,
},
success: function(data) {
success: function (data) {
console.log("got response:");
console.log(data);
},
@ -649,10 +666,10 @@ $(document).ready(function() {
cursor: "grabbing",
axis: "y",
revert: true,
handle:"i.fas.fa-server,a",
handle: "i.fas.fa-server,a",
forcePlaceholderSize: true,
placeholder:'table-placeholder',
deactivate: function(event, ui) {
placeholder: 'table-placeholder',
deactivate: function (event, ui) {
// Gets the list of ids in the server list as an array,
// and joins the elements with an [,] and sends to the server.
const ids = $("table#servers_table tbody").sortable("toArray").join();
@ -674,10 +691,10 @@ $(document).ready(function() {
// Fixes the appearance of a scrollbar when a user tries to drag an item too low
// Disabled on mobile since sorting is disabled on mobile
if($('#mobile').css('display') != 'none'){
if ($('#mobile').css('display') !== 'none') {
$("div#servers_table_wrapper").css({ overflow: "hidden" });
}
});
});
</script>

View File

@ -30,11 +30,16 @@
<div class="col-md-12 col-lg-12 grid-margin stretch-card">
<div class="card">
<div class="card-header header-sm d-flex justify-content-between align-items-center">
<h4 class="card-title"><i class="fas fa-users"></i> {{ translate('panelConfig', 'users', data['lang']) }}</h4>
<span class="too_small" title="{{ translate('dashboard', 'cannotSee', data['lang']) }}", data-content="{{ translate('dashboard', 'cannotSeeOnMobile2', data['lang']) }}", data-placement="top"></span>
<h4 class="card-title"><i class="fas fa-users"></i> {{ translate('panelConfig', 'users', data['lang'])
}}</h4>
{% if data['user_data']['hints'] %}
<span class="too_small" title="{{ translate('dashboard', 'cannotSee', data['lang']) }}" ,
data-content="{{ translate('dashboard', 'cannotSeeOnMobile2', data['lang']) }}" ,
data-placement="top"></span>
{% end %}
<!-- TODO: Translate the following -->
<div><a class="nav-link" href="/panel/add_user"><i class="fas fa-plus-circle"></i> &nbsp; {{ translate('panelConfig', 'newUser', data['lang']) }}</a></div>
<div><a class="nav-link" href="/panel/add_user"><i class="fas fa-plus-circle"></i> &nbsp; {{
translate('panelConfig', 'newUser', data['lang']) }}</a></div>
</div>
<div class="card-body">
<div class="table-responsive">
@ -93,9 +98,15 @@
<div class="col-md-12 col-lg-12 grid-margin stretch-card">
<div class="card">
<div class="card-header header-sm d-flex justify-content-between align-items-center">
<h4 class="card-title"><i class="fas fa-user-tag"></i> {{ translate('panelConfig', 'roles', data['lang']) }}</h4>
<span class="too_small2" title="{{ translate('dashboard', 'cannotSee', data['lang']) }}", data-content="{{ translate('dashboard', 'cannotSeeOnMobile2', data['lang']) }}", data-placement="top"></span>
<div><a class="nav-link" href="/panel/add_role"><i class="fas fa-plus-circle"></i> &nbsp; {{ translate('panelConfig', 'newRole', data['lang']) }}</a></div>
<h4 class="card-title"><i class="fas fa-user-tag"></i> {{ translate('panelConfig', 'roles',
data['lang']) }}</h4>
{% if data['user_data']['hints'] %}
<span class="too_small2" title="{{ translate('dashboard', 'cannotSee', data['lang']) }}" ,
data-content="{{ translate('dashboard', 'cannotSeeOnMobile2', data['lang']) }}" ,
data-placement="top"></span>
{% end %}
<div><a class="nav-link" href="/panel/add_role"><i class="fas fa-plus-circle"></i> &nbsp; {{
translate('panelConfig', 'newRole', data['lang']) }}</a></div>
</div>
<div class="card-body">
<div class="table-responsive">
@ -120,7 +131,8 @@
{% end %}
</ul>
</td>
<td><ul>
<td>
<ul>
{% for user in data['users'] %}
{% for ruser in data['user-roles'][user.user_id] %}
{% if ruser == role.role_name %}
@ -146,10 +158,12 @@
<div class="col-md-12 col-lg-12 grid-margin stretch-card">
<div class="card">
<div class="card-header header-sm d-flex justify-content-between align-items-center">
<h4 class="card-title"><i class="fas fa-user-tag"></i> {{ translate('panelConfig', 'adminControls', data['lang']) }}</h4>
<h4 class="card-title"><i class="fas fa-user-tag"></i> {{ translate('panelConfig', 'adminControls',
data['lang']) }}</h4>
</div>
<div class="card-body">
<button type="button" class="btn btn-outline-danger clear-comm">{{ translate('panelConfig', 'clearComms', data['lang']) }}</button>
<button type="button" class="btn btn-outline-danger clear-comm">{{ translate('panelConfig',
'clearComms', data['lang']) }}</button>
</div>
</div>
@ -165,9 +179,10 @@
</div>
<style>
.popover-body{
color: white !important;;
}
.popover-body {
color: white !important;
;
}
</style>
<!-- content-wrapper ends -->
@ -175,44 +190,44 @@
{% block js %}
<script>
$(document).ready(function(){
$(document).ready(function () {
$('[data-toggle="popover"]').popover();
if($(window).width() < 1000){
if ($(window).width() < 1000) {
$('.too_small').popover("show");
$('.too_small2').popover("show");
}
});
$(window).ready(function(){
$('body').click(function(){
});
$(window).ready(function () {
$('body').click(function () {
$('.too_small').popover("hide");
$('.too_small2').popover("hide");
});
});
$(window).resize(function() {
});
$(window).resize(function () {
// This will execute whenever the window is resized
if($(window).width() < 1000){
if ($(window).width() < 1000) {
$('.too_small').popover("show");
}
else{
else {
$('.too_small').popover("hide");
} // New width
if($(window).width() < 1000){
if ($(window).width() < 1000) {
$('.too_small2').popover("show");
}
else{
else {
$('.too_small2').popover("hide");
} // New width
});
});
</script>
<script>
$( document ).ready(function() {
$(document).ready(function () {
console.log('ready for JS!')
});
});
$( ".show_button" ).click(function() {
$(".show_button").click(function () {
console.log("showing key");
api_key = $(this).attr("data-id");
bootbox.alert({
@ -226,12 +241,12 @@ $( document ).ready(function() {
var token = getCookie("_xsrf")
$.ajax({
type: "POST",
headers: {'X-XSRFToken': token},
headers: { 'X-XSRFToken': token },
url: '/ajax/clear_comm',
success: function (data) {
},
});
})
})
</script>
{% end %}

View File

@ -21,7 +21,7 @@
</h4>
{% else %}
<h4 class="page-title">
{{ translate('userConfig', 'pageTitle', data['lang']) }} - {{ data['user']['user_id'] }}
{{ translate('userConfig', 'pageTitle', data['lang']) }}
<br />
<small>UID: {{ data['user']['user_id'] }}</small>
</h4>
@ -39,13 +39,16 @@
<div class="card-body pt-0">
<ul class="nav nav-tabs col-md-12 tab-simple-styled " role="tablist">
<li class="nav-item">
<a class="nav-link active" href="/panel/{{ 'add_user' if data['new_user'] else 'edit_user' }}?id={{ data['user']['user_id'] }}&subpage=config" role="tab" aria-selected="true">
<i class="fas fa-cogs"></i> {{ translate('userConfig', 'config', data['lang']) }} - {{ data['user']['user_id'] }}</a>
<a class="nav-link active"
href="/panel/{{ 'add_user' if data['new_user'] else 'edit_user' }}?id={{ data['user']['user_id'] }}&subpage=config"
role="tab" aria-selected="true">
<i class="fas fa-cogs"></i> {{ translate('userConfig', 'config', data['lang']) }}</a>
</li>
{% if not data['new_user'] %}
<li class="nav-item">
<a class="nav-link" href="/panel/edit_user_apikeys?id={{ data['user']['user_id'] }}" role="tab" aria-selected="false">
<i class="fas fa-key"></i>{{ translate('userConfig', 'apiKey', data['lang']) }} - {{ data['user']['user_id'] }}</a>
<a class="nav-link" href="/panel/edit_user_apikeys?id={{ data['user']['user_id'] }}" role="tab"
aria-selected="false">
<i class="fas fa-key"></i>{{ translate('userConfig', 'apiKey', data['lang']) }}</a>
</li>
{% end %}
</ul>
@ -64,28 +67,43 @@
<div class="card">
<div class="card-header header-sm d-flex justify-content-between align-items-center">
<h4 class="card-title"><i class="fas fa-user"></i> {{ translate('userConfig', 'userSettings', data['lang']) }} - {{ data['user']['user_id'] }}</h4>
<h4 class="card-title"><i class="fas fa-user"></i> {{ translate('userConfig', 'userSettings',
data['lang']) }}</h4>
</div>
<div class="card-body">
<div class="form-group">
<label class="form-label" for="username">{{ translate('userConfig', 'userName', data['lang']) }} - {{ data['user']['user_id'] }}<small class="text-muted ml-1"> - {{ translate('userConfig', 'userNameDesc', data['lang']) }} - {{ data['user']['user_id'] }}</small> </label>
<input type="text" class="form-control" name="username" id="username" value="{{ data['user']['username'] }}" placeholder="User Name" >
<label class="form-label" for="username">{{ translate('userConfig', 'userName', data['lang'])
}}<small class="text-muted ml-1"> - {{ translate('userConfig', 'userNameDesc', data['lang'])
}}</small> </label>
<input type="text" class="form-control" name="username" id="username"
value="{{ data['user']['username'] }}" placeholder="User Name">
</div>
<div class="form-group">
<label class="form-label" for="password0">{{ translate('userConfig', 'password', data['lang']) }} - {{ data['user']['user_id'] }}<small class="text-muted ml-1"> - {{ translate('userConfig', 'leaveBlank', data['lang']) }} - {{ data['user']['user_id'] }}</small> </label>
<input type="password" class="form-control" name="password0" id="password0" value="" placeholder="Password" >
<label class="form-label" for="password0">{{ translate('userConfig', 'password', data['lang'])
}}<small class="text-muted ml-1"> - {{ translate('userConfig', 'leaveBlank', data['lang']) }}
</small> </label>
<input type="password" class="form-control" name="password0" id="password0" value=""
placeholder="Password">
</div>
<div class="form-group">
<label class="form-label" for="password1">{{ translate('userConfig', 'repeat', data['lang']) }} - {{ data['user']['user_id'] }} <small class="text-muted ml-1"> - {{ translate('userConfig', 'leaveBlank', data['lang']) }} - {{ data['user']['user_id'] }}</small> </label>
<input type="password" class="form-control" name="password1" id="password1" value="" placeholder="Repeat Password" >
<label class="form-label" for="password1">{{ translate('userConfig', 'repeat', data['lang']) }}
<small class="text-muted ml-1"> - {{ translate('userConfig', 'leaveBlank', data['lang'])
}}</small> </label>
<input type="password" class="form-control" name="password1" id="password1" value=""
placeholder="Repeat Password">
</div>
<div class="form-group">
<label class="form-label" for="email">{{ translate('userConfig', 'gravEmail', data['lang']) }} - {{ data['user']['user_id'] }}<small class="text-muted ml-1"> - {{ translate('userConfig', 'gravDesc', data['lang']) }} - {{ data['user']['user_id'] }}</small> </label>
<input type="email" class="form-control" name="email" id="email" value="{{ data['user']['email'] }}" placeholder="Gravatar Email" >
<label class="form-label" for="email">{{ translate('userConfig', 'gravEmail', data['lang'])
}}<small class="text-muted ml-1"> - {{ translate('userConfig', 'gravDesc', data['lang'])
}}</small> </label>
<input type="email" class="form-control" name="email" id="email"
value="{{ data['user']['email'] }}" placeholder="Gravatar Email">
</div>
<div class="form-group">
<label class="form-label" for="language">{{ translate('userConfig', 'userLang', data['lang']) }}</label>
<select class="form-select form-control form-control-lg select-css" id="language" name="language" form="user_form">
<label class="form-label" for="language">{{ translate('userConfig', 'userLang', data['lang'])
}}</label>
<select class="form-select form-control form-control-lg select-css" id="language"
name="language" form="user_form">
{% for lang in data['languages'] %}
{% if not 'incomplete' in lang %}
<option value="{{lang}}">{{lang}}</option>
@ -100,7 +118,9 @@
<div class="card">
<div class="card-header header-sm d-flex justify-content-between align-items-center">
<h4 class="card-title"><i class="fas fa-user-tag"></i> {{ translate('userConfig', 'userRoles', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('userConfig', 'userRolesDesc', data['lang']) }}</small></h4>
<h4 class="card-title"><i class="fas fa-user-tag"></i> {{ translate('userConfig', 'userRoles',
data['lang']) }} <small class="text-muted ml-1"> - {{ translate('userConfig', 'userRolesDesc',
data['lang']) }}</small></h4>
</div>
<div class="card-body">
<div class="form-group">
@ -118,9 +138,13 @@
<td>{{ role.role_name }}</td>
<td>
{% if role.role_id in data['user']['roles'] %}
<input type="checkbox" class="form-check-input" id="role_{{ role.role_id }}_membership" name="role_{{ role.role_id }}_membership" checked="" value="1">
<input type="checkbox" class="form-check-input"
id="role_{{ role.role_id }}_membership" name="role_{{ role.role_id }}_membership"
checked="" value="1">
{% else %}
<input type="checkbox" class="form-check-input" id="role_{{ role.role_id }}_membership" name="role_{{ role.role_id }}_membership" value="1">
<input type="checkbox" class="form-check-input"
id="role_{{ role.role_id }}_membership" name="role_{{ role.role_id }}_membership"
value="1">
{% end %}
</td>
@ -137,7 +161,9 @@
<div class="card">
<div class="card-header header-sm d-flex justify-content-between align-items-center">
<h4 class="card-title"><i class="fas fa-user-lock"></i> {{ translate('userConfig', 'craftyPerms', data['lang']) }} <small class="text-muted ml-1"> - {{ translate('userConfig', 'craftyPermDesc', data['lang']) }}</small></h4>
<h4 class="card-title"><i class="fas fa-user-lock"></i> {{ translate('userConfig', 'craftyPerms',
data['lang']) }} <small class="text-muted ml-1"> - {{ translate('userConfig', 'craftyPermDesc',
data['lang']) }}</small></h4>
</div>
<div class="card-body">
<div class="form-group">
@ -156,12 +182,16 @@
<td>{{ permission.name }}</td>
<td>
{% if permission in data['permissions_list'] %}
<input type="checkbox" class="form-check-input" id="permission_{{ permission.name }}" name="permission_{{ permission.name }}" checked="" value="1">
<input type="checkbox" class="form-check-input" id="permission_{{ permission.name }}"
name="permission_{{ permission.name }}" checked="" value="1">
{% else %}
<input type="checkbox" class="form-check-input" id="permission_{{ permission.name }}" name="permission_{{ permission.name }}" value="1">
<input type="checkbox" class="form-check-input" id="permission_{{ permission.name }}"
name="permission_{{ permission.name }}" value="1">
{% end %}
</td>
<td><input type="text" class="form-control" name="quantity_{{ permission.name }}" id="quantity_{{ permission.name }}" value="{{ data['quantity_server'][permission.name] }}"></td>
<td><input type="text" class="form-control" name="quantity_{{ permission.name }}"
id="quantity_{{ permission.name }}"
value="{{ data['quantity_server'][permission.name] }}"></td>
</tr>
{% end %}
</tbody>
@ -174,31 +204,50 @@
<div class="form-check-flat">
<label for="enabled" class="form-check-label ml-4 mb-4">
{% if data['user']['enabled'] %}
<input type="checkbox" class="form-check-input" id="enabled" name="enabled" checked="" value="1">{{ translate('userConfig', 'enabled', data['lang']) }}
<input type="checkbox" class="form-check-input" id="enabled" name="enabled" checked=""
value="1">{{ translate('userConfig', 'enabled', data['lang']) }}
{% else %}
<input type="checkbox" class="form-check-input" id="enabled" name="enabled" value="1">{{ translate('userConfig', 'enabled', data['lang']) }}
<input type="checkbox" class="form-check-input" id="enabled" name="enabled" value="1">{{
translate('userConfig', 'enabled', data['lang']) }}
{% end %}
</label>
<label for="superuser" class="form-check-label ml-4 mb-4">
{% if data['user']['superuser'] %}
<input type="checkbox" onclick="superConfirm()" class="form-check-input" id="superuser" name="superuser" checked="" value="1" {{ data['super-disabled'] }} >{{ translate('userConfig', 'super', data['lang']) }}
<input type="checkbox" onclick="superConfirm()" class="form-check-input" id="superuser"
name="superuser" checked="" value="1" {{ data['super-disabled'] }}>{{ translate('userConfig',
'super', data['lang']) }}
{% else %}
<input type="checkbox" onclick="superConfirm()" class="form-check-input" id="superuser" name="superuser" {{ data['super-disabled'] }} value="1" >{{ translate('userConfig', 'super', data['lang']) }}
<input type="checkbox" onclick="superConfirm()" class="form-check-input" id="superuser"
name="superuser" {{ data['super-disabled'] }} value="1">{{ translate('userConfig', 'super',
data['lang']) }}
{% end %}
</label>
<label for="hints" class="form-check-label ml-4 mb-4">
{% if data['user']['hints'] %}
<input type="checkbox" class="form-check-input" id="hints" name="hints" checked=""
value="1">Enable Hints?
{% else %}
<input type="checkbox" class="form-check-input" id="hints" name="hints" value="1"> Enable
Hints?
{% end %}
</label>
</div>
<button type="submit" class="btn btn-success mr-2"><i class="fas fa-save"></i> {{ translate('panelConfig', 'save', data['lang']) }}</button>
<button type="reset" onclick="location.href='/panel/panel_config'" class="btn btn-light"><i class="fas fa-undo-alt"></i> {{ translate('panelConfig', 'cancel', data['lang']) }}</button>
<button type="submit" class="btn btn-success mr-2"><i class="fas fa-save"></i> {{
translate('panelConfig', 'save', data['lang']) }}</button>
<button type="reset" onclick="location.href='/panel/panel_config'" class="btn btn-light"><i
class="fas fa-undo-alt"></i> {{ translate('panelConfig', 'cancel', data['lang']) }}</button>
</form>
</div>
<div class="col-md-6 col-sm-12">
<div class="card">
<div class="card-body">
<h4 class="card-title"><i class="fas fa-user-cog"></i> {{ translate('userConfig', 'configArea', data['lang']) }}</h4>
<h4 class="card-title"><i class="fas fa-user-cog"></i> {{ translate('userConfig', 'configArea',
data['lang']) }}</h4>
<p class="card-description"> {{ translate('userConfig', 'configAreaDesc', data['lang']) }}</p>
<blockquote class="blockquote">
<p class="mb-0">
@ -216,13 +265,16 @@
</div>
<div class="text-center">
{% if data['new_user'] %}
<a class="btn btn-sm btn-danger disabled"><i class="fas fa-trash"></i>{{ translate('userConfig', 'deleteUserB', data['lang']) }}</a><br />
<a class="btn btn-sm btn-danger disabled"><i class="fas fa-trash"></i>{{ translate('userConfig',
'deleteUserB', data['lang']) }}</a><br />
<small>{{ translate('userConfig', 'notExist', data['lang']) }}</small>
{% elif data['user']['superuser'] %}
<a class="btn btn-sm btn-danger disabled"><i class="fas fa-trash"></i> {{ translate('userConfig', 'deleteUserB', data['lang']) }}</a><br />
<a class="btn btn-sm btn-danger disabled"><i class="fas fa-trash"></i> {{ translate('userConfig',
'deleteUserB', data['lang']) }}</a><br />
<small>{{ translate('userConfig', 'delSuper', data['lang']) }}</small>
{% else %}
<button class="btn btn-sm btn-danger delete-user"><i class="fas fa-trash"></i> {{ translate('userConfig', 'deleteUserB', data['lang']) }}</a>
<button class="btn btn-sm btn-danger delete-user"><i class="fas fa-trash"></i> {{
translate('userConfig', 'deleteUserB', data['lang']) }}</a>
{% end %}
</div>
@ -245,13 +297,13 @@
<script>
const userId = new URLSearchParams(document.location.search).get('id')
$( ".delete-user" ).click(function() {
$(".delete-user").click(function () {
var file_to_del = $(this).data("file");
console.log("User to delete is "+userId);
console.log("User to delete is " + userId);
bootbox.confirm({
title: "{% raw translate('userConfig', 'deleteUser', data['lang']) %} "+userId,
title: "{% raw translate('userConfig', 'deleteUser', data['lang']) %} " + userId,
message: "{{ translate('userConfig', 'confirmDelete', data['lang']) }}",
buttons: {
cancel: {
@ -264,15 +316,15 @@
},
callback: function (result) {
console.log(result);
if (result == true) {
location.href="/panel/remove_user?id="+userId;
if (result === true) {
location.href = "/panel/remove_user?id=" + userId;
}
}
});
});
});
function superConfirm() {
if (document.getElementById('superuser').checked){
if (document.getElementById('superuser').checked) {
bootbox.confirm({
title: "{{ translate('panelConfig', 'superConfirmTitle', data['lang']) }}",
message: "{{ translate('panelConfig', 'superConfirm', data['lang']) }}",
@ -286,16 +338,16 @@
}
},
callback: function (result) {
if (result == true){
if (result === true) {
return;
}else{
} else {
document.getElementById('superuser').checked = false;
}
}
});
}else{
} else {
return
}
}
}
@ -305,8 +357,8 @@
return r ? r[1] : undefined;
}
$( document ).ready(function() {
console.log( "ready!" );
$(document).ready(function () {
console.log("ready!");
});

View File

@ -14,7 +14,8 @@
<div class="col-12">
<div class="page-header">
<h4 class="page-title">
{{ translate('serverDetails', 'serverDetails', data['lang']) }} - {{ data['server_stats']['server_id']['server_name'] }}
{{ translate('serverDetails', 'serverDetails', data['lang']) }} - {{
data['server_stats']['server_id']['server_name'] }}
<br />
<small>UUID: {{ data['server_stats']['server_id']['server_uuid'] }}</small>
</h4>
@ -38,11 +39,18 @@
<div class="card">
<div class="card-header header-sm d-flex justify-content-between align-items-center">
<h4 class="card-title"><i class="fas fa-calendar"></i> Scheduled Tasks</h4>
<span class="too_small" title="{{ translate('serverSchedules', 'cannotSee', data['lang']) }}", data-content="{{ translate('serverSchedules', 'cannotSeeOnMobile', data['lang']) }}", data-placement="bottom"></span>
<div><button onclick="location.href=`/panel/add_schedule?id={{ data['server_stats']['server_id']['server_id'] }}`" class="btn btn-info">Create New Schedule <i class="fas fa-pencil-alt"></i></button></div>
{% if data['user_data']['hints'] %}
<span class="too_small" title="{{ translate('serverSchedules', 'cannotSee', data['lang']) }}" ,
data-content="{{ translate('serverSchedules', 'cannotSeeOnMobile', data['lang']) }}" ,
data-placement="bottom"></span>
{% end %}
<div><button
onclick="location.href=`/panel/add_schedule?id={{ data['server_stats']['server_id']['server_id'] }}`"
class="btn btn-info">Create New Schedule <i class="fas fa-pencil-alt"></i></button></div>
</div>
<div class="card-body">
<table class="table table-hover d-none d-lg-block responsive-table" id="schedule_table" width="100%" style="table-layout:fixed;">
<table class="table table-hover d-none d-lg-block responsive-table" id="schedule_table" width="100%"
style="table-layout:fixed;">
<thead>
<tr class="rounded">
<th style="width: 2%; min-width: 10px;">ID</th>
@ -92,7 +100,9 @@
{% end %}
</td>
<td id="{{schedule.action}}" class="action">
<button onclick="window.location.href='/panel/edit_schedule?id={{ data['server_stats']['server_id']['server_id'] }}&sch_id={{schedule.schedule_id}}'" class="btn btn-info">
<button
onclick="window.location.href='/panel/edit_schedule?id={{ data['server_stats']['server_id']['server_id'] }}&sch_id={{schedule.schedule_id}}'"
class="btn btn-info">
<i class="fas fa-pencil-alt"></i>
</button>
<br>
@ -106,7 +116,8 @@
</tbody>
</table>
<hr />
<table class="table table-hover d-block d-lg-none" id="mini_schedule_table" width="100%" style="table-layout:fixed;">
<table class="table table-hover d-block d-lg-none" id="mini_schedule_table" width="100%"
style="table-layout:fixed;">
<thead>
<tr class="rounded">
<th style="width: 25%; min-width: 50px;">Action</th>
@ -136,7 +147,8 @@
</td>
</tr>
<!-- Modal -->
<div class="modal fade" id="task_details_{{schedule.schedule_id}}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal fade" id="task_details_{{schedule.schedule_id}}" tabindex="-1" role="dialog"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@ -148,27 +160,35 @@
<div class="modal-body">
<ul style="list-style: none;">
<li id="{{schedule.schedule_id}}" class="id" style="border-top: .1em solid gray;">
<h4>ID</h4><p>{{schedule.schedule_id}}</p>
<h4>ID</h4>
<p>{{schedule.schedule_id}}</p>
</li>
<li id="{{schedule.action}}" class="action" style="border-top: .1em solid gray;">
<h4>Action</h4><p>{{schedule.action}}</p>
<h4>Action</h4>
<p>{{schedule.action}}</p>
</li>
<li id="{{schedule.command}}" class="action" style="border-top: .1em solid gray;">
<h4>Command</h4><p>{{schedule.command}}</p>
<h4>Command</h4>
<p>{{schedule.command}}</p>
</li>
<li id="{{schedule.interval}}" class="action" style="border-top: .1em solid gray;">
{% if schedule.interval != '' %}
<h4>Interval</h4> <p>Every {{schedule.interval}} {{schedule.interval_type}}</p>
<h4>Interval</h4>
<p>Every {{schedule.interval}} {{schedule.interval_type}}</p>
{% elif schedule.interval_type == 'reaction' %}
<h4>Interval</h4> <p>{{schedule.interval_type}}<br><br>child of ID: {{ schedule.parent }}</p>
<h4>Interval</h4>
<p>{{schedule.interval_type}}<br><br>child of ID: {{ schedule.parent }}</p>
{% else %}
<h4>Interval</h4> <p>Cron String: {{schedule.cron_string}}</p>
<h4>Interval</h4>
<p>Cron String: {{schedule.cron_string}}</p>
{% end %}
</li>
<li id="{{schedule.start_time}}" class="action" style="border-top: .1em solid gray;">
<h4>Start Time</h4> <p>{{schedule.start_time}}</p>
<h4>Start Time</h4>
<p>{{schedule.start_time}}</p>
</li>
<li id="{{schedule.enabled}}" class="action" style="border-top: .1em solid gray; border-bottom: .1em solid gray">
<li id="{{schedule.enabled}}" class="action"
style="border-top: .1em solid gray; border-bottom: .1em solid gray">
{% if schedule.enabled %}
<h4>Enabled</h4> <span class="text-success">
<i class="fas fa-check-square"></i> Yes
@ -182,7 +202,9 @@
</ul>
</div>
<div class="modal-footer">
<button onclick="window.location.href='/panel/edit_schedule?id={{ data['server_stats']['server_id']['server_id'] }}&sch_id={{schedule.schedule_id}}'" class="btn btn-info">
<button
onclick="window.location.href='/panel/edit_schedule?id={{ data['server_stats']['server_id']['server_id'] }}&sch_id={{schedule.schedule_id}}'"
class="btn btn-info">
<i class="fas fa-pencil-alt"></i> Edit
</button>
<button data-sch={{ schedule.schedule_id }} class="btn btn-danger del_button">
@ -206,8 +228,9 @@
</div>
</div>
<style>
.popover-body{
color: white !important;;
.popover-body {
color: white !important;
;
}
</style>
@ -215,17 +238,18 @@
</div>
<style>
/* Hide scrollbar for Chrome, Safari and Opera */
td::-webkit-scrollbar {
td::-webkit-scrollbar {
display: none;
}
}
/* Hide scrollbar for IE, Edge and Firefox */
td {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
/* Hide scrollbar for IE, Edge and Firefox */
td {
-ms-overflow-style: none;
/* IE and Edge */
scrollbar-width: none;
/* Firefox */
}
</style>
<!-- content-wrapper ends -->
@ -236,50 +260,50 @@ td {
const serverId = new URLSearchParams(document.location.search).get('id')
$( document ).ready(function() {
$(document).ready(function () {
console.log('ready for JS!')
$('#schedule_table').DataTable({
'order': [4, 'desc']
}
);
});
$( document ).ready(function() {
});
$(document).ready(function () {
console.log('ready for JS!')
$('#mini_schedule_table').DataTable({
'order': [2, 'desc']
}
);
document.getElementById('mini_schedule_table_wrapper').hidden = true;
});
$(document).ready(function(){
});
$(document).ready(function () {
$('[data-toggle="popover"]').popover();
if($(window).width() < 1000){
if ($(window).width() < 1000) {
$('.too_small').popover("show");
document.getElementById('schedule_table_wrapper').hidden = true;
document.getElementById('mini_schedule_table_wrapper').hidden = false;
}
});
$(window).ready(function(){
$('body').click(function(){
$(window).ready(function () {
$('body').click(function () {
$('.too_small').popover("hide");
});
});
$(window).resize(function() {
$(window).resize(function () {
// This will execute whenever the window is resized
if($(window).width() < 1000){
if ($(window).width() < 1000) {
$('.too_small').popover("show");
document.getElementById('schedule_table_wrapper').hidden = true;
document.getElementById('mini_schedule_table_wrapper').hidden = false;
}
else{
else {
$('.too_small').popover("hide");
document.getElementById('schedule_table_wrapper').hidden = false;
document.getElementById('mini_schedule_table_wrapper').hidden = true;
} // New width
});
</script>
</script>
<script>
@ -289,8 +313,8 @@ $( document ).ready(function() {
return r ? r[1] : undefined;
}
$( document ).ready(function() {
console.log( "ready!" );
$(document).ready(function () {
console.log("ready!");
});
@ -315,8 +339,8 @@ $( document ).ready(function() {
document.getElementById("interval").required = true;
document.getElementById("time").required = true;
}
}
function ifDays(that) {
}
function ifDays(that) {
if (that.value == "days") {
document.getElementById("ifDays").style.display = "block";
document.getElementById("time").required = true;
@ -324,9 +348,9 @@ function ifDays(that) {
document.getElementById("ifDays").style.display = "none";
document.getElementById("time").required = false;
}
}
}
$( ".del_button" ).click(function() {
$(".del_button").click(function () {
var sch_id = $(this).data('sch');
console.log(sch_id)
@ -350,24 +374,24 @@ $( ".del_button" ).click(function() {
}
}
});
});
});
function del_task(sch_id, id){
function del_task(sch_id, id) {
var token = getCookie("_xsrf")
$.ajax({
type: "DELETE",
headers: {'X-XSRFToken': token},
url: '/ajax/del_task?server_id='+id+'&schedule_id='+sch_id,
headers: { 'X-XSRFToken': token },
url: '/ajax/del_task?server_id=' + id + '&schedule_id=' + sch_id,
data: {
schedule_id: sch_id,
id: id
},
success: function(data) {
success: function (data) {
location.reload();
},
});
}
}
</script>

View File

@ -0,0 +1,16 @@
# Generated by database migrator
import peewee
def migrate(migrator, database, **kwargs):
migrator.add_columns("users", hints=peewee.BooleanField(default=True))
"""
Write your migrations here.
"""
def rollback(migrator, database, **kwargs):
migrator.drop_columns("users", ["hints"])
"""
Write your rollback migrations here.
"""

View File

@ -517,7 +517,7 @@
"notExist": "You cannot delete something that doesn't exist!",
"pageTitle": "Edit User",
"pageTitleNew": "Create User",
"password": "Password",
"password": "New Password",
"permName": "Permission Name",
"repeat": "Repeat Password",
"roleName": "Role Name",