summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-transmission/htdocs/luci-static
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-transmission/htdocs/luci-static')
-rw-r--r--applications/luci-app-transmission/htdocs/luci-static/resources/view/transmission.js11
1 files changed, 4 insertions, 7 deletions
diff --git a/applications/luci-app-transmission/htdocs/luci-static/resources/view/transmission.js b/applications/luci-app-transmission/htdocs/luci-static/resources/view/transmission.js
index dfbd9af6cb..f2c42ddba5 100644
--- a/applications/luci-app-transmission/htdocs/luci-static/resources/view/transmission.js
+++ b/applications/luci-app-transmission/htdocs/luci-static/resources/view/transmission.js
@@ -1,4 +1,5 @@
'use strict';
+'require view';
'require fs';
'require uci';
'require rpc';
@@ -9,7 +10,7 @@ var callServiceList = rpc.declare({
object: 'service',
method: 'list',
params: [ 'name' ],
- expect: { '': {} }
+ expect: { 'transmission': {} }
});
function setFlagBool(o) {
@@ -17,7 +18,7 @@ function setFlagBool(o) {
o.disabled = 'false';
}
-return L.view.extend({
+return view.extend({
load: function() {
return Promise.all([
L.resolveDefault(callServiceList('transmission')),
@@ -28,11 +29,7 @@ return L.view.extend({
render: function(res) {
var port = uci.get_first('transmission', 'transmission', 'rpc_port') || '9091';
- var instances = {};
- try {
- instances = res[0]['transmission']['instances'];
- } catch (e) {}
- var running = instances.length > 0;
+ var running = Object.keys(res[0].instances || {}).length > 0;
var webinstalled = res[1] || !!uci.get_first('transmission', 'transmission', 'web_home');