mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Attempt fix for delayed start issues - was finally able to reproduce
Port feature from 3.4 added by Trevor (@uplusion23) for terminal history. Add datatable to mobile version of tasks.
This commit is contained in:
parent
64b62f0f4f
commit
ef4a31d1e8
@ -151,6 +151,8 @@ class Server:
|
||||
def run_scheduled_server(self):
|
||||
console.info("Starting server ID: {} - {}".format(self.server_id, self.name))
|
||||
logger.info("Starting server {}".format(self.server_id, self.name))
|
||||
#Sets waiting start to false since we're attempting to start the server.
|
||||
servers_helper.set_waiting_start(self.server_id, False)
|
||||
self.run_threaded_server(None)
|
||||
|
||||
# remove the scheduled job since it's ran
|
||||
@ -182,8 +184,6 @@ class Server:
|
||||
console.warning("Unable to write/access {}".format(self.server_path))
|
||||
|
||||
def start_server(self, user_id):
|
||||
#Sets waiting start to false since server is now starting.
|
||||
servers_helper.set_waiting_start(self.server_id, False)
|
||||
if not user_id:
|
||||
user_lang = helper.get_setting('language')
|
||||
else:
|
||||
|
@ -101,7 +101,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<table class="table table-hover d-block d-lg-none" 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>
|
||||
@ -230,12 +230,21 @@ td {
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
$( 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(){
|
||||
$('[data-toggle="popover"]').popover();
|
||||
if($(window).width() < 1000){
|
||||
$('.too_small').popover("show");
|
||||
document.getElementById('schedule_table_wrapper').hidden = true;
|
||||
document.getElementById('mini_schedule_table_wrapper').hidden = false;
|
||||
}
|
||||
|
||||
});
|
||||
@ -249,10 +258,12 @@ td {
|
||||
if($(window).width() < 1000){
|
||||
$('.too_small').popover("show");
|
||||
document.getElementById('schedule_table_wrapper').hidden = true;
|
||||
document.getElementById('mini_schedule_table_wrapper').hidden = false;
|
||||
}
|
||||
else{
|
||||
$('.too_small').popover("hide");
|
||||
document.getElementById('schedule_table_wrapper').hidden = false;
|
||||
document.getElementById('mini_schedule_table_wrapper').hidden = true;
|
||||
} // New width
|
||||
});
|
||||
</script>
|
||||
|
@ -43,7 +43,6 @@
|
||||
<div style="gap: 0.5rem;" class="input-group flex-wrap">
|
||||
<input style="min-width: 10rem;" type="text" class="form-control" id="server_command" name="server_command" placeholder="{{ translate('serverTerm', 'commandInput', data['lang']) }}" autofocus="">
|
||||
<span class="input-group-btn ml-5">
|
||||
<input type="hidden" value="" id="last_command"/>
|
||||
<button id="submit" class="btn btn-sm btn-info" type="button">{{ translate('serverTerm', 'sendCommand', data['lang']) }}</button>
|
||||
</span>
|
||||
</div>
|
||||
@ -206,10 +205,13 @@
|
||||
$(this).removeAttr("disabled"); //Enable the textbox again if needed.
|
||||
$(this).focus();
|
||||
}
|
||||
else if (e.which == 38){
|
||||
last_command = $('#last_command').val()
|
||||
$("#server_command").val(last_command)
|
||||
}
|
||||
else if (e.which == 38) {
|
||||
e.preventDefault();
|
||||
$('#server_command').val(cmdHistory.getPrev());
|
||||
} else if (e.which == 40) {
|
||||
e.preventDefault();
|
||||
$('#server_command').val(cmdHistory.getNext());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@ -229,7 +231,8 @@
|
||||
function send_command_to_server(){
|
||||
var server_command = $("#server_command").val()
|
||||
console.log(server_command)
|
||||
$("#last_command").val(server_command)
|
||||
|
||||
cmdHistory.push(server_command);
|
||||
|
||||
var token = getCookie("_xsrf")
|
||||
|
||||
@ -248,6 +251,31 @@
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const cmdHistory = {
|
||||
history: [],
|
||||
current: 0,
|
||||
push: function(cmd) {
|
||||
this.history.push(cmd);
|
||||
this.current = this.history.length - 1;
|
||||
},
|
||||
getPrev: function() {
|
||||
const prevCommand = this.history[this.current];
|
||||
this.current--;
|
||||
if (this.current < 0) this.current = 0;
|
||||
return prevCommand;
|
||||
},
|
||||
getNext: function() {
|
||||
this.current++;
|
||||
if (this.current > (this.history.length - 1)) {
|
||||
this.current = (this.history.length - 1);
|
||||
return '';
|
||||
}
|
||||
const nextCommand = this.history[this.current];
|
||||
return nextCommand;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{% end %}
|
Loading…
Reference in New Issue
Block a user