[BS5] add responsive tabs and more

This commit is contained in:
FreddleSpl0it
2022-06-06 20:38:24 +02:00
parent f13530d8a1
commit cb6a5d4069
67 changed files with 786 additions and 409 deletions

File diff suppressed because one or more lines are too long

View File

@@ -318,6 +318,7 @@ $(document).ready(function() {
// General API delete actions
$(document).on('click', "[data-action='delete_selected']", function(e) {
console.log("delete");
e.preventDefault();
var id = $(this).data('id');
// If clicked element #delete_selected has data-item attribute, it is added to "items"
@@ -336,6 +337,7 @@ $(document).ready(function() {
if (typeof multi_data[id] == "undefined" || multi_data[id] == "") return;
data_array = multi_data[id];
api_url = $(this).data('api-url');
console.log("delete modal");
$(document).on('show.bs.modal', '#ConfirmDeleteModal', function() {
$("#ItemsToDelete").empty();
for (var i in data_array) {
@@ -343,10 +345,7 @@ $(document).ready(function() {
$("#ItemsToDelete").append("<li>" + data_array[i] + "</li>");
}
})
$('#ConfirmDeleteModal').modal({
backdrop: 'static',
keyboard: false
})
$('#ConfirmDeleteModal').modal('show')
.one('click', '#IsConfirmed', function(e) {
if (is_active($('#IsConfirmed'))) { return false; }
$.ajax({

View File

@@ -61,8 +61,8 @@ $(document).ready(function() {
// remember last navigation pill
(function () {
'use strict';
if ($('a[data-bs-toggle="tab"]').length) {
$('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) {
if ($('button[data-bs-toggle="tab"]').length) {
$('button[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) {
if ($(this).data('dont-remember') == 1) {
return true;
}
@@ -71,7 +71,7 @@ $(document).ready(function() {
if (id) {
key += ':' + id;
}
localStorage.setItem(key, $(e.target).attr('href'));
localStorage.setItem(key, $(e.target).attr('data-bs-target').substring(1));
});
$('[role="tablist"]').each(function (idx, elem) {
var id = $(elem).attr('id');
@@ -81,7 +81,7 @@ $(document).ready(function() {
}
var lastTab = localStorage.getItem(key);
if (lastTab) {
$('[href="' + lastTab + '"]').tab('show');
$("[id^=" + lastTab + "]").show();
}
});
}

View File

@@ -53,7 +53,7 @@ jQuery(function($){
$("#show_rspamd_global_filters").click(function() {
$.get("inc/ajax/show_rspamd_global_filters.php");
$("#confirm_show_rspamd_global_filters").hide();
$("#rspamd_global_filters").removeClass("hidden");
$("#rspamd_global_filters").removeClass("d-none");
});
$("#super_delete").click(function() { return confirm(lang.queue_ays); });
$(".refresh_table").on('click', function(e) {
@@ -533,17 +533,13 @@ jQuery(function($){
});
}
// Draw Table if tab is active
onVisible("[id^=tab-config-admins]", () => {
draw_admins();
draw_domain_admins();
});
onVisible("[id^=tab-config-oauth2]", () => draw_oauth2_clients());
onVisible("[id^=tab-config-fwdhosts]", () => draw_fwd_hosts());
onVisible("[id^=tab-routing]", () => {
draw_relayhosts();
draw_transport_maps();
});
onVisible("[id^=tab-mailq]", () => draw_queue());
onVisible("[id^=collapse-tab-config-admins]", () => draw_admins());
onVisible("[id^=collapse-tab-config-dadmins]", () => draw_domain_admins());
onVisible("[id^=collapse-tab-config-oauth2]", () => draw_oauth2_clients());
onVisible("[id^=collapse-tab-config-fwdhosts]", () => draw_fwd_hosts());
onVisible("[id^=collapse-tab-routing]", () => draw_relayhosts());
onVisible("[id^=collapse-tab-maps]", () => draw_transport_maps());
onVisible("[id^=collapse-tab-mailq]", () => draw_queue());
$('body').on('click', 'span.footable-toggle', function () {

View File

@@ -75,6 +75,7 @@ jQuery(function($){
processing: true,
serverSide: false,
language: lang_datatables,
order: [[0, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/logs/autodiscover/100",
@@ -115,6 +116,7 @@ jQuery(function($){
processing: true,
serverSide: false,
language: lang_datatables,
order: [[0, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/logs/postfix",
@@ -147,6 +149,7 @@ jQuery(function($){
processing: true,
serverSide: false,
language: lang_datatables,
order: [[0, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/logs/watchdog",
@@ -183,6 +186,7 @@ jQuery(function($){
processing: true,
serverSide: false,
language: lang_datatables,
order: [[0, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/logs/api",
@@ -223,6 +227,7 @@ jQuery(function($){
processing: true,
serverSide: false,
language: lang_datatables,
order: [[0, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/logs/ratelimited",
@@ -295,6 +300,7 @@ jQuery(function($){
processing: true,
serverSide: false,
language: lang_datatables,
order: [[0, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/logs/ui",
@@ -347,6 +353,7 @@ jQuery(function($){
processing: true,
serverSide: false,
language: lang_datatables,
order: [[0, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/logs/sasl",
@@ -383,6 +390,7 @@ jQuery(function($){
processing: true,
serverSide: false,
language: lang_datatables,
order: [[0, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/logs/acme",
@@ -411,6 +419,7 @@ jQuery(function($){
processing: true,
serverSide: false,
language: lang_datatables,
order: [[0, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/logs/netfilter",
@@ -443,6 +452,7 @@ jQuery(function($){
processing: true,
serverSide: false,
language: lang_datatables,
order: [[0, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/logs/sogo",
@@ -475,6 +485,7 @@ jQuery(function($){
processing: true,
serverSide: false,
language: lang_datatables,
order: [[0, 'desc']],
ajax: {
type: "GET",
url: "/api/v1/get/logs/dovecot",
@@ -507,11 +518,13 @@ jQuery(function($){
url: '/api/v1/get/rspamd/actions',
async: true,
success: function(data){
console.log(data);
var total = 0;
$(data).map(function(){total += this[1];});
var labels = $.makeArray($(data).map(function(){return this[0] + ' ' + Math.round(this[1]/total * 100) + '%';}));
var values = $.makeArray($(data).map(function(){return this[1];}));
console.log(values);
var graphdata = {
labels: labels,
@@ -540,7 +553,7 @@ jQuery(function($){
}
};
var chartcanvas = document.getElementById('rspamd_donut');
Chart.plugins.register('ChartDataLabels');
Chart.register('ChartDataLabels');
if(typeof chart == 'undefined') {
chart = new Chart(chartcanvas.getContext("2d"), {
plugins: [ChartDataLabels],
@@ -859,12 +872,8 @@ jQuery(function($){
onVisible("[id^=tab-ui]", () => draw_ui_logs());
onVisible("[id^=tab-sasl]", () => draw_sasl_logs());
onVisible("[id^=tab-netfilter-logs]", () => draw_netfilter_logs());
onVisible("[id^=tab-rspamd-history]", () => draw_rspamd_history());
$('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("href");
if (target == '#tab-rspamd-history') {
rspamd_pie_graph();
}
onVisible("[id^=tab-rspamd-history]", () => {
rspamd_pie_graph();
draw_rspamd_history()
});
});

View File

@@ -1195,17 +1195,14 @@ jQuery(function($){
}
// Load only if the tab is visible
onVisible("[id^=tab-domains]", () => draw_domain_table());
onVisible("[id^=tab-mailboxes]", () => draw_mailbox_table());
onVisible("[id^=tab-resources]", () => draw_resource_table());
onVisible("[id^=tab-mbox-aliases]", () => draw_alias_table());
onVisible("[id^=tab-domain-aliases]", () => draw_aliasdomain_table());
onVisible("[id^=tab-syncjobs]", () => draw_sync_job_table());
onVisible("[id^=tab-filters]", () => draw_filter_table());
onVisible("[id^=tab-bcc]", () => {
draw_bcc_table();
draw_recipient_map_table();
});
onVisible("[id^=tab-tls-policy]", () => draw_tls_policy_table());
onVisible("[id^=collapse-tab-domains]", () => draw_domain_table());
onVisible("[id^=collapse-tab-mailboxes]", () => draw_mailbox_table());
onVisible("[id^=collapse-tab-resources]", () => draw_resource_table());
onVisible("[id^=collapse-tab-mbox-aliases]", () => draw_alias_table());
onVisible("[id^=collapse-tab-domain-aliases]", () => draw_aliasdomain_table());
onVisible("[id^=collapse-tab-syncjobs]", () => draw_sync_job_table());
onVisible("[id^=collapse-tab-filters]", () => draw_filter_table());
onVisible("[id^=collapse-tab-bcc]", () => draw_bcc_table());
onVisible("[id^=collapse-tab-bcc-filters]", () => draw_recipient_map_table());
onVisible("[id^=collapse-tab-tls-policy]", () => draw_tls_policy_table());
});

View File

@@ -538,12 +538,12 @@ jQuery(function($){
}
// Load only if the tab is visible
onVisible("[id^=SpamAliases]", () => draw_tla_table());
onVisible("[id^=Spamfilter]", () => {
draw_wl_policy_mailbox_table();
onVisible("[id^=collapse-tab-SpamAliases]", () => draw_tla_table());
onVisible("[id^=collapse-tab-Spamfilter]", () => {
draw_bl_policy_mailbox_table();
draw_wl_policy_mailbox_table()
});
onVisible("[id^=Syncjobs]", () => draw_sync_job_table());
onVisible("[id^=AppPasswds]", () => draw_app_passwd_table());
onVisible("[id^=collapse-tab-Syncjobs]", () => draw_sync_job_table());
onVisible("[id^=collapse-tab-AppPasswds]", () => draw_app_passwd_table());
last_logins('get');
});