use peering request

This commit is contained in:
j 2016-01-13 15:22:25 +05:30
parent 614a562f3c
commit cb4ba86bac
2 changed files with 18 additions and 21 deletions

View file

@ -347,15 +347,11 @@ oml.ui.folders = function() {
Ox.print('got change event') Ox.print('got change event')
Ox.Request.clearCache(); Ox.Request.clearCache();
}, },
'peering.accept': function(data) { peering: function(data, event) {
Ox.print('peering.accept reload list')
Ox.Request.clearCache('getUsers'); Ox.Request.clearCache('getUsers');
that.updateElement(); if (Ox.contains(['peering.accept', 'peering.remove'], event)) {
}, that.updateElement();
'peering.remove': function(data) { }
Ox.print('peering.remove reload list')
Ox.Request.clearCache('getUsers');
that.updateElement();
}, },
status: function(data) { status: function(data) {
if (data.id == oml.user.id) { if (data.id == oml.user.id) {

View file

@ -39,25 +39,26 @@ oml.ui.peersButton = function() {
.appendTo(that); .appendTo(that);
oml.bindEvent({ oml.bindEvent({
'peering.request': update, peering: update
'peering.accept': update,
'peering.reject': update
}); });
update(); update();
function open() { function open() {
oml.UI.set({page: 'users'}); oml.UI.set({page: 'peers'});
} }
function update() { function update() {
oml.api.getUsers(function(result) { // wait for clearCache in folder.js
requests = result.data.users.filter(function(user) { setTimeout(function() {
return user.pending=="received"; oml.api.getUsers(function(result) {
}).length; requests = result.data.users.filter(function(user) {
count.html(requests); return user.pending=="received";
that.options({ }).length;
tooltip: Ox._(requests count.html(requests);
? Ox.formatCount(requests, 'peering request') that.options({
: 'No peering requests') tooltip: Ox._(requests
? Ox.formatCount(requests, 'peering request')
: 'No peering requests')
});
}); });
}); });
} }