alert timeouts and error codes from ari2 now show as alerts
This commit is contained in:
parent
3c86459004
commit
7d1129275b
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user