Skip to content

Commit

Permalink
ver 1.1.4 update
Browse files Browse the repository at this point in the history
Some bugfixes and features. Check CHANGES.md
  • Loading branch information
drlight17 authored Jul 7, 2023
1 parent 65ee26d commit dda002b
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 36 deletions.
9 changes: 7 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
Unreleased VER.
- add multiple simultanious text filters
- dark theme mode
- gui autorefresh 0 value as "no autorefresh"
- padding to the cells in table resizable mode
- minify
- get rid of setTimeouts
- replace momentjs wih day.js or luxone(?)
- make mailcow PR to integrate into
- maybe scrollTo by not all refreshes (?)
- remove python privex helpers code (?)
- save settings into cookies + accept cookies modal (?)
- export to xlsx file (table) (?)

VER. 1.1.4
- ~~gui autorefresh 0 value as "no autorefresh"~~
- ~~to fix log_lines filter 1 min timeout (504 error) by forced apply time period (in frontend)~~
- ~~to fix mail_to filter in postfix~~
- ~~padding to the cells in table resizable mode~~

VER. 1.1.3
- ~~tail realtime parsing mode + gui autorefresh (with config seconds)~~
Expand Down
2 changes: 1 addition & 1 deletion mlp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

# !!! change version upon update !!!
global VERSION
VERSION ="1.1.3"
VERSION ="1.1.4"

# postfix regexp
postf_match = r'([A-Za-z]+[ \t]+[0-9]+[ \t]+[0-9]+\:[0-9]+:[0-9]+).*'
Expand Down
4 changes: 2 additions & 2 deletions mlp/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@
text-overflow: ellipsis;
}

/*for resizable tables*/
/*for resizable tables
.emails-list:is(.resizable) td, .emails-list:is(.resizable) th {
white-space: nowrap;
}
}*/

