From fff305170e0f233c3c02d4cc9dc82250848202f2 Mon Sep 17 00:00:00 2001 From: Esteban Lombeyda Date: Tue, 24 Jun 2014 15:22:24 +0200 Subject: [PATCH 1/3] renaming test in order to run in only in non cluster environments --- UnitTests/Makefile.unittests | 2 +- .../tests/{shell-readonly.js => shell-readonly-noncluster.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename js/server/tests/{shell-readonly.js => shell-readonly-noncluster.js} (100%) diff --git a/UnitTests/Makefile.unittests b/UnitTests/Makefile.unittests index 5b0542a6b9..1f3bb014e0 100755 --- a/UnitTests/Makefile.unittests +++ b/UnitTests/Makefile.unittests @@ -418,7 +418,7 @@ SHELL_COMMON = \ ################################################################################ SHELL_SERVER_ONLY = \ - @top_srcdir@/js/server/tests/shell-readonly.js \ + @top_srcdir@/js/server/tests/shell-readonly-noncluster.js\ @top_srcdir@/js/server/tests/shell-wal-noncluster.js \ @top_srcdir@/js/server/tests/shell-sharding-helpers.js \ @top_srcdir@/js/server/tests/shell-compaction-noncluster.js \ diff --git a/js/server/tests/shell-readonly.js b/js/server/tests/shell-readonly-noncluster.js similarity index 100% rename from js/server/tests/shell-readonly.js rename to js/server/tests/shell-readonly-noncluster.js From 840950c6a09a9a0cf00f7a8b81abeb8270ae32aa Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Tue, 24 Jun 2014 15:32:43 +0200 Subject: [PATCH 2/3] fixed printing of functions and example generation --- .../frontend/js/bootstrap/module-internal.js | 60 ++++++++++++------- .../js/client/bootstrap/module-internal.js | 10 +--- js/client/bootstrap/module-internal.js | 10 +--- js/common/bootstrap/module-internal.js | 60 ++++++++++++------- 4 files changed, 82 insertions(+), 58 deletions(-) diff --git a/js/apps/system/aardvark/frontend/js/bootstrap/module-internal.js b/js/apps/system/aardvark/frontend/js/bootstrap/module-internal.js index e5da9268b2..57c7fc4d0d 100644 --- a/js/apps/system/aardvark/frontend/js/bootstrap/module-internal.js +++ b/js/apps/system/aardvark/frontend/js/bootstrap/module-internal.js @@ -1152,6 +1152,7 @@ //////////////////////////////////////////////////////////////////////////////// var funcRE = /function ([^\(]*)?\(\) \{ \[native code\] \}/; + var func2RE = /function ([^\(]*)?\((.*)\) \{/; exports.printRecursive = printRecursive = function (value, context) { 'use strict'; @@ -1160,6 +1161,7 @@ var customInspect = context.customInspect; var useToString = context.useToString; var limitString = context.limitString; + var showFunction = context.showFunction; if (typeof context.seen === "undefined") { context.seen = []; @@ -1203,7 +1205,7 @@ try { var s = value.toString(); - if (0 < context.level) { + if (0 < context.level && ! showFunction) { var a = s.split("\n"); var f = a[0]; @@ -1211,15 +1213,27 @@ if (m !== null) { if (m[1] === undefined) { - context.output += '[Function {native code}]'; + context.output += 'function {native code}'; } else { - context.output += '[Function "' + m[1] + '" {native code}]'; + context.output += 'function ' + m[1] + ' {native code}'; } } else { - f = f.substr(8, f.length - 10).trim(); - context.output += '[Function "' + f + '"]'; + m = func2RE.exec(f); + + if (m !== null) { + if (m[1] === undefined) { + context.output += 'function ' + '(' + m[2] +') { ... }'; + } + else { + context.output += 'function ' + m[1] + ' (' + m[2] +') { ... }'; + } + } + else { + f = f.substr(8, f.length - 10).trim(); + context.output += '[Function "' + f + '" ...]'; + } } } else { @@ -1377,17 +1391,18 @@ } else { var context = { - names: [], - seen: [], - path: "~", - level: 0, - output: "", - prettyPrint: usePrettyPrint, - useColor: useColor, customInspect: true, + emit: 16384, + level: 0, limitString: 80, - useToString: true, - emit: 16384 + names: [], + output: "", + path: "~", + prettyPrint: usePrettyPrint, + seen: [], + showFunction: false, + useColor: useColor, + useToString: true }; printRecursive(arguments[i], context); @@ -1411,14 +1426,17 @@ 'use strict'; var context = { - names: [], - seen: [], - path: "~", - level: 0, - output: "", - prettyPrint: true, - useColor: false, customInspect: options && options.customInspect, + emit: false, + level: 0, + limitString: false, + names: [], + output: "", + path: "~", + prettyPrint: true, + seen: [], + showFunction: true, + useColor: false, useToString: false }; diff --git a/js/apps/system/aardvark/frontend/js/client/bootstrap/module-internal.js b/js/apps/system/aardvark/frontend/js/client/bootstrap/module-internal.js index 0b5abdf7b0..237f401c5b 100644 --- a/js/apps/system/aardvark/frontend/js/client/bootstrap/module-internal.js +++ b/js/apps/system/aardvark/frontend/js/client/bootstrap/module-internal.js @@ -160,9 +160,7 @@ var i; if (typeof body !== 'string') { - internal.startCaptureMode(); - print(body); - body = internal.stopCaptureMode(); + body = internal.inspect(body); } curl = "shell> curl "; @@ -228,7 +226,6 @@ return function (response) { var key; var headers = response.headers; - var output; // generate header appender("HTTP/1.1 " + headers['http/1.1'] + "\n"); @@ -246,10 +243,7 @@ // append body if (response.body !== undefined) { - internal.startCaptureMode(); - print(response.body); - output = internal.stopCaptureMode(); - appender(output); + appender(internal.inspect(response.body)); appender("\n"); } }; diff --git a/js/client/bootstrap/module-internal.js b/js/client/bootstrap/module-internal.js index 0b5abdf7b0..237f401c5b 100644 --- a/js/client/bootstrap/module-internal.js +++ b/js/client/bootstrap/module-internal.js @@ -160,9 +160,7 @@ var i; if (typeof body !== 'string') { - internal.startCaptureMode(); - print(body); - body = internal.stopCaptureMode(); + body = internal.inspect(body); } curl = "shell> curl "; @@ -228,7 +226,6 @@ return function (response) { var key; var headers = response.headers; - var output; // generate header appender("HTTP/1.1 " + headers['http/1.1'] + "\n"); @@ -246,10 +243,7 @@ // append body if (response.body !== undefined) { - internal.startCaptureMode(); - print(response.body); - output = internal.stopCaptureMode(); - appender(output); + appender(internal.inspect(response.body)); appender("\n"); } }; diff --git a/js/common/bootstrap/module-internal.js b/js/common/bootstrap/module-internal.js index e5da9268b2..57c7fc4d0d 100644 --- a/js/common/bootstrap/module-internal.js +++ b/js/common/bootstrap/module-internal.js @@ -1152,6 +1152,7 @@ //////////////////////////////////////////////////////////////////////////////// var funcRE = /function ([^\(]*)?\(\) \{ \[native code\] \}/; + var func2RE = /function ([^\(]*)?\((.*)\) \{/; exports.printRecursive = printRecursive = function (value, context) { 'use strict'; @@ -1160,6 +1161,7 @@ var customInspect = context.customInspect; var useToString = context.useToString; var limitString = context.limitString; + var showFunction = context.showFunction; if (typeof context.seen === "undefined") { context.seen = []; @@ -1203,7 +1205,7 @@ try { var s = value.toString(); - if (0 < context.level) { + if (0 < context.level && ! showFunction) { var a = s.split("\n"); var f = a[0]; @@ -1211,15 +1213,27 @@ if (m !== null) { if (m[1] === undefined) { - context.output += '[Function {native code}]'; + context.output += 'function {native code}'; } else { - context.output += '[Function "' + m[1] + '" {native code}]'; + context.output += 'function ' + m[1] + ' {native code}'; } } else { - f = f.substr(8, f.length - 10).trim(); - context.output += '[Function "' + f + '"]'; + m = func2RE.exec(f); + + if (m !== null) { + if (m[1] === undefined) { + context.output += 'function ' + '(' + m[2] +') { ... }'; + } + else { + context.output += 'function ' + m[1] + ' (' + m[2] +') { ... }'; + } + } + else { + f = f.substr(8, f.length - 10).trim(); + context.output += '[Function "' + f + '" ...]'; + } } } else { @@ -1377,17 +1391,18 @@ } else { var context = { - names: [], - seen: [], - path: "~", - level: 0, - output: "", - prettyPrint: usePrettyPrint, - useColor: useColor, customInspect: true, + emit: 16384, + level: 0, limitString: 80, - useToString: true, - emit: 16384 + names: [], + output: "", + path: "~", + prettyPrint: usePrettyPrint, + seen: [], + showFunction: false, + useColor: useColor, + useToString: true }; printRecursive(arguments[i], context); @@ -1411,14 +1426,17 @@ 'use strict'; var context = { - names: [], - seen: [], - path: "~", - level: 0, - output: "", - prettyPrint: true, - useColor: false, customInspect: options && options.customInspect, + emit: false, + level: 0, + limitString: false, + names: [], + output: "", + path: "~", + prettyPrint: true, + seen: [], + showFunction: true, + useColor: false, useToString: false }; From e4f23d2b23f46db875ec0719fb1b322792354d73 Mon Sep 17 00:00:00 2001 From: scottashton Date: Tue, 24 Jun 2014 16:02:40 +0200 Subject: [PATCH 3/3] graph management --- .../frontend/js/templates/modalTable.ejs | 2 +- .../frontend/js/views/graphManagementView.js | 42 ++++++++++++++++++- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/js/apps/system/aardvark/frontend/js/templates/modalTable.ejs b/js/apps/system/aardvark/frontend/js/templates/modalTable.ejs index ec42539949..93ed33d06f 100644 --- a/js/apps/system/aardvark/frontend/js/templates/modalTable.ejs +++ b/js/apps/system/aardvark/frontend/js/templates/modalTable.ejs @@ -6,7 +6,7 @@ mandatory = '*'; } %> - + <%=row.label%><%=mandatory%>: <% diff --git a/js/apps/system/aardvark/frontend/js/views/graphManagementView.js b/js/apps/system/aardvark/frontend/js/views/graphManagementView.js index e54b136b07..5fba2329d2 100644 --- a/js/apps/system/aardvark/frontend/js/views/graphManagementView.js +++ b/js/apps/system/aardvark/frontend/js/views/graphManagementView.js @@ -47,6 +47,7 @@ graphs: this.collection, searchString : '' })); + this.events["click .tableRow"] = this.showHideDefinition.bind(this); return this; }, @@ -264,6 +265,16 @@ window.modalView.show("modalTable.ejs", "Graph Properties", buttons, tableContent); }, + + showHideDefinition : function(e) { + var id = $(e.currentTarget).attr("id"); + if (id == "row_newEdgeDefinitions1") { + $('#row_fromCollections1').toggle(); + $('#row_toCollections1').toggle(); + } + }, + + createNewGraphModal2: function() { var buttons = [], tableContent = []; @@ -278,9 +289,10 @@ true ) ); + tableContent.push( window.modalView.createTextEntry( - "newEdgeDefinitions", + "newEdgeDefinitions1", "Edge definitions", "", "Some info for edge definitions", @@ -288,6 +300,29 @@ true ) ); + + tableContent.push( + window.modalView.createSelect2Entry( + "fromCollections1", + "fromCollections", + "", + "The collection that contain the start vertices of the relation.", + "", + true + ) + ); + tableContent.push( + window.modalView.createSelect2Entry( + "toCollections1", + "toCollections", + "", + "The collection that contain the end vertices of the relation.", + "", + true + ) + ); + + tableContent.push( window.modalView.createSelect2Entry( "newVertexCollections", @@ -302,7 +337,10 @@ window.modalView.createSuccessButton("Create", this.createNewGraph.bind(this)) ); - window.modalView.show("modalTable.ejs", "Add new Graph", buttons, tableContent); + + window.modalView.show("modalTable.ejs", "Add new Graph", buttons, tableContent, null, this.events); + $('#row_fromCollections1').hide(); + $('#row_toCollections1').hide(); }, createEditGraphModal2: function(name, vertices, edges) {