Browse files

Merge branch 'devel' of github.com:triAGENS/ArangoDB

  • Loading branch information...
2 parents df19555 + 0300b78 commit d567f54cbb57bd4036142ac44cc29f0d728ae684 @fceller committed May 14, 2012
View
69 Ahuacatl/ahuacatl-access-optimiser.c
@@ -1882,6 +1882,75 @@ void TRI_DumpRangesAql (const TRI_vector_pointer_t* const ranges) {
}
////////////////////////////////////////////////////////////////////////////////
+/// @brief add a field access type to an existing field access vector
+////////////////////////////////////////////////////////////////////////////////
+
+TRI_vector_pointer_t* TRI_AddAccessAql (TRI_aql_context_t* const context,
+ TRI_vector_pointer_t* const previous,
+ TRI_aql_field_access_t* const candidate) {
+ TRI_vector_pointer_t* accesses = NULL;
+ size_t i, n;
+ bool found;
+
+ assert(context);
+ assert(candidate);
+ assert(candidate->_fieldName);
+
+ if (previous != NULL) {
+ // use existing vector if already available
+ accesses = previous;
+ }
+ else {
+ accesses = (TRI_vector_pointer_t*) TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_vector_pointer_t), false);
+ if (accesses == NULL) {
+ // OOM
+ TRI_SetErrorContextAql(context, TRI_ERROR_OUT_OF_MEMORY, NULL);
+ return NULL;
+ }
+ TRI_InitVectorPointer(accesses, TRI_UNKNOWN_MEM_ZONE);
+ }
+
+ found = false;
+ n = accesses->_length;
+ for (i = 0; i < n; ++i) {
+ TRI_aql_field_access_t* existing = (TRI_aql_field_access_t*) TRI_AtVectorPointer(accesses, i);
+ TRI_aql_field_access_t* copy;
+ int result;
+
+ if (!TRI_EqualString(candidate->_fieldName, existing->_fieldName)) {
+ continue;
+ }
+
+ // we found a match
+ found = true;
+
+ result = TRI_PickAccessAql(candidate, existing);
+ if (result < 0) {
+ // candidate is preferred
+
+ // free existing field access
+ TRI_FreeAccessAql(existing);
+ // insert candidate instead
+ copy = TRI_CloneAccessAql(context, candidate);
+ if (!copy) {
+ // OOM
+ TRI_SetErrorContextAql(context, TRI_ERROR_OUT_OF_MEMORY, NULL);
+ return accesses;
+ }
+ accesses->_buffer[i] = (void*) copy;
+ }
+ break;
+ }
+
+ if (!found) {
+ // not found, now add this candidate
+ TRI_PushBackVectorPointer(accesses, candidate);
+ }
+
+ return accesses;
+}
+
+////////////////////////////////////////////////////////////////////////////////
/// @brief track and optimise attribute accesses for a given node and subnodes
////////////////////////////////////////////////////////////////////////////////
View
8 Ahuacatl/ahuacatl-access-optimiser.h
@@ -189,6 +189,14 @@ void TRI_DumpRangeAql (const TRI_aql_field_access_t* const);
void TRI_DumpRangesAql (const TRI_vector_pointer_t* const);
////////////////////////////////////////////////////////////////////////////////
+/// @brief add a field access type to an existing field access vector
+////////////////////////////////////////////////////////////////////////////////
+
+TRI_vector_pointer_t* TRI_AddAccessAql (TRI_aql_context_t* const,
+ TRI_vector_pointer_t* const,
+ TRI_aql_field_access_t* const);
+
+////////////////////////////////////////////////////////////////////////////////
/// @brief track and optimise attribute accesses for a given node and subnodes
////////////////////////////////////////////////////////////////////////////////
View
24 Ahuacatl/ahuacatl-codegen-js.c
@@ -27,6 +27,7 @@
#include <BasicsC/logging.h>
+#include "Ahuacatl/ahuacatl-access-optimiser.h"
#include "Ahuacatl/ahuacatl-codegen-js.h"
#include "Ahuacatl/ahuacatl-functions.h"
@@ -871,6 +872,20 @@ static void ProcessIndexed (TRI_aql_codegen_js_t* const generator,
}
////////////////////////////////////////////////////////////////////////////////
+/// @brief generate code for indexed collection access
+////////////////////////////////////////////////////////////////////////////////
+
+static void ProcessIndexedCollection (TRI_aql_codegen_js_t* const generator,
+ const TRI_aql_node_t* const node,
+ const TRI_vector_pointer_t* const candidates) {
+ TRI_DumpRangesAql(candidates);
+
+ ScopeOutput(generator, "AHUACATL_GET_DOCUMENTS('");
+ ScopeOutput(generator, TRI_AQL_NODE_STRING(node));
+ ScopeOutput(generator, "')");
+}
+
+////////////////////////////////////////////////////////////////////////////////
/// @brief generate code for collection access
////////////////////////////////////////////////////////////////////////////////
@@ -1187,12 +1202,19 @@ static void ProcessFcall (TRI_aql_codegen_js_t* const generator,
static void ProcessFor (TRI_aql_codegen_js_t* const generator,
const TRI_aql_node_t* const node) {
TRI_aql_node_t* nameNode = TRI_AQL_NODE_MEMBER(node, 0);
+ TRI_aql_node_t* expressionNode = TRI_AQL_NODE_MEMBER(node, 1);
TRI_aql_codegen_register_t sourceRegister = IncRegister(generator);
ScopeOutput(generator, "var ");
ScopeOutputRegister(generator, sourceRegister);
ScopeOutput(generator, " = ");
- ProcessNode(generator, TRI_AQL_NODE_MEMBER(node, 1));
+
+ if (expressionNode->_type == AQL_NODE_COLLECTION && TRI_AQL_NODE_DATA(node) != NULL) {
+ ProcessIndexedCollection(generator, expressionNode, (TRI_vector_pointer_t*) TRI_AQL_NODE_DATA(node));
+ }
+ else {
+ ProcessNode(generator, expressionNode);
+ }
ScopeOutput(generator, ";\n");
StartFor(generator, sourceRegister, nameNode->_value._value._string);
View
239 Ahuacatl/ahuacatl-index.c
@@ -0,0 +1,239 @@
+////////////////////////////////////////////////////////////////////////////////
+/// @brief Ahuacatl, index access
+///
+/// @file
+///
+/// DISCLAIMER
+///
+/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
+///
+/// Licensed under the Apache License, Version 2.0 (the "License");
+/// you may not use this file except in compliance with the License.
+/// You may obtain a copy of the License at
+///
+/// http://www.apache.org/licenses/LICENSE-2.0
+///
+/// Unless required by applicable law or agreed to in writing, software
+/// distributed under the License is distributed on an "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+/// See the License for the specific language governing permissions and
+/// limitations under the License.
+///
+/// Copyright holder is triAGENS GmbH, Cologne, Germany
+///
+/// @author Jan Steemann
+/// @author Copyright 2012, triagens GmbH, Cologne, Germany
+////////////////////////////////////////////////////////////////////////////////
+
+#include "Ahuacatl/ahuacatl-index.h"
+#include "Ahuacatl/ahuacatl-access-optimiser.h"
+#include "Ahuacatl/ahuacatl-context.h"
+
+////////////////////////////////////////////////////////////////////////////////
+/// @addtogroup Ahuacatl
+/// @{
+////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief log information about the used index
+////////////////////////////////////////////////////////////////////////////////
+
+static void LogIndexString (TRI_index_t const* idx,
+ char const* collectionName) {
+ TRI_string_buffer_t* buffer = TRI_CreateStringBuffer(TRI_UNKNOWN_MEM_ZONE);
+ size_t i;
+
+ if (buffer == NULL) {
+ return;
+ }
+
+ for (i = 0; i < idx->_fields._length; i++) {
+ if (i > 0) {
+ TRI_AppendStringStringBuffer(buffer, ", ");
+ }
+
+ TRI_AppendStringStringBuffer(buffer, idx->_fields._buffer[i]);
+ }
+
+ LOG_TRACE("using %s index (%s) for '%s'",
+ TRI_TypeNameIndex(idx),
+ buffer->_buffer,
+ collectionName);
+
+ TRI_FreeStringBuffer(TRI_UNKNOWN_MEM_ZONE, buffer);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief pick or replace an index
+////////////////////////////////////////////////////////////////////////////////
+
+static TRI_aql_index_t* PickIndex (TRI_aql_context_t* const context,
+ TRI_aql_index_t* pickedIndex,
+ const TRI_index_t* const idx,
+ TRI_vector_pointer_t* fieldAccesses) {
+ bool isBetter;
+
+ assert(idx);
+ assert(fieldAccesses);
+
+ if (pickedIndex == NULL) {
+ pickedIndex = TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(TRI_aql_index_t), false);
+ pickedIndex->_idx = NULL;
+ pickedIndex->_fieldAccesses = NULL;
+ }
+
+ if (pickedIndex == NULL) {
+ // OOM
+ TRI_SetErrorContextAql(context, TRI_ERROR_OUT_OF_MEMORY, NULL);
+ return NULL;
+ }
+
+ if (pickedIndex->_idx == NULL) {
+ isBetter = true;
+ }
+ else {
+ isBetter = idx->_type == TRI_IDX_TYPE_PRIMARY_INDEX ||
+ fieldAccesses->_length < pickedIndex->_fieldAccesses->_length ||
+ (fieldAccesses->_length == pickedIndex->_fieldAccesses->_length && idx->_unique && !pickedIndex->_idx->_unique);
+ }
+
+ if (isBetter) {
+ if (pickedIndex->_fieldAccesses != NULL) {
+ TRI_FreeVectorPointer(TRI_UNKNOWN_MEM_ZONE, pickedIndex->_fieldAccesses);
+ }
+
+ pickedIndex->_idx = (TRI_index_t*) idx;
+ pickedIndex->_fieldAccesses = TRI_CopyVectorPointer(TRI_UNKNOWN_MEM_ZONE, fieldAccesses);
+ }
+
+ return pickedIndex;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief determine which index to use for a specific for loop
+////////////////////////////////////////////////////////////////////////////////
+
+TRI_aql_index_t* TRI_DetermineIndexAql (TRI_aql_context_t* const context,
+ const TRI_vector_pointer_t* const availableIndexes,
+ const char* const collectionName,
+ const TRI_vector_pointer_t* const candidates) {
+ TRI_aql_index_t* picked = NULL;
+ TRI_vector_pointer_t matches;
+ size_t i, j, k, n;
+
+ TRI_InitVectorPointer(&matches, TRI_UNKNOWN_MEM_ZONE);
+
+ assert(context);
+ assert(collectionName);
+ assert(candidates);
+
+ n = availableIndexes->_length;
+ for (i = 0; i < n; ++i) {
+ TRI_index_t* idx = (TRI_index_t*) availableIndexes->_buffer[i];
+ TRI_aql_access_e lastType;
+ size_t numIndexFields = idx->_fields._length;
+
+ if (idx->_type == TRI_IDX_TYPE_GEO1_INDEX ||
+ idx->_type == TRI_IDX_TYPE_GEO2_INDEX) {
+ // ignore all geo indexes for now
+ continue;
+ }
+
+ if (numIndexFields == 0) {
+ // index should contain at least one field
+ continue;
+ }
+
+ TRI_ClearVectorPointer(&matches);
+
+ lastType = TRI_AQL_ACCESS_EXACT;
+
+ // now loop over all index fields
+ for (j = 0; j < numIndexFields; ++j) {
+ char* indexedFieldName = idx->_fields._buffer[j];
+
+ if (!indexedFieldName) {
+ continue;
+ }
+
+ // now loop over all candidates
+ for (k = 0; k < candidates->_length; ++k) {
+ TRI_aql_field_access_t* candidate = (TRI_aql_field_access_t*) TRI_AtVectorPointer(candidates, k);
+
+ if (!TRI_EqualString(indexedFieldName, candidate->_fieldName)) {
+ // different field
+ continue;
+ }
+
+ if (candidate->_type == TRI_AQL_ACCESS_IMPOSSIBLE ||
+ candidate->_type == TRI_AQL_ACCESS_ALL) {
+ // wrong index type, doesn't help us at all
+ continue;
+ }
+
+ if (idx->_type == TRI_IDX_TYPE_PRIMARY_INDEX) {
+ if (candidate->_type != TRI_AQL_ACCESS_EXACT) {
+ // wrong access type for primary index
+ continue;
+ }
+
+ TRI_PushBackVectorPointer(&matches, candidate);
+ }
+ else if (idx->_type == TRI_IDX_TYPE_HASH_INDEX) {
+ if (candidate->_type != TRI_AQL_ACCESS_EXACT) {
+ // wrong access type for hash index
+ continue;
+ }
+
+ TRI_PushBackVectorPointer(&matches, candidate);
+ }
+ else if (idx->_type == TRI_IDX_TYPE_SKIPLIST_INDEX) {
+ if (candidate->_type != TRI_AQL_ACCESS_EXACT &&
+ candidate->_type != TRI_AQL_ACCESS_RANGE_SINGLE &&
+ candidate->_type != TRI_AQL_ACCESS_RANGE_DOUBLE) {
+ // wrong access type for skiplists
+ continue;
+ }
+
+ if ((candidate->_type == TRI_AQL_ACCESS_EXACT && lastType != TRI_AQL_ACCESS_EXACT) ||
+ (candidate->_type != TRI_AQL_ACCESS_EXACT && lastType != TRI_AQL_ACCESS_EXACT)) {
+ // if we already had a range query, we cannot check for equality after that
+ // if we already had a range query, we cannot check another range after that
+ continue;
+ }
+
+ TRI_PushBackVectorPointer(&matches, candidate);
+ }
+ }
+ }
+
+ // we now do or don't have an index candidate in the matches vector
+ if (matches._length < numIndexFields &&
+ (idx->_type == TRI_IDX_TYPE_PRIMARY_INDEX || idx->_type == TRI_IDX_TYPE_HASH_INDEX)) {
+ // the matches vector does not fully cover the indexed fields, but the index requires it
+ continue;
+ }
+
+ // if we can use the primary index, we'll use it
+ if (idx->_type == TRI_IDX_TYPE_PRIMARY_INDEX) {
+ picked = PickIndex(context, picked, idx, &matches);
+ }
+ }
+
+ TRI_DestroyVectorPointer(&matches);
+
+ if (picked) {
+ LogIndexString(picked->_idx, collectionName);
+ }
+
+ return picked;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @}
+////////////////////////////////////////////////////////////////////////////////
+
+// Local Variables:
+// mode: outline-minor
+// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
+// End:
View
65 Ahuacatl/ahuacatl-index.h
@@ -0,0 +1,65 @@
+////////////////////////////////////////////////////////////////////////////////
+/// @brief Ahuacatl, index access
+///
+/// @file
+///
+/// DISCLAIMER
+///
+/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
+///
+/// Licensed under the Apache License, Version 2.0 (the "License");
+/// you may not use this file except in compliance with the License.
+/// You may obtain a copy of the License at
+///
+/// http://www.apache.org/licenses/LICENSE-2.0
+///
+/// Unless required by applicable law or agreed to in writing, software
+/// distributed under the License is distributed on an "AS IS" BASIS,
+/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+/// See the License for the specific language governing permissions and
+/// limitations under the License.
+///
+/// Copyright holder is triAGENS GmbH, Cologne, Germany
+///
+/// @author Jan Steemann
+/// @author Copyright 2012, triagens GmbH, Cologne, Germany
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef TRIAGENS_DURHAM_AHUACATL_INDEX_H
+#define TRIAGENS_DURHAM_AHUACATL_INDEX_H 1
+
+#include <BasicsC/logging.h>
+#include <BasicsC/string-buffer.h>
+#include <BasicsC/vector.h>
+
+#include "VocBase/index.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+/// @addtogroup Ahuacatl
+/// @{
+////////////////////////////////////////////////////////////////////////////////
+
+typedef struct TRI_aql_index_s {
+ TRI_index_t* _idx;
+ TRI_vector_pointer_t* _fieldAccesses;
+}
+TRI_aql_index_t;
+
+////////////////////////////////////////////////////////////////////////////////
+/// @}
+////////////////////////////////////////////////////////////////////////////////
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+// Local Variables:
+// mode: outline-minor
+// outline-regexp: "^\\(/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|// --SECTION--\\|/// @\\}\\)"
+// End:
View
22 Ahuacatl/ahuacatl-optimiser.c
@@ -32,7 +32,7 @@
#include "V8/v8-execution.h"
-#undef RANGE_OPTIMIZER
+#undef RANGE_OPTIMIZER
// -----------------------------------------------------------------------------
// --SECTION-- forwards
@@ -115,12 +115,12 @@ static void PatchForLoops (TRI_aql_context_t* const context) {
TRI_SetErrorContextAql(context, TRI_ERROR_OUT_OF_MEMORY, NULL);
return;
}
-
+
+ // iterate over all possible field accesses we found in this scope
len = scope->_ranges->_length;
for (j = 0; j < len; ++j) {
TRI_aql_field_access_t* fieldAccess = (TRI_aql_field_access_t*) TRI_AtVectorPointer(scope->_ranges, j);
- TRI_aql_field_access_t* previous;
- int compareResult;
+ TRI_vector_pointer_t* previous;
// check if the range's variable name is the same as the for variable's name
if (!TRI_IsPrefixString(fieldAccess->_fieldName, prefix)) {
@@ -130,17 +130,9 @@ static void PatchForLoops (TRI_aql_context_t* const context) {
// names match
- // check if current or previous range are better
- previous = (TRI_aql_field_access_t*) scope->_node->_value._value._data;
- compareResult = TRI_PickAccessAql(previous, fieldAccess);
-
- if (compareResult == 1) {
- // clone access and copy it into node
- if (previous) {
- TRI_FreeAccessAql(previous);
- }
- scope->_node->_value._value._data = (void*) TRI_CloneAccessAql(context, fieldAccess);
- }
+ // merge the field access found into the already existing field accesses for the node
+ previous = (TRI_vector_pointer_t*) scope->_node->_value._value._data;
+ scope->_node->_value._value._data = (void*) TRI_AddAccessAql(context, previous, fieldAccess);
}
TRI_FreeString(TRI_CORE_MEM_ZONE, prefix);
View
1 Makefile.files
@@ -165,6 +165,7 @@ arangod_SOURCES = \
Ahuacatl/ahuacatl-error.c \
Ahuacatl/ahuacatl-functions.c \
Ahuacatl/ahuacatl-grammar.c \
+ Ahuacatl/ahuacatl-index.c \
Ahuacatl/ahuacatl-optimiser.c \
Ahuacatl/ahuacatl-parser.c \
Ahuacatl/ahuacatl-parser-functions.c \
View
6 Makefile.in
@@ -359,6 +359,7 @@ am_arangod_OBJECTS = Admin/ApplicationAdminServer.$(OBJEXT) \
Ahuacatl/ahuacatl-error.$(OBJEXT) \
Ahuacatl/ahuacatl-functions.$(OBJEXT) \
Ahuacatl/ahuacatl-grammar.$(OBJEXT) \
+ Ahuacatl/ahuacatl-index.$(OBJEXT) \
Ahuacatl/ahuacatl-optimiser.$(OBJEXT) \
Ahuacatl/ahuacatl-parser.$(OBJEXT) \
Ahuacatl/ahuacatl-parser-functions.$(OBJEXT) \
@@ -785,6 +786,7 @@ arangod_SOURCES = \
Ahuacatl/ahuacatl-error.c \
Ahuacatl/ahuacatl-functions.c \
Ahuacatl/ahuacatl-grammar.c \
+ Ahuacatl/ahuacatl-index.c \
Ahuacatl/ahuacatl-optimiser.c \
Ahuacatl/ahuacatl-parser.c \
Ahuacatl/ahuacatl-parser-functions.c \
@@ -1723,6 +1725,8 @@ Ahuacatl/ahuacatl-functions.$(OBJEXT): Ahuacatl/$(am__dirstamp) \
Ahuacatl/$(DEPDIR)/$(am__dirstamp)
Ahuacatl/ahuacatl-grammar.$(OBJEXT): Ahuacatl/$(am__dirstamp) \
Ahuacatl/$(DEPDIR)/$(am__dirstamp)
+Ahuacatl/ahuacatl-index.$(OBJEXT): Ahuacatl/$(am__dirstamp) \
+ Ahuacatl/$(DEPDIR)/$(am__dirstamp)
Ahuacatl/ahuacatl-optimiser.$(OBJEXT): Ahuacatl/$(am__dirstamp) \
Ahuacatl/$(DEPDIR)/$(am__dirstamp)
Ahuacatl/ahuacatl-parser.$(OBJEXT): Ahuacatl/$(am__dirstamp) \
@@ -1947,6 +1951,7 @@ mostlyclean-compile:
-rm -f Ahuacatl/ahuacatl-error.$(OBJEXT)
-rm -f Ahuacatl/ahuacatl-functions.$(OBJEXT)
-rm -f Ahuacatl/ahuacatl-grammar.$(OBJEXT)
+ -rm -f Ahuacatl/ahuacatl-index.$(OBJEXT)
-rm -f Ahuacatl/ahuacatl-optimiser.$(OBJEXT)
-rm -f Ahuacatl/ahuacatl-parser-functions.$(OBJEXT)
-rm -f Ahuacatl/ahuacatl-parser.$(OBJEXT)
@@ -2177,6 +2182,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@Ahuacatl/$(DEPDIR)/ahuacatl-error.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@Ahuacatl/$(DEPDIR)/ahuacatl-functions.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@Ahuacatl/$(DEPDIR)/ahuacatl-grammar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@Ahuacatl/$(DEPDIR)/ahuacatl-index.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@Ahuacatl/$(DEPDIR)/ahuacatl-optimiser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@Ahuacatl/$(DEPDIR)/ahuacatl-parser-functions.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@Ahuacatl/$(DEPDIR)/ahuacatl-parser.Po@am__quote@
View
26 html/admin/css/layout.css
@@ -1,5 +1,3 @@
-
-
button {
padding: 0;
}
@@ -70,9 +68,8 @@ html.busy, html.busy * {
}
html {
- font-family: Verdana,Arial,sans-serif;
+ font-family: verdana,arial,helvetica,geneva,sans-serif;
font-size: 1em;
- min-width: 1024px;
}
tr {
font-size: 0.8em;
@@ -212,8 +209,8 @@ pre ul li span{
box-shadow: inset 0 0 1px 1px #f6f6f6;
}
-#createCollection, #refreshCollections {
- font-size: 0.85em !important;
+#createCollection, #refreshCollections, #addDocumentButton, #saveEditedDocButton, #saveNewDocButton, #addEditedDocRowButton, #toggleEditedDocButton, #addNewDocButton, #toggleNewDocButton {
+ font-size: 0.8em !important;
}
#createCollectionView {
@@ -318,13 +315,18 @@ form {
}
#submitQuery {
- height:34px !important;
+ height:30px !important;
width: 100px !important;
float:right;
}
#queryOutput {
+ height:40%;
+ border: 1px solid black;
+ margin-bottom: 7px;
+ background-color:white;
font-family: "courier";
+ overflow-y: auto;
}
#queryContent {
@@ -375,13 +377,14 @@ form {
.avocshSuccess {
font-family: "courier";
background-color: #e4e9d2;
- color: #335127;
+ //color: #335127;
+ color: black;
}
.avocshError {
font-family: "courier";
background-color: #FFD8D8;
- color: red;
+ color: black;
}
.avocshClient {
@@ -656,7 +659,6 @@ form {
}
#queryView {
- height: 350px;
}
#avocshView {
@@ -705,3 +707,7 @@ form {
width: 200px;
padding-top:3px;
}
+
+#iInfo {
+ font-size: 0.8em;
+}
View
32 html/admin/index.html
@@ -38,9 +38,6 @@
<a href="/_admin/html/index.html"><img src="../html/media/images/arangodb_logo.png"></a>
</div>
- <div id="menue-center">
- </div>
-
<div id="menue-right">
<button class="minimal" id="Collections">Collections</button>
<button class="minimal" id="Logs">Logs</button>
@@ -278,11 +275,13 @@
</thead>
</table>
<div id="logToolbar">
- <button class="enabled" id="logTableID_first"><img src="/_admin/html/media/icons/rnd_br_first_icon16.png"></button>
- <button class="enabled" id="logTableID_prev"><img src="/_admin/html/media/icons/rnd_br_prev_icon16.png"></button>
- <button class="enabled" id="logTableID_next"><img src="/_admin/html/media/icons/rnd_br_next_icon16.png"></button>
- <button class="enabled" id="logTableID_last"><img src="/_admin/html/media/icons/rnd_br_last_icon16.png"></button>
- <a id="logTableID_status">Showing</a>
+ <div id="logToolbarAll">
+ <button class="enabled" id="logTableID_first"><img src="/_admin/html/media/icons/rnd_br_first_icon16.png"></button>
+ <button class="enabled" id="logTableID_prev"><img src="/_admin/html/media/icons/rnd_br_prev_icon16.png"></button>
+ <button class="enabled" id="logTableID_next"><img src="/_admin/html/media/icons/rnd_br_next_icon16.png"></button>
+ <button class="enabled" id="logTableID_last"><img src="/_admin/html/media/icons/rnd_br_last_icon16.png"></button>
+ </div>
+ <a id="logTableID_status">Showing</a>
</div>
</div>
@@ -296,11 +295,13 @@
</thead>
</table>
<div id="logToolbar">
+ <div id="logToolbarCrit">
<button class="enabled" id="critLogTableID_first"><img src="/_admin/html/media/icons/rnd_br_first_icon16.png"></button>
<button class="enabled" id="critLogTableID_prev"><img src="/_admin/html/media/icons/rnd_br_prev_icon16.png"></button>
<button class="enabled" id="critLogTableID_next"><img src="/_admin/html/media/icons/rnd_br_next_icon16.png"></button>
<button class="enabled" id="critLogTableID_last"><img src="/_admin/html/media/icons/rnd_br_last_icon16.png"></button>
<a id="critLogTableID_status">Showing</a>
+ </div>
</div>
</div>
@@ -314,10 +315,12 @@
</thead>
</table>
<div id="logToolbar">
+ <div id="logToolbarWarn">
<button class="enabled" id="warnLogTableID_first"><img src="/_admin/html/media/icons/rnd_br_first_icon16.png"></button>
<button class="enabled" id="warnLogTableID_prev"><img src="/_admin/html/media/icons/rnd_br_prev_icon16.png"></button>
<button class="enabled" id="warnLogTableID_next"><img src="/_admin/html/media/icons/rnd_br_next_icon16.png"></button>
<button class="enabled" id="warnLogTableID_last"><img src="/_admin/html/media/icons/rnd_br_last_icon16.png"></button>
+ </div>
<a id="warnLogTableID_status">Showing</a>
</div>
</div>
@@ -332,10 +335,12 @@
</thead>
</table>
<div id="logToolbar">
+ <div id="logToolbarInfo">
<button class="enabled" id="infoLogTableID_first"><img src="/_admin/html/media/icons/rnd_br_first_icon16.png"></button>
<button class="enabled" id="infoLogTableID_prev"><img src="/_admin/html/media/icons/rnd_br_prev_icon16.png"></button>
<button class="enabled" id="infoLogTableID_next"><img src="/_admin/html/media/icons/rnd_br_next_icon16.png"></button>
<button class="enabled" id="infoLogTableID_last"><img src="/_admin/html/media/icons/rnd_br_last_icon16.png"></button>
+ </div>
<a id="infoLogTableID_status">Showing</a>
</div>
</div>
@@ -350,10 +355,12 @@
</thead>
</table>
<div id="logToolbar">
+ <div id="logToolbarDebu">
<button class="enabled" id="debugLogTableID_first"><img src="/_admin/html/media/icons/rnd_br_first_icon16.png"></button>
<button class="enabled" id="debugLogTableID_prev"><img src="/_admin/html/media/icons/rnd_br_prev_icon16.png"></button>
<button class="enabled" id="debugLogTableID_next"><img src="/_admin/html/media/icons/rnd_br_next_icon16.png"></button>
<button class="enabled" id="debugLogTableID_last"><img src="/_admin/html/media/icons/rnd_br_last_icon16.png"></button>
+ </div>
<a id="debugLogTableID_status">Showing</a>
</div>
</div>
@@ -384,12 +391,15 @@
</div>
<div id="queryView" style="display: none">
+ <div id="queryOutput">
+ </div>
<form id="queryForm" method="post" onsubmit="return false">
- <textarea class="editBox" id="queryContent"></textarea><br><button class="minimal" id="submitQuery">Post</button>
+ <textarea placeholder="Type in your query..." class="editBox" id="queryContent"></textarea><br>
+ <button class="minimal" id="submitQuery">Post</button>
+ <a href=https://github.com/triAGENS/ArangoDB/wiki/Aql>ArangoDB Query Language - click for more information</a>
+ <br></br>
</form>
- <div id="queryOutput">
- </div>
</div>
</div>
View
32 html/admin/js/master.js
@@ -148,7 +148,7 @@ var collectionTable = $('#collectionsTableID').dataTable({
"bAutoWidth": false,
"iDisplayLength": -1,
"bJQueryUI": true,
- "aoColumns": [{"sWidth":"100px", "bSortable":false}, {"sWidth": "200px"}, {"sWidth": "200px"}, {"sWidth": "200px"}, {"sWidth": "200px"}, null ],
+ "aoColumns": [{"sWidth":"120px", "bSortable":false}, {"sWidth": "200px"}, {"sWidth": "200px"}, {"sWidth": "200px"}, {"sWidth": "200px"}, null ],
"oLanguage": {"sEmptyTable": "No collections"}
});
@@ -1095,6 +1095,7 @@ var logTable = $('#logTableID').dataTable({
$('#submitLogSearch').live('click', function () {
+ hideLogPagination();
var content = $('#logSearchField').val();
var selected = $("#tabs").tabs( "option", "selected" );
@@ -1189,12 +1190,14 @@ var logTable = $('#logTableID').dataTable({
contentType: "application/json",
processData: false,
success: function(data) {
+ var temp = JSON.parse(data.responseText);
$("#queryOutput").empty();
- $("#queryOutput").append('<b><font color=green>' + JSON.stringify(data) + '</font></b>');
+ $("#queryOutput").append('<font color=green>' + JSON.stringify(temp.errorMessage) + '</font>');
},
error: function(data) {
+ var temp = JSON.parse(data.responseText);
$("#queryOutput").empty();
- $("#queryOutput").append('<b><font color=red>' + JSON.stringify(data) + '</font></b>');
+ $("#queryOutput").append('<font color=red>' + JSON.stringify(temp.errorMessage) + '</font>');
}
});
});
@@ -1739,7 +1742,11 @@ $(function() {
///////////////////////////////////////////////////////////////////////////////
/// Log tables pagination
///////////////////////////////////////////////////////////////////////////////
-function createLogTable(loglevel) {
+function createLogTable(loglevel) {
+
+ $("#logSearchField").val("");
+ $(":input").focus();
+ showLogPagination();
currentPage = 1;
currentLoglevel = loglevel;
var url = "/_admin/log?level="+loglevel+"&size=10";
@@ -2249,3 +2256,20 @@ function is_int(value){
return false;
}
}
+
+function showLogPagination () {
+ $('#logToolbarAll').show();
+ $('#logToolbarCrit').show();
+ $('#logToolbarWarn').show();
+ $('#logToolbarDebu').show();
+ $('#logToolbarInfo').show();
+}
+
+function hideLogPagination() {
+ $('#logToolbarAll').hide();
+ $('#logToolbarCrit').hide();
+ $('#logToolbarWarn').hide();
+ $('#logToolbarDebu').hide();
+ $('#logToolbarInfo').hide();
+}
+

0 comments on commit d567f54

Please sign in to comment.