/* for non-resizable tables*/
.emails-list:not(.resizable) td:hover, .emails-list:not(.resizable) th:hover {
Expand Down
5 changes: 3 additions & 2 deletions mlp/static/js/local_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
<input v-model="settings.default_period" type="range" step="5" min="5" max="1440" class="ui input range">
</div>
</div>
<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>
<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>
<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>
<div class="ui input">
<input v-model="settings.refresh" type="range" step="1" min="1" max="60" class="ui input range" placeholder="Amount of seconds">
<input v-model="settings.refresh" type="range" step="1" min="0" max="60" class="ui input range" placeholder="Amount of seconds">
</div>
</div>
<div class="field">
Expand Down
99 changes: 73 additions & 26 deletions mlp/static/js/main_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,35 @@ const app = Vue.createApp({
//this.search = this.search.slice(0,-1);
//return;
} else {
$('#text_search').css('color', 'initial');
if (this.settings.filters) {
this.saveFilters();
if (this.search_by !== "log_lines") {
$('#text_search').css('color', 'initial');
if (this.settings.filters) {
this.saveFilters();
} else {
$('#default_period_div').show();
}
this.search_error = false;
this.reset_page();

} else {
this.setDuration_Log_lines();
}
this.search_error = false;
this.reset_page();
this.debounce_emails(true);
}
},
search_by(val) {
if (this.search !== "") {
if (this.settings.filters) {
this.saveFilters();
if (this.search_by !== "log_lines") {
if (this.settings.filters) {
this.saveFilters();
} else {
$('#default_period_div').show();
}
this.reset_page();

} else {
this.setDuration_Log_lines();
}
this.reset_page();
this.debounce_emails(true);
}
},
Expand All @@ -123,10 +137,15 @@ const app = Vue.createApp({
this.debounce_emails(true);
},
date_filter__gt(val) {
if (this.settings.filters) {
this.saveFilters();
if (this.search_by !== "log_lines") {
if (this.settings.filters) {
this.saveFilters();
}
this.reset_page();

} else {
this.setDuration_Log_lines();
}
this.reset_page();
// do not debounce on datestart change ???
this.debounce_emails(true);
},
Expand Down Expand Up @@ -380,20 +399,34 @@ const app = Vue.createApp({
this.loading = false;
}
},
check_nothing_found(count,table) {
check_nothing_found(count,table,wait) {
// if no results don't show table and show notification
if (count == 0) {
if (this.localeData.notie.nine == undefined) {
text = this.fallbackLocaleData.notie.nine
} else {
text = this.localeData.notie.nine
}
notie.alert({type: 'info', text: text });
// make delay for notie only, not hide operations
setTimeout(() => {
if (this.localeData.notie.nine == undefined) {
text = this.fallbackLocaleData.notie.nine
} else {
text = this.localeData.notie.nine
}
notie.alert({type: 'info', text: text });
}, wait);
table.hide();
$('.JCLRgrips').hide();
}
},
loadEmails(refresh) {
var wait = 0;
// show
if (this.search_by == "log_lines") {
wait = 3000;
if (this.localeData.notie.three == undefined) {
text = this.fallbackLocaleData.notie.ten
} else {
text = this.localeData.notie.ten
}
notie.alert({type: 'warning', text: text});
}
// check if search_error clear search text
if (this.search_error) {
this.search = "";
Expand Down Expand Up @@ -445,7 +478,7 @@ const app = Vue.createApp({
$found_table = $('.emails-list');
thead = $found_table.find('thead');
// if no results don't show table and show notification
this.check_nothing_found(this.count,$found_table);
this.check_nothing_found(this.count,$found_table,wait);

if (refresh) {
// scroll to the table top
Expand Down Expand Up @@ -620,7 +653,7 @@ const app = Vue.createApp({
this.$nextTick(function () {
// check if we are on login or api_error screen
if (!(($("div.logo.login").length > 0) || ($(".api_error_container").length > 0))) {
this.check_nothing_found(0,$('.emails-list'));
this.check_nothing_found(0,$('.emails-list'),0);
}
});
});
Expand Down Expand Up @@ -750,6 +783,18 @@ const app = Vue.createApp({
saveCurPage() {
window.localStorage['cur_page']=this.page;
},
setDuration_Log_lines() {
//console.log("Force heavy load search to the last 24 hours!");
$('#default_period_div').hide();
var startdate = new Date(new Date(Date.now()) - 24 * 60 * 60000/* - tzoffset*/);
startdate = this.format_date(startdate,datetime_format,true);
this.date_filter__gt = startdate;
this.date_filter__lt = "";
this.saveFilters();
//this.debounce_emails(true);
//this.reset_page();

},
setDuration() {
this.$nextTick(function () {
if (!(this.settings.filters)) {
Expand All @@ -766,12 +811,14 @@ const app = Vue.createApp({
// autorefresh
this.$nextTick(function () {
clearInterval(window.app.timer);
window.app.timer = setInterval(function(){
if (window.app.settings.refresh !== undefined) {
//console.log("Page is refreshed after " + window.app.settings.refresh + " seconds passed.");
window.app.loadEmails(false);
}
}, window.app.settings.refresh * 60000);
if (window.app.settings.refresh > 0) {
window.app.timer = setInterval(function(){
if (window.app.settings.refresh !== undefined) {
//console.log("Page is refreshed after " + window.app.settings.refresh + " seconds passed.");
window.app.loadEmails(false);
}
}, window.app.settings.refresh * 60000);
}
});
},
loadCurPage() {
Expand Down
4 changes: 3 additions & 1 deletion mlp/static/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"six": "You must log in to access this",
"seven": "You have been successfully logged out",
"eight": "API call error",
"nine": "No messages found matching the search criteria"
"nine": "No messages found matching the search criteria",
"ten": "Search by all log lines is chosen. Only last 24 hours is available for this search!"
},
"login": {
"message": "Please login to proceed.",
Expand Down Expand Up @@ -47,6 +48,7 @@
"page_limit": "Maximum results per page:",
"show_last_min": "Show logs for last",
"show_last_min_end": "min",
"no_refresh": "No autorefresh",
"refresh": "Refresh every",
"refresh_end": "min",
"blur": "Blur effect",
Expand Down
4 changes: 3 additions & 1 deletion mlp/static/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"six": "Для доступа сюда требуется авторизация",
"seven": "Вы успешно вышли",
"eight": "Ошибка при вызове API",
"nine": "Сообщений, удовлетворяющих условиям поиска, не найдено"
"nine": "Сообщений, удовлетворяющих условиям поиска, не найдено",
"ten": "Выбран ресурсоемкий фильтр поиска по всем строкам лога. Принудительно выставлен поиск за последние 24 часа!"
},
"login": {
"message": "Пожалуйста, введите пароль для входа.",
Expand Down Expand Up @@ -47,6 +48,7 @@
"page_limit": "Строк на страницу:",
"show_last_min": "Показывать логи за последние",
"show_last_min_end": "мин.",
"no_refresh": "Автообновление выключено",
"refresh": "Обновлять каждые",
"refresh_end": "мин.",
"blur": "Эффект размытия",
Expand Down
2 changes: 1 addition & 1 deletion mlp/webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ async def api_emails():
if settings.mta == 'exim':
recipient_match = "-> |=> |== |>> "
#recipient_match = "->|=>|==|>> "
if settings.mta == 'sendmail':
if settings.mta == 'sendmail' or settings.mta == 'postfix':
recipient_match = "to="
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)
ids = []
Expand Down

0 comments on commit dda002b

Please sign in to comment.