veyron-browser: Filter recommended methods
Restrict recommended methods to those that have actual output.
Change-Id: Ifa0d8fcbb9e0e642bd9b19e9092476d7df2016d6
diff --git a/src/components/browse/item-details/display-item-details.js b/src/components/browse/item-details/display-item-details.js
index 339477c..6d8b556 100644
--- a/src/components/browse/item-details/display-item-details.js
+++ b/src/components/browse/item-details/display-item-details.js
@@ -46,9 +46,10 @@
var details = state.details.get(data.name);
- // We will neither recommend methods that take input parameters nor
- // re-recommend a method.
- if (input.hasParams || (details && details[m] !== undefined)) {
+ // Ignore methods that take input parameters, already recommended
+ // methods, and methods with no output (only error as an out argument).
+ if (input.hasParams || (details && details[m] !== undefined) ||
+ param.numOutArgs === 1) {
continue;
}
diff --git a/src/components/browse/item-details/make-rpc.js b/src/components/browse/item-details/make-rpc.js
index 1cace44..18742e8 100644
--- a/src/components/browse/item-details/make-rpc.js
+++ b/src/components/browse/item-details/make-rpc.js
@@ -16,10 +16,10 @@
function(result) {
debug('Received:', result);
- // Do not process empty results.
- // TODO(alexfandrianto): Eventually, we will know from the method
- // signature if there are actually results we should care about.
- if (result.toString().length === 0) {
+ var expectedOutArgs = state.signature()[data.methodName].numOutArgs;
+ // Do not process results we expect to be empty.
+ // TODO(alexfandrianto): Streaming results are ignored with this logic.
+ if (expectedOutArgs === 1) { // Error is the only possible out argument.
return;
}