Skip to content

Commit dda002b

Browse files
authored
ver 1.1.4 update
Some bugfixes and features. Check CHANGES.md
1 parent 65ee26d commit dda002b

File tree

8 files changed

+93
-36
lines changed

8 files changed

+93
-36
lines changed

CHANGES.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
Unreleased VER.
22
- add multiple simultanious text filters
33
- dark theme mode
4-
- gui autorefresh 0 value as "no autorefresh"
5-
- padding to the cells in table resizable mode
64
- minify
75
- get rid of setTimeouts
86
- replace momentjs wih day.js or luxone(?)
97
- make mailcow PR to integrate into
108
- maybe scrollTo by not all refreshes (?)
119
- remove python privex helpers code (?)
1210
- save settings into cookies + accept cookies modal (?)
11+
- export to xlsx file (table) (?)
12+
13+
VER. 1.1.4
14+
- ~~gui autorefresh 0 value as "no autorefresh"~~
15+
- ~~to fix log_lines filter 1 min timeout (504 error) by forced apply time period (in frontend)~~
16+
- ~~to fix mail_to filter in postfix~~
17+
- ~~padding to the cells in table resizable mode~~
1318

1419
VER. 1.1.3
1520
- ~~tail realtime parsing mode + gui autorefresh (with config seconds)~~

mlp/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
# !!! change version upon update !!!
3737
global VERSION
38-
VERSION ="1.1.3"
38+
VERSION ="1.1.4"
3939

4040
# postfix regexp
4141
postf_match = r'([A-Za-z]+[ \t]+[0-9]+[ \t]+[0-9]+\:[0-9]+:[0-9]+).*'

mlp/static/css/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@
7979
text-overflow: ellipsis;
8080
}
8181

82-
/*for resizable tables*/
82+
/*for resizable tables
8383
8484
.emails-list:is(.resizable) td, .emails-list:is(.resizable) th {
8585
white-space: nowrap;
86-
}
86+
}*/
8787

8888
/* for non-resizable tables*/
8989
.emails-list:not(.resizable) td:hover, .emails-list:not(.resizable) th:hover {

mlp/static/js/local_settings.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
<input v-model="settings.default_period" type="range" step="5" min="5" max="1440" class="ui input range">
2222
</div>
2323
</div>
24-
<div class="ui field"><i class="sync icon"/><label style="display:inline" v-if="!$parent.loading" v-html="$parent.localeData.user_settings.refresh"></label> {{ settings.refresh }} <label style="display:inline" v-if="!$parent.loading" v-html="$parent.localeData.user_settings.refresh_end"></label></div>
24+
<div v-if="settings.refresh !== 0" class="ui field"><i class="sync icon"/><label style="display:inline" v-if="!$parent.loading" v-html="$parent.localeData.user_settings.refresh"></label> {{ settings.refresh }} <label style="display:inline" v-if="!$parent.loading" v-html="$parent.localeData.user_settings.refresh_end"></label></div>
25+
<div v-else class="ui field"><i class="sync icon"/><label style="display:inline" v-if="!$parent.loading" v-html="$parent.localeData.user_settings.no_refresh"></label></div>
2526
<div class="ui input">
26-
<input v-model="settings.refresh" type="range" step="1" min="1" max="60" class="ui input range" placeholder="Amount of seconds">
27+
<input v-model="settings.refresh" type="range" step="1" min="0" max="60" class="ui input range" placeholder="Amount of seconds">
2728
</div>
2829
</div>
2930
<div class="field">

mlp/static/js/main_app.js

Lines changed: 73 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,35 @@ const app = Vue.createApp({
9797
//this.search = this.search.slice(0,-1);
9898
//return;
9999
} else {
100-
$('#text_search').css('color', 'initial');
101-
if (this.settings.filters) {
102-
this.saveFilters();
100+
if (this.search_by !== "log_lines") {
101+
$('#text_search').css('color', 'initial');
102+
if (this.settings.filters) {
103+
this.saveFilters();
104+
} else {
105+
$('#default_period_div').show();
106+
}
107+
this.search_error = false;
108+
this.reset_page();
109+
110+
} else {
111+
this.setDuration_Log_lines();
103112
}
104-
this.search_error = false;
105-
this.reset_page();
106113
this.debounce_emails(true);
107114
}
108115
},
109116
search_by(val) {
110117
if (this.search !== "") {
111-
if (this.settings.filters) {
112-
this.saveFilters();
118+
if (this.search_by !== "log_lines") {
119+
if (this.settings.filters) {
120+
this.saveFilters();
121+
} else {
122+
$('#default_period_div').show();
123+
}
124+
this.reset_page();
125+
126+
} else {
127+
this.setDuration_Log_lines();
113128
}
114-
this.reset_page();
115129
this.debounce_emails(true);
116130
}
117131
},
@@ -123,10 +137,15 @@ const app = Vue.createApp({
123137
this.debounce_emails(true);
124138
},
125139
date_filter__gt(val) {
126-
if (this.settings.filters) {
127-
this.saveFilters();
140+
if (this.search_by !== "log_lines") {
141+
if (this.settings.filters) {
142+
this.saveFilters();
143+
}
144+
this.reset_page();
145+
146+
} else {
147+
this.setDuration_Log_lines();
128148
}
129-
this.reset_page();
130149
// do not debounce on datestart change ???
131150
this.debounce_emails(true);
132151
},
@@ -380,20 +399,34 @@ const app = Vue.createApp({
380399
this.loading = false;
381400
}
382401
},
383-
check_nothing_found(count,table) {
402+
check_nothing_found(count,table,wait) {
384403
// if no results don't show table and show notification
385404
if (count == 0) {
386-
if (this.localeData.notie.nine == undefined) {
387-
text = this.fallbackLocaleData.notie.nine
388-
} else {
389-
text = this.localeData.notie.nine
390-
}
391-
notie.alert({type: 'info', text: text });
405+
// make delay for notie only, not hide operations
406+
setTimeout(() => {
407+
if (this.localeData.notie.nine == undefined) {
408+
text = this.fallbackLocaleData.notie.nine
409+
} else {
410+
text = this.localeData.notie.nine
411+
}
412+
notie.alert({type: 'info', text: text });
413+
}, wait);
392414
table.hide();
393415
$('.JCLRgrips').hide();
394416
}
395417
},
396418
loadEmails(refresh) {
419+
var wait = 0;
420+
// show
421+
if (this.search_by == "log_lines") {
422+
wait = 3000;
423+
if (this.localeData.notie.three == undefined) {
424+
text = this.fallbackLocaleData.notie.ten
425+
} else {
426+
text = this.localeData.notie.ten
427+
}
428+
notie.alert({type: 'warning', text: text});
429+
}
397430
// check if search_error clear search text
398431
if (this.search_error) {
399432
this.search = "";
@@ -445,7 +478,7 @@ const app = Vue.createApp({
445478
$found_table = $('.emails-list');
446479
thead = $found_table.find('thead');
447480
// if no results don't show table and show notification
448-
this.check_nothing_found(this.count,$found_table);
481+
this.check_nothing_found(this.count,$found_table,wait);
449482

450483
if (refresh) {
451484
// scroll to the table top
@@ -620,7 +653,7 @@ const app = Vue.createApp({
620653
this.$nextTick(function () {
621654
// check if we are on login or api_error screen
622655
if (!(($("div.logo.login").length > 0) || ($(".api_error_container").length > 0))) {
623-
this.check_nothing_found(0,$('.emails-list'));
656+
this.check_nothing_found(0,$('.emails-list'),0);
624657
}
625658
});
626659
});
@@ -750,6 +783,18 @@ const app = Vue.createApp({
750783
saveCurPage() {
751784
window.localStorage['cur_page']=this.page;
752785
},
786+
setDuration_Log_lines() {
787+
//console.log("Force heavy load search to the last 24 hours!");
788+
$('#default_period_div').hide();
789+
var startdate = new Date(new Date(Date.now()) - 24 * 60 * 60000/* - tzoffset*/);
790+
startdate = this.format_date(startdate,datetime_format,true);
791+
this.date_filter__gt = startdate;
792+
this.date_filter__lt = "";
793+
this.saveFilters();
794+
//this.debounce_emails(true);
795+
//this.reset_page();
796+
797+
},
753798
setDuration() {
754799
this.$nextTick(function () {
755800
if (!(this.settings.filters)) {
@@ -766,12 +811,14 @@ const app = Vue.createApp({
766811
// autorefresh
767812
this.$nextTick(function () {
768813
clearInterval(window.app.timer);
769-
window.app.timer = setInterval(function(){
770-
if (window.app.settings.refresh !== undefined) {
771-
//console.log("Page is refreshed after " + window.app.settings.refresh + " seconds passed.");
772-
window.app.loadEmails(false);
773-
}
774-
}, window.app.settings.refresh * 60000);
814+
if (window.app.settings.refresh > 0) {
815+
window.app.timer = setInterval(function(){
816+
if (window.app.settings.refresh !== undefined) {
817+
//console.log("Page is refreshed after " + window.app.settings.refresh + " seconds passed.");
818+
window.app.loadEmails(false);
819+
}
820+
}, window.app.settings.refresh * 60000);
821+
}
775822
});
776823
},
777824
loadCurPage() {

mlp/static/locales/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"six": "You must log in to access this",
1212
"seven": "You have been successfully logged out",
1313
"eight": "API call error",
14-
"nine": "No messages found matching the search criteria"
14+
"nine": "No messages found matching the search criteria",
15+
"ten": "Search by all log lines is chosen. Only last 24 hours is available for this search!"
1516
},
1617
"login": {
1718
"message": "Please login to proceed.",
@@ -47,6 +48,7 @@
4748
"page_limit": "Maximum results per page:",
4849
"show_last_min": "Show logs for last",
4950
"show_last_min_end": "min",
51+
"no_refresh": "No autorefresh",
5052
"refresh": "Refresh every",
5153
"refresh_end": "min",
5254
"blur": "Blur effect",

mlp/static/locales/ru.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"six": "Для доступа сюда требуется авторизация",
1212
"seven": "Вы успешно вышли",
1313
"eight": "Ошибка при вызове API",
14-
"nine": "Сообщений, удовлетворяющих условиям поиска, не найдено"
14+
"nine": "Сообщений, удовлетворяющих условиям поиска, не найдено",
15+
"ten": "Выбран ресурсоемкий фильтр поиска по всем строкам лога. Принудительно выставлен поиск за последние 24 часа!"
1516
},
1617
"login": {
1718
"message": "Пожалуйста, введите пароль для входа.",
@@ -47,6 +48,7 @@
4748
"page_limit": "Строк на страницу:",
4849
"show_last_min": "Показывать логи за последние",
4950
"show_last_min_end": "мин.",
51+
"no_refresh": "Автообновление выключено",
5052
"refresh": "Обновлять каждые",
5153
"refresh_end": "мин.",
5254
"blur": "Эффект размытия",

mlp/webui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ async def api_emails():
187187
if settings.mta == 'exim':
188188
recipient_match = "-> |=> |== |>> "
189189
#recipient_match = "->|=>|==|>> "
190-
if settings.mta == 'sendmail':
190+
if settings.mta == 'sendmail' or settings.mta == 'postfix':
191191
recipient_match = "to="
192192
found_strings = await _sm.concat_map(lambda m: m['lines']).filter(lambda m: m['message'].match(recipient_match)).filter(lambda m: m['message'].match(search_string)).run(conn)
193193
ids = []

0 commit comments

Comments
 (0)