diff --git a/UnitTests/Makefile.unittests b/UnitTests/Makefile.unittests index e3782bdb72..10138c50bf 100755 --- a/UnitTests/Makefile.unittests +++ b/UnitTests/Makefile.unittests @@ -419,7 +419,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/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 e5ccd07e76..df369fcf43 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 @@ -174,9 +174,7 @@ var i; if (typeof body !== 'string') { - internal.startCaptureMode(); - print(body); - body = internal.stopCaptureMode(); + body = internal.inspect(body); } curl = "shell> curl "; @@ -242,7 +240,6 @@ return function (response) { var key; var headers = response.headers; - var output; // generate header appender("HTTP/1.1 " + headers['http/1.1'] + "\n"); @@ -260,10 +257,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/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) { diff --git a/js/client/bootstrap/module-internal.js b/js/client/bootstrap/module-internal.js index e5ccd07e76..df369fcf43 100644 --- a/js/client/bootstrap/module-internal.js +++ b/js/client/bootstrap/module-internal.js @@ -174,9 +174,7 @@ var i; if (typeof body !== 'string') { - internal.startCaptureMode(); - print(body); - body = internal.stopCaptureMode(); + body = internal.inspect(body); } curl = "shell> curl "; @@ -242,7 +240,6 @@ return function (response) { var key; var headers = response.headers; - var output; // generate header appender("HTTP/1.1 " + headers['http/1.1'] + "\n"); @@ -260,10 +257,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 }; 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