diff --git a/js/ctrls/alert.js b/js/ctrls/alert.js index 573321f..df5e8cf 100644 --- a/js/ctrls/alert.js +++ b/js/ctrls/alert.js @@ -10,7 +10,14 @@ angular.module('webui.ctrls.alert', [ alerts.addAlerter(function(msg, type) { type = type || 'warning'; - scope.pendingAlerts.push({ msg: msg, type: type }); + var obj = { msg: msg, type: type }; + scope.pendingAlerts.push(obj); + + setTimeout(function() { + var ind = scope.pendingAlerts.indexOf(obj); + if (ind != -1) scope.removeAlert(ind); + }, 5000); + scope.$digest(); }); diff --git a/js/ctrls/download.js b/js/ctrls/download.js index 3028582..023da43 100644 --- a/js/ctrls/download.js +++ b/js/ctrls/download.js @@ -5,7 +5,6 @@ angular ]) .controller('DownloadCtrl', [ '$scope', '$rpc', '$utils', '$settings', '$alerts', function(scope, rpc, utils, sett, alerts) { - console.log(sett); scope.active = [], scope.waiting = [], scope.stopped = []; // pause the download @@ -52,7 +51,6 @@ function(scope, rpc, utils, sett, alerts) { // start filling in the model of active, // waiting and stopped download rpc.subscribe('tellActive', [], function(data) { - console.log('got active data'); scope.$apply(function() { utils.mergeMap(data[0], scope.active, scope.getCtx); }); diff --git a/js/services/rpc/helpers.js b/js/services/rpc/helpers.js index b83d997..31dba44 100644 --- a/js/services/rpc/helpers.js +++ b/js/services/rpc/helpers.js @@ -1,11 +1,11 @@ angular.module('webui.services.rpc.helpers', [ - 'webui.services.deps', 'webui.services.rpc' + 'webui.services.deps', 'webui.services.rpc', 'webui.services.alerts' ]) -.factory('$rpchelpers', ['$_', '$rpc', function(_, rpc) { +.factory('$rpchelpers', ['$_', '$rpc', '$alerts', function(_, rpc, alerts) { return { addUris: function(uris) { var cnt = 0; - var cb = function(ret) { + var cb = function(data) { cnt--; if (!cnt) { // close modal @@ -23,7 +23,7 @@ angular.module('webui.services.rpc.helpers', [ }, addTorrents: function(txts) { var cnt = 0; - var cb = function(ret) { + var cb = function(data) { cnt--; if (!cnt) { // close modal @@ -41,7 +41,7 @@ angular.module('webui.services.rpc.helpers', [ }, addMetalinks: function(txts) { var cnt = 0; - var cb = function(ret) { + var cb = function(data) { cnt--; if (!cnt) { // close modal diff --git a/js/services/rpc/rpc.js b/js/services/rpc/rpc.js index 4c48bc2..b7f7171 100644 --- a/js/services/rpc/rpc.js +++ b/js/services/rpc/rpc.js @@ -36,11 +36,15 @@ angular name: 'system.multicall', params: [params], success: function(data) { + // configuration worked, leave this as it is configurations = []; _.each(data.result, function(d, i) { var handle = subscriptions[i]; if (handle) { + if (d.code) { + alerts.addAlert(d.message, 'error'); + } handle.cb(d); if (handle.once) { subscriptions[i] = null;