made rpc api angular friendly

This commit is contained in:
hamza zia 2013-03-12 07:51:44 +01:00
parent f10cdb0d1c
commit 9d3daff3b7
4 changed files with 10 additions and 13 deletions

View File

@ -271,7 +271,7 @@
href="#"><i class="icon-cog"></i> Settings</a>
</li>
<li ng-show="download.bittorrent">
<li ng-show="download.bittorrent && false">
<a href="#"><i class="icon-list-alt"></i> Peers</a>
</li>

View File

@ -56,22 +56,16 @@ function(
// start filling in the model of active,
// waiting and stopped download
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) {
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) {
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

View File

@ -103,5 +103,4 @@ angular
});
});
};
}]);

View File

@ -3,8 +3,10 @@ angular
'webui.services.rpc.syscall', 'webui.services.constants', 'webui.services.alerts',
'webui.services.utils'
])
.factory('$rpc', ['$syscall', '$globalTimeout', '$alerts', '$utils',
function(syscall, time, alerts, utils) {
.factory('$rpc', [
'$syscall', '$globalTimeout', '$alerts', '$utils',
'$rootScope',
function(syscall, time, alerts, utils, rootScope) {
var subscriptions = []
, configurations = [{ host: 'localhost', port: 6800, encrypt: false }]
@ -70,6 +72,8 @@ function(syscall, time, alerts, utils) {
}
});
rootScope.$apply();
if (forceNextUpdate) {
forceNextUpdate = false;
timeout = setTimeout(update, 0);