From dbed0841d95151598280e21d18ad459eb3a9c244 Mon Sep 17 00:00:00 2001 From: gSpot Date: Sun, 2 Feb 2025 16:46:56 +0300 Subject: [PATCH] luci-app-ruantiblock: minor fixes for OpenWrt 24.10, updated log. --- autoinstall/2.x/autoinstall.sh | 2 +- luci-app-ruantiblock/Makefile | 2 +- .../resources/view/ruantiblock/log-base.js | 154 +++++++++++------- .../resources/view/ruantiblock/service.js | 5 +- .../resources/view/ruantiblock/tools.js | 14 +- 5 files changed, 107 insertions(+), 70 deletions(-) diff --git a/autoinstall/2.x/autoinstall.sh b/autoinstall/2.x/autoinstall.sh index 021aeef..0e86421 100755 --- a/autoinstall/2.x/autoinstall.sh +++ b/autoinstall/2.x/autoinstall.sh @@ -12,7 +12,7 @@ HTTPS_DNS_PROXY=1 OWRT_VERSION="current" RUAB_VERSION="2.1.3-r1" RUAB_MOD_LUA_VERSION="2.1.3-r1" -RUAB_LUCI_APP_VERSION="2.1.3-r1" +RUAB_LUCI_APP_VERSION="2.1.3-r2" BASE_URL="https://raw.githubusercontent.com/gSpotx2f/packages-openwrt/master" PKG_DIR="/tmp" diff --git a/luci-app-ruantiblock/Makefile b/luci-app-ruantiblock/Makefile index a9023f5..c161204 100644 --- a/luci-app-ruantiblock/Makefile +++ b/luci-app-ruantiblock/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ruantiblock PKG_VERSION:=2.1.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 LUCI_TITLE:=LuCI support for ruantiblock LUCI_DEPENDS:=+ruantiblock LUCI_PKGARCH:=all diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/log-base.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/log-base.js index d98e7e6..3bebb13 100644 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/log-base.js +++ b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/log-base.js @@ -24,10 +24,10 @@ document.head.append(E('style', {'type': 'text/css'}, --app-log-dark-font-color: #fff; --app-log-light-font-color: #fff; --app-log-debug-font-color: #e7e7e7; - --app-log-emerg-color: #a93734; + --app-log-emerg-color: #960909; --app-log-alert: #eb5050; --app-log-crit: #dc7f79; - --app-log-err: #c89593; + --app-log-err: #9a5954; --app-log-warn: #8d7000; --app-log-notice: #007627; --app-log-info: rgba(0,0,0,0); @@ -103,7 +103,6 @@ log-emerg td { } .log-info { background-color: var(--app-log-info) !important; - /*color: var(--app-log-dark-font-color) !important;*/ } .log-debug { background-color: var(--app-log-debug) !important; @@ -138,6 +137,13 @@ log-emerg td { } .log-facility-dropdown-item { } +#moreEntriesBar { + opacity: 0.7; +} +#moreEntriesBar > button { + margin: 1em 0 1em 0 !important; + min-width: 100%; +} .log-side-block { position: fixed; z-index: 200 !important; @@ -701,7 +707,7 @@ return baseclass.extend({ filterSettingsModal() { return ui.showModal(_('Filter settings'), [ - E('div', { 'class': 'cbi-map' }, [ + E('div', { 'class': 'cbi-map' }, E('div', { 'class': 'cbi-section' }, [ E('div', { 'class': 'cbi-section-node' }, [ E('div', { 'class': 'cbi-value' }, [ @@ -709,36 +715,40 @@ return baseclass.extend({ 'class': 'cbi-value-title', 'for' : 'tailInput', }, _('Last entries')), - E('div', { 'class': 'cbi-value-field' }, [ - this.tailInput, - E('button', { - 'class': 'cbi-button btn', - 'click': L.bind(ev => { - ev.target.blur(); - ev.preventDefault(); - this.tailInput.value = 0; - this.tailInput.focus(); - }, this), - }, '⌫'), - ]), + E('div', { 'class': 'cbi-value-field' }, + E('span', { 'class': 'control-group' }, [ + this.tailInput, + E('button', { + 'class': 'cbi-button btn', + 'click': L.bind(ev => { + ev.target.blur(); + ev.preventDefault(); + this.tailInput.value = 0; + this.tailInput.focus(); + }, this), + }, '⌫'), + ]) + ), ]), E('div', { 'class': 'cbi-value' }, [ E('label', { 'class': 'cbi-value-title', 'for' : 'timeFilter', }, _('Timestamp filter')), - E('div', { 'class': 'cbi-value-field' }, [ - this.timeFilter, - E('button', { - 'class': 'cbi-button btn', - 'click': L.bind(ev => { - ev.target.blur(); - ev.preventDefault(); - this.timeFilter.value = null; - this.timeFilter.focus(); - }, this), - }, '⌫'), - ]), + E('div', { 'class': 'cbi-value-field' }, + E('span', { 'class': 'control-group' }, [ + this.timeFilter, + E('button', { + 'class': 'cbi-button btn', + 'click': L.bind(ev => { + ev.target.blur(); + ev.preventDefault(); + this.timeFilter.value = null; + this.timeFilter.focus(); + }, this), + }, '⌫'), + ]) + ), ]), E('div', { 'class': 'cbi-value' }, [ E('label', { @@ -763,18 +773,20 @@ return baseclass.extend({ 'class': 'cbi-value-title', 'for' : 'msgFilter', }, _('Message filter')), - E('div', { 'class': 'cbi-value-field' }, [ - this.msgFilter, - E('button', { - 'class': 'cbi-button btn', - 'click': L.bind(ev => { - ev.target.blur(); - ev.preventDefault(); - this.msgFilter.value = null; - this.msgFilter.focus(); - }, this), - }, '⌫'), - ]), + E('div', { 'class': 'cbi-value-field' }, + E('span', { 'class': 'control-group' }, [ + this.msgFilter, + E('button', { + 'class': 'cbi-button btn', + 'click': L.bind(ev => { + ev.target.blur(); + ev.preventDefault(); + this.msgFilter.value = null; + this.msgFilter.focus(); + }, this), + }, '⌫'), + ]) + ) ]), E('div', { 'class': 'cbi-value' }, [ E('label', { @@ -813,9 +825,9 @@ return baseclass.extend({ ]) : ''), ]), ]), - ]), - E('div', { 'class': 'right' }, [ - this.logFilterForm, + ), + this.logFilterForm, + E('div', { 'class': 'right button-row' }, [ E('button', { 'class': 'btn', 'click': ev => { @@ -875,6 +887,13 @@ return baseclass.extend({ }, onSubmitFilter() { + if(this.logSorting.value != this.logSortingValue) { + if(this.logSorting.value == 'desc') { + this.logWrapper.after(this.moreEntriesBar); + } else { + this.logWrapper.before(this.moreEntriesBar); + }; + }; this.saveSettingsToLocalStorage( this.tailInput.value, this.logSorting.value, this.autoRefresh.checked); this.setFilterSettings(); @@ -998,6 +1017,7 @@ return baseclass.extend({ this.logFilterForm = E('form', { 'id' : 'logFilterForm', 'name' : 'logFilterForm', + 'style' : 'display:none', 'submit': ev => { ev.preventDefault(); return this.onSubmitFilter(); @@ -1021,24 +1041,36 @@ return baseclass.extend({ }), }, '⟳'); + function getMoreEntries(ev) { + ev.target.blur(); + if(this.fastTailValue === null) { + this.fastTailValue = Number(this.tailValue); + }; + if(this.fastTailValue > 0) { + this.fastTailValue += this.fastTailIncrement; + }; + return this.reloadLog(this.fastTailValue); + } + this.moreEntriesBtn = E('button', { - 'title': _('Get more entries'), + 'title': _('More entries'), 'class': 'cbi-button btn log-side-btn', 'style': 'margin-top:1px !important', - 'click': ui.createHandlerFn(this, function(ev) { - ev.target.blur(); - if(this.fastTailValue === null) { - this.fastTailValue = Number(this.tailValue); - } - if(this.fastTailValue > 0) { - this.fastTailValue += this.fastTailIncrement; - }; - return this.reloadLog(this.fastTailValue); - }), + 'click': ui.createHandlerFn(this, getMoreEntries), }, `+${this.fastTailIncrement}`); + this.moreEntriesRowBtn = E('button', { + 'class': 'cbi-button btn', + 'click': ui.createHandlerFn(this, getMoreEntries), + }, _('More entries')); + + this.moreEntriesBar = E('div', { + 'id' : 'moreEntriesBar', + 'class': 'center', + }, this.moreEntriesRowBtn); + this.allEntriesBtn = E('button', { - 'title': _('Get all entries'), + 'title': _('All entries'), 'class': 'cbi-button btn log-side-btn', 'style': 'margin-top:1px !important', 'click': ui.createHandlerFn(this, function(ev) { @@ -1059,7 +1091,8 @@ return baseclass.extend({ }, '▢'); this.actionButtons.push(this.filterEditsBtn, this.logDownloadBtn, - this.refreshBtn,this.moreEntriesBtn, + this.refreshBtn, this.moreEntriesBtn, + this.moreEntriesRowBtn, this.allEntriesBtn, this.filterModalBtn); document.body.append( @@ -1094,6 +1127,11 @@ return baseclass.extend({ poll.add(this.pollFuncWrapper, this.pollInterval); }; + let logArea = [ this.moreEntriesBar, this.logWrapper ]; + if(this.logSortingValue == 'desc') { + logArea.reverse(); + }; + return E([ E('h2', { 'id': 'logTitle', 'class': 'fade-in' }, this.title), E('div', { 'class': 'cbi-section-descr fade-in' }), @@ -1115,9 +1153,7 @@ return baseclass.extend({ ]) ), E('div', { 'class': 'cbi-section fade-in' }, - E('div', { 'class': 'cbi-section-node' }, - this.logWrapper - ) + E('div', { 'class': 'cbi-section-node' }, logArea) ), E('div', { 'class': 'cbi-section fade-in' }, E('div', { 'class': 'cbi-section-node' }, diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/service.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/service.js index ed0b391..c05c41b 100644 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/service.js +++ b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/service.js @@ -63,6 +63,7 @@ return view.extend({ }; }; }; + this.dnsmasqCfgDirsSelect = E('select', { 'id' : 'dnsmasq_confdirs_list', 'class': "cbi-input-select", @@ -87,7 +88,7 @@ return view.extend({ ]), ]), ]), - E('div', { 'class': 'right' }, [ + E('div', { 'class': 'right button-row' }, [ this.cancelButton, ' ', E('button', { @@ -321,7 +322,7 @@ return view.extend({ return; }; - let section = uci.get(tools.appName, 'config'); + let section = uci.get(tools.appName, 'config'); this.statusTokenValue = (Array.isArray(status_array)) ? tools.normalizeValue(status_array[4]) : null; diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/tools.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/tools.js index 384d255..1f7990a 100644 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/tools.js +++ b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/tools.js @@ -204,25 +204,25 @@ return baseclass.extend({ E('div', { 'class': 'cbi-section' }, E('p', {}, E('textarea', { - 'id': 'widget.modal_content', - 'class': 'cbi-input-textarea', - 'style': 'width:100% !important', - 'rows': 10, - 'wrap': 'off', + 'id' : 'widget.modal_content', + 'class' : 'cbi-input-textarea', + 'style' : 'width:100% !important', + 'rows' : 10, + 'wrap' : 'off', 'spellcheck': 'false', }, content) ) ), ]), - E('div', { 'class': 'right' }, [ + E('div', { 'class': 'right button-row' }, [ E('button', { 'class': 'btn', 'click': ui.hideModal, }, _('Dismiss')), ' ', E('button', { - 'id': 'btn_save', + 'id' : 'btn_save', 'class': 'btn cbi-button-positive important', 'click': ui.createHandlerFn(this, this.handleSave), }, _('Save')),