luci2: move most RPC proxy function declarations into the views using them to reduce...
[project/luci2/ui.git] / luci2 / htdocs / luci2 / view / status.syslog.js
index e57db2c..87b3386 100644 (file)
@@ -1,13 +1,20 @@
 L.ui.view.extend({
-    title: L.tr('System Log'),
-    refresh: 5000,
-    execute: function() {
-        return L.system.getSystemLog().then(function(log) {
-            var ta = document.getElementById('syslog');
-            var lines = log.replace(/\n+$/, '').split(/\n/);
+       title: L.tr('System Log'),
+       refresh: 5000,
 
-            ta.rows = lines.length;
-            ta.value = lines.reverse().join("\n");
-        });
-    }
+       getSystemLog: L.rpc.declare({
+               object: 'luci2.system',
+               method: 'syslog',
+               expect: { log: '' }
+       }),
+
+       execute: function() {
+               return this.getSystemLog().then(function(log) {
+                       var ta = document.getElementById('syslog');
+                       var lines = log.replace(/\n+$/, '').split(/\n/);
+
+                       ta.rows = lines.length;
+                       ta.value = lines.reverse().join("\n");
+               });
+       }
 });