diff --git a/CHANGELOG b/CHANGELOG index 1b2a70cfa0..2098b517e9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,41 @@ +v1.4.x (XXXX-XX-XX) +------------------- + +* added `--server.ssl-protocol` option for client tools + this allows connecting from arangosh, arangoimp, arangoimp etc. to an ArangoDB + server that uses a non-default value for `--server.ssl-protocol`. The default + value for the SSL protocol is 4 (TLSv1). If the server is configured to use a + different protocol, it was not possible to connect to it with the client tools. + +* added more detailed request statistics + + This adds the number of async-executed HTTP requests plus the number of HTTP + requests per individual HTTP method type. + +* added `--force` option for arangorestore + this option allows continuing a restore operation even if the server reports errors + in the middle of the restore operation + +* better error reporting for arangorestore + in case the server returned an HTTP error, arangorestore previously reported this + error as `internal error` without any details only. Now server-side errors are + reported by arangorestore with the server's error message + +* include more system collections in dumps produced by arangodump + previously some system collections were intentionally excluded from dumps, even if the + dump was run with `--include-system-collections`. for example, the collections `_aal`, + `_modules`, `_routing`, and `_users` were excluded. This makes sense in a replication + context but not always in a dump context. + When specifying `--include-system-collections`, arangodump will now include the above- + mentioned collections in the dump, too. Some other system collections are still excluded + even when the dump is run with `--include-system-collections`, for example `_replication` + and `_trx`. + +* fixed issue #701: ArangoStatement undefined in arangosh + +* fixed typos in configuration files + + v1.4.3 (2013-11-25) ------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 12f755042e..a1c5ec70cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,18 +137,15 @@ endif () file(TO_NATIVE_PATH "${VARDIR_NATIVE}" VARDIR_NATIVE) +FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/lib/arangodb") +FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/lib/arangodb-apps") + ################################################################################ ### @brief TRI_BINDIR ################################################################################ set(TRI_BINDIR "${CMAKE_INSTALL_PREFIX}/bin") -################################################################################ -### @brief database directory -################################################################################ - -FILE(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/var/lib/arangodb") - ################################################################################ ### @brief apps directory ################################################################################ diff --git a/Documentation/arangodb.css b/Documentation/arangodb.css index d408693f30..de4dc5bff7 100644 --- a/Documentation/arangodb.css +++ b/Documentation/arangodb.css @@ -6,6 +6,9 @@ /* ************************************************************************** */ /* global */ /* ************************************************************************** */ +.page-id-1410 #wrapper { + margin-top: 75px; +} #content div.arangodb { background: none repeat scroll 0 0 transparent; @@ -15,7 +18,7 @@ font-size: 16px; font-weight: 300; line-height: 1.4em; - margin: 0; + margin: 0px 0px 0px 0px; padding: 0px; vertical-align: baseline; } @@ -45,8 +48,8 @@ border-bottom: 1px solid #EFECE9; font-family: Rockwell,Georgia,"Times New Roman",Times,serif; font-size: 2em; - margin-bottom: 38px; - padding: 14px 0 3px; + margin-bottom: 40px; + padding: 3px 0 3px; } #content div.arangodb h2 { @@ -58,21 +61,15 @@ padding: 14px 0 3px; } -#content div.arangodb h3 { - margin-top: 20px; - margin-bottom: 14px; - border-bottom: 1px solid #EFECE9; -} - /* ************************************************************************** */ /* navigation bar */ /* ************************************************************************** */ #content div.arangodb div.navigate { - height: 0px; - position: relative; + height: 0px; + position: relative; text-align: right; - top: -70px; + top: -69px; } /* ************************************************************************** */ @@ -82,8 +79,9 @@ #content div.arangodb div.toc { border-width: thin; border-style: solid; - background-color: #E7F3C5; + background-color: #F8F8F8; margin-bottom: 14px; + padding: 4px; } #content div.arangodb div.toc ul { @@ -92,12 +90,7 @@ } #content div.arangodb ul ul { - margin-top: 14px; - margin-bottom: 14px; -} -#content div.arangodb ul { - margin-top: 14px; - margin-bottom: 14px; + margin-bottom: 0px; } /* ************************************************************************** */ @@ -105,12 +98,7 @@ /* ************************************************************************** */ #content div.arangodb div.functionsignature { - font-size: 14px; - font-weight: bold; font-family: monospace,fixed; - border: 2px dotted; - background-color: #F8F8F8; - padding: 10px; margin-top: 14px; margin-bottom: 14px; } @@ -131,48 +119,18 @@ /* ************************************************************************** */ /* rest call */ /* ************************************************************************** */ -.space-before { - margin-top: 14px; -} + #content div.arangodb div.restheader { - font-size: 14px; - font-weight: bold; + font-size: 18px; font-family: monospace,fixed; - border: 2px dotted; - background-color: #F8F8F8; - padding: 10px; - margin-top: 14px; + border-bottom: 1px dotted; margin-bottom: 14px; } + #content div.arangodb div.restheaderremark { - float: right; -} -#content div.arangodb div.restbodyparam { + font-size: 18px; + float: right; font-family: "Helvetica",sans-serif; - font-size: 16px; - margin-bottom: 14px; -} - -#content div.arangodb div.resturlparameters { - font-weight: bold; - margin-top: 14px; - margin-bottom: 14px; -} - -#content div.arangodb div.resturlparam { - font-style: italic; - margin-top: 14px; - margin-bottom: 14px; -} - -#content div.arangodb div.restheaderparameters { - font-weight: bold; - margin-top: 14px; - margin-bottom: 14px; -} - -#content div.arangodb div.restheaderparam { - font-style: italic; } #content div.arangodb div.restqueryparameters { @@ -194,14 +152,11 @@ #content div.arangodb div.restreturncodes { font-weight: bold; margin-top: 14px; - margin-bottom: 0px; -} -#content div.arangodb div.restreturncodes p { - margin: 0px; + margin-bottom: 14px; } + #content div.arangodb div.restreturncode { font-style: italic; - display: inline; } /* ************************************************************************** */ @@ -220,11 +175,12 @@ #content div.arangodb pre { background-color: #FBFCFD !important; - border: 0px; + border: 1px solid #C4CFE5 !important; font-family: monospace,fixed; + font-size: 105%; font-size: 15px; line-height: 21px; - margin: 4px 8px 24px 36px; + margin: 4px 8px 24px 2px; overflow: auto; padding: 4px 6px; word-wrap: break-word; @@ -232,15 +188,15 @@ #content div.arangodb div.fragment { background-color: #FBFCFD !important; - border: 0px; + border: 1px solid #C4CFE5 !important; font-family: monospace,fixed; + font-size: 105%; font-size: 15px; - line-height: 11px; - margin: 4px 8px 24px 36px; + line-height: 21px; + margin: 4px 8px 24px 2px; overflow: auto; padding: 4px 6px; word-wrap: break-word; - white-space: pre; } #content div.arangodb code { @@ -259,5 +215,12 @@ /* ************************************************************************** */ #content hr { - margin-bottom: 2px; + margin-top: 15px; + margin-bottom: 2px; } + +a.anchor { + padding-top: 80px; + width: 0; + font-size: 0; +} \ No newline at end of file diff --git a/GNUmakefile b/GNUmakefile index 83d32fd6b8..8f32429670 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -104,7 +104,7 @@ pack-dmg-cmake: -D "CMAKE_INSTALL_PREFIX=${prefix}" \ -D "USE_MRUBY=ON" \ -D "USE_RAW_CONFIG=ON" \ - -D "ARANGODB_VERSION=@VERSION@" \ + -D "ARANGODB_VERSION=${VERSION}" \ -D "CPACK_PACKAGE_VERSION_MAJOR=${VERSION_MAJOR}" \ -D "CPACK_PACKAGE_VERSION_MINOR=${VERSION_MINOR}" \ -D "CPACK_PACKAGE_VERSION_PATCH=${VERSION_PATCH}" \ @@ -150,7 +150,7 @@ pack-macosx-cmake: -D "CMAKE_INSTALL_PREFIX=${prefix}" \ -D "USE_MRUBY=ON" \ -D "USE_RAW_CONFIG=ON" \ - -D "ARANGODB_VERSION=@VERSION@" \ + -D "ARANGODB_VERSION=${VERSION}" \ -D "CPACK_PACKAGE_VERSION_MAJOR=${VERSION_MAJOR}" \ -D "CPACK_PACKAGE_VERSION_MINOR=${VERSION_MINOR}" \ -D "CPACK_PACKAGE_VERSION_PATCH=${VERSION_PATCH}" \ @@ -195,7 +195,7 @@ pack-arm-cmake: -D "VARDIR=${localstatedir}" \ -D "USE_MRUBY=OFF" \ -D "USE_RAW_CONFIG=OFF" \ - -D "ARANGODB_VERSION=@VERSION@" \ + -D "ARANGODB_VERSION=${VERSION}" \ -D "CPACK_PACKAGE_VERSION_MAJOR=${VERSION_MAJOR}" \ -D "CPACK_PACKAGE_VERSION_MINOR=${VERSION_MINOR}" \ -D "CPACK_PACKAGE_VERSION_PATCH=${VERSION_PATCH}" \ diff --git a/Installation/MacOSX/Bundle/arangodb-cli.sh b/Installation/MacOSX/Bundle/arangodb-cli.sh index f9ff9e27e6..482a468a1f 100755 --- a/Installation/MacOSX/Bundle/arangodb-cli.sh +++ b/Installation/MacOSX/Bundle/arangodb-cli.sh @@ -13,8 +13,7 @@ for script in $SCRIPTS; do echo "#!/bin/bash" echo echo "export ARANGODB_ROOT=\"${ARANGODB_ROOT}Contents/MacOS/\"" - echo "export DATABASEDIR=\"\${ARANGODB_ROOT}opt/arangodb/var/lib/arangodb\"" - echo "export LOGDIR=\"\${ARANGODB_ROOT}opt/arangodb/var/log/arangodb\"" + echo "export LOCALSTATEDIR=\"\${ARANGODB_ROOT}opt/arangodb/var\"" echo "export PKGDATADIR=\"\${ARANGODB_ROOT}opt/arangodb/share/arangodb\"" echo if [ "$base" == "arango-dfdb" ]; then diff --git a/README.md b/README.md index 22ed3dd22d..31c9e6d9b4 100644 --- a/README.md +++ b/README.md @@ -92,3 +92,16 @@ You can use the Google group for improvements, feature requests, comments http://www.arangodb.org/connect + +Citing ArangoDB +--------------- +Please kindly cite ArangoDB in your publications if it helps your research: + +```bibtex +@misc{ArangoDB2013, + Author = {ArangoDB}, + Title = { {ArangoDB}: An Open Source multi-purpose database supporting flexible data models for documents, graphs, and key-values.}, + Year = {2013}, + Howpublished = {\url{http://arangodb.org/} +} +``` diff --git a/arangod/Ahuacatl/ahuacatl-functions.c b/arangod/Ahuacatl/ahuacatl-functions.c index 34c203bb04..b3160be91d 100644 --- a/arangod/Ahuacatl/ahuacatl-functions.c +++ b/arangod/Ahuacatl/ahuacatl-functions.c @@ -150,6 +150,10 @@ static bool CheckArgumentType (TRI_aql_node_t const* parameter, const param_t* const allowed) { param_t found = InitParam(); + if (parameter->_type == TRI_AQL_NODE_REFERENCE) { + return true; + } + if (parameter->_type == TRI_AQL_NODE_PARAMETER) { // node is a bind parameter char* name = TRI_AQL_NODE_STRING(parameter); diff --git a/arangod/CMakeLists.txt b/arangod/CMakeLists.txt index f2f654753f..7ece5a9c35 100644 --- a/arangod/CMakeLists.txt +++ b/arangod/CMakeLists.txt @@ -208,6 +208,10 @@ install( DIRECTORY ${PROJECT_BINARY_DIR}/var/lib/arangodb DESTINATION ${VARDIR_INSTALL}/lib) +install( + DIRECTORY ${PROJECT_BINARY_DIR}/var/lib/arangodb-apps + DESTINATION ${VARDIR_INSTALL}/lib) + ## ----------------------------------------------------------------------------- ## --SECTION-- END-OF-FILE ## ----------------------------------------------------------------------------- diff --git a/arangod/Replication/Syncer.cpp b/arangod/Replication/Syncer.cpp index 12098de5c0..c24fabbd23 100644 --- a/arangod/Replication/Syncer.cpp +++ b/arangod/Replication/Syncer.cpp @@ -120,7 +120,8 @@ Syncer::Syncer (TRI_vocbase_t* vocbase, _connection = GeneralClientConnection::factory(_endpoint, _configuration._requestTimeout, _configuration._connectTimeout, - (size_t) _configuration._maxConnectRetries); + (size_t) _configuration._maxConnectRetries, + (uint32_t) _configuration._sslProtocol); if (_connection != 0) { _client = new SimpleHttpClient(_connection, _configuration._requestTimeout, false); @@ -302,7 +303,7 @@ int Syncer::applyCollectionDumpMarker (TRI_transaction_collection_t* trxCollecti } if (res == TRI_ERROR_NO_ERROR) { - res = primary->insert(trxCollection, key, rid, &mptr, TRI_DOC_MARKER_KEY_EDGE, shaped, &edge, false, false); + res = primary->insert(trxCollection, key, rid, &mptr, TRI_DOC_MARKER_KEY_EDGE, shaped, &edge, false, false, true); } } else { @@ -311,7 +312,7 @@ int Syncer::applyCollectionDumpMarker (TRI_transaction_collection_t* trxCollecti res = TRI_ERROR_ARANGO_COLLECTION_TYPE_INVALID; } else { - res = primary->insert(trxCollection, key, rid, &mptr, TRI_DOC_MARKER_KEY_DOCUMENT, shaped, 0, false, false); + res = primary->insert(trxCollection, key, rid, &mptr, TRI_DOC_MARKER_KEY_DOCUMENT, shaped, 0, false, false, true); } } } diff --git a/arangod/RestHandler/RestReplicationHandler.cpp b/arangod/RestHandler/RestReplicationHandler.cpp index 9678a20df1..aff61debbb 100644 --- a/arangod/RestHandler/RestReplicationHandler.cpp +++ b/arangod/RestHandler/RestReplicationHandler.cpp @@ -36,6 +36,9 @@ #include "HttpServer/HttpServer.h" #include "Replication/InitialSyncer.h" #include "Rest/HttpRequest.h" +#include "Utils/EmbeddableTransaction.h" +#include "Utils/RestTransactionContext.h" +#include "Utils/SingleCollectionWriteTransaction.h" #include "VocBase/compactor.h" #include "VocBase/replication-applier.h" #include "VocBase/replication-dump.h" @@ -292,18 +295,29 @@ bool RestReplicationHandler::filterCollection (TRI_vocbase_col_t* collection, // invalid type return false; } - - if (TRI_ExcludeCollectionReplication(collection->_name)) { - // collection is excluded - return false; - } - + bool includeSystem = *((bool*) data); if (! includeSystem && collection->_name[0] == '_') { // exclude all system collections return false; } + if (TRI_ExcludeCollectionReplication(collection->_name)) { + // collection is excluded from replication + + if (includeSystem) { + // now check if we still should include it in the dump + if (! TRI_EqualString(collection->_name, TRI_COL_NAME_USERS) && + ! TRI_EqualString(collection->_name, "_aal") && + ! TRI_EqualString(collection->_name, "_modules") && + ! TRI_EqualString(collection->_name, "_routing")) { + return false; + } + } + // _aal, _modules, _routing should be included + } + + // all other cases should be included return true; } @@ -1601,10 +1615,16 @@ void RestReplicationHandler::handleCommandRestoreCollection () { if (found) { recycleIds = StringUtils::boolean(value); } + + bool force = false; + value = _request->value("force", found); + if (found) { + force = StringUtils::boolean(value); + } TRI_server_id_t remoteServerId = 0; // TODO string errorMsg; - int res = processRestoreCollection(json, overwrite, recycleIds, remoteServerId, errorMsg); + int res = processRestoreCollection(json, overwrite, recycleIds, force, remoteServerId, errorMsg); TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); @@ -1634,10 +1654,17 @@ void RestReplicationHandler::handleCommandRestoreIndexes () { "invalid JSON"); return; } + + bool found; + bool force = false; + char const* value = _request->value("force", found); + if (found) { + force = StringUtils::boolean(value); + } TRI_server_id_t remoteServerId = 0; // TODO string errorMsg; - int res = processRestoreIndexes(json, remoteServerId, errorMsg); + int res = processRestoreIndexes(json, force, remoteServerId, errorMsg); TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, json); @@ -1661,6 +1688,7 @@ void RestReplicationHandler::handleCommandRestoreIndexes () { int RestReplicationHandler::processRestoreCollection (TRI_json_t* const collection, bool dropExisting, bool reuseId, + bool force, TRI_server_id_t remoteServerId, string& errorMsg) { if (! JsonHelper::isArray(collection)) { @@ -1725,9 +1753,34 @@ int RestReplicationHandler::processRestoreCollection (TRI_json_t* const collecti if (col != 0) { if (dropExisting) { int res = TRI_DropCollectionVocBase(_vocbase, col, remoteServerId); + + if (res == TRI_ERROR_FORBIDDEN) { + // some collections must not be dropped + + // instead, truncate them + CollectionNameResolver resolver(_vocbase); + SingleCollectionWriteTransaction, UINT64_MAX> trx(_vocbase, resolver, col->_cid); + + res = trx.begin(); + if (res != TRI_ERROR_NO_ERROR) { + return res; + } + TRI_barrier_t* barrier = TRI_CreateBarrierElement(&(trx.primaryCollection()->_barrierList)); + + if (barrier == 0) { + return TRI_ERROR_INTERNAL; + } + + res = trx.truncate(false); + res = trx.finish(res); + + TRI_FreeBarrier(barrier); + + return res; + } if (res != TRI_ERROR_NO_ERROR) { - errorMsg = "unable to drop collection: " + string(TRI_errno_string(res)); + errorMsg = "unable to drop collection '" + name + "': " + string(TRI_errno_string(res)); return res; } @@ -1735,7 +1788,7 @@ int RestReplicationHandler::processRestoreCollection (TRI_json_t* const collecti else { int res = TRI_ERROR_ARANGO_DUPLICATE_NAME; - errorMsg = "unable to drop collection: " + string(TRI_errno_string(res)); + errorMsg = "unable to create collection '" + name + "': " + string(TRI_errno_string(res)); return res; } @@ -1758,6 +1811,7 @@ int RestReplicationHandler::processRestoreCollection (TRI_json_t* const collecti //////////////////////////////////////////////////////////////////////////////// int RestReplicationHandler::processRestoreIndexes (TRI_json_t* const collection, + bool force, TRI_server_id_t remoteServerId, string& errorMsg) { if (! JsonHelper::isArray(collection)) { @@ -1907,7 +1961,7 @@ int RestReplicationHandler::applyCollectionDumpMarker (CollectionNameResolver co } if (res == TRI_ERROR_NO_ERROR) { - res = primary->insert(trxCollection, key, rid, &mptr, TRI_DOC_MARKER_KEY_EDGE, shaped, &edge, false, false); + res = primary->insert(trxCollection, key, rid, &mptr, TRI_DOC_MARKER_KEY_EDGE, shaped, &edge, false, false, true); } } else { @@ -1916,7 +1970,7 @@ int RestReplicationHandler::applyCollectionDumpMarker (CollectionNameResolver co res = TRI_ERROR_ARANGO_COLLECTION_TYPE_INVALID; } else { - res = primary->insert(trxCollection, key, rid, &mptr, TRI_DOC_MARKER_KEY_DOCUMENT, shaped, 0, false, false); + res = primary->insert(trxCollection, key, rid, &mptr, TRI_DOC_MARKER_KEY_DOCUMENT, shaped, 0, false, false, true); } } } @@ -1977,6 +2031,7 @@ int RestReplicationHandler::processRestoreDataBatch (CollectionNameResolver cons TRI_transaction_collection_t* trxCollection, TRI_server_id_t generatingServer, bool useRevision, + bool force, std::string& errorMsg) { const string invalidMsg = "received invalid JSON data for collection " + StringUtils::itoa(trxCollection->_cid); @@ -2065,7 +2120,7 @@ int RestReplicationHandler::processRestoreDataBatch (CollectionNameResolver cons TRI_FreeJson(TRI_CORE_MEM_ZONE, json); - if (res != TRI_ERROR_NO_ERROR) { + if (res != TRI_ERROR_NO_ERROR && ! force) { return res; } } @@ -2084,6 +2139,7 @@ int RestReplicationHandler::processRestoreData (CollectionNameResolver const& re TRI_voc_cid_t cid, TRI_server_id_t generatingServer, bool useRevision, + bool force, string& errorMsg) { TRI_transaction_t* trx = TRI_CreateTransaction(_vocbase, @@ -2127,7 +2183,7 @@ int RestReplicationHandler::processRestoreData (CollectionNameResolver const& re // TODO: waitForSync disabled here. use for initial replication, too // sync at end of trx trxCollection->_waitForSync = false; - res = processRestoreDataBatch(resolver, trxCollection, generatingServer, useRevision, errorMsg); + res = processRestoreDataBatch(resolver, trxCollection, generatingServer, useRevision, force, errorMsg); } if (res == TRI_ERROR_NO_ERROR) { @@ -2169,11 +2225,17 @@ void RestReplicationHandler::handleCommandRestoreData () { if (value != 0) { recycleIds = StringUtils::boolean(value); } + + bool force = false; + value = _request->value("force"); + if (value != 0) { + force = StringUtils::boolean(value); + } TRI_server_id_t remoteServerId = 0; // TODO string errorMsg; - int res = processRestoreData(resolver, cid, remoteServerId, recycleIds, errorMsg); + int res = processRestoreData(resolver, cid, remoteServerId, recycleIds, force, errorMsg); if (res != TRI_ERROR_NO_ERROR) { generateError(HttpResponse::SERVER_ERROR, res); @@ -2894,6 +2956,7 @@ void RestReplicationHandler::handleCommandApplierSetConfig () { config._connectTimeout = JsonHelper::getNumericValue(json, "connectTimeout", config._connectTimeout); config._ignoreErrors = JsonHelper::getNumericValue(json, "ignoreErrors", config._ignoreErrors); config._maxConnectRetries = JsonHelper::getNumericValue(json, "maxConnectRetries", config._maxConnectRetries); + config._sslProtocol = JsonHelper::getNumericValue(json, "sslProtocol", config._sslProtocol); config._chunkSize = JsonHelper::getNumericValue(json, "chunkSize", config._chunkSize); config._autoStart = JsonHelper::getBooleanValue(json, "autoStart", config._autoStart); config._adaptivePolling = JsonHelper::getBooleanValue(json, "adaptivePolling", config._adaptivePolling); diff --git a/arangod/RestHandler/RestReplicationHandler.h b/arangod/RestHandler/RestReplicationHandler.h index 8f0da2aae2..3e7816a219 100644 --- a/arangod/RestHandler/RestReplicationHandler.h +++ b/arangod/RestHandler/RestReplicationHandler.h @@ -247,6 +247,7 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// int processRestoreCollection (struct TRI_json_s* const, + bool, bool, bool, TRI_server_id_t, @@ -257,6 +258,7 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// int processRestoreIndexes (struct TRI_json_s* const, + bool, TRI_server_id_t, std::string&); @@ -280,6 +282,7 @@ namespace triagens { struct TRI_transaction_collection_s*, TRI_server_id_t, bool, + bool, std::string&); //////////////////////////////////////////////////////////////////////////////// @@ -290,6 +293,7 @@ namespace triagens { TRI_voc_cid_t, TRI_server_id_t, bool, + bool, std::string&); //////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/Utils/Transaction.h b/arangod/Utils/Transaction.h index 80c748491f..4e515153b6 100644 --- a/arangod/Utils/Transaction.h +++ b/arangod/Utils/Transaction.h @@ -847,7 +847,8 @@ namespace triagens { shaped, data, ! isLocked(trxCollection, TRI_TRANSACTION_WRITE), - forceSync); + forceSync, + false); return res; } diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index ce4e2a2c47..eea44f27fe 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -3595,6 +3595,12 @@ static v8::Handle JS_ConfigureApplierReplication (v8::Arguments const } } + if (object->Has(TRI_V8_SYMBOL("sslProtocol"))) { + if (object->Get(TRI_V8_SYMBOL("sslProtocol"))->IsNumber()) { + config._sslProtocol = (uint32_t) TRI_ObjectToUInt64(object->Get(TRI_V8_SYMBOL("sslProtocol")), false); + } + } + if (object->Has(TRI_V8_SYMBOL("chunkSize"))) { if (object->Get(TRI_V8_SYMBOL("chunkSize"))->IsNumber()) { config._chunkSize = TRI_ObjectToUInt64(object->Get(TRI_V8_SYMBOL("chunkSize")), true); diff --git a/arangod/VocBase/document-collection.c b/arangod/VocBase/document-collection.c index 99b123b01d..de493a1984 100644 --- a/arangod/VocBase/document-collection.c +++ b/arangod/VocBase/document-collection.c @@ -429,7 +429,8 @@ static int CreateDocumentMarker (TRI_primary_collection_t* primary, const TRI_df_marker_type_e markerType, TRI_voc_key_t key, TRI_shaped_json_t const* shaped, - void const* data) { + void const* data, + bool isRestore) { char* mem; TRI_doc_document_key_marker_t* marker; TRI_key_generator_t* keyGenerator; @@ -458,7 +459,8 @@ static int CreateDocumentMarker (TRI_primary_collection_t* primary, tick, key, (char*) &keyBuffer, - &keySize); + &keySize, + isRestore); if (res != TRI_ERROR_NO_ERROR) { // key generation failed @@ -1565,7 +1567,8 @@ static int InsertShapedJson (TRI_transaction_collection_t* trxCollection, TRI_shaped_json_t const* shaped, void const* data, const bool lock, - const bool forceSync) { + const bool forceSync, + const bool isRestore) { TRI_primary_collection_t* primary; TRI_doc_document_key_marker_t* marker; @@ -1593,7 +1596,8 @@ static int InsertShapedJson (TRI_transaction_collection_t* trxCollection, markerType, key, shaped, - data); + data, + isRestore); if (res != TRI_ERROR_NO_ERROR) { return res; diff --git a/arangod/VocBase/key-generator.c b/arangod/VocBase/key-generator.c index 47c4f570dc..a7300c276d 100644 --- a/arangod/VocBase/key-generator.c +++ b/arangod/VocBase/key-generator.c @@ -232,7 +232,8 @@ static int TraditionalGenerate (TRI_key_generator_t* const generator, const TRI_voc_tick_t tick, const char* const userKey, char* const outBuffer, - size_t* const outLength) { + size_t* const outLength, + bool isRestore) { traditional_keygen_t* data; char* current; @@ -245,7 +246,7 @@ static int TraditionalGenerate (TRI_key_generator_t* const generator, size_t userKeyLength; // user has specified a key - if (! data->_allowUserKeys) { + if (! data->_allowUserKeys && ! isRestore) { // we do not allow user-generated keys return TRI_ERROR_ARANGO_DOCUMENT_KEY_UNEXPECTED; } @@ -475,7 +476,8 @@ static int AutoIncrementGenerate (TRI_key_generator_t* const generator, const TRI_voc_tick_t tick, const char* const userKey, char* const outBuffer, - size_t* const outLength) { + size_t* const outLength, + bool isRestore) { autoincrement_keygen_t* data; char* current; @@ -489,7 +491,7 @@ static int AutoIncrementGenerate (TRI_key_generator_t* const generator, size_t userKeyLength; // user has specified a key - if (! data->_allowUserKeys) { + if (! data->_allowUserKeys && ! isRestore) { // we do not allow user-generated keys return TRI_ERROR_ARANGO_DOCUMENT_KEY_UNEXPECTED; } diff --git a/arangod/VocBase/key-generator.h b/arangod/VocBase/key-generator.h index 08c7deac2e..4177861669 100644 --- a/arangod/VocBase/key-generator.h +++ b/arangod/VocBase/key-generator.h @@ -78,7 +78,7 @@ typedef struct TRI_key_generator_s { void* _data; int (*init)(struct TRI_key_generator_s* const, const struct TRI_json_s* const); - int (*generate)(struct TRI_key_generator_s* const, const size_t, const TRI_voc_tick_t, const char* const, char* const, size_t* const); + int (*generate)(struct TRI_key_generator_s* const, const size_t, const TRI_voc_tick_t, const char* const, char* const, size_t* const, bool); void (*track)(struct TRI_key_generator_s* const, const TRI_voc_key_t); void (*free)(struct TRI_key_generator_s* const); struct TRI_json_s* (*toJson)(const struct TRI_key_generator_s* const); diff --git a/arangod/VocBase/primary-collection.h b/arangod/VocBase/primary-collection.h index 02f8e97ad7..4c22cf326c 100644 --- a/arangod/VocBase/primary-collection.h +++ b/arangod/VocBase/primary-collection.h @@ -321,7 +321,7 @@ typedef struct TRI_primary_collection_s { #endif int (*notifyTransaction) (struct TRI_primary_collection_s*, TRI_transaction_status_e); - int (*insert) (struct TRI_transaction_collection_s*, const TRI_voc_key_t, TRI_voc_rid_t, TRI_doc_mptr_t*, TRI_df_marker_type_e, TRI_shaped_json_t const*, void const*, const bool, const bool); + int (*insert) (struct TRI_transaction_collection_s*, const TRI_voc_key_t, TRI_voc_rid_t, TRI_doc_mptr_t*, TRI_df_marker_type_e, TRI_shaped_json_t const*, void const*, const bool, const bool, const bool); int (*read) (struct TRI_transaction_collection_s*, const TRI_voc_key_t, TRI_doc_mptr_t*, const bool); diff --git a/arangod/VocBase/replication-applier.c b/arangod/VocBase/replication-applier.c index 7c87ca978e..2c9e20a716 100644 --- a/arangod/VocBase/replication-applier.c +++ b/arangod/VocBase/replication-applier.c @@ -173,6 +173,11 @@ static TRI_json_t* JsonConfiguration (TRI_replication_applier_configuration_t co json, "maxConnectRetries", TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) config->_maxConnectRetries)); + + TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, + json, + "sslProtocol", + TRI_CreateNumberJson(TRI_CORE_MEM_ZONE, (double) config->_sslProtocol)); TRI_Insert3ArrayJson(TRI_CORE_MEM_ZONE, json, @@ -304,6 +309,12 @@ static int LoadConfiguration (TRI_vocbase_t* vocbase, config->_maxConnectRetries = (uint64_t) value->_value._number; } + value = TRI_LookupArrayJson(json, "sslProtocol"); + + if (TRI_IsNumberJson(value)) { + config->_sslProtocol = (uint32_t) value->_value._number; + } + value = TRI_LookupArrayJson(json, "chunkSize"); if (TRI_IsNumberJson(value)) { @@ -1178,6 +1189,7 @@ void TRI_InitConfigurationReplicationApplier (TRI_replication_applier_configurat config->_requestTimeout = 300.0; config->_connectTimeout = 10.0; config->_maxConnectRetries = 100; + config->_sslProtocol = 0; config->_autoStart = false; config->_chunkSize = 0; config->_adaptivePolling = true; @@ -1247,6 +1259,7 @@ void TRI_CopyConfigurationReplicationApplier (TRI_replication_applier_configurat dst->_connectTimeout = src->_connectTimeout; dst->_ignoreErrors = src->_ignoreErrors; dst->_maxConnectRetries = src->_maxConnectRetries; + dst->_sslProtocol = src->_sslProtocol; dst->_chunkSize = src->_chunkSize; dst->_autoStart = src->_autoStart; dst->_adaptivePolling = src->_adaptivePolling; diff --git a/arangod/VocBase/replication-applier.h b/arangod/VocBase/replication-applier.h index 7dfee43dcb..2c02adc7cc 100644 --- a/arangod/VocBase/replication-applier.h +++ b/arangod/VocBase/replication-applier.h @@ -74,6 +74,7 @@ typedef struct TRI_replication_applier_configuration_s { uint64_t _ignoreErrors; uint64_t _maxConnectRetries; uint64_t _chunkSize; + uint32_t _sslProtocol; bool _autoStart; bool _adaptivePolling; } diff --git a/arangod/VocBase/replication-logger.c b/arangod/VocBase/replication-logger.c index b51909c2cb..5e690bd292 100644 --- a/arangod/VocBase/replication-logger.c +++ b/arangod/VocBase/replication-logger.c @@ -523,7 +523,8 @@ static int LogEvent (TRI_replication_logger_t* logger, shaped, NULL, isStandaloneOperation, - forceSync); + forceSync, + false); TRI_FreeShapedJson(primary->_shaper->_memoryZone, shaped); diff --git a/arangod/VocBase/transaction.c b/arangod/VocBase/transaction.c index 82921a9e90..2a2f92c522 100644 --- a/arangod/VocBase/transaction.c +++ b/arangod/VocBase/transaction.c @@ -438,6 +438,7 @@ static int InsertTrxCallback (TRI_transaction_collection_t* trxCollection, shaped, NULL, false, + false, false); TRI_FreeShapedJson(primary->_shaper->_memoryZone, shaped); diff --git a/arangoirb/MRClient/MRubyClientConnection.cpp b/arangoirb/MRClient/MRubyClientConnection.cpp index 9733497e5c..99fd455bd1 100644 --- a/arangoirb/MRClient/MRubyClientConnection.cpp +++ b/arangoirb/MRClient/MRubyClientConnection.cpp @@ -78,7 +78,7 @@ MRubyClientConnection::MRubyClientConnection (mrb_state* mrb, _client(0), _httpResult(0) { - _connection = GeneralClientConnection::factory(endpoint, connectionTimeout, requestTimeout, numRetries); + _connection = GeneralClientConnection::factory(endpoint, connectionTimeout, requestTimeout, numRetries, 0); if (_connection == 0) { throw "out of memory"; } diff --git a/arangosh/ArangoShell/ArangoClient.cpp b/arangosh/ArangoShell/ArangoClient.cpp index e6995fb36f..2da1ab25d5 100644 --- a/arangosh/ArangoShell/ArangoClient.cpp +++ b/arangosh/ArangoShell/ArangoClient.cpp @@ -111,7 +111,8 @@ ArangoClient::ArangoClient () _password(""), _hasPassword(false), _connectTimeout(DEFAULT_CONNECTION_TIMEOUT), - _requestTimeout(DEFAULT_REQUEST_TIMEOUT) { + _requestTimeout(DEFAULT_REQUEST_TIMEOUT), + _sslProtocol(4) { char* p = TRI_GetTempPath(); @@ -242,6 +243,7 @@ void ArangoClient::setupServer (ProgramOptionsDescription& description) { ("server.password", &_password, "password to use when connecting (leave empty for prompt)") ("server.connect-timeout", &_connectTimeout, "connect timeout in seconds") ("server.request-timeout", &_requestTimeout, "request timeout in seconds") + ("server.ssl-protocol", &_sslProtocol, "1 = SSLv2, 2 = SSLv23, 3 = SSLv3, 4 = TLSv1") ; description(clientOptions, false); @@ -828,6 +830,14 @@ double ArangoClient::requestTimeout () const { return _requestTimeout; } +//////////////////////////////////////////////////////////////////////////////// +/// @brief ssl protocol +//////////////////////////////////////////////////////////////////////////////// + +uint32_t ArangoClient::sslProtocol () const { + return _sslProtocol; +} + // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE // ----------------------------------------------------------------------------- diff --git a/arangosh/ArangoShell/ArangoClient.h b/arangosh/ArangoShell/ArangoClient.h index cb2816d0a2..823c662baf 100644 --- a/arangosh/ArangoShell/ArangoClient.h +++ b/arangosh/ArangoShell/ArangoClient.h @@ -415,6 +415,12 @@ namespace triagens { double requestTimeout () const; +//////////////////////////////////////////////////////////////////////////////// +/// @brief ssl protocol +//////////////////////////////////////////////////////////////////////////////// + + uint32_t sslProtocol () const; + //////////////////////////////////////////////////////////////////////////////// /// @} //////////////////////////////////////////////////////////////////////////////// @@ -589,6 +595,12 @@ namespace triagens { //////////////////////////////////////////////////////////////////////////////// double _requestTimeout; + +//////////////////////////////////////////////////////////////////////////////// +/// @brief ssl protocol +//////////////////////////////////////////////////////////////////////////////// + + uint32_t _sslProtocol; }; } } diff --git a/arangosh/Benchmark/BenchmarkThread.h b/arangosh/Benchmark/BenchmarkThread.h index 435a7e7574..d21ebcfe18 100644 --- a/arangosh/Benchmark/BenchmarkThread.h +++ b/arangosh/Benchmark/BenchmarkThread.h @@ -82,6 +82,7 @@ namespace triagens { const string& password, double requestTimeout, double connectTimeout, + uint32_t sslProtocol, bool keepAlive, bool async) : Thread("arangob"), @@ -99,6 +100,7 @@ namespace triagens { _password(password), _requestTimeout(requestTimeout), _connectTimeout(connectTimeout), + _sslProtocol(sslProtocol), _keepAlive(keepAlive), _async(async), _client(0), @@ -146,7 +148,8 @@ namespace triagens { virtual void run () { allowAsynchronousCancelation(); - _connection = GeneralClientConnection::factory(_endpoint, _requestTimeout, _connectTimeout, 3); + _connection = GeneralClientConnection::factory(_endpoint, _requestTimeout, _connectTimeout, 3, _sslProtocol); + if (_connection == 0) { LOGGER_FATAL_AND_EXIT("out of memory"); } @@ -519,6 +522,12 @@ namespace triagens { double _connectTimeout; +//////////////////////////////////////////////////////////////////////////////// +/// @brief ssl protocol +//////////////////////////////////////////////////////////////////////////////// + + uint32_t _sslProtocol; + //////////////////////////////////////////////////////////////////////////////// /// @brief use HTTP keep-alive //////////////////////////////////////////////////////////////////////////////// diff --git a/arangosh/Benchmark/arangob.cpp b/arangosh/Benchmark/arangob.cpp index 3aea672bcb..fbcb686c18 100644 --- a/arangosh/Benchmark/arangob.cpp +++ b/arangosh/Benchmark/arangob.cpp @@ -309,6 +309,7 @@ int main (int argc, char* argv[]) { BaseClient.password(), BaseClient.requestTimeout(), BaseClient.connectTimeout(), + BaseClient.sslProtocol(), KeepAlive, Async); diff --git a/arangosh/V8Client/V8ClientConnection.cpp b/arangosh/V8Client/V8ClientConnection.cpp index 12f39ccf64..947b89bcb8 100644 --- a/arangosh/V8Client/V8ClientConnection.cpp +++ b/arangosh/V8Client/V8ClientConnection.cpp @@ -67,6 +67,7 @@ V8ClientConnection::V8ClientConnection (Endpoint* endpoint, double requestTimeout, double connectTimeout, size_t numRetries, + uint32_t sslProtocol, bool warn) : _connection(0), _databaseName(databaseName), @@ -76,7 +77,7 @@ V8ClientConnection::V8ClientConnection (Endpoint* endpoint, _httpResult(0) { - _connection = GeneralClientConnection::factory(endpoint, requestTimeout, connectTimeout, numRetries); + _connection = GeneralClientConnection::factory(endpoint, requestTimeout, connectTimeout, numRetries, sslProtocol); if (_connection == 0) { throw "out of memory"; diff --git a/arangosh/V8Client/V8ClientConnection.h b/arangosh/V8Client/V8ClientConnection.h index 96a141009e..9a55ea0f53 100644 --- a/arangosh/V8Client/V8ClientConnection.h +++ b/arangosh/V8Client/V8ClientConnection.h @@ -97,6 +97,7 @@ namespace triagens { double, double, size_t, + uint32_t, bool); //////////////////////////////////////////////////////////////////////////////// diff --git a/arangosh/V8Client/arangodump.cpp b/arangosh/V8Client/arangodump.cpp index 56eb8b0590..cf0af17e7e 100644 --- a/arangosh/V8Client/arangodump.cpp +++ b/arangosh/V8Client/arangodump.cpp @@ -891,7 +891,8 @@ int main (int argc, char* argv[]) { Connection = GeneralClientConnection::factory(BaseClient.endpointServer(), BaseClient.requestTimeout(), BaseClient.connectTimeout(), - ArangoClient::DEFAULT_RETRIES); + ArangoClient::DEFAULT_RETRIES, + BaseClient.sslProtocol()); if (Connection == 0) { cerr << "out of memory" << endl; diff --git a/arangosh/V8Client/arangoimp.cpp b/arangosh/V8Client/arangoimp.cpp index 316aa38d8a..df331cc388 100644 --- a/arangosh/V8Client/arangoimp.cpp +++ b/arangosh/V8Client/arangoimp.cpp @@ -301,6 +301,7 @@ int main (int argc, char* argv[]) { BaseClient.requestTimeout(), BaseClient.connectTimeout(), ArangoClient::DEFAULT_RETRIES, + BaseClient.sslProtocol(), false); if (! ClientConnection->isConnected() || ClientConnection->getLastHttpReturnCode() != HttpResponse::OK) { diff --git a/arangosh/V8Client/arangorestore.cpp b/arangosh/V8Client/arangorestore.cpp index 8a7fa439f6..d640bb2e4b 100644 --- a/arangosh/V8Client/arangorestore.cpp +++ b/arangosh/V8Client/arangorestore.cpp @@ -137,6 +137,12 @@ static bool Overwrite = true; static bool RecycleIds = false; +//////////////////////////////////////////////////////////////////////////////// +/// @brief continue restore even in the face of errors +//////////////////////////////////////////////////////////////////////////////// + +static bool Force = false; + //////////////////////////////////////////////////////////////////////////////// /// @brief statistics //////////////////////////////////////////////////////////////////////////////// @@ -173,6 +179,7 @@ static void ParseProgramOptions (int argc, char* argv[]) { ("batch-size", &ChunkSize, "maximum size for individual data batches (in bytes)") ("import-data", &ImportData, "import data into collection") ("recycle-ids", &RecycleIds, "recycle collection and revision ids from dump") + ("force", &Force, "continue restore even in the face of some server-side errors") ("create-collection", &ImportStructure, "create collection structure") ("include-system-collections", &IncludeSystemCollections, "include system collections") ("input-directory", &InputDirectory, "input directory") @@ -367,7 +374,8 @@ static int SendRestoreCollection (TRI_json_t const* json, const string url = "/_api/replication/restore-collection" "?overwrite=" + string(Overwrite ? "true" : "false") + - "&recycleIds=" + string(RecycleIds ? "true" : "false"); + "&recycleIds=" + string(RecycleIds ? "true" : "false") + + "&force=" + string(Force ? "true" : "false"); const string body = JsonHelper::toString(json); @@ -407,7 +415,7 @@ static int SendRestoreIndexes (TRI_json_t const* json, string& errorMsg) { map headers; - const string url = "/_api/replication/restore-indexes"; + const string url = "/_api/replication/restore-indexes?force=" + string(Force ? "true" : "false"); const string body = JsonHelper::toString(json); SimpleHttpResult* response = Client->request(HttpRequest::HTTP_REQUEST_PUT, @@ -451,7 +459,8 @@ static int SendRestoreData (string const& cid, const string url = "/_api/replication/restore-data?collection=" + StringUtils::urlEncode(cname) + - "&recycleIds=" + (RecycleIds ? "true" : "false"); + "&recycleIds=" + (RecycleIds ? "true" : "false") + + "&force=" + (Force ? "true" : "false"); SimpleHttpResult* response = Client->request(HttpRequest::HTTP_REQUEST_PUT, url, @@ -630,12 +639,22 @@ static int ProcessInputDirectory (string& errorMsg) { if (ImportStructure) { // re-create collection if (Progress) { - cout << "Creating collection '" << cname << "'..." << endl; + if (Overwrite) { + cout << "Re-creating collection '" << cname << "'..." << endl; + } + else { + cout << "Creating collection '" << cname << "'..." << endl; + } } int res = SendRestoreCollection(json, errorMsg); if (res != TRI_ERROR_NO_ERROR) { + if (Force) { + cerr << errorMsg << endl; + continue; + } + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, collections); return TRI_ERROR_INTERNAL; @@ -728,9 +747,19 @@ static int ProcessInputDirectory (string& errorMsg) { if (res != TRI_ERROR_NO_ERROR) { TRI_CLOSE(fd); - errorMsg = string(TRI_errno_string(res)); - TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, collections); + if (errorMsg.empty()) { + errorMsg = string(TRI_errno_string(res)); + } + else { + errorMsg = string(TRI_errno_string(res)) + ": " + errorMsg; + } + if (Force) { + cerr << errorMsg << endl; + continue; + } + + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, collections); return res; } @@ -760,6 +789,11 @@ static int ProcessInputDirectory (string& errorMsg) { int res = SendRestoreIndexes(json, errorMsg); if (res != TRI_ERROR_NO_ERROR) { + if (Force) { + cerr << errorMsg << endl; + continue; + } + TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, collections); return TRI_ERROR_INTERNAL; @@ -851,7 +885,8 @@ int main (int argc, char* argv[]) { Connection = GeneralClientConnection::factory(BaseClient.endpointServer(), BaseClient.requestTimeout(), BaseClient.connectTimeout(), - ArangoClient::DEFAULT_RETRIES); + ArangoClient::DEFAULT_RETRIES, + BaseClient.sslProtocol()); if (Connection == 0) { cerr << "out of memory" << endl; diff --git a/arangosh/V8Client/arangosh.cpp b/arangosh/V8Client/arangosh.cpp index ae84959bf2..7f7daf774d 100644 --- a/arangosh/V8Client/arangosh.cpp +++ b/arangosh/V8Client/arangosh.cpp @@ -406,6 +406,7 @@ static V8ClientConnection* CreateConnection () { BaseClient.requestTimeout(), BaseClient.connectTimeout(), ArangoClient::DEFAULT_RETRIES, + BaseClient.sslProtocol(), false); } diff --git a/etc/arangodb/arangob.conf.in b/etc/arangodb/arangob.conf.in index 170ad09433..10614f687d 100644 --- a/etc/arangodb/arangob.conf.in +++ b/etc/arangodb/arangob.conf.in @@ -3,4 +3,4 @@ progress = true [server] endpoint = tcp://localhost:8529 -disable-authentcation = true +disable-authentication = true diff --git a/etc/arangodb/arangodump.conf.in b/etc/arangodb/arangodump.conf.in index adeccdaef1..977eb10949 100644 --- a/etc/arangodb/arangodump.conf.in +++ b/etc/arangodb/arangodump.conf.in @@ -2,4 +2,4 @@ progress = true [server] endpoint = tcp://localhost:8529 -disable-authentcation = true +disable-authentication = true diff --git a/etc/arangodb/arangorestore.conf.in b/etc/arangodb/arangorestore.conf.in index adeccdaef1..977eb10949 100644 --- a/etc/arangodb/arangorestore.conf.in +++ b/etc/arangodb/arangorestore.conf.in @@ -2,4 +2,4 @@ progress = true [server] endpoint = tcp://localhost:8529 -disable-authentcation = true +disable-authentication = true diff --git a/js/actions/api-graph.js b/js/actions/api-graph.js index f2e5c14908..8e768af373 100644 --- a/js/actions/api-graph.js +++ b/js/actions/api-graph.js @@ -79,90 +79,90 @@ function graph_by_request (req) { if (g._properties === null) { throw "no graph found for: " + key; - } - - return g; } - //////////////////////////////////////////////////////////////////////////////// - /// @brief get vertex by request (throws exception) - //////////////////////////////////////////////////////////////////////////////// + return g; +} - function vertex_by_request (req, g) { - if (req.suffix.length < 3) { - throw "no vertex found"; - } +//////////////////////////////////////////////////////////////////////////////// +/// @brief get vertex by request (throws exception) +//////////////////////////////////////////////////////////////////////////////// - var key = req.suffix[2]; - if (req.suffix.length > 3) { - key += "/" + req.suffix[3]; - } - - var vertex = g.getVertex(key); - - if (vertex === null || vertex._properties === undefined) { - throw "no vertex found for: " + key; - } - - return vertex; +function vertex_by_request (req, g) { + if (req.suffix.length < 3) { + throw "no vertex found"; } - //////////////////////////////////////////////////////////////////////////////// - /// @brief get edge by request (throws exception) - //////////////////////////////////////////////////////////////////////////////// - - function edge_by_request (req, g) { - if (req.suffix.length < 3) { - throw "no edge found"; - } - - var key = req.suffix[2]; - if (req.suffix.length > 3) { - key += "/" + req.suffix[3]; - } - var edge = g.getEdge(key); - - if (edge === null || edge._properties === undefined) { - throw "no edge found for: " + key; - } - - return edge; + var key = req.suffix[2]; + if (req.suffix.length > 3) { + key += "/" + req.suffix[3]; } - //////////////////////////////////////////////////////////////////////////////// - /// @brief returns true if a "if-match" or "if-none-match" error happens - //////////////////////////////////////////////////////////////////////////////// + var vertex = g.getVertex(key); - function matchError (req, res, doc, errorCode) { + if (vertex === null || vertex._properties === undefined) { + throw "no vertex found for: " + key; + } - if (req.headers["if-none-match"] !== undefined) { - if (doc._rev === req.headers["if-none-match"]) { - // error - res.responseCode = actions.HTTP_NOT_MODIFIED; - res.contentType = "application/json; charset=utf-8"; - res.body = ''; - res.headers = {}; - return true; - } - } - - if (req.headers["if-match"] !== undefined) { - if (doc._rev !== req.headers["if-match"]) { - // error - actions.resultError(req, - res, - actions.HTTP_PRECONDITION_FAILED, - errorCode, - "wrong revision", - {}); - return true; - } - } - - var rev = req.parameters.rev; - if (rev !== undefined) { - if (doc._rev !== rev) { - // error + return vertex; +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief get edge by request (throws exception) +//////////////////////////////////////////////////////////////////////////////// + +function edge_by_request (req, g) { + if (req.suffix.length < 3) { + throw "no edge found"; + } + + var key = req.suffix[2]; + if (req.suffix.length > 3) { + key += "/" + req.suffix[3]; + } + var edge = g.getEdge(key); + + if (edge === null || edge._properties === undefined) { + throw "no edge found for: " + key; + } + + return edge; +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief returns true if a "if-match" or "if-none-match" error happens +//////////////////////////////////////////////////////////////////////////////// + +function matchError (req, res, doc, errorCode) { + + if (req.headers["if-none-match"] !== undefined) { + if (doc._rev === req.headers["if-none-match"]) { + // error + res.responseCode = actions.HTTP_NOT_MODIFIED; + res.contentType = "application/json; charset=utf-8"; + res.body = ''; + res.headers = {}; + return true; + } + } + + if (req.headers["if-match"] !== undefined) { + if (doc._rev !== req.headers["if-match"]) { + // error + actions.resultError(req, + res, + actions.HTTP_PRECONDITION_FAILED, + errorCode, + "wrong revision", + {}); + return true; + } + } + + var rev = req.parameters.rev; + if (rev !== undefined) { + if (doc._rev !== rev) { + // error actions.resultError(req, res, actions.HTTP_PRECONDITION_FAILED, @@ -455,9 +455,20 @@ function delete_graph_graph (req, res) { var g; try { - g = graph_by_request(req); - if (g === null || g === undefined) { - throw "graph not found"; + var name = req.suffix[0]; + var exists = arangodb.db._collection('_graphs').exists(name); + + try { + g = graph_by_request(req); + if (g === null || g === undefined) { + throw "graph not found"; + } + } + catch (graphNotFound) { + if (exists) { + graph.Graph.drop(name); + actions.resultOk(req, res, actions.HTTP_OK, { "deleted" : true }); + } } } catch (err) { diff --git a/js/actions/api-system.js b/js/actions/api-system.js index 60996342f8..f3f367d06c 100644 --- a/js/actions/api-system.js +++ b/js/actions/api-system.js @@ -357,7 +357,8 @@ actions.defineHttp({ try { result = {}; result.system = internal.processStatistics(); - result.client = internal.requestStatistics(); + result.client = internal.clientStatistics(); + result.http = internal.httpStatistics(); result.server = internal.serverStatistics(); actions.resultOk(req, res, actions.HTTP_OK, result); @@ -391,7 +392,7 @@ actions.defineHttp({ /// - `group`: The identifier of the group to which this figure belongs. /// - `identifier`: The identifier of the figure. It is unique within the group. /// - `name`: The name of the figure. -/// - `description`: A description of the group. +/// - `description`: A description of the figure. /// - `type`: Either `current`, `accumulated`, or `distribution`. /// - `cuts`: The distribution vector. /// - `units`: Units in which the figure is measured. @@ -432,10 +433,16 @@ actions.defineHttp({ { group: "client", - name: "Client Statistics", - description: "Statistics about the clients connecting to the server." + name: "Client Connection Statistics", + description: "Statistics about the connections." }, - + + { + group: "http", + name: "HTTP Request Statistics", + description: "Statistics about the HTTP requests." + }, + { group: "server", name: "Server Statistics", @@ -523,12 +530,12 @@ actions.defineHttp({ // ............................................................................. // client statistics // ............................................................................. - + { group: "client", identifier: "httpConnections", - name: "HTTP Client Connections", - description: "The number of http connections that are currently open.", + name: "Client Connections", + description: "The number of connections that are currently open.", type: "current", units: "number" }, @@ -562,7 +569,7 @@ actions.defineHttp({ cuts: internal.requestTimeDistribution, units: "seconds" }, - + { group: "client", identifier: "bytesSent", @@ -592,6 +599,87 @@ actions.defineHttp({ cuts: internal.connectionTimeDistribution, units: "seconds" }, + + { + group: "http", + identifier: "requestsTotal", + name: "Total requests", + description: "Total number of HTTP requests.", + type: "accumulated", + units: "number" + }, + + { + group: "http", + identifier: "requestsAsync", + name: "Async requests", + description: "Number of asynchronously executed HTTP requests.", + type: "accumulated", + units: "number" + }, + + { + group: "http", + identifier: "requestsGet", + name: "HTTP GET requests", + description: "Number of HTTP GET requests.", + type: "accumulated", + units: "number" + }, + + { + group: "http", + identifier: "requestsHead", + name: "HTTP HEAD requests", + description: "Number of HTTP HEAD requests.", + type: "accumulated", + units: "number" + }, + + { + group: "http", + identifier: "requestsPost", + name: "HTTP POST requests", + description: "Number of HTTP POST requests.", + type: "accumulated", + units: "number" + }, + + { + group: "http", + identifier: "requestsPut", + name: "HTTP PUT requests", + description: "Number of HTTP PUT requests.", + type: "accumulated", + units: "number" + }, + + { + group: "http", + identifier: "requestsPatch", + name: "HTTP PATCH requests", + description: "Number of HTTP PATCH requests.", + type: "accumulated", + units: "number" + }, + + { + group: "http", + identifier: "requestsDelete", + name: "HTTP DELETE requests", + description: "Number of HTTP DELETE requests.", + type: "accumulated", + units: "number" + }, + + { + group: "http", + identifier: "requestsOptions", + name: "HTTP OPTIONS requests", + description: "Number of HTTP OPTIONS requests.", + type: "accumulated", + units: "number" + }, // ............................................................................. // server statistics diff --git a/js/actions/api-traversal.js b/js/actions/api-traversal.js index 6fa558462a..08222eff20 100644 --- a/js/actions/api-traversal.js +++ b/js/actions/api-traversal.js @@ -91,34 +91,45 @@ function notFound (req, res, code, message) { /// - `Array` -> containing any combination of the above. /// If there is at least one `"exclude"` or `"prune"` respectivly /// is contained, it's effect will occur. +/// /// - `minDepth` (optional, ANDed with any existing filters): /// visits only nodes in at least the given depth +/// /// - `maxDepth` (optional, ANDed with any existing filters): /// visits only nodes in at most the given depth +/// /// - `visitor` (optional): body (JavaScript) code of custom visitor function /// function signature: (config, result, vertex, path) -> void /// visitor function can do anything, but its return value is ignored. To /// populate a result, use the `result` variable by reference +/// /// - `direction` (optional): direction for traversal /// - *if set*, must be either `"outbound"`, `"inbound"`, or `"any"` /// - *if not set*, the `expander` attribute must be specified +/// /// - `init` (optional): body (JavaScript) code of custom result initialisation function /// function signature: (config, result) -> void /// initialise any values in result with what is required +/// /// - `expander` (optional): body (JavaScript) code of custom expander function /// *must* be set if `direction` attribute is *not* set /// function signature: (config, vertex, path) -> array /// expander must return an array of the connections for `vertex` /// each connection is an object with the attributes `edge` and `vertex` +/// /// - `strategy` (optional): traversal strategy /// can be `"depthfirst"` or `"breadthfirst"` +/// /// - `order` (optional): traversal order /// can be `"preorder"` or `"postorder"` +/// /// - `itemOrder` (optional): item iteration order /// can be `"forward"` or `"backward"` +/// /// - `uniqueness` (optional): specifies uniqueness for vertices and edges visited /// if set, must be an object like this: /// `"uniqueness": {"vertices": "none"|"global"|path", "edges": "none"|"global"|"path"}` +/// /// - `maxIterations` (optional): Maximum number of iterations in each traversal. This number can be /// set to prevent endless loops in traversal of cyclic graphs. When a traversal performs /// as many iterations as the `maxIterations` value, the traversal will abort with an diff --git a/js/apps/system/aardvark/aardvark.js b/js/apps/system/aardvark/aardvark.js index 0c8e21d97c..e6f6998a9a 100644 --- a/js/apps/system/aardvark/aardvark.js +++ b/js/apps/system/aardvark/aardvark.js @@ -150,7 +150,29 @@ controller.get('/docu/:key/*', function(req, res) { allowMultiple: false }).summary("List the API for one foxx") .notes("This function lists the API of the foxx" - + " runnning under the given mount point"); + + " running under the given mount point"); + +// ............................................................................. +// Move one foxx from mount-point to another +// ............................................................................. + +controller.put('/foxx/move/:key', function(req, res) { + var body = req.body(); + var mountPoint = body.mount; + var app = body.app; + var key = req.params("key"); + var prefix = body.prefix; + var result = foxxes.move(key, app, mountPoint, prefix); + if (result.error) { + res.status(result.status); + res.body = result.message; + return; + } + res.json(result); +}) +.summary("Move one foxx to another moint point") + .notes ("This function moves one installed foxx" + + " to a given mount point."); // ----------------------------------------------------------------------------- // --SECTION-- END-OF-FILE diff --git a/js/apps/system/aardvark/frontend/css/ansi.css b/js/apps/system/aardvark/frontend/css/ansi.css index 296cfc6089..1770cda404 100644 --- a/js/apps/system/aardvark/frontend/css/ansi.css +++ b/js/apps/system/aardvark/frontend/css/ansi.css @@ -34,7 +34,7 @@ to { opacity: 0.0; } } -.jqconsole-ansi-blink { +.jqconsole-ansi-blink, .jqconsole-ansi-blink-rapid { -webkit-animation-name: blinker; -moz-animation-name: blinker; -ms-animation-name: blinker; @@ -47,6 +47,9 @@ -ms-animation-timing-function: cubic-bezier(1.0,0,0,1.0); -o-animation-timing-function: cubic-bezier(1.0,0,0,1.0); -moz-animation-timing-function: cubic-bezier(1.0,0,0,1.0); +} + +.jqconsole-ansi-blink { -webkit-animation-duration: 1s; -moz-animation-duration: 1s; -o-animation-duration: 1s; @@ -54,18 +57,6 @@ } .jqconsole-ansi-blink-rapid { - -webkit-animation-name: blinker; - -moz-animation-name: blinker; - -ms-animation-name: blinker; - -o-animation-name: blinker; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - -ms-animation-iteration-count: infinite; - -o-animation-iteration-count: infinite; - -webkit-animation-timing-function: cubic-bezier(1.0,0,0,1.0); - -ms-animation-timing-function: cubic-bezier(1.0,0,0,1.0); - -o-animation-timing-function: cubic-bezier(1.0,0,0,1.0); - -moz-animation-timing-function: cubic-bezier(1.0,0,0,1.0); -webkit-animation-duration: 0.5s; -moz-animation-duration: 0.5s; -o-animation-duration: 0.5s; diff --git a/js/apps/system/aardvark/frontend/css/api.css b/js/apps/system/aardvark/frontend/css/api.css index c44df18834..65063b9103 100644 --- a/js/apps/system/aardvark/frontend/css/api.css +++ b/js/apps/system/aardvark/frontend/css/api.css @@ -5,7 +5,6 @@ .api-actions { margin: 0 !important; padding: 0; - background-color: rgba(0,0,0,0.15) !important; } .api-actions .container { diff --git a/js/apps/system/aardvark/frontend/css/arangodbIcons.css b/js/apps/system/aardvark/frontend/css/arangodbIcons.css index e5da1592f9..ce8912964a 100644 --- a/js/apps/system/aardvark/frontend/css/arangodbIcons.css +++ b/js/apps/system/aardvark/frontend/css/arangodbIcons.css @@ -10,16 +10,18 @@ font-style: normal; } +.arango-icon-disk, .arango-icon-uncomment, .arango-icon-export, .arango-icon-import, .arango-icon-remove, .arango-icon-remove-2, .arango-icon-trashcan, .arango-icon-undo, .arango-icon-loop, .arango-icon-comment, .arango-icon-redo ,[data-icon]:before { + font-family: 'arangodbfont'; + speak: none; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + -webkit-font-smoothing: antialiased; +} /* Use the following CSS code if you want to use data attributes for inserting your icons */ [data-icon]:before { - font-family: 'arangodbfont'; content: attr(data-icon); - speak: none; - font-weight: normal; - font-variant: normal; - text-transform: none; - line-height: 1; - -webkit-font-smoothing: antialiased; } /* Use the following CSS code if you want to have a class per icon */ @@ -29,14 +31,7 @@ you can use the generic selector below, but it's slower: [class*="arango-icon-"] { */ .arango-icon-disk, .arango-icon-uncomment, .arango-icon-export, .arango-icon-import, .arango-icon-remove, .arango-icon-remove-2, .arango-icon-trashcan, .arango-icon-undo, .arango-icon-loop, .arango-icon-comment, .arango-icon-redo { - font-family: 'arangodbfont'; - speak: none; font-style: normal; - font-weight: normal; - font-variant: normal; - text-transform: none; - line-height: 1; - -webkit-font-smoothing: antialiased; } .arango-icon-disk:before { content: "\e000"; diff --git a/js/apps/system/aardvark/frontend/css/buttons.css b/js/apps/system/aardvark/frontend/css/buttons.css new file mode 100644 index 0000000000..6cb1d442a3 --- /dev/null +++ b/js/apps/system/aardvark/frontend/css/buttons.css @@ -0,0 +1,15 @@ +.addButton { + position: relative; + margin-right: 7px; + font-size: 20px; + color: #8AA050; + margin-top: 2px; +} +.deleteButton { + color: #B30000; + font-size: 20px; + padding-right: 3px; + top: 3px; + position: relative; +} + diff --git a/js/apps/system/aardvark/frontend/css/collectionsItemView.css b/js/apps/system/aardvark/frontend/css/collectionsItemView.css index 4340e5147c..23be9f0c71 100644 --- a/js/apps/system/aardvark/frontend/css/collectionsItemView.css +++ b/js/apps/system/aardvark/frontend/css/collectionsItemView.css @@ -46,7 +46,7 @@ margin-right: 5px; opacity: 0.5; cursor: pointer; - font-size: 20px; + font-size: 25px; } .span3 .glyphicon-edit { margin-top: 4px !important; diff --git a/js/apps/system/aardvark/frontend/css/collectionsView.css b/js/apps/system/aardvark/frontend/css/collectionsView.css index 436c7bba48..bc45315733 100644 --- a/js/apps/system/aardvark/frontend/css/collectionsView.css +++ b/js/apps/system/aardvark/frontend/css/collectionsView.css @@ -10,9 +10,10 @@ } #newCollection { + position: relative; margin-left: 22px; - font-size: 25px; - margin-top: -3px; + font-size: 28px; + margin-top: -5px; margin-right: 10px; } @@ -24,7 +25,6 @@ .thumbnails2 { padding-top: 1px !important; - background-color: rgba(0, 0, 0, 0.15); margin-left:0; margin-bottom:0; } @@ -35,12 +35,10 @@ padding-right: 0px; padding-bottom: 5px; padding-top: 13px; - background-color: rgba(0, 0, 0, 0.15); } .thumbnails li { background-color: #f4f3f3; - /*border: 2px solid rgba(0, 0, 0, 0.1);*/ } .thumbnails a.add { @@ -103,14 +101,7 @@ #transparentHeader { width: auto; - height: 36px; - margin-top: 5px !important; margin-bottom: 0px !important; - background-color:#686766; - color:#FFF; - margin-left: 5px; - margin-right: 5px; - padding-left: 5px; padding-right: 10px; position:relative; font-size: 16px; @@ -162,9 +153,9 @@ /* option 1 - dropdown filter */ #transparentHeader .dropdown-menu { - border-radius: 0 0 0px 0px !important; - margin-top: 6px !important; - margin-right: -20px !important; + border-radius: 0px 0px 0px 0px; + margin-top: 6px; + margin-right: -20px; background-color: rgba(0, 0, 0, 0.7); /*background-color: #BFBDBC;*/ border: solid 1px #686766; @@ -216,6 +207,56 @@ border-top: 0; border-radius: 0 !important; } +div.headerDropdown { + background-color: white; + position:relative; + display:none; + margin-left: 5px; + margin-right: 5px; + padding-bottom: 15px; + width: auto; +} + +div.headerDropdown > div.dropdownInner { + position: relative; + min-height: 125px; + width: auto; + box-shadow: 0 !important; +} + +div.dropdownInner > .nav-header { + font-size: 13px; + font-weight: 400; + color: black; +} + +div.dropdownInner > label { + color: black; + font-weight: 300; +} + +div.dropdownInner > ul { + border-left: 1px solid black; +} + +div.dropdownInner > ul:first-of-type { + border: none; +} + +div.dropdownInner ul { + min-height: 105px; + float: left; + margin-top: 10px; + width: 238px; + display: inline; +} + +div.dropdownInner ul li label { + padding-left: 35px; + color: black; +} + +/* #collectionsDropdown2, #dashboardDropdownOut, #foxxDropdownOut, .dropdownOut { background-color: white; position:relative; @@ -224,14 +265,14 @@ border-top: 0; margin-right: 5px; width: auto; } - +*/ +/* #collectionsDropdown, #dashboardDropdown, #foxxDropdown, .dropdownIn{ position: relative; min-height: 125px; width: auto; box-shadow: 0 !important; } - #collectionsDropdown .nav-header, #dashboardDropdown .nav-header, #foxxDropdown .nav-header, .dropdownOut .nav-header{ font-size: 13px; font-weight: 400; @@ -246,7 +287,6 @@ border-top: 0; #collectionsDropdown ul, #dashboardDropdown ul, #foxxDropdown ul, .dropdownIn ul{ border-left: 1px solid black; } - .dropdownOut ul:last-of-type, #collectionsDropdown ul:last-of-type, #dashboardDropdown ul:last-of-type, @@ -282,6 +322,7 @@ border-top: 0; color: black; } +*/ .containerdivNewLine { clear: both; float: left; diff --git a/js/apps/system/aardvark/frontend/css/dashboardView.css b/js/apps/system/aardvark/frontend/css/dashboardView.css index 28591a0575..4e58dde26b 100644 --- a/js/apps/system/aardvark/frontend/css/dashboardView.css +++ b/js/apps/system/aardvark/frontend/css/dashboardView.css @@ -25,6 +25,8 @@ margin-top: 6px; margin-bottom: 0; padding-bottom: 0; + border-radius: 0 !important; + max-height: 30px !important; } #dashboardHeader ul a { @@ -202,7 +204,7 @@ li:hover h6, li.hover h6 { font-family: 'Open Sans', sans-serif !important; } -#dashboardHeader { +#dashboardHeader, #transparentHeader { margin-left: 5px; margin-right: 5px; padding-right: 5px; @@ -213,10 +215,6 @@ li:hover h6, li.hover h6 { margin-top: 5px !important; } -#dashboardHeader .btn-group { - border-radius: 0 !important; - max-height: 30px !important; -} /*NVD3*/ .nv-series { @@ -356,6 +354,8 @@ li:hover h6, li.hover h6 { #detailReplicationDiv table { margin-top: 10px; border-spacing: 0 0px; + width: 100%; + text-align:left !important; } #detailReplicationDiv table thead { @@ -367,35 +367,27 @@ li:hover h6, li.hover h6 { font-weight: 400 !important; } -#detailReplicationDiv table { - width: 100%; -} - -#detailReplicationDiv table { - text-align:left !important; -} - -#detailReplicationDiv table tr { -} - #detailReplicationDiv table tbody tr th { padding-bottom: 4px; padding-top: 4px; } -#rightReplicationDiv { - min-height: 150px; +#leftReplicationDiv, #rightReplicationDiv { + padding: 10px !important; padding-top: 5px; + min-height: 150px; margin-right: 10px; - margin-bottom: 8px; background-color: #FFFFFF; } -#leftReplicationDiv, #rightReplicationDiv { - padding: 10px !important; +#rightReplicationDiv { + margin-bottom: 8px; } -#leftReplicationDiv h4, #rightReplicationDiv h4 { +#leftReplicationDiv { + width: auto; + margin-top: -1px; + border-top: 1px solid #888; } #leftReplicationDiv table, #rightReplicationDiv table { @@ -428,15 +420,6 @@ li:hover h6, li.hover h6 { #leftReplicationDiv tbody tr, #rightReplicationDiv tbody tr { } -#leftReplicationDiv { - padding-top: 5px; - width: auto; - min-height: 150px; - margin-right: 10px; - margin-top: -1px; - border-top: 1px solid #888; - background-color: #FFFFFF; -} .alignLeft { width: 240px !important; @@ -572,32 +555,26 @@ li:hover h6, li.hover h6 { visibility: hidden !important; } -.greenLight { - background: green; - background-image: radial-gradient(lime, transparent); +.greenLight, .redLight { background-size: 3px 3px; width: 20px; height: 20px; border-radius: 50%; - box-shadow: margin-top: 1px; - 0 0 10px #111 inset, - 0 0 5px lime; +} + +.greenLight { + background: green; + background-image: radial-gradient(lime, transparent); + box-shadow: 0 0 10px #111 inset, 0 0 5px lime; animation: 13s green infinite; } .redLight { background: red; background-image: radial-gradient(brown, transparent); - background-size: 3px 3px; - margin-top: 1px; - width: 20px; - height: 20px; - border-radius: 50%; animation: 13s red infinite; - box-shadow: - 0 0 10px #111 inset, - 0 0 5px red; + box-shadow: 0 0 10px #111 inset, 0 0 5px red; } #dashboardDropdown > ul > li > a > .radio { diff --git a/js/apps/system/aardvark/frontend/css/databaseView.css b/js/apps/system/aardvark/frontend/css/databaseView.css index 244853d67e..5817bfa535 100644 --- a/js/apps/system/aardvark/frontend/css/databaseView.css +++ b/js/apps/system/aardvark/frontend/css/databaseView.css @@ -1,5 +1,4 @@ #databaseDiv { - background-color: rgba(0,0,0,0.15); padding: 5px; } diff --git a/js/apps/system/aardvark/frontend/css/datatables.css b/js/apps/system/aardvark/frontend/css/datatables.css new file mode 100644 index 0000000000..30c57cffed --- /dev/null +++ b/js/apps/system/aardvark/frontend/css/datatables.css @@ -0,0 +1,56 @@ +#documentsTable thead { + border: 0 !important; +} + +#tableDiv table.dataTable td { + padding:12px 18px !important; +} + +#logContent .odd { + background-color: #F1F0EE; +} + +#logContent .even { + background-color: #FFFFFF; +} + + +table.dataTable thead th { + border-bottom:none; + cursor: default !important; +} + +table.arangoDataTable.dataTable td { + padding:10px 18px; +} + +.arangoDataTable thead { + font-weight: 400 !important; + background-color: #FFFFFF !important; + text-align: left; +} + +.arangoDataTable { + padding-left: 5px !important; + padding-right: 5px !important; + width: 100% !important; + position: relative; + table-layout:fixed !important; + border-spacing:0 0px; +} + +.arangoDataTable.dataTable thead tr { + border-bottom: 1px solid #C2C2C2; +} + +.arangoDataTable .odd:hover, +.arangoDataTable .even:hover, +#logContent .odd:hover, +#logContent .even:hover { + cursor: pointer; +} + +.arangoDataTable .key { + margin-top: 4px; +} + diff --git a/js/apps/system/aardvark/frontend/css/dbSelectionView.css b/js/apps/system/aardvark/frontend/css/dbSelectionView.css index f4deadedb8..91e057b929 100644 --- a/js/apps/system/aardvark/frontend/css/dbSelectionView.css +++ b/js/apps/system/aardvark/frontend/css/dbSelectionView.css @@ -1,12 +1,8 @@ -span.selectDB { - top: 6px; - left: 210px; - position: absolute; -} - span.selectDB > select { line-height: 20px; height: 20px; width: 150px; - padding: 0px; + margin: -3px 0px 2px 0px; + border-radius: 0px !important; + border: 1px solid; } diff --git a/js/apps/system/aardvark/frontend/css/documentSourceView.css b/js/apps/system/aardvark/frontend/css/documentSourceView.css index 264108717d..c8a9a09f6c 100644 --- a/js/apps/system/aardvark/frontend/css/documentSourceView.css +++ b/js/apps/system/aardvark/frontend/css/documentSourceView.css @@ -28,9 +28,6 @@ #sourceDiv { margin-top: 0px; - padding-left: 5px; - padding-top: 13px; - padding-right: 5px; padding-bottom: 5px; min-height: 400px; margin-bottom: 20px; diff --git a/js/apps/system/aardvark/frontend/css/documentView.css b/js/apps/system/aardvark/frontend/css/documentView.css index 9c2f1de060..509b79c387 100644 --- a/js/apps/system/aardvark/frontend/css/documentView.css +++ b/js/apps/system/aardvark/frontend/css/documentView.css @@ -18,15 +18,6 @@ cursor: default !important; } -.docLink { -} - -.docPreview { - text-align: right; - float: right; - margin-right: -17px !important; -} - #collectionPrev, #collectionNext{ cursor: pointer; } @@ -36,8 +27,14 @@ cursor: default !important; } -#tableDiv, #logContent{ - padding: 13px 5px 10px 5px; +#tableDiv, #logContent, #documentsDiv, #sourceDiv, #graphManagementDiv { + padding-top: 13px; + padding-right: 5px; + padding-left: 5px; +} + +#tableDiv, #logContent { + padding-bottom: 10px; } #logContent .tab-content { @@ -83,19 +80,36 @@ color: #B30000; } +.editSecondAttribute, .editFirstAttribute, .docPreview { + text-align: right; + float: right; +} .editSecondAttribute, .editFirstAttribute { color: #444444; font-size: 16px; - float:right; padding-top: 4px; } +.editFirstAttribute, .docPreview{ + margin-right: -17px !important; +} + +.editSecondAttribute { + margin-right: -30px !important; + padding-bottom: 1px; +} + .addAttribute, .deleteAttribute { - font-size: 20px; + font-size: 27px; float:right; padding-top: 2px; } +#documentTableID .icon_arangodb_edit { + font-size: 27px; + margin-top: -2px; +} + #documentTableID { font-weight: 300; font-size: 15px !important; @@ -123,18 +137,7 @@ table.dataTable thead th { cursor: default !important; } -.editFirstAttribute { - float:right; - text-align:right; - margin-right: -17px !important; -} -.editSecondAttribute { - float:right; - text-align:right; - margin-right: -30px !important; - padding-bottom: 1px; -} #documentTableID .icon-edit { margin-top: 0; @@ -156,10 +159,12 @@ table.dataTable thead th { box-shadow: none; } -#documentTableID .odd, #documentsTableID .odd { +#documentTableID .odd, +table.dataTable.arangoDataTable tr.odd { background:#F1F0EE; } -#documentTableID .even, #documentsTableID .even { +#documentTableID .even, +table.dataTable.arangoDataTable tr.even { background:#FFFFFF; } diff --git a/js/apps/system/aardvark/frontend/css/documentsView.css b/js/apps/system/aardvark/frontend/css/documentsView.css index 41938ae52f..97d6112df1 100644 --- a/js/apps/system/aardvark/frontend/css/documentsView.css +++ b/js/apps/system/aardvark/frontend/css/documentsView.css @@ -1,27 +1,3 @@ -#documentsTableID .key { - margin-top: 4px; -} - -#addDocumentButton { - position: relative; - margin-right: 6px; - font-size: 20px; - color: #8AA050; - margin-top: 2px; -} - -table.dataTable thead th { - cursor: default !important; -} - -#tableDiv table.dataTable td { - padding:12px 18px !important; -} - -#documentsDiv table.dataTable td { - padding:10px 18px !important; -} - #documentAddBtn { margin-left: 6px; } @@ -30,19 +6,7 @@ table.dataTable thead th { width: 30px !important; } -#deleteDoc { - color: #B30000; - font-size: 20px; - padding-right: 3px; - top: 3px; - position: relative; -} - -#deleteDoc span { -} - #documentsFooterBox { - background-color: rgba(0,0,0,0.15); height: 56px; } @@ -78,24 +42,26 @@ table.dataTable thead th { } .arangoDropdown { - background-color: rgba(0,0,0,0.15); margin-bottom: -10px; } -#filterHeader, #importHeader, .arangoDropdownIn { +#filterHeader, #importHeader, .arangoDropdownIn, #indexHeaderContent { + margin-left: 5px; + margin-right: 5px; background-color: white; +} + +#filterHeader, #importHeader, .arangoDropdownIn { padding-top: 10px; padding-left: 10px; padding-right: 10px; padding-bottom: 5px; - margin-left: 5px; - margin-right: 5px; position:relative; } #importHeader input { line-height: 0px !important; - (;margin-top: 5px;margin-bottom: -5px;) + margin-top: 5px;margin-bottom: -5px; } #confirmDocImport { @@ -137,16 +103,6 @@ table.dataTable thead th { #documentsDiv { margin-top: 10px !important; - padding-left: 5px; - padding-right: 5px; - padding-top: 13px; - background-color: rgba(0, 0, 0, 0.15); -} - -#documentsTableID thead { - font-weight: 400 !important; - background-color: #FFFFFF !important; - text-align: left; } #documentsTableID_length, #documentsTableID_filter { @@ -162,68 +118,10 @@ table.dataTable thead th { visibility: hidden; } -#documentsTableID { - padding-left: 5px !important; - padding-right: 5px !important; - width: 100% !important; - position: relative; - table-layout:fixed !important; - border-spacing:0 0px; -} - -#documentsTable thead { - border: 0 !important; -} - .docsFirstCol, .docsSecCol, .docsThirdCol { border: 0 !important; } -table.dataTable thead th { - border-bottom:none; -} - -#documentsTableID.dataTable thead tr { - border-bottom: 1px solid #C2C2C2; -} - -#documentsTableID tbody { -} - -#documentsTableID.dataTable tr, -#logContent .dataTable tr { -} - -#logContent .odd { - background-color: #F1F0EE; -} - -#logContent .even { - background-color: #FFFFFF; -} - - -#documentsTableID .odd:hover, -#documentsTableID .even:hover, -#logContent .odd:hover, -#logContent .even:hover { - cursor: pointer; - /*background-color: #D4DFC3 !important;*/ -} - -#documentsTableID.dataTable tr.even td.sorting_1, -#documentsTableID.dataTable tr.odd td.sorting_1, -#logContent tr.even td.sorting_1, -#logContent tr.odd td.sorting_1 { -} - -#documentsTableID tr.even:hover td.sorting_1, -#documentsTableID tr.odd:hover td.sorting_1, -#logContent tr.even:hover td.sorting_1, -#logContent tr.odd:hover td.sorting_1 { -} - - #documentsTableID_paginate, #documentsTableID_filter, #documentsTableID_length { visibility: hidden; } @@ -353,22 +251,24 @@ table.dataTable thead th { padding-right: 9px; } -.badge-success .cornered { +.badge-success .cornered, +.badge-important .cornered, +.badge-inverse .cornered { height: 0px; - border-bottom: 16px solid #8AA051; border-left: 16px solid transparent; + border-bottom-width: 16px; + border-bottom-style: solid; +} +.badge-success .cornered { + border-bottom-color: #8AA051; } .badge-important .cornered { - height: 0px; - border-bottom: 16px solid #B94A48; - border-left: 16px solid transparent; + border-bottom-color: #B94A48; } .badge-inverse .cornered { - height: 0px; - border-bottom: 16px solid #333333; - border-left: 16px solid transparent; + border-bottom-color: #333333; } .badge .arrow:after { @@ -376,9 +276,6 @@ table.dataTable thead th { border-right-color: #8AA051; bottom: -10px; left: 1px; -} - -.badge .arrow:after { border-width: 10px; content: ""; } @@ -473,7 +370,6 @@ table.dataTable thead th { } .docsThirdCol { - padding-right: 15px !important; float:right; } @@ -527,24 +423,38 @@ table.dataTable thead th { } #documentsToolbar span { - font-size: 16px; + position: absolute; + top: 0; + right: 2px; + font-size: 25px; margin-right: 3px; margin-left: 0px; } -#resetView, #filterSend, #confirmDocImport { +/* better look of some icons */ +#documentsToolbar .icon_arangodb_filter { + top: 1px !important; } -#indexHeaderContent { - margin-left: 5px; - margin-right: 5px; - background-color: white; +#documentsToolbar .icon_arangodb_import { + top: -1px !important; +} + +#documentsToolbar .icon_arangodb_arrowleft, +#documentsToolbar .icon_arangodb_arrowright { + font-weight:bold; } #indexHeaderContent > div { padding: 10px; } +#indexHeaderContent .arangoicon { + font-size: 25px; + position: relative; + top: -3px !important; +} + #figuresHeader th { width: 100% !important; } diff --git a/js/apps/system/aardvark/frontend/css/footerView.css b/js/apps/system/aardvark/frontend/css/footerView.css index 36836a55f7..ee36bfe445 100644 --- a/js/apps/system/aardvark/frontend/css/footerView.css +++ b/js/apps/system/aardvark/frontend/css/footerView.css @@ -1,5 +1,5 @@ .container { - padding-bottom: 40px; + margin-bottom: 40px; } .footer { diff --git a/js/apps/system/aardvark/frontend/css/general.css b/js/apps/system/aardvark/frontend/css/general.css new file mode 100644 index 0000000000..f1c0bb0315 --- /dev/null +++ b/js/apps/system/aardvark/frontend/css/general.css @@ -0,0 +1,75 @@ +/* Sets the default values shared for content views*/ +#content +{ + background-color: rgba(0, 0, 0, 0.15); + margin-top: 74px; + margin-bottom: 33px; + min-height: 80px; + height: 100%; + width: 100%; + margin-left: 20px; + margin-left: 0; +} +/* layout.css +#aboutDiv { + padding-bottom: 5px; +} + +queryView.css +#queryDiv { + margin-top: 0px !important; + padding-top: 6px !important; + padding-left: 5px; + padding-right: 5px; + padding-bottom: 5px !important; +} + +#queryDropdown { + margin-left: 0; + margin-right: 0; + padding-left: 5px; + padding-right: 5px; +} + +documentsView.css +#documentsFooterBox { + height: 56px; +} + +.arangoDropdown { + margin-bottom: -10px; +} + +#documentsDiv { + margin-top: 10px !important; +} + +#databaseDiv { + padding: 5px; +} + +collectionsView.css + +.thumbnails { + margin-left:0px; + padding-left: 0px; + padding-right: 0px; + padding-bottom: 5px; + padding-top: 13px; +} + + +.thumbnails2 { + padding-top: 1px !important; + margin-left:0; + margin-bottom:0; +} + +api.css + +.api-actions { + margin: 0 !important; + padding: 0; +} + +*/ diff --git a/js/apps/system/aardvark/frontend/css/graphView.css b/js/apps/system/aardvark/frontend/css/graphView.css index e69de29bb2..3f34afb60e 100644 --- a/js/apps/system/aardvark/frontend/css/graphView.css +++ b/js/apps/system/aardvark/frontend/css/graphView.css @@ -0,0 +1,11 @@ +svg.graphViewer { + background-color: white; + border-width: 1px; + border-style: solid; + border-color: rgba(0,0,0,0.125); + margin-left: 74px; +} + +.gv_manageButtonContainer { + margin-top: 10px; +} diff --git a/js/apps/system/aardvark/frontend/css/graphlayout.css b/js/apps/system/aardvark/frontend/css/graphlayout.css index dac698b3a7..4e30f47bc0 100644 --- a/js/apps/system/aardvark/frontend/css/graphlayout.css +++ b/js/apps/system/aardvark/frontend/css/graphlayout.css @@ -22,18 +22,32 @@ img.searchSubmit { } .toolbox { - margin-right: -40px; + margin-left: 5px; + margin-right: 5px; + margin-bottom: -340px; border-radius: 0px !important; -webkit-border-radius: 0px !important; -moz-border-radius: 0px !important; + border-style: solid; + border-width: 3px; + border-color: rgb(51, 51, 51); } .toolbox > .btn { - width: 40px; - height: 40px; - padding: 0px; + width: 50px; + height: 50px; + margin-top: 2px; + margin-bottom: 2px; background-color: rgb(51, 51, 51); - background-size: 40px 40px; + background-size: 50px 50px; +} + +.toolbox > .btn:first-child { + margin-top: 0px; +} + +.toolbox > .btn:last-child { + margin-bottom: 0px; } .btn-icon { @@ -44,6 +58,7 @@ img.searchSubmit { .searchByAttribute, .searchEqualsLabel { margin-top: 3px; margin-right: 6px; + margin-left: 6px; } svg.graphViewer text { @@ -55,10 +70,6 @@ svg.graphViewer text { text-transform:capitalize; } -svg.graphViewer { - border-style: groove; - background-color: #FFFFEE -} div.mousepointer { position: absolute; @@ -134,62 +145,43 @@ button.gv-icon-btn { -moz-border-radius: 0px !important; } +button.gv-icon-btn.active { + background-color: #8AA051 +} + button.gv-icon-btn.edit{ background-image:url("../img/gv_edit.png"); } -button.gv-icon-btn.edit.active{ - background-image:url("../img/gv_edit_reverse.png"); -} button.gv-icon-btn.view{ background-image:url("../img/gv_view.png"); } -button.gv-icon-btn.view.active{ - background-image:url("../img/gv_view_reverse.png"); -} button.gv-icon-btn.add{ background-image:url("../img/gv_add.png"); } -button.gv-icon-btn.add.active{ - background-image:url("../img/gv_add_reverse.png"); -} - button.gv-icon-btn.expand{ background-image:url("../img/gv_expand.png"); } -button.gv-icon-btn.expand.active{ - background-image:url("../img/gv_expand_reverse.png"); -} button.gv-icon-btn.drag{ background-image:url("../img/gv_drag.png"); } -button.gv-icon-btn.drag.active{ - background-image:url("../img/gv_drag_reverse.png"); -} button.gv-icon-btn.connect{ background-image:url("../img/gv_connect.png"); } -button.gv-icon-btn.connect.active{ - background-image:url("../img/gv_connect_reverse.png"); -} button.gv-icon-btn.trash{ background-image:url("../img/gv_trash.png"); } -button.gv-icon-btn.trash.active{ - background-image:url("../img/gv_trash_reverse.png"); -} div.gv_zoom_widget { position: relative; - left: 60px; - top: 20px; + left: 95px; width: 40px; height: 300px; - margin-bottom: -300px; + margin-bottom: -322px; } div.gv_zoom_slider { margin: 0px 17px; @@ -211,7 +203,7 @@ div.gv_zoom_buttons_bg { button.btn-zoom:hover { -background:inherit; + background: inherit; } button.btn-zoom { @@ -280,7 +272,8 @@ input.gv_radio_button { } label.gv_dropdown_label { - color: white; + color: white !important; + padding-left: 0px !important; } /*Overriding the slider UI*/ @@ -335,13 +328,51 @@ ul.gv_configure_menu { top: 18px; } -a.gv_dropdown_entry { - width: 160px !important; - background-color: rgba(0, 0, 0, 0.7) !important; - color: #FFFFFF !important; - height: 20px !important; +button.gv_dropdown_entry { + width: 160px; + height: 30px; + margin: 4px 4px 4px 30px; +} + +button.gv_context_button { + width: 65px; } span.gv_caret { margin-top: 2px !important; } + +div.gv_colour_list { + position: relative; + right: 26px; + top: 20px; + text-align: right; + height: 680px; + overflow: auto; + margin-bottom: -100%; + float: right; +} + +div.gv_colour_list li { + background-color: transparent; + padding: 2px 6px; +} + +div.queryline div.searchByAttribute > ul.dropdown-menu { + position: absolute; + border-radius: 0px; + top: 21px; + left: 5px; + width: 247px; + background-color: #333231; + color: white; + margin-bottom: 100%; + display: none; + /* background-color: #8F8D8C; */ +} + +/* Temporary */ +#transparentPlaceholder { + margin-right: -100%; +} + diff --git a/js/apps/system/aardvark/frontend/css/layout.css b/js/apps/system/aardvark/frontend/css/layout.css index cec33807d8..f581b55200 100644 --- a/js/apps/system/aardvark/frontend/css/layout.css +++ b/js/apps/system/aardvark/frontend/css/layout.css @@ -6,9 +6,7 @@ margin-left: 22px; } -.arangoBtn { - background: none repeat scroll 0 0 #FFFFFF; - color: #333232; +.arangoBtn, .arangoBtnSuccess { float: left; font-family: 'Open Sans', sans-serif; font-size: 16px; @@ -16,14 +14,14 @@ text-decoration: none; } +.arangoBtn { + background: none repeat scroll 0 0 #FFFFFF; + color: #333232; +} + .arangoBtnSuccess { background: none repeat scroll 0 0 #5E7B36; color: #FFFFFF; - float: left; - font-family: 'Open Sans', sans-serif; - font-size: 16px; - padding: 4px 10px; - text-decoration: none; } /* Radius */ @@ -138,16 +136,6 @@ textarea, .alert { color:#b9d375; } -#content { - margin-top: 74px; - margin-bottom: 33px; - min-height: 80px; - height: 100%; - width: 100%; - margin-left: 20px; - margin-left: 0; -} - body { background-color: white !important; /*background: url("../img/bg_paper.gif") repeat scroll 0 0 #E5E1DD !important;*/ @@ -158,7 +146,8 @@ body { } .form-actions { - background-color: #FFFFFF; + margin-top: -10px !important; + background-color: rgba(0,0,0,0.05); border:none; } @@ -172,15 +161,22 @@ body { margin-right: 12px; } -.clearicon { +.clearicon, .reloadicon { opacity: 0.2; cursor: pointer; margin-top: 3px; top: 20px; - right: 25px; position: absolute; } +.clearicon { + right: 25px; +} + +.reloadicon { + right: 45px; +} + #plusIcon { margin-right: 10px; margin-top: 11px; @@ -188,26 +184,7 @@ body { opacity: 0.3; } -#plusIcon:hover { - opacity: 0.8; - cursor: pointer; -} - -.reloadicon { - opacity: 0.2; - cursor: pointer; - margin-top: 3px; - top: 20px; - right: 45px; - position: absolute; -} - -.clearicon:hover { - opacity: 0.8; - cursor: pointer; -} - -.reloadicon:hover { +#plusIcon:hover, .clearicon:hover, .reloadicon:hover { opacity: 0.8; cursor: pointer; } @@ -218,7 +195,6 @@ table .sorting { /* ABOUT VIEW */ #aboutDiv { - background-color: rgba(0,0,0,0.15); padding-bottom: 5px; } @@ -260,15 +236,12 @@ table .sorting { } .row { - margin: 0; + margin-left: 0; + margin-right: 0; + margin-top: 0; + margin-bottom: 20px; } -.marginRight10 { -} - -.form-actions { - margin-top: -10px !important; -} input,select,option { border-radius: 0 !important; @@ -300,3 +273,15 @@ button { width: 397px !important; font-weight: 400; } + +li a [class^="icon_arangodb"], li a [class*=" icon_arangodb"] { + font-size: 26px; + position: absolute; + right: 4px; + top: 0px; +} + +.modal-body .icon_arangodb_info { + font-size: 23px; + color: #736B68; +} diff --git a/js/apps/system/aardvark/frontend/css/logsView.css b/js/apps/system/aardvark/frontend/css/logsView.css index 0cc760a6ee..6b577c3322 100644 --- a/js/apps/system/aardvark/frontend/css/logsView.css +++ b/js/apps/system/aardvark/frontend/css/logsView.css @@ -1,11 +1,3 @@ -/*#logContent { - margin-top: 0; - border: 20px solid rgba(0, 0, 0, 0.00); - background-color: rgba(0, 0, 0, 0.05); - min-height: 330px !important; - padding-bottom: 25px; -} -*/ #logPages { float:left; margin-top: -6px !important; @@ -112,9 +104,9 @@ background-color: none !important; } #logContent .dataTable { -› table-layout:fixed !important; -› border-collapse:separate; -› border-spacing:0 5px; + table-layout:fixed !important; + border-collapse:separate; + border-spacing:0 5px; } #logPaginationDiv a { diff --git a/js/apps/system/aardvark/frontend/css/navigationView.css b/js/apps/system/aardvark/frontend/css/navigationView.css index 97597d8d77..47bde8e068 100644 --- a/js/apps/system/aardvark/frontend/css/navigationView.css +++ b/js/apps/system/aardvark/frontend/css/navigationView.css @@ -56,13 +56,3 @@ body, input, textarea, .page-title span, .pingback a.url { margin-right: 15px; } -@media (max-width: 1284px) { - #arangoCollectionUl { display: none; } - #collectionsDropdown ul { width: auto !important; } - #arangoCollectionSelect { display: inline-block; } - .footer-left { display: none; } - .footer-mid { margin-left: 35%; height: 30px; margin-top: 10px;} - .footer-mid p { display: inline; } - .footer-right { display: none; } -} - diff --git a/js/apps/system/aardvark/frontend/css/openSansFont.css b/js/apps/system/aardvark/frontend/css/openSansFont.css new file mode 100644 index 0000000000..b5d5cbf9ca --- /dev/null +++ b/js/apps/system/aardvark/frontend/css/openSansFont.css @@ -0,0 +1,36 @@ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 300; + src: local('Open Sans Light'), local('OpenSans-Light'), url(../fonts/opensans/OpenSansLight.woff) format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: local('Open Sans'), local('OpenSans'), url(../fonts/opensans/OpenSans.woff) format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 700; + src: local('Open Sans Bold'), local('OpenSans-Bold'), url(../fonts/opensans/OpenSansBold.woff) format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: italic; + font-weight: 300; + src: local('Open Sans Light Italic'), local('OpenSansLight-Italic'), url(../fonts/opensans/OpenSansLightItalic.woff) format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: italic; + font-weight: 400; + src: local('Open Sans Italic'), local('OpenSans-Italic'), url(../fonts/opensans/OpenSansItalic.woff) format('woff'); +} +@font-face { + font-family: 'Open Sans'; + font-style: italic; + font-weight: 700; + src: local('Open Sans Bold Italic'), local('OpenSans-BoldItalic'), url(../fonts/opensans/OpenSansBoldItalic.woff) format('woff'); +} diff --git a/js/apps/system/aardvark/frontend/css/queryView.css b/js/apps/system/aardvark/frontend/css/queryView.css index 1e73fdb4b6..0af9c59e05 100644 --- a/js/apps/system/aardvark/frontend/css/queryView.css +++ b/js/apps/system/aardvark/frontend/css/queryView.css @@ -24,24 +24,44 @@ border-top: 0; } -#editorToolbar { - margin-top: 5px; +.queryToolbar, #aqlEditor { margin-left: 0px; margin-right: 0px; - border-top: 1px solid #A0A0A0; - border-right: 1px solid #A0A0A0; - border-left: 1px solid #A0A0A0; + border-width: 1px; + border-style: solid; + border-bottom: 0px; height: 20px; background-color: #F0F0F0; } +#editorToolbar { + margin-top: 5px; + border-color: #A0A0A0; +} + +#outputToolbar { + position: relative; + width: auto; + border-color: #C0C0C0; +} + +#aqlEditor { + border-bottom: 1px; + width: auto; + border-color: #A0A0A0; + min-width: 99.8%; + height: 200px; + min-height: 100px; + margin-bottom: 5px; +} + #queryDiv { - background-color: rgba(0,0,0,0.15); margin-top: 0px !important; padding-top: 6px !important; padding-left: 5px; padding-right: 5px; - padding-bottom: 5px !important; + padding-bottom: 20px !important; + background-color: transparent; } #outputToolbar span, #editorToolbar span { @@ -52,19 +72,6 @@ float:right; } - -#outputToolbar { - position: relative; - margin-left: 0; - margin-right: 0; - width: auto; - border-top: 1px solid #C0C0C0; - border-right: 1px solid #C0C0C0; - border-left: 1px solid #C0C0C0; - height: 20px; - background-color: #F0F0F0; -} - #editorToolbar i:hover, #outputToolbar i:hover { cursor: pointer; } @@ -99,17 +106,6 @@ border-top: 0 !important; } -#aqlEditor { - width: auto; - min-width: 99.8%; - margin-right: 0px; - margin-left: 0px; - height: 200px; - min-height: 100px; - border: 1px solid #A0A0A0; - margin-bottom: 5px; -} - #wideButtonDiv { width: 100%; height: 20px; @@ -255,7 +251,7 @@ margin-right: 0; padding-left: 5px; padding-right: 5px; - background-color: rgba(0,0,0,0.15); + background-color: #D9D9D9; } #queryDropdownIn { diff --git a/js/apps/system/aardvark/frontend/css/screenSizes.css b/js/apps/system/aardvark/frontend/css/screenSizes.css new file mode 100644 index 0000000000..a200f3d998 --- /dev/null +++ b/js/apps/system/aardvark/frontend/css/screenSizes.css @@ -0,0 +1,25 @@ +@media (max-width: 798px) { + #arangoCollectionUl { + display: none; + } + #collectionsDropdown ul { + width: auto !important; + } + #arangoCollectionSelect { + display: inline-block; + } +} + +@media (min-width: 799px) and (max-width: 1041px) { + #arangoCollectionUl a { + font-size: 12px; + padding: 7px 5px 10px; + } +} + + +@media (min-width: 1042px) and (max-width: 1284px) { + #arangoCollectionUl a { + font-size: 13px; + } +} diff --git a/js/apps/system/aardvark/frontend/css/shellView.css b/js/apps/system/aardvark/frontend/css/shellView.css index bfe17cef66..155a8a1ee9 100644 --- a/js/apps/system/aardvark/frontend/css/shellView.css +++ b/js/apps/system/aardvark/frontend/css/shellView.css @@ -3,7 +3,6 @@ .shellul { border-bottom: 20px solid rgba(0, 0, 0, 0.00); padding-bottom: 20px; - background-color: black; } #shell_workspace { diff --git a/js/apps/system/aardvark/frontend/css/swaggerView.css b/js/apps/system/aardvark/frontend/css/swaggerView.css index a81b0615e4..b257ead55d 100644 --- a/js/apps/system/aardvark/frontend/css/swaggerView.css +++ b/js/apps/system/aardvark/frontend/css/swaggerView.css @@ -2,7 +2,6 @@ pre{ margin: 0 0 0 0; } .form-actions { - background-color: rgba(0,0,0,0.05); } .swagger-ui-wrap .container { width: auto; diff --git a/js/apps/system/aardvark/frontend/fonts/opensans/OpenSans.woff b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSans.woff new file mode 100644 index 0000000000..58e6cb3818 Binary files /dev/null and b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSans.woff differ diff --git a/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansBold.woff b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansBold.woff new file mode 100644 index 0000000000..a8b5bc261e Binary files /dev/null and b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansBold.woff differ diff --git a/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansBoldItalic.woff b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansBoldItalic.woff new file mode 100644 index 0000000000..6a1833811e Binary files /dev/null and b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansBoldItalic.woff differ diff --git a/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansItalic.woff b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansItalic.woff new file mode 100644 index 0000000000..039a294953 Binary files /dev/null and b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansItalic.woff differ diff --git a/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansLight.woff b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansLight.woff new file mode 100644 index 0000000000..8025ba6cb5 Binary files /dev/null and b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansLight.woff differ diff --git a/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansLightItalic.woff b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansLightItalic.woff new file mode 100644 index 0000000000..c1e29dc534 Binary files /dev/null and b/js/apps/system/aardvark/frontend/fonts/opensans/OpenSansLightItalic.woff differ diff --git a/js/apps/system/aardvark/frontend/img/gv_add.png b/js/apps/system/aardvark/frontend/img/gv_add.png index f97410dfeb..f91f3b303c 100644 Binary files a/js/apps/system/aardvark/frontend/img/gv_add.png and b/js/apps/system/aardvark/frontend/img/gv_add.png differ diff --git a/js/apps/system/aardvark/frontend/img/gv_add_reverse.png b/js/apps/system/aardvark/frontend/img/gv_add_reverse.png deleted file mode 100644 index ae48222b40..0000000000 Binary files a/js/apps/system/aardvark/frontend/img/gv_add_reverse.png and /dev/null differ diff --git a/js/apps/system/aardvark/frontend/img/gv_collapse_reverse.png b/js/apps/system/aardvark/frontend/img/gv_collapse_reverse.png deleted file mode 100644 index 911ea9b275..0000000000 Binary files a/js/apps/system/aardvark/frontend/img/gv_collapse_reverse.png and /dev/null differ diff --git a/js/apps/system/aardvark/frontend/img/gv_connect.png b/js/apps/system/aardvark/frontend/img/gv_connect.png index af6c1fd71a..716d8306db 100644 Binary files a/js/apps/system/aardvark/frontend/img/gv_connect.png and b/js/apps/system/aardvark/frontend/img/gv_connect.png differ diff --git a/js/apps/system/aardvark/frontend/img/gv_connect_reverse.png b/js/apps/system/aardvark/frontend/img/gv_connect_reverse.png deleted file mode 100644 index f8e7b78cdc..0000000000 Binary files a/js/apps/system/aardvark/frontend/img/gv_connect_reverse.png and /dev/null differ diff --git a/js/apps/system/aardvark/frontend/img/gv_drag.png b/js/apps/system/aardvark/frontend/img/gv_drag.png index fd3c94b74e..0c59e252e0 100644 Binary files a/js/apps/system/aardvark/frontend/img/gv_drag.png and b/js/apps/system/aardvark/frontend/img/gv_drag.png differ diff --git a/js/apps/system/aardvark/frontend/img/gv_drag_reverse.png b/js/apps/system/aardvark/frontend/img/gv_drag_reverse.png deleted file mode 100644 index e2250fec83..0000000000 Binary files a/js/apps/system/aardvark/frontend/img/gv_drag_reverse.png and /dev/null differ diff --git a/js/apps/system/aardvark/frontend/img/gv_edit.png b/js/apps/system/aardvark/frontend/img/gv_edit.png index c1d8b36ccb..690a86591c 100644 Binary files a/js/apps/system/aardvark/frontend/img/gv_edit.png and b/js/apps/system/aardvark/frontend/img/gv_edit.png differ diff --git a/js/apps/system/aardvark/frontend/img/gv_edit_reverse.png b/js/apps/system/aardvark/frontend/img/gv_edit_reverse.png deleted file mode 100644 index 601a4b79c2..0000000000 Binary files a/js/apps/system/aardvark/frontend/img/gv_edit_reverse.png and /dev/null differ diff --git a/js/apps/system/aardvark/frontend/img/gv_expand.png b/js/apps/system/aardvark/frontend/img/gv_expand.png index be19c0109e..40bfea6d44 100644 Binary files a/js/apps/system/aardvark/frontend/img/gv_expand.png and b/js/apps/system/aardvark/frontend/img/gv_expand.png differ diff --git a/js/apps/system/aardvark/frontend/img/gv_expand_reverse.png b/js/apps/system/aardvark/frontend/img/gv_expand_reverse.png deleted file mode 100644 index 3eecc1a019..0000000000 Binary files a/js/apps/system/aardvark/frontend/img/gv_expand_reverse.png and /dev/null differ diff --git a/js/apps/system/aardvark/frontend/img/gv_trash.png b/js/apps/system/aardvark/frontend/img/gv_trash.png index 6237765d21..83d2ceb075 100644 Binary files a/js/apps/system/aardvark/frontend/img/gv_trash.png and b/js/apps/system/aardvark/frontend/img/gv_trash.png differ diff --git a/js/apps/system/aardvark/frontend/img/gv_trash_reverse.png b/js/apps/system/aardvark/frontend/img/gv_trash_reverse.png deleted file mode 100644 index 76d67d94e9..0000000000 Binary files a/js/apps/system/aardvark/frontend/img/gv_trash_reverse.png and /dev/null differ diff --git a/js/apps/system/aardvark/frontend/img/gv_view.png b/js/apps/system/aardvark/frontend/img/gv_view.png index fa01ec3506..7f7c020a9f 100644 Binary files a/js/apps/system/aardvark/frontend/img/gv_view.png and b/js/apps/system/aardvark/frontend/img/gv_view.png differ diff --git a/js/apps/system/aardvark/frontend/img/gv_view_reverse.png b/js/apps/system/aardvark/frontend/img/gv_view_reverse.png deleted file mode 100644 index a359d51713..0000000000 Binary files a/js/apps/system/aardvark/frontend/img/gv_view_reverse.png and /dev/null differ diff --git a/js/apps/system/aardvark/frontend/js/arango/arango.js b/js/apps/system/aardvark/frontend/js/arango/arango.js index 66ac399918..9a8d40da4c 100644 --- a/js/apps/system/aardvark/frontend/js/arango/arango.js +++ b/js/apps/system/aardvark/frontend/js/arango/arango.js @@ -1,253 +1,255 @@ -/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ +/*jslint indent: 2, nomen: true, maxlen: 100, vars: true, white: true, plusplus: true */ /*global window, $ */ -window.arangoHelper = { - lastNotificationMessage: null, +(function() { + "use strict"; + window.arangoHelper = { + lastNotificationMessage: null, - CollectionTypes: {}, - systemAttributes: function () { - return { - '_id' : true, - '_rev' : true, - '_key' : true, - '_bidirectional' : true, - '_vertices' : true, - '_from' : true, - '_to' : true, - '$id' : true - }; - }, + CollectionTypes: {}, + systemAttributes: function () { + return { + '_id' : true, + '_rev' : true, + '_key' : true, + '_bidirectional' : true, + '_vertices' : true, + '_from' : true, + '_to' : true, + '$id' : true + }; + }, - fixTooltips: function (selector, placement) { - $(selector).tooltip({ - placement: placement, - hide: false, - show: false - }); - }, - - currentDatabase: function () { - var returnVal = false; - $.ajax({ - type: "GET", - cache: false, - url: "/_api/database/current", - contentType: "application/json", - processData: false, - async: false, - success: function(data) { - returnVal = data.result.name; - }, - error: function(data) { - returnVal = false; - } - }); - return returnVal; - }, - - databaseAllowed: function () { - var currentDB = this.currentDatabase(); - returnVal = false; - $.ajax({ - type: "GET", - cache: false, - url: "/_db/"+encodeURIComponent(currentDB)+"/_api/database/", - contentType: "application/json", - processData: false, - async: false, - success: function(data) { - returnVal = true; - }, - error: function(data) { - returnVal = false; - } - }); - return returnVal; - }, - - removeNotifications: function () { - $.gritter.removeAll(); - this.lastNotificationMessage = null; - }, - arangoNotification: function (message) { - var returnVal = false; - $.gritter.add({ - title: "Notice:", - text: message, - time: 3000, - before_open: function(){ - returnVal = true; - } - }); - this.lastNotificationMessage = null; - - return returnVal; - }, - arangoError: function (message) { - var returnVal = false; - $.gritter.add({ - title: "Error:", - text: message, - sticky: true, - before_open: function(){ - if (this.lastNotificationMessage === message) { - // prevent display the same message over & over - return false; - } - if($('.gritter-item-wrapper').length == 3) { - // not more than 3 messages at once - return false; - } - this.lastNotificationMessage = message; - returnVal = true; - }, - before_close: function(){ - // reset last text when closing a specific message - this.lastNotificationMessage = null; - } - }); - return returnVal; - }, - getRandomToken: function () { - return Math.round(new Date().getTime()); - }, - - isSystemAttribute: function (val) { - var a = this.systemAttributes(); - return a[val]; - }, - - isSystemCollection: function (val) { - //return val && val.name && val.name.substr(0, 1) === '_'; - return val.substr(0, 1) === '_'; - }, - - collectionApiType: function (identifier, refresh) { - // set "refresh" to disable caching collection type - if (refresh || this.CollectionTypes[identifier] === undefined) { - this.CollectionTypes[identifier] = window.arangoDocumentStore - .getCollectionInfo(identifier).type; - } - - if (this.CollectionTypes[identifier] === 3) { - return "edge"; - } - return "document"; - }, - - collectionType: function (val) { - if (! val || val.name === '') { - return "-"; - } - var type; - if (val.type === 2) { - type = "document"; - } - else if (val.type === 3) { - type = "edge"; - } - else { - type = "unknown"; - } - - if (val.name.substr(0, 1) === '_') { - type += " (system)"; - } - - return type; - }, - - FormatJSON: function (oData, sIndent) { - var self = this; - var sHTML, iCount; - if (sIndent === undefined) { - sIndent = ""; - } - var sIndentStyle = " "; - var sDataType = self.RealTypeOf(oData); - - if (sDataType === "array") { - if (oData.length === 0) { - return "[]"; - } - sHTML = "["; - } else { - iCount = 0; - $.each(oData, function() { - iCount++; - return; + fixTooltips: function (selector, placement) { + $(selector).tooltip({ + placement: placement, + hide: false, + show: false }); - if (iCount === 0) { // object is empty - return "{}"; - } - sHTML = "{"; - } + }, - iCount = 0; - $.each(oData, function(sKey, vValue) { - if (iCount > 0) { - sHTML += ","; + currentDatabase: function () { + var returnVal = false; + $.ajax({ + type: "GET", + cache: false, + url: "/_api/database/current", + contentType: "application/json", + processData: false, + async: false, + success: function(data) { + returnVal = data.result.name; + }, + error: function(data) { + returnVal = false; + } + }); + return returnVal; + }, + + databaseAllowed: function () { + var currentDB = this.currentDatabase(), + returnVal = false; + $.ajax({ + type: "GET", + cache: false, + url: "/_db/"+encodeURIComponent(currentDB)+"/_api/database/", + contentType: "application/json", + processData: false, + async: false, + success: function(data) { + returnVal = true; + }, + error: function(data) { + returnVal = false; + } + }); + return returnVal; + }, + + removeNotifications: function () { + $.gritter.removeAll(); + this.lastNotificationMessage = null; + }, + arangoNotification: function (message) { + var returnVal = false; + $.gritter.add({ + title: "Notice:", + text: message, + time: 3000, + before_open: function(){ + returnVal = true; + } + }); + this.lastNotificationMessage = null; + + return returnVal; + }, + arangoError: function (message) { + var returnVal = false; + $.gritter.add({ + title: "Error:", + text: message, + sticky: true, + before_open: function(){ + if (this.lastNotificationMessage === message) { + // prevent display the same message over & over + return false; + } + if($('.gritter-item-wrapper').length === 3) { + // not more than 3 messages at once + return false; + } + this.lastNotificationMessage = message; + returnVal = true; + }, + before_close: function(){ + // reset last text when closing a specific message + this.lastNotificationMessage = null; + } + }); + return returnVal; + }, + getRandomToken: function () { + return Math.round(new Date().getTime()); + }, + + isSystemAttribute: function (val) { + var a = this.systemAttributes(); + return a[val]; + }, + + isSystemCollection: function (val) { + //return val && val.name && val.name.substr(0, 1) === '_'; + return val.substr(0, 1) === '_'; + }, + + collectionApiType: function (identifier, refresh) { + // set "refresh" to disable caching collection type + if (refresh || this.CollectionTypes[identifier] === undefined) { + this.CollectionTypes[identifier] = window.arangoDocumentStore + .getCollectionInfo(identifier).type; } + if (this.CollectionTypes[identifier] === 3) { + return "edge"; + } + return "document"; + }, + + collectionType: function (val) { + if (! val || val.name === '') { + return "-"; + } + var type; + if (val.type === 2) { + type = "document"; + } + else if (val.type === 3) { + type = "edge"; + } + else { + type = "unknown"; + } + + if (val.name.substr(0, 1) === '_') { + type += " (system)"; + } + + return type; + }, + + FormatJSON: function (oData, sIndent) { + var self = this; + var sHTML, iCount; + if (sIndent === undefined) { + sIndent = ""; + } + var sIndentStyle = " "; + var sDataType = self.RealTypeOf(oData); + if (sDataType === "array") { - sHTML += ("\n" + sIndent + sIndentStyle); + if (oData.length === 0) { + return "[]"; + } + sHTML = "["; } else { - sHTML += ("\n" + sIndent + sIndentStyle + JSON.stringify(sKey) + ": "); + iCount = 0; + $.each(oData, function() { + iCount++; + return; + }); + if (iCount === 0) { // object is empty + return "{}"; + } + sHTML = "{"; } - // display relevant data type - switch (self.RealTypeOf(vValue)) { - case "array": - case "object": - sHTML += self.FormatJSON(vValue, (sIndent + sIndentStyle)); - break; - case "boolean": - case "number": - sHTML += vValue.toString(); - break; - case "null": - sHTML += "null"; - break; - case "string": - sHTML += "\"" + vValue.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\""; - break; - default: - sHTML += ("TYPEOF: " + typeof vValue); - } - // loop - iCount++; - }); + iCount = 0; + $.each(oData, function(sKey, vValue) { + if (iCount > 0) { + sHTML += ","; + } + if (sDataType === "array") { + sHTML += ("\n" + sIndent + sIndentStyle); + } else { + sHTML += ("\n" + sIndent + sIndentStyle + JSON.stringify(sKey) + ": "); + } - // close object - if (sDataType === "array") { - sHTML += ("\n" + sIndent + "]"); - } else { - sHTML += ("\n" + sIndent + "}"); + // display relevant data type + switch (self.RealTypeOf(vValue)) { + case "array": + case "object": + sHTML += self.FormatJSON(vValue, (sIndent + sIndentStyle)); + break; + case "boolean": + case "number": + sHTML += vValue.toString(); + break; + case "null": + sHTML += "null"; + break; + case "string": + sHTML += "\"" + vValue.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\""; + break; + default: + sHTML += ("TYPEOF: " + typeof vValue); + } + // loop + iCount++; + }); + + // close object + if (sDataType === "array") { + sHTML += ("\n" + sIndent + "]"); + } else { + sHTML += ("\n" + sIndent + "}"); + } + + // return + return sHTML; + }, + + RealTypeOf: function (v) { + if (typeof v === "object") { + if (v === null) { + return "null"; + } + var array = []; + if (v.constructor === array.constructor) { + return "array"; + } + var date = new Date(); + if (v.constructor === date.constructor) { + return "date"; + } + var regexp = new RegExp(); + if (v.constructor === regexp.constructor) { + return "regex"; + } + return "object"; + } + return typeof v; } - // return - return sHTML; - }, - - RealTypeOf: function (v) { - if (typeof v === "object") { - if (v === null) { - return "null"; - } - var array = []; - if (v.constructor === array.constructor) { - return "array"; - } - var date = new Date(); - if (v.constructor === date.constructor) { - return "date"; - } - var regexp = new RegExp(); - if (v.constructor === regexp.constructor) { - return "regex"; - } - return "object"; - } - return typeof v; - } - -}; + }; +}()); diff --git a/js/apps/system/aardvark/frontend/js/arango/templateEngine.js b/js/apps/system/aardvark/frontend/js/arango/templateEngine.js index 7942c57ca2..6a8d4c0f1c 100644 --- a/js/apps/system/aardvark/frontend/js/arango/templateEngine.js +++ b/js/apps/system/aardvark/frontend/js/arango/templateEngine.js @@ -1,3 +1,5 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, vars: true, white: true, plusplus: true*/ +/*global EJS, window*/ (function() { "use strict"; var TemplateEngine = function(prefix) { diff --git a/js/apps/system/aardvark/frontend/js/bootstrap/errors.js b/js/apps/system/aardvark/frontend/js/bootstrap/errors.js index b97ef8ab25..7e29953482 100644 --- a/js/apps/system/aardvark/frontend/js/bootstrap/errors.js +++ b/js/apps/system/aardvark/frontend/js/bootstrap/errors.js @@ -94,6 +94,7 @@ "ERROR_ARANGO_ENDPOINT_NOT_FOUND" : { "code" : 1231, "message" : "endpoint not found" }, "ERROR_ARANGO_INVALID_KEY_GENERATOR" : { "code" : 1232, "message" : "invalid key generator" }, "ERROR_ARANGO_INVALID_EDGE_ATTRIBUTE" : { "code" : 1233, "message" : "edge attribute missing" }, + "ERROR_ARANGO_INDEX_DOCUMENT_ATTRIBUTE_MISSING" : { "code" : 1234, "message" : "index insertion warning - attribute missing in document" }, "ERROR_ARANGO_DATAFILE_FULL" : { "code" : 1300, "message" : "datafile full" }, "ERROR_REPLICATION_NO_RESPONSE" : { "code" : 1400, "message" : "no response" }, "ERROR_REPLICATION_INVALID_RESPONSE" : { "code" : 1401, "message" : "invalid response" }, @@ -173,24 +174,8 @@ "SIMPLE_CLIENT_COULD_NOT_CONNECT" : { "code" : 2001, "message" : "could not connect to server" }, "SIMPLE_CLIENT_COULD_NOT_WRITE" : { "code" : 2002, "message" : "could not write to server" }, "SIMPLE_CLIENT_COULD_NOT_READ" : { "code" : 2003, "message" : "could not read from server" }, - "ERROR_ARANGO_INDEX_PQ_INSERT_FAILED" : { "code" : 3100, "message" : "priority queue insert failure" }, - "ERROR_ARANGO_INDEX_PQ_REMOVE_FAILED" : { "code" : 3110, "message" : "priority queue remove failure" }, - "ERROR_ARANGO_INDEX_PQ_REMOVE_ITEM_MISSING" : { "code" : 3111, "message" : "priority queue remove failure - item missing in index" }, - "ERROR_ARANGO_INDEX_HASH_INSERT_ITEM_DUPLICATED" : { "code" : 3112, "message" : "(non-unique) hash index insert failure - document duplicated in index" }, - "ERROR_ARANGO_INDEX_SKIPLIST_INSERT_ITEM_DUPLICATED" : { "code" : 3113, "message" : "(non-unique) skiplist index insert failure - document duplicated in index" }, - "WARNING_ARANGO_INDEX_HASH_DOCUMENT_ATTRIBUTE_MISSING" : { "code" : 3200, "message" : "hash index insertion warning - attribute missing in document" }, - "WARNING_ARANGO_INDEX_HASH_UPDATE_ATTRIBUTE_MISSING" : { "code" : 3202, "message" : "hash index update warning - attribute missing in revised document" }, - "WARNING_ARANGO_INDEX_HASH_REMOVE_ITEM_MISSING" : { "code" : 3211, "message" : "hash index remove failure - item missing in index" }, - "WARNING_ARANGO_INDEX_SKIPLIST_DOCUMENT_ATTRIBUTE_MISSING" : { "code" : 3300, "message" : "skiplist index insertion warning - attribute missing in document" }, - "WARNING_ARANGO_INDEX_SKIPLIST_UPDATE_ATTRIBUTE_MISSING" : { "code" : 3302, "message" : "skiplist index update warning - attribute missing in revised document" }, - "WARNING_ARANGO_INDEX_SKIPLIST_INSERT_CAS_FAILURE" : { "code" : 3304, "message" : "skiplist index insertion warning - CAS failure while attempting to insert document" }, - "WARNING_ARANGO_INDEX_SKIPLIST_REMOVE_ITEM_MISSING" : { "code" : 3311, "message" : "skiplist index remove failure - item missing in index" }, - "WARNING_ARANGO_INDEX_SKIPLIST_REMOVE_CAS_FAILURE" : { "code" : 3313, "message" : "skiplist index remove warning - CAS failure while attempting to remove document" }, - "WARNING_ARANGO_INDEX_SKIPLIST_REMOVE_ITEM_POST_INSERTED" : { "code" : 3315, "message" : "skiplist index remove failure - item inserted post this transaction in the index" }, - "WARNING_ARANGO_INDEX_SKIPLIST_REMOVE_ITEM_PRIOR_REMOVED" : { "code" : 3317, "message" : "skiplist index remove failure - item removed prior this transaction in the index" }, - "WARNING_ARANGO_INDEX_BITARRAY_DOCUMENT_ATTRIBUTE_MISSING" : { "code" : 3400, "message" : "bitarray index insertion warning - attribute missing in document" }, - "WARNING_ARANGO_INDEX_BITARRAY_UPDATE_ATTRIBUTE_MISSING" : { "code" : 3402, "message" : "bitarray index update warning - attribute missing in revised document" }, - "WARNING_ARANGO_INDEX_BITARRAY_REMOVE_ITEM_MISSING" : { "code" : 3411, "message" : "bitarray index remove failure - item missing in index" }, + "ERROR_ARANGO_INDEX_BITARRAY_UPDATE_ATTRIBUTE_MISSING" : { "code" : 3402, "message" : "bitarray index update warning - attribute missing in revised document" }, + "ERROR_ARANGO_INDEX_BITARRAY_REMOVE_ITEM_MISSING" : { "code" : 3411, "message" : "bitarray index remove failure - item missing in index" }, "ERROR_ARANGO_INDEX_BITARRAY_INSERT_ITEM_UNSUPPORTED_VALUE" : { "code" : 3413, "message" : "bitarray index insert failure - document attribute value unsupported in index" }, "ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_ATTRIBUTES" : { "code" : 3415, "message" : "bitarray index creation failure - one or more index attributes are duplicated." }, "ERROR_ARANGO_INDEX_BITARRAY_CREATION_FAILURE_DUPLICATE_VALUES" : { "code" : 3417, "message" : "bitarray index creation failure - one or more index attribute values are duplicated." }, 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 18f8cd021b..4424edd68b 100644 --- a/js/apps/system/aardvark/frontend/js/bootstrap/module-internal.js +++ b/js/apps/system/aardvark/frontend/js/bootstrap/module-internal.js @@ -11,7 +11,7 @@ SYS_RAND, SYS_SERVER_STATISTICS, SYS_SPRINTF, SYS_TIME, SYS_START_PAGER, SYS_STOP_PAGER, SYS_SHA256, SYS_WAIT, SYS_PARSE, SYS_IMPORT_CSV_FILE, SYS_IMPORT_JSON_FILE, SYS_LOG, SYS_GEN_RANDOM_NUMBERS, SYS_GEN_RANDOM_ALPHA_NUMBERS, SYS_GEN_RANDOM_SALT, SYS_CREATE_NONCE, - SYS_CHECK_AND_MARK_NONCE, SYS_REQUEST_STATISTICS, SYS_UNIT_TESTS, SYS_UNIT_TESTS_RESULT:true, + SYS_CHECK_AND_MARK_NONCE, SYS_CLIENT_STATISTICS, SYS_HTTP_STATISTICS, SYS_UNIT_TESTS, SYS_UNIT_TESTS_RESULT:true, SYS_PROCESS_CSV_FILE, SYS_PROCESS_JSON_FILE, ARANGO_QUIET, COLORS, COLOR_OUTPUT, COLOR_OUTPUT_RESET, COLOR_BRIGHT, COLOR_BLACK, COLOR_BOLD_BLACK, COLOR_BLINK, COLOR_BLUE, COLOR_BOLD_BLUE, COLOR_BOLD_GREEN, COLOR_RED, COLOR_BOLD_RED, COLOR_GREEN, COLOR_WHITE, @@ -627,12 +627,21 @@ } //////////////////////////////////////////////////////////////////////////////// -/// @brief requestStatistics +/// @brief clientStatistics //////////////////////////////////////////////////////////////////////////////// - if (typeof SYS_REQUEST_STATISTICS !== "undefined") { - exports.requestStatistics = SYS_REQUEST_STATISTICS; - delete SYS_REQUEST_STATISTICS; + if (typeof SYS_CLIENT_STATISTICS !== "undefined") { + exports.clientStatistics = SYS_CLIENT_STATISTICS; + delete SYS_CLIENT_STATISTICS; + } + +//////////////////////////////////////////////////////////////////////////////// +/// @brief httpStatistics +//////////////////////////////////////////////////////////////////////////////// + + if (typeof SYS_HTTP_STATISTICS !== "undefined") { + exports.httpStatistics = SYS_HTTP_STATISTICS; + delete SYS_HTTP_STATISTICS; } // ----------------------------------------------------------------------------- diff --git a/js/apps/system/aardvark/frontend/js/client/client.js b/js/apps/system/aardvark/frontend/js/client/client.js index 6772ae4c33..170d904dc7 100644 --- a/js/apps/system/aardvark/frontend/js/client/client.js +++ b/js/apps/system/aardvark/frontend/js/client/client.js @@ -108,6 +108,12 @@ var arango = require("org/arangodb").arango; var fm = require("org/arangodb/foxx/manager"); +//////////////////////////////////////////////////////////////////////////////// +/// @brief global 'ArangoStatement' +//////////////////////////////////////////////////////////////////////////////// + +var ArangoStatement = require("org/arangodb/arango-statement").ArangoStatement; + //////////////////////////////////////////////////////////////////////////////// /// @brief global 'Buffer' //////////////////////////////////////////////////////////////////////////////// diff --git a/js/apps/system/aardvark/frontend/js/collections/arangoDocument.js b/js/apps/system/aardvark/frontend/js/collections/arangoDocument.js index 42fb06481e..c4ec22a24b 100644 --- a/js/apps/system/aardvark/frontend/js/collections/arangoDocument.js +++ b/js/apps/system/aardvark/frontend/js/collections/arangoDocument.js @@ -161,10 +161,10 @@ window.arangoDocument = Backbone.Collection.extend({ contentType: "application/json", processData: false, success: function(data) { - result = true; + result = true; }, error: function(data) { - result = false; + result = false; } }); return result; diff --git a/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js b/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js index 03e1c9ac82..560d147094 100644 --- a/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js +++ b/js/apps/system/aardvark/frontend/js/collections/arangoDocuments.js @@ -1,206 +1,211 @@ -/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ +/*jslint indent: 2, nomen: true, maxlen: 100, vars: true, white: true, plusplus: true */ /*global require, exports, window, Backbone, arangoDocumentModel, _, $*/ +(function() { + "use strict"; -window.arangoDocuments = Backbone.Collection.extend({ - currentPage: 1, - collectionID: 1, - totalPages: 1, - documentsPerPage: 10, - documentsCount: 1, - offset: 0, + window.arangoDocuments = Backbone.Collection.extend({ + currentPage: 1, + collectionID: 1, + totalPages: 1, + documentsPerPage: 10, + documentsCount: 1, + offset: 0, - url: '/_api/documents', - model: arangoDocumentModel, - getFirstDocuments: function () { - if (this.currentPage !== 1) { - var link = window.location.hash.split("/"); - window.location.hash = link[0] + "/" + link[1] + "/" + link[2] + "/1"; - } - }, - getLastDocuments: function () { - if (this.currentPage !== this.totalPages) { - var link = window.location.hash.split("/"); - window.location.hash = link[0] + "/" + link[1] + "/" + link[2] + "/" + this.totalPages; - } - }, - getPrevDocuments: function () { - if (this.currentPage !== 1) { - var link = window.location.hash.split("/"); - var page = parseInt(this.currentPage, null) - 1; - window.location.hash = link[0] + "/" + link[1] + "/" + link[2] + "/" + page; - } - }, - getNextDocuments: function () { - if (this.currentPage !== this.totalPages) { - var link = window.location.hash.split("/"); - var page = parseInt(this.currentPage, null) + 1; - window.location.hash = link[0] + "/" + link[1] + "/" + link[2] + "/" + page; - } - }, - getDocuments: function (colid, currpage) { - var self = this; - this.collectionID = colid; - this.currentPage = currpage; - - $.ajax({ - cache: false, - type: "GET", - url: "/_api/collection/" + this.collectionID + "/count", - contentType: "application/json", - processData: false, - async: false, - success: function(data) { - self.totalPages = Math.ceil(data.count / self.documentsPerPage); - self.documentsCount = data.count; - }, - error: function(data) { + url: '/_api/documents', + model: arangoDocumentModel, + getFirstDocuments: function () { + if (this.currentPage !== 1) { + var link = window.location.hash.split("/"); + window.location.hash = link[0] + "/" + link[1] + "/" + link[2] + "/1"; } - }); - - - if (isNaN(this.currentPage) || this.currentPage === undefined || this.currentPage < 1) { - this.currentPage = 1; - } - if (this.totalPages === 0) { - this.totalPages = 1; - } - - this.offset = (this.currentPage - 1) * this.documentsPerPage; - - var myQueryVal; - var sortParameter = '_key'; - var sortCount = 10000; - - if (this.documentsCount <= sortCount) { - //sorted - myQueryVal = "FOR x in @@collection SORT TO_NUMBER(x._key) == 0 " + - "? x._key : TO_NUMBER(x._key) LIMIT @offset, @count RETURN x"; - } - else { - //not sorted - myQueryVal = "FOR x in @@collection LIMIT @offset, @count RETURN x"; - } - - var myQuery = { - query: myQueryVal, - bindVars: { - "@collection": this.collectionID, - "offset": this.offset, - "count": this.documentsPerPage + }, + getLastDocuments: function () { + if (this.currentPage !== this.totalPages) { + var link = window.location.hash.split("/"); + window.location.hash = link[0] + "/" + link[1] + "/" + link[2] + "/" + this.totalPages; } - }; + }, + getPrevDocuments: function () { + if (this.currentPage !== 1) { + var link = window.location.hash.split("/"); + var page = parseInt(this.currentPage, null) - 1; + window.location.hash = link[0] + "/" + link[1] + "/" + link[2] + "/" + page; + } + }, + getNextDocuments: function () { + if (this.currentPage !== this.totalPages) { + var link = window.location.hash.split("/"); + var page = parseInt(this.currentPage, null) + 1; + window.location.hash = link[0] + "/" + link[1] + "/" + link[2] + "/" + page; + } + }, + getDocuments: function (colid, currpage) { + var self = this; + this.collectionID = colid; + this.currentPage = currpage; - $.ajax({ - cache: false, - type: 'POST', - async: false, - url: '/_api/cursor', - data: JSON.stringify(myQuery), - contentType: "application/json", - success: function(data) { - self.clearDocuments(); - if (self.documentsCount !== 0) { - $.each(data.result, function(k, v) { - //ERROR HERE - window.arangoDocumentsStore.add({ - "id": v._id, - "rev": v._rev, - "key": v._key, - "content": v + $.ajax({ + cache: false, + type: "GET", + url: "/_api/collection/" + this.collectionID + "/count", + contentType: "application/json", + processData: false, + async: false, + success: function(data) { + self.totalPages = Math.ceil(data.count / self.documentsPerPage); + self.documentsCount = data.count; + }, + error: function(data) { + } + }); + + + if (isNaN(this.currentPage) || this.currentPage === undefined || this.currentPage < 1) { + this.currentPage = 1; + } + if (this.totalPages === 0) { + this.totalPages = 1; + } + + this.offset = (this.currentPage - 1) * this.documentsPerPage; + + var myQueryVal; + var sortCount = 10000; + + if (this.documentsCount <= sortCount) { + //sorted + myQueryVal = "FOR x in @@collection SORT TO_NUMBER(x._key) == 0 " + + "? x._key : TO_NUMBER(x._key) LIMIT @offset, @count RETURN x"; + } + else { + //not sorted + myQueryVal = "FOR x in @@collection LIMIT @offset, @count RETURN x"; + } + + var myQuery = { + query: myQueryVal, + bindVars: { + "@collection": this.collectionID, + "offset": this.offset, + "count": this.documentsPerPage + } + }; + + $.ajax({ + cache: false, + type: 'POST', + async: false, + url: '/_api/cursor', + data: JSON.stringify(myQuery), + contentType: "application/json", + success: function(data) { + self.clearDocuments(); + if (self.documentsCount !== 0) { + $.each(data.result, function(k, v) { + //ERROR HERE + window.arangoDocumentsStore.add({ + "id": v._id, + "rev": v._rev, + "key": v._key, + "content": v + }); }); - }); - window.documentsView.drawTable(); - window.documentsView.renderPagination(self.totalPages); + window.documentsView.drawTable(); + window.documentsView.renderPagination(self.totalPages); + } + else { + window.documentsView.initTable(); + window.documentsView.drawTable(); + } + }, + error: function(data) { } - else { - window.documentsView.initTable(); - window.documentsView.drawTable(); - } - }, - error: function(data) { + }); + }, + + getFilteredDocuments: function (colid, currpage, filter, bindValues) { + var self = this; + this.collectionID = colid; + this.currentPage = currpage; + this.currentFilterPage = currpage; + var filterString; + if(filter.length === 0){ + filterString =""; + } else { + filterString = ' FILTER' + filter.join(' && '); } - }); - }, - getFilteredDocuments: function (colid, currpage, filter, bindValues) { - var self = this; - this.collectionID = colid; - this.currentPage = currpage; - this.currentFilterPage = currpage; - var filterString; - if(filter.length === 0){ - filterString =""; - } else { - filterString = ' FILTER' + filter.join(' && '); - } + var sortCount = 10000; - var sortCount = 10000; - - var sortString = ''; - if (this.documentsCount <= sortCount) { - //sorted - sortString = " SORT TO_NUMBER(u._key) == 0 ? u._key : TO_NUMBER(u._key)"; - } - var myQueryVal = "FOR u in @@collection" + filterString + sortString + - " LIMIT 0, @count RETURN u"; - - var myQuery = { - query: myQueryVal, - bindVars: { - "@collection": this.collectionID, - "count": this.documentsPerPage - }, - options: { - fullCount: true + var sortString = ''; + if (this.documentsCount <= sortCount) { + //sorted + sortString = " SORT TO_NUMBER(u._key) == 0 ? u._key : TO_NUMBER(u._key)"; } - }; + var myQueryVal = "FOR u in @@collection" + filterString + sortString + + " LIMIT 0, @count RETURN u"; - $.each(bindValues, function(k,v) { - myQuery.bindVars[k] = v; - }); - - $.ajax({ - cache: false, - type: 'POST', - async: false, - url: '/_api/cursor', - data: JSON.stringify(myQuery), - contentType: "application/json", - success: function(data) { - self.clearDocuments(); - self.documentsCount = data.extra.fullCount; - self.totalPages = Math.ceil(self.documentsCount / self.documentsPerPage); - if (isNaN(this.currentPage) || this.currentPage === undefined || this.currentPage < 1) { - this.currentPage = 1; - } - if (this.totalPages === 0) { - this.totalPages = 1; + var myQuery = { + query: myQueryVal, + bindVars: { + "@collection": this.collectionID, + "count": this.documentsPerPage + }, + options: { + fullCount: true } + }; - this.offset = (this.currentPage - 1) * this.documentsPerPage; - if (self.documentsCount !== 0) { - $.each(data.result, function(k, v) { - window.arangoDocumentsStore.add({ - "id": v._id, - "rev": v._rev, - "key": v._key, - "content": v + $.each(bindValues, function(k,v) { + myQuery.bindVars[k] = v; + }); + + $.ajax({ + cache: false, + type: 'POST', + async: false, + url: '/_api/cursor', + data: JSON.stringify(myQuery), + contentType: "application/json", + success: function(data) { + self.clearDocuments(); + self.documentsCount = data.extra.fullCount; + self.totalPages = Math.ceil(self.documentsCount / self.documentsPerPage); + if ( + isNaN(this.currentPage) + || this.currentPage === undefined + || this.currentPage < 1 + ) { + this.currentPage = 1; + } + if (this.totalPages === 0) { + this.totalPages = 1; + } + + this.offset = (this.currentPage - 1) * this.documentsPerPage; + if (self.documentsCount !== 0) { + $.each(data.result, function(k, v) { + window.arangoDocumentsStore.add({ + "id": v._id, + "rev": v._rev, + "key": v._key, + "content": v + }); }); - }); - window.documentsView.drawTable(); - window.documentsView.renderPagination(self.totalPages, true); + window.documentsView.drawTable(); + window.documentsView.renderPagination(self.totalPages, true); + } + else { + window.documentsView.initTable(); + window.documentsView.drawTable(); + } + }, + error: function(data) { } - else { - window.documentsView.initTable(); - window.documentsView.drawTable(); - } - }, - error: function(data) { - "use strict"; - } - }); - }, - clearDocuments: function () { - window.arangoDocumentsStore.reset(); - } -}); + }); + }, + clearDocuments: function () { + window.arangoDocumentsStore.reset(); + } + }); +}()); diff --git a/js/apps/system/aardvark/frontend/js/collections/arangoLogs.js b/js/apps/system/aardvark/frontend/js/collections/arangoLogs.js index 7834c96ab4..49b45281d3 100644 --- a/js/apps/system/aardvark/frontend/js/collections/arangoLogs.js +++ b/js/apps/system/aardvark/frontend/js/collections/arangoLogs.js @@ -1,57 +1,16 @@ -/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ +/*jslint indent: 2, nomen: true, maxlen: 100, vars: true, white: true, plusplus: true */ /*global require, exports, Backbone, window, $, arangoLog */ +(function () { -window.arangoLogs = Backbone.Collection.extend({ - url: '/_admin/log?upto=4&size=10&offset=0', - parse: function(response) { - var myResponse = []; - var i = 0; - $.each(response.lid, function(key, val) { - myResponse.push({ - "level": response.level[i], - "lid": response.lid[i], - "text": response.text[i], - "timestamp": response.timestamp[i], - "totalAmount": response.totalAmount - }); - i++; - }); - return myResponse; - }, - tables: ["logTableID", "warnTableID", "infoTableID", "debugTableID", "critTableID"], - model: arangoLog, - clearLocalStorage: function () { - window.arangoLogsStore.reset(); - }, - returnElements: function () { - }, - fillLocalStorage: function (table, offset, size) { - var self = this; - this.clearLocalStorage(); - if (! table) { - table = 'logTableID'; - } - if (! size) { - size = 10; - } - if (! offset) { - offset = 0; - } - - var loglevel = this.showLogLevel(table); - var url = ""; - if (loglevel === 5) { - url = "/_admin/log?upto=4"; - } - else { - url = "/_admin/log?level=" + loglevel; - } - url = url + "&size=" + size + "&offset=" + offset; - $.getJSON(url, function(response) { - var totalAmount = response.totalAmount; + "use strict"; + + window.ArangoLogs = Backbone.Collection.extend({ + url: '/_admin/log?upto=4&size=10&offset=0', + parse: function(response) { + var myResponse = []; var i = 0; - $.each(response.lid, function () { - window.arangoLogsStore.add({ + $.each(response.lid, function(key, val) { + myResponse.push({ "level": response.level[i], "lid": response.lid[i], "text": response.text[i], @@ -60,27 +19,70 @@ window.arangoLogs = Backbone.Collection.extend({ }); i++; }); - window.logsView.drawTable(); - }); - }, - showLogLevel: function (tableid) { - tableid = '#'+tableid; - var returnVal = 0; - if (tableid === "#critTableID") { - returnVal = 1; + return myResponse; + }, + tables: ["logTableID", "warnTableID", "infoTableID", "debugTableID", "critTableID"], + model: arangoLog, + clearLocalStorage: function () { + window.arangoLogsStore.reset(); + }, + returnElements: function () { + }, + fillLocalStorage: function (table, offset, size) { + this.clearLocalStorage(); + if (! table) { + table = 'logTableID'; + } + if (! size) { + size = 10; + } + if (! offset) { + offset = 0; + } + + var loglevel = this.showLogLevel(table); + var url = ""; + if (loglevel === 5) { + url = "/_admin/log?upto=4"; + } + else { + url = "/_admin/log?level=" + loglevel; + } + url = url + "&size=" + size + "&offset=" + offset; + $.getJSON(url, function(response) { + var i = 0; + $.each(response.lid, function () { + window.arangoLogsStore.add({ + "level": response.level[i], + "lid": response.lid[i], + "text": response.text[i], + "timestamp": response.timestamp[i], + "totalAmount": response.totalAmount + }); + i++; + }); + window.logsView.drawTable(); + }); + }, + showLogLevel: function (tableid) { + tableid = '#'+tableid; + var returnVal = 0; + if (tableid === "#critTableID") { + returnVal = 1; + } + else if (tableid === "#warnTableID") { + returnVal = 2; + } + else if (tableid === "#infoTableID") { + returnVal = 3; + } + else if (tableid === "#debugTableID") { + returnVal = 4; + } + else if (tableid === "#logTableID") { + returnVal = 5; + } + return returnVal; } - else if (tableid === "#warnTableID") { - returnVal = 2; - } - else if (tableid === "#infoTableID") { - returnVal = 3; - } - else if (tableid === "#debugTableID") { - returnVal = 4; - } - else if (tableid === "#logTableID") { - returnVal = 5; - } - return returnVal; - } -}); + }); +}()); diff --git a/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js b/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js index 2d16aa03a6..d054dad4f5 100644 --- a/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js +++ b/js/apps/system/aardvark/frontend/js/collections/foxxCollection.js @@ -1,7 +1,10 @@ -/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ +/*jslint indent: 2, nomen: true, maxlen: 100, white: true, plusplus: true */ /*global window, Backbone */ -window.FoxxCollection = Backbone.Collection.extend({ - model: window.Foxx, - - url: "/_admin/aardvark/foxxes" -}); +(function() { + "use strict"; + window.FoxxCollection = Backbone.Collection.extend({ + model: window.Foxx, + + url: "/_admin/aardvark/foxxes" + }); +}()); diff --git a/js/apps/system/aardvark/frontend/js/collections/graphCollection.js b/js/apps/system/aardvark/frontend/js/collections/graphCollection.js new file mode 100644 index 0000000000..1c4ec52470 --- /dev/null +++ b/js/apps/system/aardvark/frontend/js/collections/graphCollection.js @@ -0,0 +1,19 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */ +/*global window, Backbone */ +(function () { + "use strict"; + + window.GraphCollection = Backbone.Collection.extend({ + model: window.Graph, + + url: "/_api/graph", + + comparator: "_key", + + parse: function(res) { + if (!res.error) { + return res.graphs; + } + } + }); +}()); diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/demo.html b/js/apps/system/aardvark/frontend/js/graphViewer/demo.html deleted file mode 100644 index 014ff1d81c..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/demo.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DEMO - - - -
-
- Create the Viewer -
- Setup Arango Connection -
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
- -
-
-
-
-
- - - \ No newline at end of file diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/JSONAdapter.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/JSONAdapter.js index 9dd19f7fb1..a93548e7b0 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/JSONAdapter.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/JSONAdapter.js @@ -28,13 +28,13 @@ /// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// -function JSONAdapter(jsonPath, nodes, edges, width, height) { +function JSONAdapter(jsonPath, nodes, edges, viewer, width, height) { "use strict"; var self = this, initialX = {}, initialY = {}, - absAdapter = new AbstractAdapter(nodes, edges, this), + absAdapter = new AbstractAdapter(nodes, edges, this, viewer), findNode = function(n) { var res = $.grep(nodes, function(e){ return e._id === n._id; @@ -208,4 +208,4 @@ function JSONAdapter(jsonPath, nodes, edges, width, height) { self.explore = absAdapter.explore; -} \ No newline at end of file +} diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/abstractAdapter.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/abstractAdapter.js index 6db00a3cf1..f14fb1e0c1 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/abstractAdapter.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/abstractAdapter.js @@ -30,7 +30,7 @@ //////////////////////////////////////////////////////////////////////////////// -function AbstractAdapter(nodes, edges, descendant, config) { +function AbstractAdapter(nodes, edges, descendant, viewer, config) { "use strict"; if (nodes === undefined) { @@ -42,6 +42,9 @@ function AbstractAdapter(nodes, edges, descendant, config) { if (descendant === undefined) { throw "An inheriting class has to be given."; } + if (viewer === undefined) { + throw "A reference to the graph viewer has to be given."; + } config = config || {}; var self = this, @@ -104,7 +107,7 @@ function AbstractAdapter(nodes, edges, descendant, config) { throw "Too many edges with the same ID, should never happen"; }, - insertNode = function(data) { + insertNode = function(data, x, y) { var node = { _data: data, _id: data._id @@ -113,8 +116,8 @@ function AbstractAdapter(nodes, edges, descendant, config) { if (n) { return n; } - node.x = initialX.getStart(); - node.y = initialY.getStart(); + node.x = x || initialX.getStart(); + node.y = y || initialY.getStart(); nodes.push(node); node._outboundCounter = 0; node._inboundCounter = 0; @@ -134,6 +137,7 @@ function AbstractAdapter(nodes, edges, descendant, config) { edges.length = 0; joinedInCommunities = {}; cachedCommunities = {}; + viewer.cleanUp(); }, insertEdge = function(data) { diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/arangoAdapter.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/arangoAdapter.js index c7c2ee5f8e..3a7ce5486c 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/arangoAdapter.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/arangoAdapter.js @@ -28,7 +28,7 @@ /// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// -function ArangoAdapter(nodes, edges, config) { +function ArangoAdapter(nodes, edges, viewer, config) { "use strict"; if (nodes === undefined) { @@ -37,6 +37,9 @@ function ArangoAdapter(nodes, edges, config) { if (edges === undefined) { throw "The edges have to be given."; } + if (viewer === undefined) { + throw "A reference to the graph viewer has to be given."; + } if (config === undefined) { throw "A configuration with node- and edgeCollection has to be given."; } @@ -124,9 +127,9 @@ function ArangoAdapter(nodes, edges, config) { if (query !== queries.getAllGraphs) { if (query !== queries.connectedEdges) { bindVars["@nodes"] = nodeCollection; - } - if (query !== queries.childrenCentrality) { - bindVars.dir = direction; + if (query !== queries.childrenCentrality) { + bindVars.dir = direction; + } } bindVars["@edges"] = edgeCollection; } @@ -265,7 +268,7 @@ function ArangoAdapter(nodes, edges, config) { return; } callback(absAdapter.insertInitialNode(n)); - } + }; }, @@ -281,7 +284,7 @@ function ArangoAdapter(nodes, edges, config) { if (config.prioList) { absConfig.prioList = config.prioList; } - absAdapter = new AbstractAdapter(nodes, edges, this, absConfig); + absAdapter = new AbstractAdapter(nodes, edges, this, viewer, absConfig); parseConfig(config); diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/colourMapper.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/colourMapper.js index 56ff1ebebf..57e7b71313 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/colourMapper.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/colourMapper.js @@ -30,13 +30,12 @@ function ColourMapper() { "use strict"; - var mapCreated = false, - mapping = {}, - reverseMapping = {}, - colours = [], - listener, - self = this, - nextColour = 0; + var mapping = {}, + reverseMapping = {}, + colours = [], + listener, + self = this, + nextColour = 0; colours.push({back: "navy", front: "white"}); colours.push({back: "green", front: "white"}); @@ -129,4 +128,4 @@ function ColourMapper() { }; this.reset(); -} \ No newline at end of file +} diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/communityNode.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/communityNode.js index 609c0e6a2a..0a301eea17 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/communityNode.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/communityNode.js @@ -368,7 +368,7 @@ function CommunityNode(parent, initial) { .attr("height", "20") .attr("fill", "#686766") .attr("stroke", "none"); - var dissolveBtn = bBox.append("image") + bBox.append("image") .attr("id", self._id + "_dissolve") .attr("xlink:href", "img/icon_delete.png") .attr("width", "16") @@ -379,8 +379,8 @@ function CommunityNode(parent, initial) { .on("click", function() { self.dissolve(); start(); - }), - collapseBtn = bBox.append("image") + }); + bBox.append("image") .attr("id", self._id + "_collapse") .attr("xlink:href", "img/gv_collapse.png") .attr("width", "16") @@ -391,8 +391,8 @@ function CommunityNode(parent, initial) { .on("click", function() { self.collapse(); start(); - }), - title = bBox.append("text") + }); + var title = bBox.append("text") .attr("x", "45") .attr("y", "15") .attr("fill", "white") diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/domObserverFactory.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/domObserverFactory.js index a8187a8317..9f5a376225 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/domObserverFactory.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/domObserverFactory.js @@ -35,6 +35,9 @@ function DomObserverFactory() { var Constructor = window.WebKitMutationObserver || window.MutationObserver; this.createObserver = function(callback) { + if (!Constructor) { + throw "Observer not supported"; + } return new Constructor(callback); }; -} \ No newline at end of file +} diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/edgeShaper.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/edgeShaper.js index 5e006ed986..6b7b9c84fa 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/edgeShaper.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/edgeShaper.js @@ -1,6 +1,6 @@ /*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ /*global _, $, d3*/ -/*global ColourMapper*/ +/*global ColourMapper, ContextMenu*/ //////////////////////////////////////////////////////////////////////////////// /// @brief Graph functionality /// @@ -49,6 +49,7 @@ function EdgeShaper(parent, config, idfunc) { var self = this, edges = [], communityNodes = {}, + contextMenu = new ContextMenu("gv_edge_cm"), toplevelSVG, visibleLabels = true, followEdge = {}, @@ -60,6 +61,9 @@ function EdgeShaper(parent, config, idfunc) { }, colourMapper = new ColourMapper(), + resetColourMap = function() { + colourMapper.reset(); + }, events, addUpdate, addShape = noop, @@ -181,6 +185,7 @@ function EdgeShaper(parent, config, idfunc) { _.each(communityNodes, function(c) { c.shapeInnerEdges(d3.select(this), addQue); }); + contextMenu.bindMenu($(".link")); }, updateEdges = function () { @@ -265,6 +270,7 @@ function EdgeShaper(parent, config, idfunc) { parseColorFlag = function (color) { $("svg defs #gradientEdgeColor").remove(); + resetColourMap(); switch (color.type) { case "single": addColor = function (line, g) { @@ -408,6 +414,12 @@ function EdgeShaper(parent, config, idfunc) { followEdge = {}; } }; + + self.addMenuEntry = function(name, func) { + contextMenu.addEntry(name, func); + }; + + self.resetColourMap = resetColourMap; } EdgeShaper.shapes = Object.freeze({ diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/eventDispatcher.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/eventDispatcher.js index 75ae394817..4344e415b6 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/eventDispatcher.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/eventDispatcher.js @@ -31,7 +31,6 @@ function EventDispatcher(nodeShaper, edgeShaper, config) { "use strict"; var eventlib, - expandConfig, svgBase, svgTemp, svgObj, @@ -45,7 +44,7 @@ function EventDispatcher(nodeShaper, edgeShaper, config) { patch = new eventlib.PatchNode(config), del = new eventlib.DeleteNode(config); - self.events.CREATENODE = function(getNewData, callback) { + self.events.CREATENODE = function(getNewData, callback, x, y) { var data; if (!_.isFunction(getNewData)) { data = getNewData; @@ -53,7 +52,7 @@ function EventDispatcher(nodeShaper, edgeShaper, config) { data = getNewData(); } return function() { - insert(data, callback); + insert(data, callback, x, y); }; }; self.events.PATCHNODE = function(node, getNewData, callback) { @@ -268,4 +267,5 @@ function EventDispatcher(nodeShaper, edgeShaper, config) { throw "Not implemented"; }; */ + Object.freeze(self.events); } diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/eventLibrary.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/eventLibrary.js index 4bccb490d7..8d850c80af 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/eventLibrary.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/eventLibrary.js @@ -121,7 +121,7 @@ function EventLibrary() { var adapter = config.adapter, nodeShaper = config.shaper; - return function(data, callback) { + return function(data, callback, x, y) { var cb, d; if (_.isFunction(data) && !callback) { cb = data; @@ -132,8 +132,8 @@ function EventLibrary() { } adapter.createNode(d, function(newNode) { nodeShaper.reshapeNodes(); - callback(newNode); - }); + cb(newNode); + }, x, y); }; }; diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/foxxAdapter.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/foxxAdapter.js index 47b48f2b15..c0a05a5f95 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/foxxAdapter.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/foxxAdapter.js @@ -28,7 +28,7 @@ /// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// -function FoxxAdapter(nodes, edges, route, config) { +function FoxxAdapter(nodes, edges, route, viewer, config) { "use strict"; if (nodes === undefined) { @@ -40,6 +40,9 @@ function FoxxAdapter(nodes, edges, route, config) { if (route === undefined) { throw "The route has to be given."; } + if (viewer === undefined) { + throw "A reference to the graph viewer has to be given."; + } config = config || {}; @@ -202,7 +205,7 @@ function FoxxAdapter(nodes, edges, route, config) { if (config.prioList) { absConfig.prioList = config.prioList; } - absAdapter = new AbstractAdapter(nodes, edges, this, absConfig); + absAdapter = new AbstractAdapter(nodes, edges, this, viewer, absConfig); parseConfig(config); fillRoutes(); diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/nodeReducer.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/nodeReducer.js index 1d1d89bcd4..3c39eb578d 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/nodeReducer.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/nodeReducer.js @@ -1,7 +1,5 @@ /*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ /*global _*/ -// Will be injected by WebWorkers -/*global self*/ //////////////////////////////////////////////////////////////////////////////// /// @brief Graph functionality /// diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/nodeShaper.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/nodeShaper.js index c8943c46cf..6a54cf32ae 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/nodeShaper.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/nodeShaper.js @@ -1,6 +1,6 @@ /*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ /*global $, _, d3*/ -/*global ColourMapper*/ +/*global ColourMapper, ContextMenu*/ //////////////////////////////////////////////////////////////////////////////// /// @brief Graph functionality /// @@ -82,17 +82,36 @@ function NodeShaper(parent, flags, idfunc) { var self = this, nodes = [], visibleLabels = true, + contextMenu = new ContextMenu("gv_node_cm"), + findFirstValue = function(list, data) { + if (_.isArray(list)) { + return data[_.find(list, function(val) { + return data[val]; + })]; + } + return data[list]; + }, splitLabel = function(label) { if (label === undefined) { return [""]; } if (typeof label !== "string") { - label = String(label); } var chunks = label.match(/[\w\W]{1,10}(\s|$)|\S+?(\s|$)/g); chunks[0] = $.trim(chunks[0]); chunks[1] = $.trim(chunks[1]); + if (chunks[0].length > 12) { + chunks[0] = $.trim(label.substring(0,10)) + "-"; + chunks[1] = $.trim(label.substring(10)); + if (chunks[1].length > 12) { + chunks[1] = chunks[1].split(/\W/)[0]; + if (chunks[1].length > 12) { + chunks[1] = chunks[1].substring(0,10) + "..."; + } + } + chunks.length = 2; + } if (chunks.length > 2) { chunks.length = 2; chunks[1] += "..."; @@ -120,6 +139,9 @@ function NodeShaper(parent, flags, idfunc) { }); }, colourMapper = new ColourMapper(), + resetColourMap = function() { + colourMapper.reset(); + }, events, addUpdate, idFunction = function(d) { @@ -219,6 +241,7 @@ function NodeShaper(parent, flags, idfunc) { g.selectAll("* > *").remove(); addQue(g); updateNodes(); + contextMenu.bindMenu($(".node")); }, parseShapeFlag = function (shape) { @@ -344,7 +367,8 @@ function NodeShaper(parent, flags, idfunc) { .attr("fill", addLabelColor) // Force a black color .attr("stroke", "none"); // Make it readable textN.each(function(d) { - var chunks = splitLabel(d._data[label]); + // var chunks = splitLabel(d._data[label]); + var chunks = splitLabel(findFirstValue(label, d._data)); d3.select(this).append("tspan") .attr("x", "0") .attr("dy", "-4") @@ -372,6 +396,7 @@ function NodeShaper(parent, flags, idfunc) { }, parseColorFlag = function (color) { + resetColourMap(); switch (color.type) { case "single": addColor = function (g) { @@ -400,14 +425,14 @@ function NodeShaper(parent, flags, idfunc) { if (n._data === undefined) { return colourMapper.getCommunityColour(); } - return colourMapper.getColour(n._data[color.key]); + return colourMapper.getColour(findFirstValue(color.key, n._data)); }); }; addLabelColor = function (n) { if (n._data === undefined) { return colourMapper.getForegroundCommunityColour(); } - return colourMapper.getForegroundColour(n._data[color.key]); + return colourMapper.getForegroundColour(findFirstValue(color.key, n._data)); }; break; default: @@ -527,6 +552,12 @@ function NodeShaper(parent, flags, idfunc) { self.getColor = function() { return self.color.key || ""; }; + + self.addMenuEntry = function(name, func) { + contextMenu.addEntry(name, func); + }; + + self.resetColourMap = resetColourMap; } NodeShaper.shapes = Object.freeze({ diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/previewAdapter.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/previewAdapter.js index f5b2498293..3080e4b38c 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/previewAdapter.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/previewAdapter.js @@ -28,7 +28,7 @@ /// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany //////////////////////////////////////////////////////////////////////////////// -function PreviewAdapter(nodes, edges, config) { +function PreviewAdapter(nodes, edges, viewer, config) { "use strict"; if (nodes === undefined) { @@ -37,9 +37,12 @@ function PreviewAdapter(nodes, edges, config) { if (edges === undefined) { throw "The edges have to be given."; } + if (viewer === undefined) { + throw "A reference to the graph viewer has to be given."; + } var self = this, - absAdapter = new AbstractAdapter(nodes, edges, this), + absAdapter = new AbstractAdapter(nodes, edges, this, viewer), parseConfig = function(config) { if (config.width !== undefined) { diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graph/webWorkerWrapper.js b/js/apps/system/aardvark/frontend/js/graphViewer/graph/webWorkerWrapper.js index 513fe9984d..df0b137532 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graph/webWorkerWrapper.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graph/webWorkerWrapper.js @@ -1,5 +1,5 @@ /*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ -/*global window*/ +/*global window, _*/ // These values are injected /*global w:true, Construct, self*/ //////////////////////////////////////////////////////////////////////////////// @@ -40,82 +40,135 @@ function WebWorkerWrapper(Class, callback) { if (callback === undefined) { throw "A callback has to be given."; } - var args = Array.prototype.slice.call(arguments), - - onmessage = function(e) { - switch(e.data.cmd) { - case "construct": - try { - w = new (Function.prototype.bind.apply( - Construct, [null].concat(e.data.args) - ))(); - if (w) { - self.postMessage({ - cmd: "construct", - result: true + exports = {}, + createInBlobContext = function() { + var onmessage = function(e) { + switch(e.data.cmd) { + case "construct": + try { + w = new (Function.prototype.bind.apply( + Construct, [null].concat(e.data.args) + ))(); + if (w) { + self.postMessage({ + cmd: "construct", + result: true + }); + } else { + self.postMessage({ + cmd: "construct", + result: false + }); + } + } catch (err) { + self.postMessage({ + cmd: "construct", + result: false, + error: err.message || err }); - } else { - self.postMessage({ - cmd: "construct", - result: false - }); - } - } catch (err) { - self.postMessage({ - cmd: "construct", - result: false, - error: err.message || err - }); - } - break; - default: - var msg = { - cmd: e.data.cmd - }, - res; - if (w && typeof w[e.data.cmd] === "function") { - try { - res = w[e.data.cmd].apply(w, e.data.args); - if (res) { - msg.result = res; } - self.postMessage(msg); - } catch (err1) { - msg.error = err1.message || err1; - self.postMessage(msg); - } - } else { - msg.error = "Method not known"; - self.postMessage(msg); + break; + default: + var msg = { + cmd: e.data.cmd + }, + res; + if (w && typeof w[e.data.cmd] === "function") { + try { + res = w[e.data.cmd].apply(w, e.data.args); + if (res) { + msg.result = res; + } + self.postMessage(msg); + } catch (err1) { + msg.error = err1.message || err1; + self.postMessage(msg); + } + } else { + msg.error = "Method not known"; + self.postMessage(msg); + } } - } + }, + + BlobObject = function(c) { + var code = "var w, Construct = " + + c.toString() + + ";self.onmessage = " + + onmessage.toString(); + return new window.Blob(code.split()); + }, + worker, + url = window.webkitURL || window.URL, + blobPointer = new BlobObject(Class); + worker = new window.Worker(url.createObjectURL(blobPointer)); + worker.onmessage = callback; + return worker; }, - - BlobObject = function(c) { - var code = "var w, Construct = " - + c.toString() - + ";self.onmessage = " - + onmessage.toString(); - return new window.Blob(code.split()); + Wrap = function() { + return Class.apply(this, args); }, - worker, - url = window.webkitURL || window.URL, - blobPointer = new BlobObject(Class); - worker = new window.Worker(url.createObjectURL(blobPointer)); - worker.onmessage = callback; - - this.call = function(cmd) { - var args = Array.prototype.slice.call(arguments); - args.shift(); - worker.postMessage({ - cmd: cmd, - args: args - }); - }; + worker; - args.shift(); - args.shift(); - args.unshift("construct"); - this.call.apply(this, args); -} \ No newline at end of file + try { + worker = createInBlobContext(); + exports.call = function(cmd) { + var args = Array.prototype.slice.call(arguments); + args.shift(); + worker.postMessage({ + cmd: cmd, + args: args + }); + }; + + args.shift(); + args.shift(); + args.unshift("construct"); + exports.call.apply(this, args); + return exports; + } catch (e) { + args.shift(); + args.shift(); + Wrap.prototype = Class.prototype; + try { + worker = new Wrap(); + } catch (err) { + callback({ + data: { + cmd: "construct", + error: err + } + }); + return; + } + exports.call = function(cmd) { + var args = Array.prototype.slice.call(arguments), + resp = { + data: { + cmd: cmd + } + }; + if (!_.isFunction(worker[cmd])) { + resp.data.error = "Method not known"; + callback(resp); + return; + } + args.shift(); + try { + resp.data.result = worker[cmd].apply(worker, args); + callback(resp); + } catch (e) { + resp.data.error = e; + callback(resp); + } + }; + callback({ + data: { + cmd: "construct", + result: true + } + }); + return exports; + } +} diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/graphViewer.js b/js/apps/system/aardvark/frontend/js/graphViewer/graphViewer.js index ae55d65b74..acb21b53ca 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/graphViewer.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/graphViewer.js @@ -51,7 +51,13 @@ function GraphViewer(svg, width, height, adapterConfig, config) { if (adapterConfig === undefined || adapterConfig.type === undefined) { throw "An adapter configuration has to be given"; } - + + // Globally disable the right-click menu + /* + svg[0][0].oncontextmenu = function() { + return false; + }; + */ var self = this, adapter, nodeShaper, @@ -122,6 +128,7 @@ function GraphViewer(svg, width, height, adapterConfig, config) { adapter = new ArangoAdapter( nodes, edges, + this, adapterConfig ); adapter.setChildLimit(10); @@ -133,6 +140,7 @@ function GraphViewer(svg, width, height, adapterConfig, config) { nodes, edges, adapterConfig.route, + this, adapterConfig ); break; @@ -141,6 +149,7 @@ function GraphViewer(svg, width, height, adapterConfig, config) { adapterConfig.path, nodes, edges, + this, width, height ); @@ -151,6 +160,7 @@ function GraphViewer(svg, width, height, adapterConfig, config) { adapter = new PreviewAdapter( nodes, edges, + this, adapterConfig ); break; @@ -186,7 +196,6 @@ function GraphViewer(svg, width, height, adapterConfig, config) { }; this.loadGraphWithAttributeValue = function(attribute, value, callback) { -// loadNodeFromTreeByAttributeValue adapter.loadInitialNodeByAttributeValue(attribute, value, function (node) { if (node.errorCode) { callback(node); @@ -199,6 +208,11 @@ function GraphViewer(svg, width, height, adapterConfig, config) { } }); }; + + this.cleanUp = function() { + nodeShaper.resetColourMap(); + edgeShaper.resetColourMap(); + }; this.changeWidth = function(w) { layouter.changeWidth(w); diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/jasmineTestLinks.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/jasmineTestLinks.html deleted file mode 100644 index 15bea4a365..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/jasmineTestLinks.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerAll.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerAll.html deleted file mode 100644 index b01e81a832..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerAll.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - Jasmine Test Graph Interface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerArangoAdapter.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerArangoAdapter.html deleted file mode 100644 index 087559bd42..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerArangoAdapter.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - Jasmine Test Arango Adapter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerColourMapper.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerColourMapper.html deleted file mode 100644 index 31c88503fe..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerColourMapper.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - Jasmine Test Edge Shaper - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerEdgeShaper.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerEdgeShaper.html deleted file mode 100644 index 00dd0e8615..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerEdgeShaper.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - Jasmine Test Edge Shaper - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerEventDispatcher.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerEventDispatcher.html deleted file mode 100644 index e712b76ba0..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerEventDispatcher.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - Jasmine Test Event Dispatcher - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerEventLibrary.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerEventLibrary.html deleted file mode 100644 index 2f01364e18..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerEventLibrary.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - Jasmine Test Event Library - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerForceLayouter.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerForceLayouter.html deleted file mode 100644 index d11f56dff0..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerForceLayouter.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - Jasmine Test Force Layouter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerGraphViewer.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerGraphViewer.html deleted file mode 100644 index 7f2a9a5be6..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerGraphViewer.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - Jasmine Test Graph Viewer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerJSLint.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerJSLint.html deleted file mode 100644 index 1b4928c060..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerJSLint.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - Jasmine Test JSLint - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerJSONAdapter.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerJSONAdapter.html deleted file mode 100644 index fce1d07333..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerJSONAdapter.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - Jasmine Test JSON Adapter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerNodeReducer.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerNodeReducer.html deleted file mode 100644 index 25bf9a697a..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerNodeReducer.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - Jasmine Test Zoom Manager - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerNodeShaper.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerNodeShaper.html deleted file mode 100644 index 45089e852b..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerNodeShaper.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - Jasmine Test Node Shaper - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerZoomManager.html b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerZoomManager.html deleted file mode 100644 index 64776f4f75..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/runnerZoomManager.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - Jasmine Test Zoom Manager - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- Back to List -

- - diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/specAdapter/interfaceSpec.js b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/specAdapter/interfaceSpec.js deleted file mode 100644 index e8c9cf4b52..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/specAdapter/interfaceSpec.js +++ /dev/null @@ -1,243 +0,0 @@ -/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ -/*global it, expect, describe, beforeEach*/ -/*global spyOn, jasmine, window*/ - - -//////////////////////////////////////////////////////////////////////////////// -/// @brief Graph functionality -/// -/// @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 Michael Hackstein -/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany -//////////////////////////////////////////////////////////////////////////////// - - -var describeInterface = function (testee) { - "use strict"; - - describe('checking the interface', function() { - it('should comply to the Adapter Interface', function() { - this.addMatchers({ - toHaveFunction: function(func, argCounter) { - var obj = this.actual; - this.message = function(){ - return testee.constructor.name - + " should react to function " - + func - + " with at least " - + argCounter - + " arguments."; - }; - if (typeof(obj[func]) !== "function") { - return false; - } - if (obj[func].length < argCounter) { - return false; - } - return true; - } - }); - - // Add functions to load here: - expect(testee).toHaveFunction("loadNode", 2); - expect(testee).toHaveFunction("loadInitialNode", 2); - expect(testee).toHaveFunction("explore", 2); -// expect(testee).toHaveFunction("loadNodeFromTreeById", 2); - expect(testee).toHaveFunction("requestCentralityChildren", 2); -// expect(testee).toHaveFunction("loadNodeFromTreeByAttributeValue", 3); - expect(testee).toHaveFunction("createEdge", 2); - expect(testee).toHaveFunction("deleteEdge", 2); - expect(testee).toHaveFunction("patchEdge", 3); - expect(testee).toHaveFunction("createNode", 2); - expect(testee).toHaveFunction("deleteNode", 2); - expect(testee).toHaveFunction("patchNode", 3); - expect(testee).toHaveFunction("setNodeLimit", 2); - expect(testee).toHaveFunction("setChildLimit", 1); - expect(testee).toHaveFunction("expandCommunity", 2); - }); - }); - - -}; - -/** -* Expectations on constructor: -* Created with config: {prioList: ["foo", "bar", "baz"]} -* loadNode -> Adds {_id: 1} -{_id:"1-2"}-> {_id: 2} -* createEdge({source: {_id: 1}, target: {_id: 1}}) -> {_id: "1-2", _from:1, _to:2} -* createNode({}) -> {_id: 1} -* -*/ - -var describeIntegeration = function(constructor) { - "use strict"; - - describe('checking integeration of the abstract adapter', function() { - - var mockedAbstract, testee; - - beforeEach(function() { - mockedAbstract = { - edges: [], - nodes: [], - setWidth: function(){}, - setHeight: function(){}, - insertNode: function(data){ - var node = { - _data: data, - _id: data._id - }, i; - for (i = 0; i < this.nodes.length; i++) { - if (this.nodes[i]._id === node._id) { - return this.nodes[i]; - } - } - this.nodes.push(node); - return node; - }, - insertEdge: function(){}, - removeNode: function(){}, - removeEdge: function(){}, - removeEdgesForNode: function(){}, - expandCommunity: function(){}, - setNodeLimit: function(){}, - setChildLimit: function(){}, - checkSizeOfInserted: function(){}, - checkNodeLimit: function(){}, - explore: function(){}, - changeTo: function(){}, - getPrioList: function(){} - }; - - - spyOn(window, "AbstractAdapter").andCallFake(function(nodes, edges, descendant, config) { - mockedAbstract.nodes = nodes; - mockedAbstract.edges = edges; - return mockedAbstract; - }); - }); - - it('should create the AbstractAdapter with correct values', function() { - testee = constructor(); - expect(window.AbstractAdapter).wasCalledWith( - [], - [], - testee, - {prioList: ["foo", "bar", "baz"]} - ); - }); - - it('should call getPrioList on the abstract', function() { - spyOn(mockedAbstract, "getPrioList"); - testee = constructor(); - testee.getPrioList(); - expect(mockedAbstract.getPrioList).wasCalled(); - }); - - it('should call setNodeLimit on the abstract', function() { - spyOn(mockedAbstract, "setNodeLimit"); - testee = constructor(); - testee.setNodeLimit(5, function(){}); - expect(mockedAbstract.setNodeLimit).wasCalledWith(5, jasmine.any(Function)); - }); - - it('should propagate changeTo to the abstract', function() { - spyOn(mockedAbstract, "changeTo"); - testee = constructor(); - testee.changeTo({prioList: ["foo", "bar", "baz"]}); - expect(mockedAbstract.changeTo).wasCalledWith({prioList: ["foo", "bar", "baz"]}); - }); - - it('should call explore on the abstract', function() { - spyOn(mockedAbstract, "explore"); - testee = constructor(); - var node = { - _id: "1" - }; - testee.explore(node, function(){}); - expect(mockedAbstract.explore).wasCalledWith(node, jasmine.any(Function)); - }); - - it('should call setChildLimit on the abstract', function() { - spyOn(mockedAbstract, "setChildLimit"); - testee = constructor(); - testee.setChildLimit(5); - expect(mockedAbstract.setChildLimit).wasCalledWith(5); - }); - - it('should call expandCommunity on the abstract', function() { - spyOn(mockedAbstract, "expandCommunity"); - var comm = {}; - testee = constructor(); - testee.expandCommunity(comm); - expect(mockedAbstract.expandCommunity).wasCalledWith(comm); - }); - - it('should use the abstract to insert objects from loadNode', function() { - spyOn(mockedAbstract, "insertNode").andCallThrough(); - spyOn(mockedAbstract, "insertEdge").andCallThrough(); - spyOn(mockedAbstract, "checkSizeOfInserted"); - spyOn(mockedAbstract, "checkNodeLimit"); - testee = constructor(); - testee.loadNode(1); - expect(mockedAbstract.insertNode).wasCalledWith({_id: 1}); - expect(mockedAbstract.insertNode).wasCalledWith({_id: 2}); - expect(mockedAbstract.insertEdge).wasCalledWith({_id: "1-2", _from: 1, _to: 2}); - expect(mockedAbstract.checkSizeOfInserted).wasCalledWith({2: mockedAbstract.nodes[1]}); - expect(mockedAbstract.checkNodeLimit).wasCalledWith(mockedAbstract.nodes[0]); - }); - - it('should insert an edge on createEdge', function() { - spyOn(mockedAbstract, "insertEdge"); - testee = constructor(); - testee.createEdge({source: {_id: 1}, target: {_id: 2}}, function(){}); - expect(mockedAbstract.insertEdge).wasCalledWith({_id: "1-2", _from: 1, _to: 2}); - }); - - it('should remove an edge on deleteEdge', function() { - spyOn(mockedAbstract, "removeEdge"); - testee = constructor(); - var edge = {_id: "1-2", _from: 1, _to: 2}; - testee.deleteEdge(edge); - expect(mockedAbstract.removeEdge).wasCalledWith(edge); - }); - - it('should insert a node on createNode', function() { - spyOn(mockedAbstract, "insertNode"); - testee = constructor(); - testee.createNode({}, function(){}); - expect(mockedAbstract.insertNode).wasCalledWith({_id: 1}); - }); - - it('should remove a node on deleteNode', function() { - spyOn(mockedAbstract, "removeNode"); - spyOn(mockedAbstract, "removeEdgesForNode"); - testee = constructor(); - var node = {_id: 1}; - testee.deleteNode(node); - expect(mockedAbstract.removeEdgesForNode).wasCalledWith(node); - expect(mockedAbstract.removeNode).wasCalledWith(node); - }); - - }); - -}; diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/specJSLint/jsLintSpec.js b/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/specJSLint/jsLintSpec.js deleted file mode 100644 index fb48a51e0c..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/jasmine_test/specJSLint/jsLintSpec.js +++ /dev/null @@ -1,78 +0,0 @@ -/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ -/*global beforeEach, afterEach */ -/*global describe, it, expect, jasmine, spyOn*/ -/*global waitsFor, runs, waits */ -/*global _, JSLINT*/ -/*global document*/ - -(function () { - "use strict"; - describe('JSLint', function () { - var options = {}, - lint = /^\/specJSLint|[\w\W]jsLintSpec\.js$/; - - function get(path) { - path = path + "?" + new Date().getTime(); - - var xhr; - try { - xhr = new jasmine.XmlHttpRequest(); - xhr.open("GET", path, false); - xhr.send(null); - } catch (e) { - throw new Error("couldn't fetch " + path + ": " + e); - } - if (xhr.status < 200 || xhr.status > 299) { - throw new Error("Could not load '" + path + "'."); - } - - return xhr.responseText; - } - - describe('checking codeFiles', function() { - var files = /^([\w\W]*lib\/[\w\W]*)|([\w\W]*Spec\.js)$/; - - _.each(document.getElementsByTagName('script'), function (element) { - var script = element.getAttribute('src'); - if (script === null || files.test(script)) { - return; - } - it(script, function () { - var self = this, - source = get(script), - result = JSLINT(source, options); - _.each(JSLINT.errors, function (error) { - self.addMatcherResult(new jasmine.ExpectationResult({ - passed: false, - message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence - })); - }); - expect(true).toBe(true); // force spec to show up if there are no errors - }); - }); - }); - - describe('checking specFiles', function() { - var files = /^\/spec*|[\w\W]*Spec\.js$/; - - _.each(document.getElementsByTagName('script'), function (element) { - var script = element.getAttribute('src'); - if (!files.test(script) || lint.test(script)) { - return; - } - it(script, function () { - var self = this, - source = get(script), - result = JSLINT(source, options); - _.each(JSLINT.errors, function (error) { - self.addMatcherResult(new jasmine.ExpectationResult({ - passed: false, - message: "line " + error.line + ' - ' + error.reason + ' - ' + error.evidence - })); - }); - expect(true).toBe(true); // force spec to show up if there are no errors - }); - }); - }); - }); -}()); \ No newline at end of file diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/karma/karma.conf.js b/js/apps/system/aardvark/frontend/js/graphViewer/karma/karma.conf.js deleted file mode 100644 index 9350abdda2..0000000000 --- a/js/apps/system/aardvark/frontend/js/graphViewer/karma/karma.conf.js +++ /dev/null @@ -1,149 +0,0 @@ -// Karma configuration -// Generated on Thu Jul 04 2013 11:39:34 GMT+0200 (CEST) - -module.exports = function(karma) { - karma.set({ - - // base path, that will be used to resolve files and exclude - basePath: '../jasmine_test/', - - - // frameworks to use - frameworks: ['jasmine'], - - - // list of files / patterns to load in the browser - files: [ - 'lib/jasmine-1.3.1/jasmine-html.js', - 'lib/jslint.js', - '../../lib/d3.v3.min.js', - '../../lib/d3.fisheye.js', - '../../lib/underscore.js', - '../../lib/jquery-1.8.3.js', - '../../lib/bootstrap.js', - '../../lib/jquery.livequery.js', - '../../lib/jquery-ui-1.9.2.custom.js', - - // Mocks - 'helper/eventHelper.js', - 'helper/objectsHelper.js', - 'helper/mocks.js', - 'helper/commMock.js', - 'helper/uiMatchers.js', - - // Core Modules - '../graphViewer.js', - '../graph/domObserverFactory.js', - '../graph/colourMapper.js', - '../graph/communityNode.js', - '../graph/webWorkerWrapper.js', - '../graph/nodeShaper.js', - '../graph/abstractAdapter.js', - '../graph/jsonAdapter.js', - '../graph/arangoAdapter.js', - '../graph/foxxAdapter.js', - '../graph/previewAdapter.js', - '../graph/edgeShaper.js', - '../graph/forceLayouter.js', - '../graph/eventDispatcher.js', - '../graph/eventLibrary.js', - '../graph/zoomManager.js', - '../graph/nodeReducer.js', - '../graph/modularityJoiner.js', - // UI Modules - '../ui/modalDialogHelper.js', - '../ui/nodeShaperControls.js', - '../ui/edgeShaperControls.js', - '../ui/arangoAdapterControls.js', - '../ui/layouterControls.js', - '../ui/uiComponentsHelper.js', - '../ui/eventDispatcherControls.js', - '../ui/graphViewerUI.js', - '../ui/graphViewerWidget.js', - '../ui/graphViewerPreview.js', - - // Specs - - 'specColourMapper/colourMapperSpec.js', - 'specWindowObjects/domObserverFactorySpec.js', - 'specCommunityNode/communityNodeSpec.js', - 'specAdapter/interfaceSpec.js', - 'specAdapter/abstractAdapterSpec.js', - 'specAdapter/jsonAdapterSpec.js', - 'specAdapter/arangoAdapterSpec.js', - 'specAdapter/foxxAdapterSpec.js', - 'specAdapter/previewAdapterSpec.js', - 'specAdapter/arangoAdapterUISpec.js', - 'specNodeShaper/nodeShaperSpec.js', - 'specNodeShaper/nodeShaperUISpec.js', - 'specEdgeShaper/edgeShaperSpec.js', - 'specEdgeShaper/edgeShaperUISpec.js', - 'specForceLayouter/forceLayouterSpec.js', - 'specForceLayouter/forceLayouterUISpec.js', - 'specEvents/eventLibrarySpec.js', - 'specEvents/eventDispatcherSpec.js', - 'specEvents/eventDispatcherUISpec.js', - 'specZoomManager/zoomManagerSpec.js', - 'specGraphViewer/graphViewerSpec.js', - 'specGraphViewer/graphViewerUISpec.js', - 'specGraphViewer/graphViewerWidgetSpec.js', - 'specGraphViewer/graphViewerPreviewSpec.js', - 'specNodeReducer/nodeReducerSpec.js', - 'specNodeReducer/modularityJoinerSpec.js', - 'specWindowObjects/workerWrapperSpec.js', - 'specJSLint/jsLintSpec.js' - ], - - - // list of files to exclude - exclude: [ - - ], - - - // test results reporter to use - // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' - reporters: ['progress'], - - - // web server port - port: 9876, - - - // cli runner port - runnerPort: 9100, - - - // enable / disable colors in the output (reporters and logs) - colors: true, - - - // level of logging - // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG - logLevel: karma.LOG_INFO, - - - // enable / disable watching file and executing tests whenever any file changes - autoWatch: true, - - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - browsers: [], - - - // If browser does not capture in given timeout [ms], kill it - captureTimeout: 60000, - - - // Continuous Integration mode - // if true, it capture browsers, run tests and exit - singleRun: false - }); -}; diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/ui/arangoAdapterControls.js b/js/apps/system/aardvark/frontend/js/graphViewer/ui/arangoAdapterControls.js index 9a15437bb3..860cb4064d 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/ui/arangoAdapterControls.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/ui/arangoAdapterControls.js @@ -37,16 +37,13 @@ function ArangoAdapterControls(list, adapter) { if (adapter === undefined) { throw "The ArangoAdapter has to be given."; } - var self = this, - baseClass = "adapter"; - this.addControlChangeCollections = function(callback) { var prefix = "control_adapter_collections", idprefix = prefix + "_"; adapter.getCollections(function(nodeCols, edgeCols) { adapter.getGraphs(function(graphs) { - uiComponentsHelper.createButton(baseClass, list, "Collections", prefix, function() { + uiComponentsHelper.createButton(list, "Collections", prefix, function() { modalDialogHelper.createModalDialog("Switch Collections", idprefix, [{ type: "decission", @@ -130,10 +127,11 @@ function ArangoAdapterControls(list, adapter) { this.addControlChangePriority = function() { var prefix = "control_adapter_priority", idprefix = prefix + "_", - prioList = adapter.getPrioList(); + prioList = adapter.getPrioList(), + label = "Group vertices"; - uiComponentsHelper.createButton(baseClass, list, "Group By", prefix, function() { - modalDialogHelper.createModalChangeDialog("Group By", + uiComponentsHelper.createButton(list, label, prefix, function() { + modalDialogHelper.createModalChangeDialog(label, idprefix, [{ type: "extendable", id: "attribute", @@ -155,7 +153,7 @@ function ArangoAdapterControls(list, adapter) { }); /* adapter.getCollections(function(nodeCols, edgeCols) { - uiComponentsHelper.createButton(baseClass, list, "Collections", prefix, function() { + uiComponentsHelper.createButton(list, "Collections", prefix, function() { modalDialogHelper.createModalDialog("Switch Collections", idprefix, [{ type: "list", diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/ui/contextMenuHelper.js b/js/apps/system/aardvark/frontend/js/graphViewer/ui/contextMenuHelper.js new file mode 100644 index 0000000000..82588a6f11 --- /dev/null +++ b/js/apps/system/aardvark/frontend/js/graphViewer/ui/contextMenuHelper.js @@ -0,0 +1,83 @@ +/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */ +/*global $, _, d3*/ +/*global document*/ +/*global EdgeShaper, modalDialogHelper, uiComponentsHelper*/ +//////////////////////////////////////////////////////////////////////////////// +/// @brief Graph functionality +/// +/// @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 Michael Hackstein +/// @author Copyright 2011-2013, triAGENS GmbH, Cologne, Germany +//////////////////////////////////////////////////////////////////////////////// +function ContextMenu(id) { + "use strict"; + + if (id === undefined) { + throw("An id has to be given."); + } + var div, + ul, + jqId = "#" + id, + menu, + + addEntry = function(label, callback) { + var li, button; + li = document.createElement("li"); + button = document.createElement("button"); + button.onclick = function() { + callback(d3.select(menu.target).data()[0]); + }; + button.className = "btn btn-primary gv_context_button"; + button.appendChild(document.createTextNode(label)); + li.appendChild(button); + ul.appendChild(li); + }, + + bindMenu = function($objects) { + menu = $.contextMenu.create(jqId, {shadow: false}); + $objects.each(function() { + $(this).bind('contextmenu', function(e){ + menu.show(this,e); + return false; + }); + }); + }, + + divFactory = function() { + div = document.getElementById(id); + if (!div) { + div = document.createElement("div"); + div.id = id; + ul = document.createElement("ul"); + document.body.appendChild(div); + div.appendChild(ul); + } + ul = div.firstChild; + return div; + }; + + divFactory(); + + this.addEntry = addEntry; + this.bindMenu = bindMenu; +} + diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/ui/edgeShaperControls.js b/js/apps/system/aardvark/frontend/js/graphViewer/ui/edgeShaperControls.js index 6df9be8843..ea8de4b218 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/ui/edgeShaperControls.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/ui/edgeShaperControls.js @@ -37,13 +37,12 @@ function EdgeShaperControls(list, shaper) { if (shaper === undefined) { throw "The EdgeShaper has to be given."; } - var self = this, - baseClass = "graph"; + var self = this; this.addControlOpticShapeNone = function() { var prefix = "control_edge_none", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "None", prefix, function() { + uiComponentsHelper.createButton(list, "None", prefix, function() { shaper.changeTo({ shape: { type: EdgeShaper.shapes.NONE @@ -55,7 +54,7 @@ function EdgeShaperControls(list, shaper) { this.addControlOpticShapeArrow = function() { var prefix = "control_edge_arrow", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Arrow", prefix, function() { + uiComponentsHelper.createButton(list, "Arrow", prefix, function() { shaper.changeTo({ shape: { type: EdgeShaper.shapes.ARROW @@ -69,7 +68,7 @@ function EdgeShaperControls(list, shaper) { this.addControlOpticLabel = function() { var prefix = "control_edge_label", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Label", prefix, function() { + uiComponentsHelper.createButton(list, "Label", prefix, function() { modalDialogHelper.createModalDialog("Switch Label Attribute", idprefix, [{ type: "text", @@ -90,7 +89,7 @@ function EdgeShaperControls(list, shaper) { this.addControlOpticSingleColour = function() { var prefix = "control_edge_singlecolour", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Single Colour", prefix, function() { + uiComponentsHelper.createButton(list, "Single Colour", prefix, function() { modalDialogHelper.createModalDialog("Switch to Colour", idprefix, [{ type: "text", @@ -111,7 +110,7 @@ function EdgeShaperControls(list, shaper) { this.addControlOpticAttributeColour = function() { var prefix = "control_edge_attributecolour", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Colour by Attribute", prefix, function() { + uiComponentsHelper.createButton(list, "Colour by Attribute", prefix, function() { modalDialogHelper.createModalDialog("Display colour by attribute", idprefix, [{ type: "text", @@ -132,7 +131,7 @@ function EdgeShaperControls(list, shaper) { this.addControlOpticGradientColour = function() { var prefix = "control_edge_gradientcolour", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Gradient Colour", prefix, function() { + uiComponentsHelper.createButton(list, "Gradient Colour", prefix, function() { modalDialogHelper.createModalDialog("Change colours for gradient", idprefix, [{ type: "text", @@ -173,4 +172,4 @@ function EdgeShaperControls(list, shaper) { self.addAllActions(); }; -} \ No newline at end of file +} diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/ui/eventDispatcherControls.js b/js/apps/system/aardvark/frontend/js/graphViewer/ui/eventDispatcherControls.js index 2d3a7313b1..e54f267681 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/ui/eventDispatcherControls.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/ui/eventDispatcherControls.js @@ -38,11 +38,6 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) if (list === undefined) { throw "A list element has to be given."; } - /* - if (cursorIconBox === undefined) { - throw "The cursor decoration box has to be given."; - } - */ if (nodeShaper === undefined) { throw "The NodeShaper has to be given."; } @@ -51,22 +46,6 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) } var self = this, - /* archive - firstButton = true, - currentListGroup, - placeHolderBtn = uiComponentsHelper.createIconButton( - "none", - "" - ), - icons = { - expand: "plus", - add: "plus-sign", - trash: "trash", - drag: "move", - edge: "resize-horizontal", - edit: "pencil" - }, - */ icons = { expand: "expand", add: "add", @@ -76,33 +55,13 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) edit: "edit", view: "view" }, - baseClass = "event", dispatcher = new EventDispatcher(nodeShaper, edgeShaper, dispatcherConfig), - setCursorIcon = function(icon) { - //cursorIconBox.className = "mousepointer icon-" + icon; - }, - appendToList = function(button) { list.appendChild(button); - /* archive - if (firstButton) { - currentListGroup = document.createElement("div"); - currentListGroup.className = "btn btn-group"; - currentListGroup.appendChild(button); - currentListGroup.appendChild(placeHolderBtn); - firstButton = false; - list.appendChild(currentListGroup); - } else { - currentListGroup.removeChild(placeHolderBtn); - currentListGroup.appendChild(button); - firstButton = true; - } - */ }, createButton = function(title, callback) { uiComponentsHelper.createButton( - baseClass, list, title, "control_event_" + title, @@ -126,7 +85,6 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) rebindSVG = function(actions) { dispatcher.rebind("svg", actions); }, - getCursorPosition = function (ev) { var e = ev || window.event, res = {}; @@ -136,37 +94,171 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) res.y += document.body.scrollTop; return res; }, - getCursorPositionInSVG = function (ev) { - var pos = getCursorPosition(ev); - pos.x -= $('svg').offset().left; - pos.y -= $('svg').offset().top; + var pos = getCursorPosition(ev), + off = $('svg').offset(); + // Hack for Firefox + /* + var off = { + left: 166, + top: 171 + }; + */ + pos.x -= off.left; + pos.y -= off.top; return pos; + }, + callbacks = { + nodes: {}, + edges: {}, + svg: {} + }, + + /******************************************* + * Create callbacks wenn clicking on objects + * + *******************************************/ + + createNewNodeCB = function() { + var prefix = "control_event_new_node", + idprefix = prefix + "_", + createCallback = function(ev) { + var pos = getCursorPositionInSVG(ev); + modalDialogHelper.createModalCreateDialog( + "Create New Node", + idprefix, + {}, + function(data) { + dispatcher.events.CREATENODE(data, function(node) { + $("#" + idprefix + "modal").modal('hide'); + nodeShaper.reshapeNodes(); + }, pos.x, pos.y)(); + } + ); + }; + callbacks.nodes.newNode = createCallback; + }, + createViewCBs = function() { + var prefix = "control_event_view", + idprefix = prefix + "_", + nodeCallback = function(n) { + modalDialogHelper.createModalViewDialog( + "View Node " + n._id, + "control_event_node_view_", + n._data, + function() { + modalDialogHelper.createModalEditDialog( + "Edit Node " + n._id, + "control_event_node_edit_", + n._data, + function(newData) { + dispatcher.events.PATCHNODE(n, newData, function() { + $("#control_event_node_edit_modal").modal('hide'); + })(); + } + ); + } + ); + }, + edgeCallback = function(e) { + modalDialogHelper.createModalViewDialog( + "View Edge " + e._id, + "control_event_edge_view_", + e._data, + function() { + modalDialogHelper.createModalEditDialog( + "Edit Edge " + e._id, + "control_event_edge_edit_", + e._data, + function(newData) { + dispatcher.events.PATCHEDGE(e, newData, function() { + $("#control_event_edge_edit_modal").modal('hide'); + })(); + } + ); + } + ); + }; + + callbacks.nodes.view = nodeCallback; + callbacks.edges.view = edgeCallback; + }, + createConnectCBs = function() { + var prefix = "control_event_connect", + idprefix = prefix + "_", + nodesDown = dispatcher.events.STARTCREATEEDGE(function(startNode, ev) { + var pos = getCursorPositionInSVG(ev), + moveCB = edgeShaper.addAnEdgeFollowingTheCursor(pos.x, pos.y); + dispatcher.bind("svg", "mousemove", function(ev) { + var pos = getCursorPositionInSVG(ev); + moveCB(pos.x, pos.y); + }); + }), + nodesUp = dispatcher.events.FINISHCREATEEDGE(function(edge){ + edgeShaper.removeCursorFollowingEdge(); + dispatcher.bind("svg", "mousemove", function(){}); + }), + svgUp = function() { + dispatcher.events.CANCELCREATEEDGE(); + edgeShaper.removeCursorFollowingEdge(); + }; + callbacks.nodes.startEdge = nodesDown; + callbacks.nodes.endEdge = nodesUp; + callbacks.svg.cancelEdge = svgUp; + }, + createEditsCBs = function() { + var prefix = "control_event_edit", + idprefix = prefix + "_", + nodeCallback = function(n) { + modalDialogHelper.createModalEditDialog( + "Edit Node " + n._id, + "control_event_node_edit_", + n._data, + function(newData) { + dispatcher.events.PATCHNODE(n, newData, function() { + $("#control_event_node_edit_modal").modal('hide'); + })(); + } + ); + }, + edgeCallback = function(e) { + modalDialogHelper.createModalEditDialog( + "Edit Edge " + e._id, + "control_event_edge_edit_", + e._data, + function(newData) { + dispatcher.events.PATCHEDGE(e, newData, function() { + $("#control_event_edge_edit_modal").modal('hide'); + })(); + } + ); + }; + callbacks.nodes.edit = nodeCallback; + callbacks.edges.edit = edgeCallback; + }, + createDeleteCBs = function() { + callbacks.nodes.del = dispatcher.events.DELETENODE( + function() {} + ); + callbacks.edges.del = dispatcher.events.DELETEEDGE( + function() {} + ); + }, + createSpotCB = function() { + callbacks.nodes.spot = dispatcher.events.EXPAND; }; - /* Archive - moveCursorBox = function(ev) { - var pos = getCursorPosition(ev); - pos.x += 7; - pos.y += 12; - cursorIconBox.style.position = "absolute"; - cursorIconBox.style.left = pos.x + 'px'; - cursorIconBox.style.top = pos.y + 'px'; - }; - */ - /* Archive - dispatcher.fixSVG("mousemove", moveCursorBox); - dispatcher.fixSVG("mouseout", function() { - cursorIconBox.style.display = "none"; - }); - dispatcher.fixSVG("mouseover", function() { - cursorIconBox.style.display = "block"; - }); - */ + + createNewNodeCB(); + createViewCBs(); + createConnectCBs(); + createEditsCBs(); + createDeleteCBs(); + createSpotCB(); + /******************************************* * Raw rebind objects * *******************************************/ - this.dragRebinds = function() { return { nodes: { @@ -176,142 +268,43 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) }; this.newNodeRebinds = function() { - var prefix = "control_event_new_node", - idprefix = prefix + "_", - createCallback = function(n) { - modalDialogHelper.createModalCreateDialog( - "Create New Node", - idprefix, - {}, - function(data) { - dispatcher.events.CREATENODE(data, function(node) { - $("#" + idprefix + "modal").modal('hide'); - nodeShaper.reshapeNodes(); - })(); - } - ); - }; return { svg: { - click: createCallback + click: callbacks.nodes.newNode } }; }; this.viewRebinds = function() { - var prefix = "control_event_view", - idprefix = prefix + "_", - nodeCallback = function(n) { - modalDialogHelper.createModalViewDialog( - "View Node " + n._id, - "control_event_node_view_", - n._data, - function() { - modalDialogHelper.createModalEditDialog( - "Edit Node " + n._id, - "control_event_node_edit_", - n._data, - function(newData) { - dispatcher.events.PATCHNODE(n, newData, function() { - $("#control_event_node_edit_modal").modal('hide'); - })(); - } - ); - } - ); - }, - edgeCallback = function(e) { - modalDialogHelper.createModalViewDialog( - "View Edge " + e._id, - "control_event_edge_view_", - e._data, - function() { - modalDialogHelper.createModalEditDialog( - "Edit Edge " + e._id, - "control_event_edge_edit_", - e._data, - function(newData) { - dispatcher.events.PATCHEDGE(e, newData, function() { - $("#control_event_edge_edit_modal").modal('hide'); - })(); - } - ); - } - ); - }; return { nodes: { - click: nodeCallback + click: callbacks.nodes.view }, edges: { - click: edgeCallback + click: callbacks.edges.view } }; }; this.connectNodesRebinds = function() { - var prefix = "control_event_connect", - idprefix = prefix + "_", - nodesDown = dispatcher.events.STARTCREATEEDGE(function(startNode, ev) { - var pos = getCursorPositionInSVG(ev), - moveCB = edgeShaper.addAnEdgeFollowingTheCursor(pos.x, pos.y); - dispatcher.bind("svg", "mousemove", function(ev) { - var pos = getCursorPositionInSVG(ev); - moveCB(pos.x, pos.y); - }); - }), - nodesUp = dispatcher.events.FINISHCREATEEDGE(function(edge){ - edgeShaper.removeCursorFollowingEdge(); - dispatcher.bind("svg", "mousemove", function(){}); - }), - svgUp = function() { - dispatcher.events.CANCELCREATEEDGE(); - edgeShaper.removeCursorFollowingEdge(); - }; return { nodes: { - mousedown: nodesDown, - mouseup: nodesUp + mousedown: callbacks.nodes.startEdge, + mouseup: callbacks.nodes.endEdge }, svg: { - mouseup: svgUp + mouseup: callbacks.svg.cancelEdge } }; }; this.editRebinds = function() { - var prefix = "control_event_edit", - idprefix = prefix + "_", - nodeCallback = function(n) { - modalDialogHelper.createModalEditDialog( - "Edit Node " + n._id, - "control_event_node_edit_", - n._data, - function(newData) { - dispatcher.events.PATCHNODE(n, newData, function() { - $("#control_event_node_edit_modal").modal('hide'); - })(); - } - ); - }, - edgeCallback = function(e) { - modalDialogHelper.createModalEditDialog( - "Edit Edge " + e._id, - "control_event_edge_edit_", - e._data, - function(newData) { - dispatcher.events.PATCHEDGE(e, newData, function() { - $("#control_event_edge_edit_modal").modal('hide'); - })(); - } - ); - }; return { nodes: { - click: nodeCallback + click: callbacks.nodes.edit }, edges: { - click: edgeCallback + click: callbacks.edges.edit } }; }; @@ -319,7 +312,7 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) this.expandRebinds = function() { return { nodes: { - click: dispatcher.events.EXPAND + click: callbacks.nodes.spot } }; }; @@ -327,14 +320,10 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) this.deleteRebinds = function() { return { nodes: { - click: dispatcher.events.DELETENODE( - function() {} - ) + click: callbacks.nodes.del }, edges: { - click: dispatcher.events.DELETEEDGE( - function() {} - ) + click: callbacks.edges.del } }; }; @@ -345,6 +334,21 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) rebindSVG(obj.svg); }; + /******************************************* + * Inject controls into right-click menus + * + *******************************************/ + + nodeShaper.addMenuEntry("View", callbacks.nodes.view); + nodeShaper.addMenuEntry("Edit", callbacks.nodes.edit); + nodeShaper.addMenuEntry("Spot", callbacks.nodes.spot); + nodeShaper.addMenuEntry("Trash", callbacks.nodes.del); + + edgeShaper.addMenuEntry("View", callbacks.edges.view); + edgeShaper.addMenuEntry("Edit", callbacks.edges.edit); + edgeShaper.addMenuEntry("Trash", callbacks.edges.del); + + /******************************************* * Functions to add controls * @@ -354,7 +358,6 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) this.addControlNewNode = function() { var icon = icons.add, callback = function() { - setCursorIcon(icon); self.rebindAll(self.newNodeRebinds()); }; createIcon(icon, "new_node", callback); @@ -363,7 +366,6 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) this.addControlView = function() { var icon = icons.view, callback = function() { - setCursorIcon(icon); self.rebindAll(self.viewRebinds()); }; createIcon(icon, "view", callback); @@ -374,7 +376,6 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) idprefix = prefix + "_", icon = icons.drag, callback = function() { - setCursorIcon(icon); self.rebindAll(self.dragRebinds()); }; createIcon(icon, "drag", callback); @@ -383,7 +384,6 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) this.addControlEdit = function() { var icon = icons.edit, callback = function() { - setCursorIcon(icon); self.rebindAll(self.editRebinds()); }; createIcon(icon, "edit", callback); @@ -392,7 +392,6 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) this.addControlExpand = function() { var icon = icons.expand, callback = function() { - setCursorIcon(icon); self.rebindAll(self.expandRebinds()); }; createIcon(icon, "expand", callback); @@ -401,7 +400,6 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) this.addControlDelete = function() { var icon = icons.trash, callback = function() { - setCursorIcon(icon); rebindNodes({click: dispatcher.events.DELETENODE(function() { })}); @@ -416,7 +414,6 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) this.addControlConnect = function() { var icon = icons.edge, callback = function() { - setCursorIcon(icon); self.rebindAll(self.connectNodesRebinds()); }; createIcon(icon, "connect", callback); @@ -431,5 +428,4 @@ function EventDispatcherControls(list, nodeShaper, edgeShaper, dispatcherConfig) self.addControlConnect(); self.addControlNewNode(); }; - } diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/ui/graphViewerUI.js b/js/apps/system/aardvark/frontend/js/graphViewer/ui/graphViewerUI.js index 00372f88b8..93aef92cec 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/ui/graphViewerUI.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/ui/graphViewerUI.js @@ -43,9 +43,8 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf throw "An adapter configuration has to be given"; } - var self = this, - graphViewer, - width = (optWidth || container.offsetWidth) - 60, + var graphViewer, + width = (optWidth || container.offsetWidth) - 81, height = optHeight || container.offsetHeight, menubar = document.createElement("ul"), background = document.createElement("div"), @@ -76,34 +75,182 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf return list; }, - makeConfigure = function (div, id) { - var ul, li, a, span, list; - div.className = "pagination pagination-small pagination-right btn-group"; - ul = document.createElement("ul"); - li = document.createElement("li"); - li.className = "enabled"; - a = document.createElement("a"); - a.id = id; - a.className = "arangoHeaderA"; - span = document.createElement("span"); - span.className = "glyphicon glyphicon-cog"; - span.title = "Configure"; + makeFilterDiv = function() { + var + div = document.createElement("div"), + innerDiv = document.createElement("div"), + queryLine = document.createElement("div"), + searchAttrDiv = document.createElement("div"), + searchAttrExampleToggle = document.createElement("button"), + searchAttrExampleCaret = document.createElement("span"), + searchValueField = document.createElement("input"), + searchStart = document.createElement("img"), + equalsField = document.createElement("span"), + + showSpinner = function() { + $(background).css("cursor", "progress"); + }, + + hideSpinner = function() { + $(background).css("cursor", ""); + }, + + alertError = function(msg) { + window.alert(msg); + }, + + resultCB = function(res) { + hideSpinner(); + if (res && res.errorCode && res.errorCode === 404) { + alertError("Sorry could not find a matching node."); + return; + } + return; + }, + + searchFunction = function() { + showSpinner(); + if (searchAttrField.value === "" + || searchAttrField.value === undefined) { + graphViewer.loadGraph( + searchValueField.value, + resultCB + ); + } else { + graphViewer.loadGraphWithAttributeValue( + searchAttrField.value, + searchValueField.value, + resultCB + ); + } + }; + + div.id = "filterDropdown"; + div.className = "headerDropdown"; + innerDiv.className = "dropdownInner"; + queryLine.className = "queryline"; + + searchAttrField = document.createElement("input"); + searchAttrExampleList = document.createElement("ul"); + + searchAttrDiv.className = "pull-left input-append searchByAttribute"; + searchAttrField.id = "attribute"; + //searchAttrField.className = "input"; + searchAttrField.type = "text"; + searchAttrField.placeholder = "Attribute name"; + searchAttrExampleToggle.id = "attribute_example_toggle"; + searchAttrExampleToggle.className = "btn gv_example_toggle"; + searchAttrExampleCaret.className = "caret gv_caret"; + searchAttrExampleList.className = "dropdown-menu"; + searchValueField.id = "value"; + searchValueField.className = "searchInput"; + //searchValueField.className = "filterValue"; + searchValueField.type = "text"; + searchValueField.placeholder = "Attribute value"; + searchStart.id = "loadnode"; + searchStart.className = "searchSubmit"; + equalsField.className = "searchEqualsLabel"; + equalsField.appendChild(document.createTextNode("==")); + + innerDiv.appendChild(queryLine); + queryLine.appendChild(searchAttrDiv); + + searchAttrDiv.appendChild(searchAttrField); + searchAttrDiv.appendChild(searchAttrExampleToggle); + searchAttrDiv.appendChild(searchAttrExampleList); + searchAttrExampleToggle.appendChild(searchAttrExampleCaret); + queryLine.appendChild(equalsField); + queryLine.appendChild(searchValueField); + queryLine.appendChild(searchStart); + + searchStart.onclick = searchFunction; + $(searchValueField).keypress(function(e) { + if (e.keyCode === 13 || e.which === 13) { + searchFunction(); + return false; + } + }); - div.appendChild(ul); - ul.appendChild(li); - li.appendChild(a); - a.appendChild(span); - - list = document.createElement("ul"); - list.className = "dropdown-menu gv_configure_menu"; - list.style.display = "none"; - div.appendChild(list); - - a.onclick = function () { - $(list).slideToggle(200); + searchAttrExampleToggle.onclick = function() { + $(searchAttrExampleList).slideToggle(200); }; - return list; + div.appendChild(innerDiv); + return div; + }, + + makeConfigureDiv = function () { + var div, innerDiv, nodeList, nodeHeader, colList, colHeader; + div = document.createElement("div"); + div.id = "configureDropdown"; + div.className = "headerDropdown"; + innerDiv = document.createElement("div"); + innerDiv.className = "dropdownInner"; + nodeList = document.createElement("ul"); + nodeHeader = document.createElement("li"); + nodeHeader.className = "nav-header"; + nodeHeader.appendChild(document.createTextNode("Vertices")); + colList = document.createElement("ul"); + colHeader = document.createElement("li"); + colHeader.className = "nav-header"; + colHeader.appendChild(document.createTextNode("Connection")); + nodeList.appendChild(nodeHeader); + colList.appendChild(colHeader); + innerDiv.appendChild(nodeList); + innerDiv.appendChild(colList); + div.appendChild(innerDiv); + return { + configure: div, + nodes: nodeList, + col: colList + }; + }, + + makeConfigure = function (div, idConf, idFilter) { + var ul, liConf, aConf, spanConf, liFilter, aFilter, spanFilter, lists; + div.className = "pagination pagination-small pagination-right btn-group"; + ul = document.createElement("ul"); + liConf = document.createElement("li"); + liConf.className = "enabled"; + aConf = document.createElement("a"); + aConf.id = idConf; + aConf.className = "arangoHeaderA"; + spanConf = document.createElement("span"); + spanConf.className = "glyphicon glyphicon-cog"; + $(spanConf).attr("data-original-title", "Configure"); + + liFilter = document.createElement("li"); + liFilter.className = "enabled"; + aFilter = document.createElement("a"); + aFilter.id = idFilter; + aFilter.className = "arangoHeaderA"; + spanFilter = document.createElement("span"); + spanFilter.className = "glyphicon glyphicon-filter"; + $(spanFilter).attr("data-original-title", "Filter"); + + div.appendChild(ul); + + ul.appendChild(liConf); + liConf.appendChild(aConf); + aConf.appendChild(spanConf); + + ul.appendChild(liFilter); + liFilter.appendChild(aFilter); + aFilter.appendChild(spanFilter); + + lists = makeConfigureDiv(); + lists.filter = makeFilterDiv(); + aConf.onclick = function () { + $(lists.configure).slideToggle(200); + $(lists.filter).hide(); + }; + + aFilter.onclick = function () { + $(lists.filter).slideToggle(200); + $(lists.configure).hide(); + }; + + return lists; }, createSVG = function () { @@ -112,7 +259,7 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf .attr("id", "graphViewerSVG") .attr("width",width) .attr("height",height) - .attr("class", "graphViewer pull-right") + .attr("class", "graphViewer") .style("width", width + "px") .style("height", height + "px"); }, @@ -152,10 +299,11 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf slider = document.createElement("div"); slider.id = "gv_zoom_slider"; slider.className = "gv_zoom_slider"; - + background.appendChild(zoomUI); - zoomUI.appendChild(zoomButtons); + background.insertBefore(zoomUI, svg[0][0]); + zoomUI.appendChild(zoomButtons); zoomUI.appendChild(slider); $( "#gv_zoom_slider" ).slider({ orientation: "vertical", @@ -179,8 +327,8 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf graphViewer.dispatcherConfig ); toolbox.id = "toolbox"; - toolbox.className = "btn-group btn-group-vertical pull-left toolbox"; - background.appendChild(toolbox); + toolbox.className = "btn-group btn-group-vertical toolbox"; + background.insertBefore(toolbox, svg[0][0]); dispatcherUI.addAll(); // Default selection $("#control_event_expand").click(); @@ -206,6 +354,7 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf searchAttrExampleList.appendChild(entry); entry.onclick = function() { searchAttrField.value = r; + $(searchAttrExampleList).slideToggle(200); }; }); }); @@ -213,19 +362,13 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf createMenu = function() { var transparentHeader = document.createElement("div"), - searchDiv = document.createElement("div"), - searchAttrDiv = document.createElement("div"), - searchAttrExampleToggle = document.createElement("button"), - searchAttrExampleCaret = document.createElement("span"), - searchValueField = document.createElement("input"), - searchStart = document.createElement("img"), buttons = document.createElement("div"), - equalsField = document.createElement("span"), configureDropDown = document.createElement("div"), - configureList = makeConfigure( + configureLists = makeConfigure( configureDropDown, - "configuredropdown" - ), + "configuredropdown", + "filterdropdown" + ); /* nodeShaperDropDown = document.createElement("div"), @@ -270,56 +413,17 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf ), */ - showSpinner = function() { - $(background).css("cursor", "progress"); - }, - hideSpinner = function() { - $(background).css("cursor", ""); - }, - - alertError = function(msg) { - window.alert(msg); - }, - - resultCB = function(res) { - hideSpinner(); - if (res && res.errorCode && res.errorCode === 404) { - alertError("Sorry could not find a matching node."); - return; - } - return; - }, - - searchFunction = function() { - showSpinner(); - if (searchAttrField.value === "" - || searchAttrField.value === undefined) { - graphViewer.loadGraph( - searchValueField.value, - resultCB - ); - } else { - graphViewer.loadGraphWithAttributeValue( - searchAttrField.value, - searchValueField.value, - resultCB - ); - } - }; nodeShaperUI = new NodeShaperControls( - configureList, + configureLists.nodes, graphViewer.nodeShaper ); adapterUI = new ArangoAdapterControls( - configureList, + configureLists.col, graphViewer.adapter ); - searchAttrField = document.createElement("input"); - searchAttrExampleList = document.createElement("ul"); - menubar.id = "menubar"; menubar.className = "thumbnails2"; @@ -328,27 +432,6 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf buttons.id = "modifiers"; buttons.className = "pull-right"; - searchDiv.id = "transparentPlaceholder"; - searchDiv.className = "pull-left"; - - searchAttrDiv.className = "pull-left input-append searchByAttribute"; - searchAttrField.id = "attribute"; - searchAttrField.className = "input"; - searchAttrField.type = "text"; - searchAttrField.placeholder = "Attribute"; - searchAttrExampleToggle.id = "attribute_example_toggle"; - searchAttrExampleToggle.className = "btn gv_example_toggle"; - searchAttrExampleToggle.setAttribute("data-toggle", "dropdown"); - searchAttrExampleCaret.className = "caret gv_caret"; - searchAttrExampleList.className = "dropdown-menu"; - searchValueField.id = "value"; - searchValueField.className = "input-xlarge searchInput"; - searchValueField.type = "text"; - searchValueField.placeholder = "Value"; - searchStart.id = "loadnode"; - searchStart.className = "searchSubmit"; - equalsField.className = "searchEqualsLabel"; - equalsField.appendChild(document.createTextNode("==")); /* nodeShaperDropDown.id = "nodeshapermenu"; @@ -359,25 +442,9 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf configureDropDown.id = "configuremenu"; - searchStart.onclick = searchFunction; - $(searchValueField).keypress(function(e) { - if (e.keyCode === 13 || e.which === 13) { - searchFunction(); - return false; - } - - }); - menubar.appendChild(transparentHeader); - transparentHeader.appendChild(searchDiv); - searchDiv.appendChild(searchAttrDiv); - searchAttrDiv.appendChild(searchAttrField); - searchAttrDiv.appendChild(searchAttrExampleToggle); - searchAttrDiv.appendChild(searchAttrExampleList); - searchAttrExampleToggle.appendChild(searchAttrExampleCaret); - searchDiv.appendChild(equalsField); - searchDiv.appendChild(searchValueField); - searchDiv.appendChild(searchStart); + menubar.appendChild(configureLists.configure); + menubar.appendChild(configureLists.filter); transparentHeader.appendChild(buttons); buttons.appendChild(configureDropDown); @@ -387,7 +454,8 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf graphViewer.start(); }); adapterUI.addControlChangePriority(); - nodeShaperUI.addControlOpticLabelAndColour(graphViewer.adapter); + // nodeShaperUI.addControlOpticLabelAndColour(graphViewer.adapter); + nodeShaperUI.addControlOpticLabelAndColourList(graphViewer.adapter); /* buttons.appendChild(nodeShaperDropDown); @@ -405,13 +473,8 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf createColourList = function() { colourList = nodeShaperUI.createColourMappingList(); - colourList.style.position = "absolute"; - var intSVG = $("#graphViewerSVG"); - colourList.style.top = intSVG.position().top.toFixed(1) + "px"; - colourList.style.left = (intSVG.position().left + intSVG.width()).toFixed(1) + "px"; - colourList.style.height = intSVG.height() + "px"; - colourList.style.overflow = "auto"; - container.appendChild(colourList); + colourList.className = "gv_colour_list"; + background.insertBefore(colourList, svg[0][0]); }; container.appendChild(menubar); container.appendChild(background); diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/ui/graphViewerWidget.js b/js/apps/system/aardvark/frontend/js/graphViewer/ui/graphViewerWidget.js index d1bee967fb..75955eaa09 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/ui/graphViewerWidget.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/ui/graphViewerWidget.js @@ -60,7 +60,7 @@ function GraphViewerWidget(viewerConfig, startNode) { .attr("width",width) .attr("height",height) .attr("class", "graphViewer") - .attr("style", "width:" + width + "px;height:" + height + ";"); + .attr("style", "width:" + width + "px;height:" + height + "px;"); }, shouldCreateToolbox = function(config) { @@ -192,4 +192,4 @@ function GraphViewerWidget(viewerConfig, startNode) { } parseActions(viewerConfig.actions); -} \ No newline at end of file +} diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/ui/layouterControls.js b/js/apps/system/aardvark/frontend/js/graphViewer/ui/layouterControls.js index 88e4272af8..e5f90dd141 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/ui/layouterControls.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/ui/layouterControls.js @@ -37,13 +37,12 @@ function LayouterControls(list, layouter) { if (layouter === undefined) { throw "The Layouter has to be given."; } - var self = this, - baseClass = "layout"; + var self = this; this.addControlGravity = function() { var prefix = "control_layout_gravity", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Gravity", prefix, function() { + uiComponentsHelper.createButton(list, "Gravity", prefix, function() { modalDialogHelper.createModalDialog("Switch Gravity Strength", idprefix, [{ type: "text", @@ -61,7 +60,7 @@ function LayouterControls(list, layouter) { this.addControlCharge = function() { var prefix = "control_layout_charge", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Charge", prefix, function() { + uiComponentsHelper.createButton(list, "Charge", prefix, function() { modalDialogHelper.createModalDialog("Switch Charge Strength", idprefix, [{ type: "text", @@ -79,7 +78,7 @@ function LayouterControls(list, layouter) { this.addControlDistance = function() { var prefix = "control_layout_distance", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Distance", prefix, function() { + uiComponentsHelper.createButton(list, "Distance", prefix, function() { modalDialogHelper.createModalDialog("Switch Distance Strength", idprefix, [{ type: "text", @@ -101,4 +100,4 @@ function LayouterControls(list, layouter) { self.addControlCharge(); }; -} \ No newline at end of file +} diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/ui/modalDialogHelper.js b/js/apps/system/aardvark/frontend/js/graphViewer/ui/modalDialogHelper.js index bf6be0d524..1ed5fca83a 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/ui/modalDialogHelper.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/ui/modalDialogHelper.js @@ -196,9 +196,9 @@ var modalDialogHelper = modalDialogHelper || {}; }, displayDecissionRowsOfGroup = function(group) { - var rows = $(".decission_" + group), + var options = $(".decission_" + group), selected = $("input[type='radio'][name='" + group + "']:checked").attr("id"); - rows.each(function() { + options.each(function() { if ($(this).attr("decider") === selected) { $(this).css("display", ""); } else { @@ -213,7 +213,8 @@ var modalDialogHelper = modalDialogHelper || {}; text, isDefault, interior, contentTh, table) { var input = document.createElement("input"), id = idPre + idPost, - lbl = document.createElement("label"); + lbl = document.createElement("label"), + tBody = document.createElement("tbody"); input.id = id; input.type = "radio"; input.name = group; @@ -222,10 +223,11 @@ var modalDialogHelper = modalDialogHelper || {}; contentTh.appendChild(lbl); lbl.appendChild(input); lbl.appendChild(document.createTextNode(text)); + table.appendChild(tBody); + $(tBody).toggleClass("decission_" + group, true); + $(tBody).attr("decider", id); _.each(interior, function(o) { - var row = $(insertModalRow(table, idPre, o)); - row.toggleClass("decission_" + group, true); - row.attr("decider", id); + insertModalRow(tBody, idPre, o); }); if (isDefault) { input.checked = true; diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/ui/nodeShaperControls.js b/js/apps/system/aardvark/frontend/js/graphViewer/ui/nodeShaperControls.js index 1f058b7d4f..5a6458561a 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/ui/nodeShaperControls.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/ui/nodeShaperControls.js @@ -38,7 +38,6 @@ function NodeShaperControls(list, shaper) { throw "The NodeShaper has to be given."; } var self = this, - baseClass = "graph", colourDiv, fillColourDiv = function(mapping) { @@ -63,7 +62,7 @@ function NodeShaperControls(list, shaper) { }; this.addControlOpticShapeNone = function() { - uiComponentsHelper.createButton(baseClass, list, "None", "control_node_none", function() { + uiComponentsHelper.createButton(list, "None", "control_node_none", function() { shaper.changeTo({ shape: { type: NodeShaper.shapes.NONE @@ -75,7 +74,7 @@ function NodeShaperControls(list, shaper) { this.addControlOpticShapeCircle = function() { var prefix = "control_node_circle", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Circle", prefix, function() { + uiComponentsHelper.createButton(list, "Circle", prefix, function() { modalDialogHelper.createModalDialog("Switch to Circle", idprefix, [{ type: "text", @@ -96,7 +95,7 @@ function NodeShaperControls(list, shaper) { this.addControlOpticShapeRect = function() { var prefix = "control_node_rect", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Rectangle", prefix, function() { + uiComponentsHelper.createButton(list, "Rectangle", prefix, function() { modalDialogHelper.createModalDialog("Switch to Rectangle", "control_node_rect_", [{ type: "text", @@ -122,7 +121,7 @@ function NodeShaperControls(list, shaper) { this.addControlOpticLabel = function() { var prefix = "control_node_label", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Label", prefix, function() { + uiComponentsHelper.createButton(list, "Label", prefix, function() { modalDialogHelper.createModalChangeDialog("Change label attribute", idprefix, [{ type: "text", @@ -144,7 +143,7 @@ function NodeShaperControls(list, shaper) { this.addControlOpticSingleColour = function() { var prefix = "control_node_singlecolour", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Single Colour", prefix, function() { + uiComponentsHelper.createButton(list, "Single Colour", prefix, function() { modalDialogHelper.createModalDialog("Switch to Colour", idprefix, [{ type: "text", @@ -170,7 +169,7 @@ function NodeShaperControls(list, shaper) { this.addControlOpticAttributeColour = function() { var prefix = "control_node_attributecolour", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Colour by Attribute", prefix, function() { + uiComponentsHelper.createButton(list, "Colour by Attribute", prefix, function() { modalDialogHelper.createModalDialog("Display colour by attribute", idprefix, [{ type: "text", @@ -191,7 +190,7 @@ function NodeShaperControls(list, shaper) { this.addControlOpticExpandColour = function() { var prefix = "control_node_expandcolour", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Expansion Colour", prefix, function() { + uiComponentsHelper.createButton(list, "Expansion Colour", prefix, function() { modalDialogHelper.createModalDialog("Display colours for expansion", idprefix, [{ type: "text", @@ -221,7 +220,7 @@ function NodeShaperControls(list, shaper) { this.addControlOpticLabelAndColour = function(adapter) { var prefix = "control_node_labelandcolour", idprefix = prefix + "_"; - uiComponentsHelper.createButton(baseClass, list, "Label", prefix, function() { + uiComponentsHelper.createButton(list, "Label", prefix, function() { modalDialogHelper.createModalChangeDialog("Change label attribute", idprefix, [{ type: "text", @@ -270,6 +269,72 @@ function NodeShaperControls(list, shaper) { ); }); }; + + this.addControlOpticLabelAndColourList = function(adapter) { + var prefix = "control_node_labelandcolourlist", + idprefix = prefix + "_"; + uiComponentsHelper.createButton(list, "Label", prefix, function() { + modalDialogHelper.createModalChangeDialog("Change label attribute", + idprefix, [{ + type: "extendable", + id: "label", + text: "Vertex label attribute", + objects: shaper.getLabel() + },{ + type: "decission", + id: "samecolour", + group: "colour", + text: "Use this attribute for coloring, too", + isDefault: (shaper.getLabel() === shaper.getColor()) + },{ + type: "decission", + id: "othercolour", + group: "colour", + text: "Use different attribute for coloring", + isDefault: (shaper.getLabel() !== shaper.getColor()), + interior: [ + { + type: "extendable", + id: "colour", + text: "Color attribute", + objects: shaper.getColor() || "" + } + ] + }], function () { + var lblList = $("input[id^=" + idprefix + "label_]"), + colList = $("input[id^=" + idprefix + "colour_]"), + selected = $("input[type='radio'][name='colour']:checked").attr("id"), + labels = [], colours = []; + lblList.each(function(i, t) { + var val = $(t).attr("value"); + if (val !== "") { + labels.push(val); + } + }); + colList.each(function(i, t) { + var val = $(t).attr("value"); + if (val !== "") { + colours.push(val); + } + }); + if (selected === idprefix + "samecolour") { + colours = labels; + } + shaper.changeTo({ + label: labels, + color: { + type: "attribute", + key: colours + } + }); + if (colourDiv === undefined) { + colourDiv = self.createColourMappingList(); + } + + } + ); + }); + }; ////////////////////////////////////////////////////////////////// // Multiple Buttons diff --git a/js/apps/system/aardvark/frontend/js/graphViewer/ui/uiComponentsHelper.js b/js/apps/system/aardvark/frontend/js/graphViewer/ui/uiComponentsHelper.js index e97503616c..8ded61658e 100644 --- a/js/apps/system/aardvark/frontend/js/graphViewer/ui/uiComponentsHelper.js +++ b/js/apps/system/aardvark/frontend/js/graphViewer/ui/uiComponentsHelper.js @@ -33,11 +33,24 @@ var uiComponentsHelper = uiComponentsHelper || {}; (function componentsHelper() { "use strict"; - uiComponentsHelper.createButton = function(baseclass, list, title, prefix, callback) { + uiComponentsHelper.createButton = function(list, title, prefix, callback) { + var li = document.createElement("li"), + button = document.createElement("button"); + li.className = "graph_control " + prefix; + li.id = prefix; + li.appendChild(button); + button.className = "btn btn-primary gv_dropdown_entry"; + button.appendChild(document.createTextNode(title)); + list.appendChild(li); + button.id = prefix + "_button"; + button.onclick = callback; + }; + + uiComponentsHelper.createListEntry = function(list, title, prefix, callback) { var button = document.createElement("li"), a = document.createElement("a"), label = document.createElement("label"); - button.className = baseclass + "_control " + prefix; + button.className = "graph_control " + prefix; button.id = prefix; button.appendChild(a); a.className = "gv_dropdown_entry"; diff --git a/js/apps/system/aardvark/frontend/js/lib/jquery.contextmenu.js b/js/apps/system/aardvark/frontend/js/lib/jquery.contextmenu.js new file mode 100644 index 0000000000..136c85fdd9 --- /dev/null +++ b/js/apps/system/aardvark/frontend/js/lib/jquery.contextmenu.js @@ -0,0 +1,265 @@ +/** + * Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com) + * + * Dual licensed under the MIT and GPL licenses. + * This basically means you can use this code however you want for + * free, but don't claim to have written it yourself! + * Donations always accepted: http://www.JavascriptToolbox.com/donate/ + * + * Please do not link to the .js files on javascripttoolbox.com from + * your site. Copy the files locally to your server instead. + * + */ +/** + * jquery.contextmenu.js + * jQuery Plugin for Context Menus + * http://www.JavascriptToolbox.com/lib/contextmenu/ + * + * Copyright (c) 2008 Matt Kruse (javascripttoolbox.com) + * Dual licensed under the MIT and GPL licenses. + * + * @version 1.1 + * @history 1.1 2010-01-25 Fixed a problem with 1.4 which caused undesired show/hide animations + * @history 1.0 2008-10-20 Initial Release + * @todo slideUp doesn't work in IE - because of iframe? + * @todo Hide all other menus when contextmenu is shown? + * @todo More themes + * @todo Nested context menus + */ +;(function($){ + $.contextMenu = { + shadow:true, + shadowOffset:0, + shadowOffsetX:5, + shadowOffsetY:5, + shadowWidthAdjust:-3, + shadowHeightAdjust:-3, + shadowOpacity:.2, + shadowClass:'context-menu-shadow', + shadowColor:'black', + + offsetX:0, + offsetY:0, + appendTo:'body', + direction:'down', + constrainToScreen:true, + + showTransition:'show', + hideTransition:'hide', + showSpeed:null, + hideSpeed:null, + showCallback:null, + hideCallback:null, + + className:'context-menu', + itemClassName:'context-menu-item', + itemHoverClassName:'context-menu-item-hover', + disabledItemClassName:'context-menu-item-disabled', + disabledItemHoverClassName:'context-menu-item-disabled-hover', + separatorClassName:'context-menu-separator', + innerDivClassName:'context-menu-item-inner', + themePrefix:'context-menu-theme-', + theme:'default', + + separator:'context-menu-separator', // A specific key to identify a separator + target:null, // The target of the context click, to be populated when triggered + menu:null, // The jQuery object containing the HTML object that is the menu itself + shadowObj:null, // Shadow object + bgiframe:null, // The iframe object for IE6 + shown:false, // Currently being shown? + useIframe:/*@cc_on @*//*@if (@_win32) true, @else @*/false,/*@end @*/ // This is a better check than looking at userAgent! + + // Create the menu instance + create: function(menu,opts) { + var cmenu = $.extend({},this,opts); // Clone all default properties to created object + + // If a selector has been passed in, then use that as the menu + if (typeof menu=="string") { + cmenu.menu = $(menu); + } + // If a function has been passed in, call it each time the menu is shown to create the menu + else if (typeof menu=="function") { + cmenu.menuFunction = menu; + } + // Otherwise parse the Array passed in + else { + cmenu.menu = cmenu.createMenu(menu,cmenu); + } + if (cmenu.menu) { + cmenu.menu.css({display:'none'}); + $(cmenu.appendTo).append(cmenu.menu); + } + + // Create the shadow object if shadow is enabled + if (cmenu.shadow) { + cmenu.createShadow(cmenu); // Extracted to method for extensibility + if (cmenu.shadowOffset) { cmenu.shadowOffsetX = cmenu.shadowOffsetY = cmenu.shadowOffset; } + } + $('body').bind('contextmenu',function(){cmenu.hide();}); // If right-clicked somewhere else in the document, hide this menu + return cmenu; + }, + + // Create an iframe object to go behind the menu + createIframe: function() { + return $('