forked from breeze303/luci
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
luci-app-banip: various optimizations
* add various translation improvements based on the work of "stokito" * use the new logreadbox component for the firewall log as well * removed obsolete standard Save/Save & Apply buttons in the footer, use only the improved/customized "Reload" and "Restart" buttons * improved the error handling in the try/catch blocks Signed-off-by: Dirk Brenken [email protected] Signed-off-by: Dirk Brenken <[email protected]>
- Loading branch information
Showing
4 changed files
with
244 additions
and
247 deletions.
There are no files selected for viewing
41 changes: 2 additions & 39 deletions
41
applications/luci-app-banip/htdocs/luci-static/resources/view/banip/firewall_log.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,4 @@ | ||
'use strict'; | ||
'require view'; | ||
'require poll'; | ||
'require fs'; | ||
'require tools.views as views'; | ||
|
||
return view.extend({ | ||
load: function () { | ||
return Promise.all([ | ||
L.resolveDefault(fs.stat('/sbin/logread'), null), | ||
L.resolveDefault(fs.stat('/usr/sbin/logread'), null) | ||
]); | ||
}, | ||
render: function (stat) { | ||
var logger = stat[0] ? stat[0].path : stat[1] ? stat[1].path : null; | ||
poll.add(function () { | ||
return L.resolveDefault(fs.exec_direct(logger, ['-e', ' banIP/'])).then(function (res) { | ||
var log = document.getElementById("logfile"); | ||
if (res) { | ||
log.value = res.trim(); | ||
} else { | ||
log.value = _('No banIP related firewall logs yet!'); | ||
} | ||
log.scrollTop = log.scrollHeight; | ||
}); | ||
}); | ||
return E('div', { class: 'cbi-map' }, | ||
E('div', { class: 'cbi-section' }, [ | ||
E('div', { class: 'cbi-section-descr' }, _('The syslog output, prefiltered for banIP-related firewall log entries only.')), | ||
E('textarea', { | ||
'id': 'logfile', | ||
'style': 'width: 100% !important; padding: 5px; font-family: monospace', | ||
'readonly': 'readonly', | ||
'wrap': 'off', | ||
'rows': 25 | ||
}) | ||
])); | ||
}, | ||
handleSaveApply: null, | ||
handleSave: null, | ||
handleReset: null | ||
}); | ||
return views.LogreadBox(" banIP/", "banIP firewall logs"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.