From 07d3ca21ef9c2842c02b1a60e4a614c67991f954 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 19 Feb 2017 05:55:53 +0300 Subject: [PATCH] working on the peer api... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/all.js | 1 + ui (gen4)/features/core.js | 3 +++ ui (gen4)/features/peer.js | 20 ++++++++++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ui (gen4)/features/all.js b/ui (gen4)/features/all.js index 5f087c86..8d5219de 100755 --- a/ui (gen4)/features/all.js +++ b/ui (gen4)/features/all.js @@ -17,6 +17,7 @@ require('features/location') require('features/recover') require('features/history') require('features/app') +require('features/peer') require('features/ui') require('features/ui-partial-ribbons') require('features/ui-single-image') diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index 25027a22..060eb3d9 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -280,6 +280,9 @@ var IntrospectionActions = actions.Actions({ .isUserCallable() `, + // XXX should this check only the root action or the whole set??? + //function(action){ + // return this.getActionAttr(action, '__not_user_callable__') != true }], actions.doWithRootAction(function(action){ return action.__not_user_callable__ != true })], }) diff --git a/ui (gen4)/features/peer.js b/ui (gen4)/features/peer.js index 1668d1d0..5dfb5a89 100755 --- a/ui (gen4)/features/peer.js +++ b/ui (gen4)/features/peer.js @@ -22,7 +22,9 @@ var core = require('features/core') // Protocols: // - child_process // - http -// - rpc/mq +// - rpc +// - mq +// - ... var PeerActions = actions.Actions({ // XXX need more control... @@ -32,8 +34,18 @@ var PeerActions = actions.Actions({ getPeerActions: ['- Peer/', function(id){ - // XXX + var that = this + return this.actions.filter(id ? + function(action){ + return that.getActionAttr(action, '__peer__') == id } + // get all peer actions... + : function(action){ + return that.getActionAttr(action, '__peer__') }) }], + // XXX should this also check props??? + isPeerAction: ['- Peer/', + function(name){ + return !!this.getActionAttr(name, '__peer__') }], peerCreate: ['- Peer/', function(){ @@ -48,12 +60,12 @@ var PeerActions = actions.Actions({ peerConnected: ['- Peer/', core.notUserCallable(function(){ // XXX - }], + })], // event... peerDisconnected: ['- Peer/', core.notUserCallable(function(){ // XXX - }], + })], peerList: ['- Peer/', function(){