mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add search to dashboard
Fix MOTD formatting
This commit is contained in:
parent
35a6307183
commit
6b42735444
@ -111,16 +111,16 @@
|
|||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
{% if len(data['servers']) > 0 %}
|
{% if len(data['servers']) > 0 %}
|
||||||
<table class="table table-hover">
|
<table id="servers_table" class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="rounded">
|
<tr class="rounded" id="first" draggable="false">
|
||||||
<th>{{ translate('dashboard', 'server', data['lang']) }}</th>
|
<th draggable="false">{{ translate('dashboard', 'server', data['lang']) }}</th>
|
||||||
<th>{{ translate('dashboard', 'actions', data['lang']) }}</th>
|
<th draggable="false">{{ translate('dashboard', 'actions', data['lang']) }}</th>
|
||||||
<th>{{ translate('dashboard', 'cpuUsage', data['lang']) }}</th>
|
<th draggable="false">{{ translate('dashboard', 'cpuUsage', data['lang']) }}</th>
|
||||||
<th>{{ translate('dashboard', 'memUsage', data['lang']) }}</th>
|
<th draggable="false">{{ translate('dashboard', 'memUsage', data['lang']) }}</th>
|
||||||
<th>{{ translate('dashboard', 'size', data['lang']) }}</th>
|
<th draggable="false">{{ translate('dashboard', 'size', data['lang']) }}</th>
|
||||||
<th>{{ translate('dashboard', 'players', data['lang']) }}</th>
|
<th draggable="false">{{ translate('dashboard', 'players', data['lang']) }}</th>
|
||||||
<th>{{ translate('dashboard', 'status', data['lang']) }}</th>
|
<th draggable="false">{{ translate('dashboard', 'status', data['lang']) }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -228,7 +228,7 @@
|
|||||||
data['lang']) }} <br />
|
data['lang']) }} <br />
|
||||||
|
|
||||||
{% if server['stats']['desc'] != 'False' %}
|
{% if server['stats']['desc'] != 'False' %}
|
||||||
{{ server['stats']['desc'] }} <br />
|
<div style="overflow-wrap: break-word !important; max-width: 70px !important; overflow: scroll;">{{ server['stats']['desc'] }}</div> <br />
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
||||||
{% if server['stats']['version'] != 'False' %}
|
{% if server['stats']['version'] != 'False' %}
|
||||||
@ -438,7 +438,7 @@
|
|||||||
var motd = "";
|
var motd = "";
|
||||||
if (server.desc) {
|
if (server.desc) {
|
||||||
motd = `<span id="input_motd_` + server.id + `" class="input_motd">` + server.desc + `</span>`;
|
motd = `<span id="input_motd_` + server.id + `" class="input_motd">` + server.desc + `</span>`;
|
||||||
server_infos = server_infos + motd + "<br />";
|
server_infos = server_infos + '<div style="word-wrap: break-word; max-width: 70px !important; overflow: auto;">' + motd + '</div>' + "<br />";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Version */
|
/* Version */
|
||||||
@ -464,7 +464,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update_servers_status(data) {
|
function update_servers_status(data) {
|
||||||
|
try{
|
||||||
update_one_server_status(data[0]);
|
update_one_server_status(data[0]);
|
||||||
|
}catch{
|
||||||
|
|
||||||
|
}
|
||||||
display_motd();
|
display_motd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,8 +621,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(id_string)
|
console.log(id_string)
|
||||||
sendOrder(id_string)
|
if($('#servers_table').find('input[type=search]').length == 0){
|
||||||
|
sendOrder(id_string)
|
||||||
|
}else{
|
||||||
|
console.log("Will not reorder when servers are filtered")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendOrder(id_string) {
|
function sendOrder(id_string) {
|
||||||
var token = getCookie("_xsrf")
|
var token = getCookie("_xsrf")
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -634,7 +643,28 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
$(document).ready(function () {
|
||||||
|
var servers_table = $('#servers_table').DataTable({
|
||||||
|
"ordering": false, // false to disable sorting (or any other option)
|
||||||
|
"paging": false
|
||||||
|
});
|
||||||
|
document.getElementById('first').setAttribute('draggable', false);
|
||||||
|
$('.dataTables_length').addClass('bs-select');
|
||||||
|
});
|
||||||
|
$('#servers_table').on('search.dt', function() {
|
||||||
|
let value = $('.dataTables_filter input').val()
|
||||||
|
if(value == ''){
|
||||||
|
const table = document.querySelector("table");
|
||||||
|
for (const row of table.rows) {
|
||||||
|
row.setAttribute('draggable', true)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
const table = document.querySelector("table");
|
||||||
|
for (const row of table.rows) {
|
||||||
|
row.setAttribute('draggable', false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
|
@ -34,10 +34,10 @@
|
|||||||
<div class="col-sm-3 mr-2">
|
<div class="col-sm-3 mr-2">
|
||||||
{% if data['server_stats']['version'] != 'False' %}
|
{% if data['server_stats']['version'] != 'False' %}
|
||||||
<b>{{ translate('serverStats', 'version', data['lang']) }}:</b> <span id="version">{{ data['server_stats']['version'] }}</span><br />
|
<b>{{ translate('serverStats', 'version', data['lang']) }}:</b> <span id="version">{{ data['server_stats']['version'] }}</span><br />
|
||||||
<b>{{ translate('serverStats', 'description', data['lang']) }}:</b> <span id="input_motd" class="input_motd">{{ data['server_stats']['desc'] }}</span> <br />
|
<b>{{ translate('serverStats', 'description', data['lang']) }}:</b> <span id="input_motd" style="max-width: 10px; max-height: 10px" class="input_motd">{{ data['server_stats']['desc'] }}</span> <br />
|
||||||
{% else %}
|
{% else %}
|
||||||
<b>{{ translate('serverStats', 'version', data['lang']) }}:</b> <span id="version">{{ translate('serverStats', 'unableToConnect', data['lang']) }}</span> <br />
|
<b>{{ translate('serverStats', 'version', data['lang']) }}:</b> <span id="version">{{ translate('serverStats', 'unableToConnect', data['lang']) }}</span> <br />
|
||||||
<b>{{ translate('serverStats', 'description', data['lang']) }}:</b> <span id="input_motd" class="input_motd">{{ translate('serverStats', 'unableToConnect', data['lang']) }}</span> <br />
|
<b>{{ translate('serverStats', 'description', data['lang']) }}:</b> <span style="max-width: 10px; max-height: 10px" id="input_motd" class="input_motd">{{ translate('serverStats', 'unableToConnect', data['lang']) }}</span> <br />
|
||||||
{% end %}
|
{% end %}
|
||||||
<b>Server Type: <span class="text-info">{{data['server_stats']['server_type']}}</span></b>
|
<b>Server Type: <span class="text-info">{{data['server_stats']['server_type']}}</span></b>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user