Permalink
Browse files

work on custom node and slot view support

  • Loading branch information...
1 parent 28f30cc commit 80fe5d3e7467ea893a65bdb1731aed45aa81b193 @stevedekorte committed Dec 1, 2011
View
@@ -96,6 +96,19 @@ PRecord = Proto.clone().newSlots({
c.next();
}
return names;
+ },
+
+ slotsAsDict: function()
+ {
+ var dict = {};
+ var c = this.cursor();
+ c.first();
+ while(c.key())
+ {
+ dict[c.key()] = c.value();
+ c.next();
+ }
+ return dict;
}
})
View
@@ -498,7 +498,7 @@ if(elapsed > 1000)
{
var results = [];
- writeln("request = ", JSON.stringify(requestItems));
+ writeln(">>> ", JSON.stringify(requestItems));
for (var i = 0; i < requestItems.length; i ++)
{
@@ -548,6 +548,7 @@ if(elapsed > 1000)
}
// writeln("results = ", results);
+ writeln("<<< ", JSON.stringify(results) + "\n");
return results;
},
@@ -669,7 +670,7 @@ if(elapsed > 1000)
api_ls: function(dict)
{
//var expressionFunc = eval(selectExpression);
- console.log("api_ls: " + JSON.stringify(dict.path));
+ //console.log("api_ls: " + JSON.stringify(dict.path));
if(dict.options == null) { dict.options = {}; }
var destNode = this.node(dict.path);
@@ -706,17 +707,18 @@ if(elapsed > 1000)
//{
if(dict.options.returnCount == null)
{
+ var inlinedNode = destNode.at(c.key());
+ var mdict = inlinedNode.mRecord().slotsAsDict();
/*
- var v = null;
- if (dict.options.inline)
- {
- var inlinedNode = destNode.at(c.key());
- v = inlinedNode.asJsonObject(true);
- }
+ var mdict = {};
+ var mtype = inlinedNode.mread("type");
+ var mview = inlinedNode.mread("view");
+ if(mtype) { mdict.type = mtype; }
+ if(mview) { mdict.view = mview; }
*/
- var v = destNode.mread("type");
- results[c.key()] = v;
+ results[c.key()] = mdict;
}
+
count ++;
if(max) { max = max - 1; }
@@ -832,16 +834,7 @@ if(elapsed > 1000)
return null;
}
- var names = destNode.mRecord().slotNames();
- var pairs = [];
- for(var i = 0; i < names.length; i++)
- {
- var name = names[i];
- var value = destNode.mRecord().at(name);
- pairs.push([name, value]);
- }
-
- return pairs;
+ return destNode.mRecord().slotsAsDict();
},
api_mrm: function(dict) //path, name)
Binary file not shown.
Binary file not shown.

0 comments on commit 80fe5d3

Please sign in to comment.