Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI] Various tweaks/improvements #5010

Draft
wants to merge 2 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions data/web/js/site/mailbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2067,13 +2067,16 @@ jQuery(function($){
'<a href="#" data-action="delete_selected" data-id="single-syncjob" data-api-url="delete/syncjob" data-item="' + item.id + '" class="btn btn-sm btn-xs-half btn-danger"><i class="bi bi-trash"></i> ' + lang.remove + '</a>' +
'</div>';
item.chkbox = '<input type="checkbox" data-id="syncjob" name="multi_select" value="' + item.id + '" />';
if (item.is_running == 1) {

if (item.is_running == 1 && item.active == 1) {
item.is_running = '<span id="active-script" class="badge fs-6 bg-success">' + lang.running + '</span>';
} else {
} else if (item.is_running == 0 && item.active == 1) {
item.is_running = '<span id="inactive-script" class="badge fs-6 bg-warning">' + lang.waiting + '</span>';
} else {
item.is_running = '<span id="inactive-script" class="badge fs-6 bg-danger">' + lang.inactive + '</span>';
}
if (!item.last_run > 0) {
item.last_run = lang.waiting;
if (!item.last_run) {
item.last_run = lang.never;
}
if (item.success == null) {
item.success = '-';
Expand Down Expand Up @@ -2142,19 +2145,17 @@ jQuery(function($){
data: 'log',
defaultContent: ''
},
{
title: lang.active,
data: 'active',
defaultContent: '',
render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':0==data&&'<i class="bi bi-x-lg"></i>';
}
},
{
title: lang.status,
data: 'is_running',
defaultContent: ''
},
{
title: lang.encryption,
data: 'enc1',
defaultContent: '',
className: 'none'
},
{
title: lang.excludes,
data: 'exclude',
Expand Down
35 changes: 19 additions & 16 deletions data/web/js/site/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ jQuery(function($){
}
}

$(".refresh_table").on('click', function(e) {
e.preventDefault();
var table_name = $(this).data('table');

if ($.fn.DataTable.isDataTable('#' + table_name))
$('#' + table_name).DataTable().ajax.reload();
});
function draw_tla_table() {
// just recalc width if instance already exists
if ($.fn.DataTable.isDataTable('#tla_table') ) {
Expand Down Expand Up @@ -233,7 +240,6 @@ jQuery(function($){
type: "GET",
url: '/api/v1/get/syncjobs/' + encodeURIComponent(mailcow_cc_username) + '/no_log',
dataSrc: function(data){
console.log(data);
$.each(data, function (i, item) {
item.user1 = escapeHtml(item.user1);
item.log = '<a href="#syncjobLogModal" data-bs-toggle="modal" data-syncjob-id="' + item.id + '">' + lang.open_logs + '</a>'
Expand All @@ -254,13 +260,15 @@ jQuery(function($){
item.action = '<span>-</span>';
item.chkbox = '<input type="checkbox" disabled />';
}
if (item.is_running == 1) {
if (item.is_running == 1 && item.active == 1) {
item.is_running = '<span id="active-script" class="badge fs-6 bg-success">' + lang.running + '</span>';
} else {
} else if (item.is_running == 0 && item.active == 1) {
item.is_running = '<span id="inactive-script" class="badge fs-6 bg-warning">' + lang.waiting + '</span>';
} else {
item.is_running = '<span id="disabled-script" class="badge fs-6 bg-danger">' + lang.inactive + '</span>';
}
if (!item.last_run > 0) {
item.last_run = lang.waiting;
if (!item.last_run) {
item.last_run = lang.never;
}
if (item.success == null) {
item.success = '-';
Expand Down Expand Up @@ -329,14 +337,6 @@ jQuery(function($){
data: 'log',
defaultContent: ''
},
{
title: lang.active,
data: 'active',
defaultContent: '',
render: function (data, type) {
return 1==data?'<i class="bi bi-check-lg"></i>':0==data&&'<i class="bi bi-x-lg"></i>'
}
},
{
title: lang.status,
data: 'is_running',
Expand All @@ -346,17 +346,20 @@ jQuery(function($){
{
title: lang.encryption,
data: 'enc1',
defaultContent: ''
defaultContent: '',
className: 'none'
},
{
title: lang.excludes,
data: 'exclude',
defaultContent: ''
defaultContent: '',
className: 'none'
},
{
title: lang.interval + " (min)",
data: 'mins_interval',
defaultContent: ''
defaultContent: '',
className: 'none'
},
{
title: lang.action,
Expand Down
4 changes: 3 additions & 1 deletion data/web/lang/lang.de-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@
"edit": "Bearbeiten",
"empty": "Keine Einträge vorhanden",
"enable_x": "Aktivieren",
"encryption": "Verschlüsselung",
"excludes": "Ausschlüsse",
"filter_table": "Filtern",
"filters": "Filter",
Expand Down Expand Up @@ -1175,6 +1176,7 @@
"recent_successful_connections": "Kürzlich erfolgreiche Verbindungen",
"remove": "Entfernen",
"running": "Wird ausgeführt",
"inactive": "Inaktiv",
"save": "Änderungen speichern",
"save_changes": "Änderungen speichern",
"sender_acl_disabled": "<span class=\"badge fs-6 bg-danger\">Absenderprüfung deaktiviert</span>",
Expand Down Expand Up @@ -1220,7 +1222,7 @@
"user_settings": "Benutzereinstellungen",
"username": "Benutzername",
"verify": "Verifizieren",
"waiting": "Warte auf Ausführung",
"waiting": "Wartend",
"week": "Woche",
"weekly": "Wöchentlich",
"weeks": "Wochen",
Expand Down
2 changes: 2 additions & 0 deletions data/web/lang/lang.en-gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@
"edit": "Edit",
"empty": "No results",
"enable_x": "Enable",
"encryption": "Encryption",
"excludes": "Excludes",
"filter_table": "Filter table",
"filters": "Filters",
Expand Down Expand Up @@ -1143,6 +1144,7 @@
"hour": "hour",
"hourly": "Hourly",
"hours": "hours",
"inactive": "Inactive",
"in_use": "Used",
"interval": "Interval",
"is_catch_all": "Catch-all for domain/s",
Expand Down
6 changes: 5 additions & 1 deletion data/web/templates/user/Syncjobs.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<button class="btn d-md-none flex-grow-1 text-start" data-bs-target="#collapse-tab-Syncjobs" data-bs-toggle="collapse" aria-controls="collapse-tab-Syncjobs">
{{ lang.user.sync_jobs }}
</button>
<span class="d-none d-md-block">{{ lang.user.sync_jobs }}
<span class="d-none d-md-block">{{ lang.user.sync_jobs }} <span class="badge bg-info table-lines"></span></span>

<div class="btn-group ms-auto d-flex">
<button class="btn btn-xs btn-secondary refresh_table" data-draw="draw_sync_job_table" data-table="sync_job_table">{{ lang.admin.refresh }}</button>
</div>
</div>
<div id="collapse-tab-Syncjobs" class="card-body collapse" data-bs-parent="#user-content">
<div class="mass-actions-user mb-4">
Expand Down