Add Password change to profile, change tables layout

This commit is contained in:
ghostersk
2025-05-27 13:27:36 +01:00
parent 510501ce7e
commit c613a564ce
7 changed files with 107 additions and 30 deletions
+22 -23
View File
@@ -208,31 +208,31 @@
<table id="logsTable" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>Timestamp</th>
<th>Event Type</th>
<th>User Name</th>
{% if current_user.is_global_admin() and not selected_company_id %}
<th>Company</th>
{% endif %}
<th>Site</th>
<th>Computer Name</th>
<th>IP Address</th>
<th>Site</th>
<th>Timestamp</th>
{% if current_user.is_global_admin() and not selected_company_id %}
<th>Company</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for log in logs %}
<tr>
<td>{{ log.event_type }}</td>
<td>{{ log.user_name }}</td>
<td>{{ log.computer_name }}</td>
<td>{{ log.ip_address }}</td>
<td>{{ log.api_key.description if log.api_key else 'N/A' }}</td>
<td data-order="{{ log.timestamp.strftime('%Y%m%d%H%M%S') }}">
{{ log.timestamp|format_datetime }}
</td>
<td>{{ log.event_type }}</td>
<td>{{ log.user_name }}</td>
{% if current_user.is_global_admin() and not selected_company_id %}
<td>{{ log.company.name if log.company else 'N/A' }}</td>
<td>{{ log.company.name if log.company else 'N/A' }}</td>
{% endif %}
<td>{{ log.api_key.description if log.api_key else 'N/A' }}</td>
<td>{{ log.computer_name }}</td>
<td>{{ log.ip_address }}</td>
</tr>
{% endfor %}
</tbody>
@@ -310,14 +310,15 @@
var table = $('#logsTable').DataTable({
pageLength: 50,
lengthMenu: [[50, 100, 200, 500, 1000], [50, 100, 200, 500, 1000]],
order: [[{% if current_user.is_global_admin() and not selected_company_id %}6{% else %}5{% endif %}, 'desc']], // Sort by timestamp column descending
order: [[0, 'desc']], // Sort by timestamp column descending
dom: '<"row"<"col-sm-12 col-md-6"l><"col-sm-12 col-md-6"f>>' +
'<"row"<"col-sm-12"tr>>' +
'<"row"<"col-sm-12 col-md-5"i><"col-sm-12 col-md-7"p>>',
columnDefs: [
{
targets: [2, 3], // Computer Name and IP Address columns
visible: false // Hide by default
targets: [5, 6], // Computer Name and IP Address columns are now at indices 5 and 6
visible: false, // Hide by default
searchable: true // Still allow searching in these columns
}
],
buttons: [
@@ -363,15 +364,13 @@
// Column names for the visibility controls
var columnNames = [
'Timestamp',
'Event Type',
'User Name',
'Computer Name',
'IP Address',
'User Name',
{% if current_user.is_global_admin() and not selected_company_id %}'Company',{% endif %}
'Site',
'Timestamp'
{% if current_user.is_global_admin() and not selected_company_id %},
'Company'
{% endif %}
'Computer Name',
'IP Address'
];
// Load saved column visibility from localStorage
@@ -384,10 +383,10 @@
console.log('Error parsing saved column visibility:', e);
}
}
// Default visibility - hide Computer Name (2) and IP Address (3)
// Default visibility - hide Computer Name (5) and IP Address (6)
var defaultVisibility = {};
columnNames.forEach(function(name, index) {
defaultVisibility[index] = index !== 2 && index !== 3;
defaultVisibility[index] = index !== 5 && index !== 6;
});
return defaultVisibility;
}