made rpc api angular friendly
This commit is contained in:
parent
f10cdb0d1c
commit
9d3daff3b7
|
@ -271,7 +271,7 @@
|
||||||
href="#"><i class="icon-cog"></i> Settings</a>
|
href="#"><i class="icon-cog"></i> Settings</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li ng-show="download.bittorrent">
|
<li ng-show="download.bittorrent && false">
|
||||||
<a href="#"><i class="icon-list-alt"></i> Peers</a>
|
<a href="#"><i class="icon-list-alt"></i> Peers</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
|
@ -56,22 +56,16 @@ function(
|
||||||
// start filling in the model of active,
|
// start filling in the model of active,
|
||||||
// waiting and stopped download
|
// waiting and stopped download
|
||||||
rpc.subscribe('tellActive', [], function(data) {
|
rpc.subscribe('tellActive', [], function(data) {
|
||||||
scope.$apply(function() {
|
utils.mergeMap(data[0], scope.active, scope.getCtx);
|
||||||
utils.mergeMap(data[0], scope.active, scope.getCtx);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.subscribe('tellWaiting', [0, 1000], function(data) {
|
rpc.subscribe('tellWaiting', [0, 1000], function(data) {
|
||||||
scope.$apply(function() {
|
utils.mergeMap(data[0], scope.waiting, scope.getCtx);
|
||||||
utils.mergeMap(data[0], scope.waiting, scope.getCtx);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
rpc.subscribe('tellStopped', [0, 1000], function(data) {
|
rpc.subscribe('tellStopped', [0, 1000], function(data) {
|
||||||
scope.$apply(function() {
|
utils.mergeMap(data[0], scope.stopped, scope.getCtx);
|
||||||
utils.mergeMap(data[0], scope.stopped, scope.getCtx);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// actual downloads used by the view
|
// actual downloads used by the view
|
||||||
|
|
|
@ -103,5 +103,4 @@ angular
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -3,8 +3,10 @@ angular
|
||||||
'webui.services.rpc.syscall', 'webui.services.constants', 'webui.services.alerts',
|
'webui.services.rpc.syscall', 'webui.services.constants', 'webui.services.alerts',
|
||||||
'webui.services.utils'
|
'webui.services.utils'
|
||||||
])
|
])
|
||||||
.factory('$rpc', ['$syscall', '$globalTimeout', '$alerts', '$utils',
|
.factory('$rpc', [
|
||||||
function(syscall, time, alerts, utils) {
|
'$syscall', '$globalTimeout', '$alerts', '$utils',
|
||||||
|
'$rootScope',
|
||||||
|
function(syscall, time, alerts, utils, rootScope) {
|
||||||
|
|
||||||
var subscriptions = []
|
var subscriptions = []
|
||||||
, configurations = [{ host: 'localhost', port: 6800, encrypt: false }]
|
, configurations = [{ host: 'localhost', port: 6800, encrypt: false }]
|
||||||
|
@ -70,6 +72,8 @@ function(syscall, time, alerts, utils) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
rootScope.$apply();
|
||||||
|
|
||||||
if (forceNextUpdate) {
|
if (forceNextUpdate) {
|
||||||
forceNextUpdate = false;
|
forceNextUpdate = false;
|
||||||
timeout = setTimeout(update, 0);
|
timeout = setTimeout(update, 0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user