Fix bug could not drag servers after searching

This commit is contained in:
Andrew 2022-03-13 16:41:27 -04:00
parent c111f7b69e
commit f889dc1dad

View File

@ -133,7 +133,7 @@
</a>
</td>
<td id="controls{{server['server_data']['server_id']}}" class="actions_serverlist">
<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"
@ -180,7 +180,7 @@
{% end %}
</td>
<td id="server_cpu_{{server['server_data']['server_id']}}">
<td draggable="false" id="server_cpu_{{server['server_data']['server_id']}}">
<div class="progress mb-1" data-toggle="tooltip" data-placement="top"
title="{{server['stats']['cpu']}}">
<div class="progress-bar
@ -197,7 +197,7 @@
{{server['stats']['cpu']}}%
</td>
<td id="server_mem_{{server['server_data']['server_id']}}">
<td draggable="false" id="server_mem_{{server['server_data']['server_id']}}">
<div class="progress mb-1" data-toggle="tooltip" data-placement="top"
title="{{server['stats']['mem']}}">
<div class="progress-bar
@ -219,10 +219,10 @@
{{server['stats']['mem']}}
{% end %}
</td>
<td id="server_world_{{server['server_data']['server_id']}}">
<td draggable="false" id="server_world_{{server['server_data']['server_id']}}">
{{ server['stats']['world_size'] }}
</td>
<td id="server_desc_{{server['server_data']['server_id']}}">
<td draggable="false" id="server_desc_{{server['server_data']['server_id']}}">
{% if server['stats']['int_ping_results'] %}
{{ server['stats']['online'] }} / {{ server['stats']['max'] }} {{ translate('dashboard', 'max',
data['lang']) }} <br />
@ -237,7 +237,7 @@
{% end %}
</td>
<td id="server_running_status_{{server['server_data']['server_id']}}">
<td draggable="false" id="server_running_status_{{server['server_data']['server_id']}}">
{% if server['stats']['running'] %}
<span class="text-success"><i class="fas fa-signal"></i> {{ translate('dashboard', 'online',
data['lang']) }}</span>
@ -651,20 +651,20 @@
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)
}
$(document).mousedown(function( event ) {
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>
{% end %}