mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 19:55:13 +08:00
🎄 Sync 2026-09-26 02:25:56
This commit is contained in:
1 parent
99196a85d3
commit
4136a9b488
73 files changed
+2401
-4124
No files matched your search
@@ -16,6 +16,31 @@ const callLogRead = rpc.declare({
|
||||
expect: { log: [] }
|
||||
});
|
||||
|
||||
function exportLogButton(filename, label) {
|
||||
return E('button', {
|
||||
'type': 'button',
|
||||
'class': 'cbi-button cbi-button-action',
|
||||
'style': 'margin-left: 10px',
|
||||
'click': function() {
|
||||
const log = document.getElementById('syslog');
|
||||
if (!log)
|
||||
return;
|
||||
|
||||
const blob = new Blob(['\ufeff', log.value], { type: 'text/plain;charset=utf-8' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = E('a', {
|
||||
'href': url,
|
||||
'download': filename + '-' + new Date().toISOString().replace(/[:.]/g, '-') + '.txt',
|
||||
'style': 'display: none'
|
||||
});
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
window.setTimeout(function() { URL.revokeObjectURL(url); }, 1000);
|
||||
}
|
||||
}, label);
|
||||
}
|
||||
|
||||
var CBILogreadBox = function(logtag, name) {
|
||||
return L.view.extend({
|
||||
|
||||
@@ -271,7 +296,10 @@ var CBILogreadBox = function(logtag, name) {
|
||||
E('label', { 'for': 'logMaxRows', 'style': 'margin: 0 5px' }, _('Max rows:')),
|
||||
filterMaxRows,
|
||||
]),
|
||||
E('div', {'style': 'padding-bottom: 20px'}, [scrollDownButton]),
|
||||
E('div', {'style': 'padding-bottom: 20px'}, [
|
||||
scrollDownButton,
|
||||
!logtag ? exportLogButton('system-log', _('Export system log to TXT')) : null
|
||||
]),
|
||||
E('textarea', {
|
||||
'id': 'syslog',
|
||||
'style': 'font-size:12px',
|
||||
@@ -292,4 +320,5 @@ var CBILogreadBox = function(logtag, name) {
|
||||
|
||||
return L.Class.extend({
|
||||
LogreadBox: CBILogreadBox,
|
||||
exportLogButton: exportLogButton,
|
||||
});
|
||||
@@ -14173,3 +14173,9 @@ msgstr "连接数"
|
||||
|
||||
msgid "Wireless scan failed: %s"
|
||||
msgstr "无线扫描失败:%s"
|
||||
|
||||
msgid "Export system log to TXT"
|
||||
msgstr "导出系统日志到 TXT"
|
||||
|
||||
msgid "Export kernel log to TXT"
|
||||
msgstr "导出内核日志到 TXT"
|
||||
@@ -14028,3 +14028,9 @@ msgstr "連線數"
|
||||
|
||||
msgid "Wireless scan failed: %s"
|
||||
msgstr "無線掃描失敗:%s"
|
||||
|
||||
msgid "Export system log to TXT"
|
||||
msgstr "匯出系統日誌至 TXT"
|
||||
|
||||
msgid "Export kernel log to TXT"
|
||||
msgstr "匯出核心日誌至 TXT"
|
||||
Reference in new issue
Block a user