From e3ea63277331c50c2a94002b0f3486f2924220af Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Thu, 22 Nov 2012 10:32:29 +0100 Subject: [PATCH 01/13] issue #289 --- CHANGELOG | 2 ++ lib/V8/V8LineEditor.cpp | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d722ecafb1..f49dc03332 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ v1.1.beta3 (XXXX-XX-XX) ----------------------- +* fixed issue #289: tab-completion does not insert any spaces + * made AQL function NOT_NULL take any number of arguments. Will now return its first argument that is not null, or null if all arguments are null. This is downwards compatible. diff --git a/lib/V8/V8LineEditor.cpp b/lib/V8/V8LineEditor.cpp index 3612eac057..44889b5a56 100644 --- a/lib/V8/V8LineEditor.cpp +++ b/lib/V8/V8LineEditor.cpp @@ -198,15 +198,16 @@ static char** AttemptedCompletion (char const* text, int start, int end) { if (result != 0 && result[0] != 0 && result[1] == 0) { size_t n = strlen(result[0]); - if (result[0][n-1] == ')') { - result[0][n-1] = '\0'; - -#if RL_READLINE_VERSION >= 0x0500 - rl_completion_suppress_append = 1; -#endif + if (result[0][n - 1] == ')') { + result[0][n - 1] = '\0'; } } +#if RL_READLINE_VERSION >= 0x0500 + // issue #289 + rl_completion_suppress_append = 1; +#endif + return result; } @@ -250,6 +251,9 @@ V8LineEditor::V8LineEditor (v8::Handle context, std::string const& bool V8LineEditor::open (const bool autoComplete) { if (autoComplete) { + // issue #289: do not append a space after completion + rl_completion_append_character = '\0'; + rl_attempted_completion_function = AttemptedCompletion; rl_completer_word_break_characters = WordBreakCharacters; From 5b537d221cfc60a83b8e01b1c35921560f89848f Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Thu, 22 Nov 2012 11:17:58 +0100 Subject: [PATCH 02/13] issue #282 --- CHANGELOG | 2 ++ html/admin/js/master.js | 29 ++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index f49dc03332..f53c020aea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,8 @@ v1.1.beta3 (XXXX-XX-XX) * fixed issue #289: tab-completion does not insert any spaces +* fixed issue #282: fix escaping in web interface + * made AQL function NOT_NULL take any number of arguments. Will now return its first argument that is not null, or null if all arguments are null. This is downwards compatible. diff --git a/html/admin/js/master.js b/html/admin/js/master.js index 6b362f5d40..d86e9a1ce3 100644 --- a/html/admin/js/master.js +++ b/html/admin/js/master.js @@ -1823,6 +1823,7 @@ function escaped (value) { /////////////////////////////////////////////////////////////////////////////// function getTypedValue (value) { + value = value.replace(/(^\s+|\s+$)/g, ''); if (value == 'true') { return true; } @@ -1856,7 +1857,33 @@ function getTypedValue (value) { value = value + ''; if (value.substr(0, 1) == '"' && value.substr(-1) == '"' ) { - value = value.substr(1, value.length-2); + // remove quotes + value = value.substr(1, value.length - 2); + + var replacements = { 'b' : '\b', 'f' : '\f', 'n' : '\n', 'r' : '\r', 't' : '\t', '\\' : '\\', '"' : '"' }; + var sanitised = ""; + var escaped = false; + for (var i = 0; i < value.length; ++i) { + var c = value.charAt(i); + if (escaped) { + escaped = false; + if (replacements[c] != '') { + sanitised += replacements[c]; + } + else { + // invalid escape sequence + } + } + else { + if (c === '\\') { + escaped = true; + } + else { + sanitised += c; + } + } + } + value = sanitised; } return value; } From 362a21a1f7931e014d25d0f99afafd2019f56138 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Thu, 22 Nov 2012 11:54:02 +0100 Subject: [PATCH 03/13] issue #282 --- html/admin/js/master.js | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/html/admin/js/master.js b/html/admin/js/master.js index d86e9a1ce3..f6c27421f2 100644 --- a/html/admin/js/master.js +++ b/html/admin/js/master.js @@ -1856,34 +1856,17 @@ function getTypedValue (value) { // fallback: value is a string value = value + ''; - if (value.substr(0, 1) == '"' && value.substr(-1) == '"' ) { - // remove quotes - value = value.substr(1, value.length - 2); - - var replacements = { 'b' : '\b', 'f' : '\f', 'n' : '\n', 'r' : '\r', 't' : '\t', '\\' : '\\', '"' : '"' }; - var sanitised = ""; - var escaped = false; - for (var i = 0; i < value.length; ++i) { - var c = value.charAt(i); - if (escaped) { - escaped = false; - if (replacements[c] != '') { - sanitised += replacements[c]; - } - else { - // invalid escape sequence - } - } - else { - if (c === '\\') { - escaped = true; - } - else { - sanitised += c; - } - } - } - value = sanitised; + if (value.substr(0, 1) != '"' || value.substr(-1) != '"') { + alert("You have entered an invalid string value. Please review and adjust it."); + throw "error"; + } + + try { + value = JSON.parse(value); + } + catch (e) { + alert("You have entered an invalid string value. Please review and adjust it."); + throw e; } return value; } From d7ab82b524d89cf386c40daf51576462e408fd47 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Thu, 22 Nov 2012 12:05:22 +0100 Subject: [PATCH 04/13] finally --- html/admin/css/.jquery-ui-1.7.2.custom.css.swp | Bin 12287 -> 0 bytes html/admin/js/master.js | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 html/admin/css/.jquery-ui-1.7.2.custom.css.swp diff --git a/html/admin/css/.jquery-ui-1.7.2.custom.css.swp b/html/admin/css/.jquery-ui-1.7.2.custom.css.swp deleted file mode 100644 index ba9b23000a92feceed5d1bd29ad06510918d3a97..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12287 zcmeI%Jx{|h5P;z;VntLiv9&PA?#ED8P^Aha#8enjng$YRQiyE<3;b06Nx_y{wq&Qg zCs~$#r<3m4EYEs37gwE;8j6p$$kAQ*`nJ82%UzM|DXq#`oMa)_5U;5*=^`)PTSJjg zef&1mlicdFDlQ+E<8z(aVxi-Ck(W9#MnAr|w0e(R9`)5o4OHTcT^7oxn%k2_0D&3- zXYZraz3Fh!?}dt!<8J5hU|LhmH3A4AfB*srAb Date: Thu, 22 Nov 2012 12:23:51 +0100 Subject: [PATCH 05/13] added collection type label to web interface --- CHANGELOG | 2 ++ html/admin/index.html | 1 + html/admin/js/master.js | 48 ++++++++++++++++++++++++++++++++++++----- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f53c020aea..f6757f78d4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ v1.1.beta3 (XXXX-XX-XX) ----------------------- +* added collection type label to web interface + * fixed issue #289: tab-completion does not insert any spaces * fixed issue #282: fix escaping in web interface diff --git a/html/admin/index.html b/html/admin/index.html index 8ef6514c8d..1edc42cbe1 100644 --- a/html/admin/index.html +++ b/html/admin/index.html @@ -86,6 +86,7 @@ ID Name + Type Status Size Documents Number of Documents diff --git a/html/admin/js/master.js b/html/admin/js/master.js index 19ddf6ac05..4ac5a474ec 100644 --- a/html/admin/js/master.js +++ b/html/admin/js/master.js @@ -221,8 +221,8 @@ var collectionTable = $('#collectionsTableID').dataTable({ "bAutoWidth": false, "iDisplayLength": -1, "bJQueryUI": true, - "aoColumns": [{"sWidth":"150px", "bSortable":false}, {"sWidth": "200px"}, {"sWidth": "200px"}, null, {"sWidth": "200px"}, {"sWidth": "200px"} ], - "aoColumnDefs": [{ "sClass": "alignRight", "aTargets": [ 4, 5 ] }], + "aoColumns": [{"sWidth":"150px", "bSortable":false, "sClass":"leftCell"}, {"sWidth": "200px"}, {"sWidth": "200px"}, {"sWidth": "150px"}, null, {"sWidth": "200px"}, {"sWidth": "200px", "sClass":"rightCell"} ], + "aoColumnDefs": [{ "sClass": "alignRight", "aTargets": [ 5, 6 ] }], "oLanguage": {"sEmptyTable": "No collections"} }); @@ -1696,7 +1696,7 @@ function drawCollectionsTable () { else if (tempStatus == 2) { tempStatus = "unloaded"; items.push(['', - val.id, val.name, tempStatus, "", ""]); + val.id, val.name, collectionType(val), tempStatus, "", ""]); } else if (tempStatus == 3) { tempStatus = "loaded"; @@ -1718,7 +1718,7 @@ function drawCollectionsTable () { }); items.push(['', - val.id, val.name, tempStatus, bytesToSize(size), alive]); + val.id, val.name, collectionType(val), tempStatus, bytesToSize(size), alive]); } else if (tempStatus == 4) { tempStatus = "in the process of being unloaded"; @@ -1727,7 +1727,7 @@ function drawCollectionsTable () { } else if (tempStatus == 5) { tempStatus = "deleted"; - items.push(["", val.id, val.name, tempStatus, "", ""]); + items.push(["", val.id, val.name, collectionType(val), tempStatus, "", ""]); } /* else { tempStatus = "corrupted"; @@ -3008,3 +3008,41 @@ function createSingleBox (id, val, question) { temptop = temptop + 10; stateSaving(); } + +function collectionType (val) { + if (! val || val.name == '') { + return "-"; + } + + if (val.name.substr(0, 1) === '_') { + return "system"; + } + + if (val.type == 2) { + return "document"; + } + else if (val.type == 3) { + return "edge"; + } + + return "unknown"; +} + +function collectionType (val) { + if (! val || val.name == '') { + return "-"; + } + + if (val.name.substr(0, 1) === '_') { + return "system"; + } + + if (val.type == 2) { + return "document"; + } + else if (val.type == 3) { + return "edge"; + } + + return "unknown"; +} From 26b847dda649eccb05175195f385eebbaa326de1 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Thu, 22 Nov 2012 13:58:19 +0100 Subject: [PATCH 06/13] collection type --- html/admin/index.html | 10 +++++----- html/admin/js/master.js | 29 +++++++++++++++++++---------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/html/admin/index.html b/html/admin/index.html index 1edc42cbe1..a4ed723101 100644 --- a/html/admin/index.html +++ b/html/admin/index.html @@ -131,13 +131,13 @@ If true then the data is synchronised to disk before returning from a create or update of an document. - isSystem: -
- yes - no + type: + + document + edge
- If true, create a system collection. In this case collection-name should start with an underscore. + The type of the collection to create. diff --git a/html/admin/js/master.js b/html/admin/js/master.js index 4ac5a474ec..d09c645a5b 100644 --- a/html/admin/js/master.js +++ b/html/admin/js/master.js @@ -1502,11 +1502,12 @@ var lastFormatQuestion = true; $('#saveNewCollection').live('click', function () { var wfscheck = $('input:radio[name=waitForSync]:checked').val(); - var systemcheck = $('input:radio[name=isSystem]:checked').val(); + var type = $('input:radio[name=type]:checked').val(); // collection type var collName = $('#createCollName').val(); var collSize = $('#createCollSize').val(); var journalSizeString; - + var isSystem = (collName.substr(0, 1) === '_'); + if (collSize == '') { journalSizeString = ''; } @@ -1522,7 +1523,7 @@ var lastFormatQuestion = true; $.ajax({ type: "POST", url: "/_api/collection", - data: '{"name":"' + collName + '", "waitForSync":' + JSON.parse(wfscheck) + ',"isSystem":' + JSON.parse(systemcheck)+ journalSizeString + '}', + data: '{"name":' + JSON.stringify(collName) + ',"waitForSync":' + JSON.stringify(wfscheck) + ',"isSystem":' + JSON.stringify(isSystem) + journalSizeString + ',"type":' + type + '}', contentType: "application/json", processData: false, success: function(data) { @@ -3028,21 +3029,29 @@ function collectionType (val) { return "unknown"; } +function isSystemCollection(val) { + return val && val.name && val.name.substr(0, 1) === '_'; +} + function collectionType (val) { if (! val || val.name == '') { return "-"; } - if (val.name.substr(0, 1) === '_') { - return "system"; - } - + var type; if (val.type == 2) { - return "document"; + type = "document"; } else if (val.type == 3) { - return "edge"; + type = "edge"; + } + else { + type = "unknown"; } - return "unknown"; + if (isSystemCollection(val)) { + type += " (system)"; + } + + return type; } From edeb2e26514646b49cede341ee6a69ce91019eab Mon Sep 17 00:00:00 2001 From: Heiko Kernbach Date: Thu, 22 Nov 2012 16:55:17 +0100 Subject: [PATCH 07/13] frontend: devel -> 1.1 --- html/admin/css/layout.css | 94 +++++-- html/admin/index.html | 59 ++-- html/admin/js/master.js | 575 ++++++++++++++++++-------------------- 3 files changed, 376 insertions(+), 352 deletions(-) diff --git a/html/admin/css/layout.css b/html/admin/css/layout.css index 2f700a9761..895daf5b40 100644 --- a/html/admin/css/layout.css +++ b/html/admin/css/layout.css @@ -229,7 +229,8 @@ html.busy, html.busy * { .hoverClass:hover { background-color: #696969 !important; - border-bottom: 1px solid #696969; + border-bottom: 1px solid #696969; + margin-top: -1px; color: white !important; } @@ -549,14 +550,14 @@ form { } #formatJSONyesno { - margin-top: -40px; + margin-top: -50px; float:right; margin-right: 120px; color: #797979; } #aqlinfo { - line-height: 150%; + line-height: 250%; } #submitQuery { @@ -565,19 +566,26 @@ form { } #refreshShell{ padding-bottom: 3px; - margin-top: -10px; + margin-top: -6px; width: 9.5% !important; } #queryOutput a, .queryError, .querySuccess { font-size: 0.9em !important; font-family: "courier"; + padding-left: 10px; + padding-top: 10px !important; } +#queryOutput pre { + padding-left: 10px; + padding-top: 10px; +} #queryOutput { margin-bottom: 5px; - height:35%; + height:35%; + padding-top: 10px; overflow-y: auto; border: 1px solid black; background: white; @@ -587,10 +595,13 @@ form { } #queryContent { + padding-top: 10px; height: 45%; font-family: "courier"; width: 100%; resize: vertical; + padding-left: 10px; + margin-top: 2px; } #avocshWindow { @@ -626,6 +637,7 @@ form { height: 30px; background-color: white; margin-right: 0.5%; + padding-left: 10px; } .avocshSuccess { @@ -707,7 +719,7 @@ form { #menue-right { padding-top:11px; - padding-right:14px; + padding-right:10px; height:40px; width:auto; float:right; @@ -826,6 +838,12 @@ form { #logTableID_info { } +#logTableID, #warnLogTableID, #critLogTableID, #infoLogTableID, #debugLogTableID { + border-left: 1px solid #AAAAAA; + border-right: 1px solid #AAAAAA; +} + + .ui-dialog { height:100px; font-size: 0.8em; @@ -834,9 +852,9 @@ form { .fg-toolbar { font-size: 0.7em; border: 1px solid #D3D3D3 !important; -// -webkit-box-shadow: inset 0 0 1px 1px #f6f6f6; -// -moz-box-shadow: inset 0 0 1px 1px #f6f6f6; -// box-shadow: inset 0 0 1px 1px #f6f6f6; + -webkit-box-shadow: inset 0 0 1px 1px #f6f6f6; + -moz-box-shadow: inset 0 0 1px 1px #f6f6f6; + box-shadow: inset 0 0 1px 1px #f6f6f6; } /* @@ -848,29 +866,16 @@ form { background: #e3e3e3; padding: 9px 0 8px; border: 1px solid #bbb; -// -webkit-box-shadow: inset 0 0 1px 1px #f6f6f6; -// -moz-box-shadow: inset 0 0 1px 1px #f6f6f6; -// box-shadow: inset 0 0 1px 1px #f6f6f6; color: #333; font: 0.7em Verdana,Arial,sans-serif; line-height: 1; text-align: center; - text-shadow: 0 1px 0 #fff; width: 90px; } #menue button.minimal:hover { - background: #d9d9d9; -// -webkit-box-shadow: inset 0 0 1px 1px #eaeaea; -// -moz-box-shadow: inset 0 0 1px 1px #eaeaea; -// box-shadow: inset 0 0 1px 1px #eaeaea; - color: #222; +/* background: #d9d9d9; */ +/* color: #222; */ cursor: pointer; } -#menue button.minimal:active { - background: #d0d0d0; -// -webkit-box-shadow: inset 0 0 1px 1px #e3e3e3; -// -moz-box-shadow: inset 0 0 1px 1px #e3e3e3; -// box-shadow: inset 0 0 1px 1px #e3e3e3; - color: #000; } /* ############################################################################## ### CollectionView subView Buttons @@ -909,7 +914,7 @@ form { } #queryForm { - margin-top: -5px; + margin-top: -3px; } #queryView { @@ -962,3 +967,42 @@ form { #iInfo { font-size: 0.8em; } + +#shellInfo { + line-height: 200%; +} + +#formatJSONyesno { + padding-top: 5px !important +} + +@media screen + and (-webkit-min-device-pixel-ratio:0) +{ + #submitAvoc { + padding-top: 4px !important; + height: 30px !important; + } + + #refreshShell { + margin-top: -4px !important; + margin-right: 2px !important; + } + + #refrehShellTextRefresh { + line-height:230% !important; + } + + #formatshellJSONyesno { + padding-top: 5px; + } +} + +.leftCell { + border-left: 1px solid #D3D3D3 !important; +} + +.rightCell { + border-right: 1px solid #D3D3D3 !important; +} + diff --git a/html/admin/index.html b/html/admin/index.html index a4ed723101..8a2147d4a4 100644 --- a/html/admin/index.html +++ b/html/admin/index.html @@ -10,30 +10,30 @@ @import "css/jquery-ui-1.8.19.custom.css"; @import "css/jquery.dataTables_themeroller.css"; - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +