luci2: move most RPC proxy function declarations into the views using them to reduce...
[project/luci2/ui.git] / luci2 / htdocs / luci2 / luci2.js
index 30e3063..34cef8a 100644 (file)
@@ -2805,41 +2805,6 @@ function LuCI2()
                        });
                },
 
-               getProcessList: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'process_list',
-                       expect: { processes: [ ] },
-                       filter: function(data) {
-                               data.sort(function(a, b) { return a.pid - b.pid });
-                               return data;
-                       }
-               }),
-
-               getSystemLog: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'syslog',
-                       expect: { log: '' }
-               }),
-
-               getKernelLog: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'dmesg',
-                       expect: { log: '' }
-               }),
-
-               getZoneInfo: function(cb)
-               {
-                       return $.getJSON(_luci2.globals.resource + '/zoneinfo.json', cb);
-               },
-
-               sendSignal: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'process_signal',
-                       params: [ 'pid', 'signal' ],
-                       filter: function(data) {
-                               return (data == 0);
-                       }
-               }),
 
                initList: _luci2.rpc.declare({
                        object: 'luci2.system',
@@ -2879,239 +2844,12 @@ function LuCI2()
                initDisable: function(init, cb) { return _luci2.system.initRun(init, 'disable', cb) },
 
 
-               getRcLocal: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'rclocal_get',
-                       expect: { data: '' }
-               }),
-
-               setRcLocal: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'rclocal_set',
-                       params: [ 'data' ]
-               }),
-
-
-               getCrontab: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'crontab_get',
-                       expect: { data: '' }
-               }),
-
-               setCrontab: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'crontab_set',
-                       params: [ 'data' ]
-               }),
-
-
-               getSSHKeys: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'sshkeys_get',
-                       expect: { keys: [ ] }
-               }),
-
-               setSSHKeys: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'sshkeys_set',
-                       params: [ 'keys' ]
-               }),
-
-
-               setPassword: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'password_set',
-                       params: [ 'user', 'password' ]
-               }),
-
-
-               listLEDs: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'led_list',
-                       expect: { leds: [ ] }
-               }),
-
-               listUSBDevices: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'usb_list',
-                       expect: { devices: [ ] }
-               }),
-
-
-               testUpgrade: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'upgrade_test',
-                       expect: { '': { } }
-               }),
-
-               startUpgrade: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'upgrade_start',
-                       params: [ 'keep' ]
-               }),
-
-               cleanUpgrade: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'upgrade_clean'
-               }),
-
-
-               restoreBackup: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'backup_restore'
-               }),
-
-               cleanBackup: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'backup_clean'
-               }),
-
-
-               getBackupConfig: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'backup_config_get',
-                       expect: { config: '' }
-               }),
-
-               setBackupConfig: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'backup_config_set',
-                       params: [ 'data' ]
-               }),
-
-
-               listBackup: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'backup_list',
-                       expect: { files: [ ] }
-               }),
-
-
-               testReset: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'reset_test',
-                       expect: { supported: false }
-               }),
-
-               startReset: _luci2.rpc.declare({
-                       object: 'luci2.system',
-                       method: 'reset_start'
-               }),
-
-
                performReboot: _luci2.rpc.declare({
                        object: 'luci2.system',
                        method: 'reboot'
                })
        };
 
-       this.opkg = {
-               updateLists: _luci2.rpc.declare({
-                       object: 'luci2.opkg',
-                       method: 'update',
-                       expect: { '': { } }
-               }),
-
-               _allPackages: _luci2.rpc.declare({
-                       object: 'luci2.opkg',
-                       method: 'list',
-                       params: [ 'offset', 'limit', 'pattern' ],
-                       expect: { '': { } }
-               }),
-
-               _installedPackages: _luci2.rpc.declare({
-                       object: 'luci2.opkg',
-                       method: 'list_installed',
-                       params: [ 'offset', 'limit', 'pattern' ],
-                       expect: { '': { } }
-               }),
-
-               _findPackages: _luci2.rpc.declare({
-                       object: 'luci2.opkg',
-                       method: 'find',
-                       params: [ 'offset', 'limit', 'pattern' ],
-                       expect: { '': { } }
-               }),
-
-               _fetchPackages: function(action, offset, limit, pattern)
-               {
-                       var packages = [ ];
-
-                       return action(offset, limit, pattern).then(function(list) {
-                               if (!list.total || !list.packages)
-                                       return { length: 0, total: 0 };
-
-                               packages.push.apply(packages, list.packages);
-                               packages.total = list.total;
-
-                               if (limit <= 0)
-                                       limit = list.total;
-
-                               if (packages.length >= limit)
-                                       return packages;
-
-                               _luci2.rpc.batch();
-
-                               for (var i = offset + packages.length; i < limit; i += 100)
-                                       action(i, (Math.min(i + 100, limit) % 100) || 100, pattern);
-
-                               return _luci2.rpc.flush();
-                       }).then(function(lists) {
-                               for (var i = 0; i < lists.length; i++)
-                               {
-                                       if (!lists[i].total || !lists[i].packages)
-                                               continue;
-
-                                       packages.push.apply(packages, lists[i].packages);
-                                       packages.total = lists[i].total;
-                               }
-
-                               return packages;
-                       });
-               },
-
-               listPackages: function(offset, limit, pattern)
-               {
-                       return _luci2.opkg._fetchPackages(_luci2.opkg._allPackages, offset, limit, pattern);
-               },
-
-               installedPackages: function(offset, limit, pattern)
-               {
-                       return _luci2.opkg._fetchPackages(_luci2.opkg._installedPackages, offset, limit, pattern);
-               },
-
-               findPackages: function(offset, limit, pattern)
-               {
-                       return _luci2.opkg._fetchPackages(_luci2.opkg._findPackages, offset, limit, pattern);
-               },
-
-               installPackage: _luci2.rpc.declare({
-                       object: 'luci2.opkg',
-                       method: 'install',
-                       params: [ 'package' ],
-                       expect: { '': { } }
-               }),
-
-               removePackage: _luci2.rpc.declare({
-                       object: 'luci2.opkg',
-                       method: 'remove',
-                       params: [ 'package' ],
-                       expect: { '': { } }
-               }),
-
-               getConfig: _luci2.rpc.declare({
-                       object: 'luci2.opkg',
-                       method: 'config_get',
-                       expect: { config: '' }
-               }),
-
-               setConfig: _luci2.rpc.declare({
-                       object: 'luci2.opkg',
-                       method: 'config_set',
-                       params: [ 'data' ]
-               })
-       };
-
        this.session = {
 
                login: _luci2.rpc.declare({