mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-29 21:55:13 +08:00
update 2026-07-27 22:20:34
This commit is contained in:
1 parent
079ea4f182
commit
20b786ab77
6243 files changed
-2850540
No files matched your search
@@ -1,35 +0,0 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require fs';
|
||||
'require ui';
|
||||
|
||||
const isReadonlyView = !L.hasViewPermission() || null;
|
||||
|
||||
return view.extend({
|
||||
handleSaveApply: null,
|
||||
handleReset: null,
|
||||
|
||||
load() {
|
||||
return L.resolveDefault(fs.read('/etc/netdata/netdata.conf'), '');
|
||||
},
|
||||
|
||||
handleSave(ev) {
|
||||
let value = (document.querySelector('textarea').value || '').trim().replace(/\r\n/g, '\n') + '\n';
|
||||
|
||||
return fs.write('/etc/netdata/netdata.conf', value).then((rc) => {
|
||||
document.querySelector('textarea').value = value;
|
||||
ui.addNotification(null, E('p', _('Contents have been saved.')), 'info');
|
||||
|
||||
return fs.exec('/etc/init.d/netdata', [ 'reload' ]);
|
||||
}).catch((e) => {
|
||||
ui.addNotification(null, E('p', _('Unable to save contents: %s').format(e.message)));
|
||||
});
|
||||
},
|
||||
|
||||
render(conf) {
|
||||
return E([
|
||||
E('h4', _('Edit Netdata main config: <code>/etc/netdata/netdata.conf</code>')),
|
||||
E('p', {}, E('textarea', { 'style': 'width:100%', 'rows': 25, 'disabled': isReadonlyView }, [ conf != null ? conf : '' ]))
|
||||
]);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user