1
0
Fork 0

Merge remote-tracking branch 'origin/devel' into sharding

Conflicts:
	arangod/VocBase/document-collection.c
	arangosh/CMakeLists.txt
	js/apps/system/aardvark/test/karma/karma.conf.js
This commit is contained in:
Michael Hackstein 2014-02-18 08:50:27 +01:00
commit 015ab56259
52 changed files with 600 additions and 436 deletions

View File

@ -1,6 +1,6 @@
language: c
before_script: "bash -c 'cd UnitTests/HttpInterface && gem install bundler && bundle'"
script: "make setup && ./configure --enable-relative --enable-all-in-one-libev --enable-all-in-one-v8 --enable-all-in-one-icu && make -j2 && make unittests-shell-server unittests-shell-server-ahuacatl unittests-http-server SKIP_RANGES=1 && echo 'done'"
before_script: "bash -c Installation/travisCI/before_script.sh"
script: "bash -c Installation/travisCI/script.sh"
branches:
only:
- master

View File

@ -1,6 +1,10 @@
v1.5.0 (XXXX-XX-XX)
-------------------
* added AQL SLICE function to extract slices from lists
* removed check-server binary
* made module loader more node compatible
* the startup option `--javascript.package-path` for arangosh is now deprecated and does

View File

@ -37,7 +37,6 @@ set(BIN_ARANGOIMP arangoimp)
set(BIN_ARANGOIRB arangoirb)
set(BIN_ARANGORESTORE arangorestore)
set(BIN_ARANGOSH arangosh)
set(BIN_CHECK_SERVER check-server)
set(SCRIPT_ARANGO_DFDB arango-dfdb)
set(SCRIPT_FOXX_MANAGER foxx-manager)

View File

@ -1113,6 +1113,35 @@ AQL supports the following functions to operate on list values:
position only `true` or `false` are returned, depending on whether the sought element
is contained in the list.
- @FN{SLICE(@FA{list}, @FA{start}, @FA{length})}: extracts a slice of the list specified
by @FA{list}. The extraction will start at list element with position @FA{start}.
Positions start at 0. Up to @FA{length} elements will be extracted. If @FA{length} is
not specified, all list elements starting at @FA{start} will be returned.
If @FA{start} is negative, it can be used to indicate positions from the end of the
list.
Examples:
SLICE([ 1, 2, 3, 4, 5 ], 0, 1)
will return `[ 1 ]`
SLICE([ 1, 2, 3, 4, 5 ], 1, 2)
will return `[ 2, 3 ]`
SLICE([ 1, 2, 3, 4, 5 ], 3)
will return `[ 4, 5 ]`
SLICE([ 1, 2, 3, 4, 5 ], 1, -1)
will return `[ 2, 3, 4 ]`
SLICE([ 1, 2, 3, 4, 5 ], 0, -2)
will return `[ 1, 2, 3 ]`
- @FN{UNIQUE(@FA{list})}: returns all unique elements in @FA{list}. To determine
uniqueness, the function will use the comparison order defined in @ref AqlTypeOrder.
Calling this function might return the unique elements in any order.
@ -1125,25 +1154,28 @@ AQL supports the following functions to operate on list values:
@LIT{UNION_DISTINCT} function or apply the @LIT{UNIQUE} on the result of @LIT{union}.
Example:
RETURN UNION(
[ 1, 2, 3 ],
[ 1, 2 ]
)
will produce:
[ [ 1, 2, 3, 1, 2 ] ]
with duplicate removal:
RETURN UNIQUE(
UNION(
RETURN UNION(
[ 1, 2, 3 ],
[ 1, 2 ]
)
)
will produce:
[ [ 1, 2, 3, 1, 2 ] ]
with duplicate removal:
RETURN UNIQUE(
UNION(
[ 1, 2, 3 ],
[ 1, 2 ]
)
)
will produce:
[ [ 1, 2, 3 ] ]
[ [ 1, 2, 3 ] ]
- @FN{UNION_DISTINCT(@FA{list1, list2, ...})}: returns the union of distinct values of
all lists specified. The function expects at least two list values as its arguments.

View File

@ -0,0 +1,13 @@
d='UnitTests/HttpInterface'
echo
echo "$0: switching into ${d}"
cd "${d}" || exit 1
echo
echo "$0: installing bundler"
gem install bundler || exit 1
echo
echo "$0: executing bundle"
bundle || exit 1

29
Installation/travisCI/script.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
echo
echo '$0: setup make-system'
make setup || exit 1
echo
echo "$0: configuring ArangoDB"
./configure \
--enable-relative \
--enable-all-in-one-libev \
--enable-all-in-one-v8 \
--enable-all-in-one-icu \
|| exit 1
echo
echo "$0: compiling ArangoDB"
make -j2 || exit 1
echo
echo "$0: testing ArangoDB"
make unittests-shell-server unittests-shell-server-ahuacatl unittests-http-server SKIP_RANGES=1 || exit 1
echo
echo "$0: done"

View File

@ -198,6 +198,12 @@ endif
sbin_PROGRAMS = \
bin/arangod
################################################################################
### @brief helper programs
################################################################################
noinst_bin =
################################################################################
### @brief /sbin scripts
################################################################################
@ -208,8 +214,7 @@ bin_SCRIPTS =
### @brief uninstalled programs
################################################################################
noinst_PROGRAMS = \
bin/check-server
noinst_PROGRAMS =
################################################################################
### @brief /etc data

View File

@ -675,6 +675,8 @@ TRI_associative_pointer_t* TRI_CreateFunctionsAql (void) {
REGISTER_FUNCTION("STDDEV_SAMPLE", "STDDEV_SAMPLE", true, true, "l", NULL);
REGISTER_FUNCTION("STDDEV_POPULATION", "STDDEV_POPULATION", true, true, "l", NULL);
REGISTER_FUNCTION("UNIQUE", "UNIQUE", true, false, "l", NULL);
REGISTER_FUNCTION("SLICE", "SLICE", true, false, "l,n|n", NULL);
// note: REVERSE() can be applied on strings, too
REGISTER_FUNCTION("REVERSE", "REVERSE", true, false, "ls", NULL);
REGISTER_FUNCTION("FIRST", "FIRST", true, false, "l", NULL);

View File

@ -230,28 +230,6 @@ install(
REGEX "^.*/common/tests$" EXCLUDE
REGEX "^.*/client/tests$" EXCLUDE)
################################################################################
### @brief check-server
################################################################################
add_executable(
${BIN_CHECK_SERVER}
V8Client/V8ClientConnection.cpp
V8Client/check-server.cpp
)
target_link_libraries(
${BIN_CHECK_SERVER}
${LIB_ARANGO_V8}
${LIB_ARANGO_CLIENT}
${LIB_ARANGO}
${V8_LIBS}
${ICU_LIBS}
${ZLIB_LIBS}
${OPENSSL_LIBS}
${MSVC_LIBS}
)
## -----------------------------------------------------------------------------
## --SECTION-- END-OF-FILE
## -----------------------------------------------------------------------------

View File

@ -103,25 +103,6 @@ bin_arangosh_SOURCES = \
arangosh/V8Client/V8ClientConnection.cpp \
arangosh/V8Client/arangosh.cpp
################################################################################
### @brief program "check-server"
################################################################################
bin_check_server_CPPFLAGS = \
-I@top_srcdir@/arangosh \
$(AM_CPPFLAGS)
bin_check_server_LDADD = \
lib/libarango_v8.a \
lib/libarango_client.a \
lib/libarango.a \
$(LIBS) \
@V8_LIBS@
bin_check_server_SOURCES = \
arangosh/V8Client/V8ClientConnection.cpp \
arangosh/V8Client/check-server.cpp
## -----------------------------------------------------------------------------
## --SECTION-- END-OF-FILE
## -----------------------------------------------------------------------------

View File

@ -1,233 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief checks server is alive and answering requests
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2004-2013 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 Dr. Frank Celler
/// @author Copyright 2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
#include "BasicsC/common.h"
#include "ArangoShell/ArangoClient.h"
#include "BasicsC/init.h"
#include "BasicsC/logging.h"
#include "Rest/InitialiseRest.h"
#include "V8Client/V8ClientConnection.h"
using namespace std;
using namespace triagens::basics;
using namespace triagens::rest;
using namespace triagens::httpclient;
using namespace triagens::v8client;
using namespace triagens::arango;
// -----------------------------------------------------------------------------
// --SECTION-- private functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief exit function
////////////////////////////////////////////////////////////////////////////////
#ifdef _WIN32
static void checkserverExitFunction (int exitCode, void* data) {
int res = 0;
// ...........................................................................
// TODO: need a terminate function for windows to be called and cleanup
// any windows specific stuff.
// ...........................................................................
res = finaliseWindows(TRI_WIN_FINAL_WSASTARTUP_FUNCTION_CALL, 0);
if (res != 0) {
exit(1);
}
exit(exitCode);
}
#else
static void checkserverExitFunction (int exitCode, void* data) {
}
#endif
////////////////////////////////////////////////////////////////////////////////
/// @brief startup function
////////////////////////////////////////////////////////////////////////////////
#ifdef _WIN32
static void checkserverEntryFunction () {
int maxOpenFiles = 1024;
int res = 0;
// ...........................................................................
// Uncomment this to call this for extended debug information.
// If you familiar with valgrind ... then this is not like that, however
// you do get some similar functionality.
// ...........................................................................
//res = initialiseWindows(TRI_WIN_INITIAL_SET_DEBUG_FLAG, 0);
res = initialiseWindows(TRI_WIN_INITIAL_SET_INVALID_HANLE_HANDLER, 0);
if (res != 0) {
_exit(1);
}
res = initialiseWindows(TRI_WIN_INITIAL_SET_MAX_STD_IO,(const char*)(&maxOpenFiles));
if (res != 0) {
_exit(1);
}
res = initialiseWindows(TRI_WIN_INITIAL_WSASTARTUP_FUNCTION_CALL, 0);
if (res != 0) {
_exit(1);
}
TRI_Application_Exit_SetExit(checkserverExitFunction);
}
#else
static void checkserverEntryFunction () {
}
#endif
////////////////////////////////////////////////////////////////////////////////
/// @brief return a new client connection instance
////////////////////////////////////////////////////////////////////////////////
static V8ClientConnection* CreateConnection (Endpoint* endpoint) {
return new V8ClientConnection(endpoint,
"_system", // database
"", // user
"", //
300, // request timeout
3, // connection timeout
3, // retries
false,
0);
}
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief main
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char* argv[]) {
int ret = EXIT_SUCCESS;
checkserverEntryFunction();
TRIAGENS_C_INITIALISE(argc, argv);
TRIAGENS_REST_INITIALISE(argc, argv);
TRI_InitialiseLogging(false);
if (4 < argc || argc < 2) {
cerr << "usage: " << argv[0] << " <endpoint> [<retries> [start|stop]]" << endl;
exit(EXIT_FAILURE);
}
int loop = 1;
bool start = true;
if (2 < argc) {
loop = StringUtils::int32(argv[2]);
}
if (3 < argc) {
if (strcmp(argv[3], "stop") == 0) {
start = false;
}
}
const char* endpointString = argv[1];
Endpoint* endpoint = Endpoint::clientFactory(endpointString);
if (endpoint != 0) {
bool connected = false;
bool waitFor = start;
int i = 0;
do {
V8ClientConnection* connection = CreateConnection(endpoint);
if (connection->isConnected() && connection->getLastHttpReturnCode() == HttpResponse::OK) {
cout << "version: " << connection->getVersion() << endl;
connected = true;
}
else {
cout << "cannot connect to '" << endpointString << "'" << endl;
}
delete connection;
i++;
if (waitFor != connected && i < loop) {
sleep(1);
}
}
while (waitFor != connected && i < loop);
if (connected != waitFor) {
if (start) {
cout << "server '" << endpointString << "' failed to start" << endl;
}
else {
cout << "server '" << endpointString << "' failed to stop" << endl;
}
ret = EXIT_FAILURE;
}
}
else {
cout << "cannot parse endpoint definition '" << endpointString << "'" << endl;
ret = EXIT_FAILURE;
}
TRIAGENS_REST_SHUTDOWN;
checkserverExitFunction(ret, NULL);
return ret;
}
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// {@inheritDoc}\\|/// @addtogroup\\|/// @page\\|// --SECTION--\\|/// @\\}"
// End:

View File

@ -76,6 +76,11 @@ var users = require("org/arangodb/users");
////////////////////////////////////////////////////////////////////////////////
function get_api_user (req, res) {
if (req.suffix.length === 0) {
actions.resultOk(req, res, actions.HTTP_OK, users.all());
return;
}
if (req.suffix.length !== 1) {
actions.resultBad(req, res, arangodb.ERROR_HTTP_BAD_PARAMETER);
return;

View File

@ -202,3 +202,64 @@ li a [class^="icon_arangodb"], li a [class*=" icon_arangodb"] {
font-size: 23px;
color: #736B68;
}
/*copy to scss*/
.fixedDropdown {
margin: 34px 0 0 0 !important;
border-radius: 0 !important;
width: 210px;
}
.fixedDropdown:after {
visibility: hidden;
}
.fixedDropdown .dropdown-item {
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
.fixedDropdown .dropdown-header {
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
padding: 0 !important;
}
.fixedDropdown a {
padding-left: 5px !important;
}
.fixedDropdown .notificationItemContent {
width: 170px;
float: left;
margin-left: 5px;
}
.fixedDropdown button {
float:right;
margin-right: 5px;
}
.innerDropdownInnerUL {
min-height: 220px;
height: 220px !important;
width: 100%;
overflow-y: scroll;
overflow-x: hidden;
float: left;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
.innerDropdownInnerUL li {
width: auto !important;
}
.innerDropdownInnerUL li:last-child {
color: red;
border-bottom: 0;
}
.fixedDropdown .notificationItem {
color: black;
}
.notificationItem i {
float:left;
}

View File

@ -61,3 +61,6 @@ body, input, textarea, .page-title span, .pingback a.url {
margin-right: 15px;
}
.fixedDropdown {
margin: 34px 0 0 !important;
}

View File

@ -4,8 +4,12 @@
<div class="navlogo">
<a class="logo" href="#"><img src="img/logo_arangodb_white.png"/></a>
</div>
<div class="navmenu" id="navigationBar">
</div>
<div class="statmenu" id="statisticBar">
</div>
<div class="usermenu" id="userBar" style="float:right;">
</div>
<div class="navmenu" id="navigationBar">
</div>
</div>
</nav>

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -101,49 +101,12 @@
return returnVal;
},
removeNotifications: function () {
$.gritter.removeAll();
this.lastNotificationMessage = null;
arangoNotification: function (message) {
},
arangoNotification: function (message, time) {
var returnVal = false;
$.gritter.add({
title: "Notice:",
text: message,
time: 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());
},

View File

@ -11,7 +11,7 @@ window.ArangoUsers = Backbone.Collection.extend({
"testing": true
},
url: "../api/user",
url: "/_api/user",
initialize: function() {
//check cookies / local storage

View File

@ -5,10 +5,12 @@
window.Notification = Backbone.Model.extend({
defaults: {
"title": "",
"content": "",
"priority": "",
"seen": false
"title" : "",
"date" : 0,
"content" : "",
"priority" : "",
"tags" : "",
"seen" : false
}
});

View File

@ -76,16 +76,11 @@
});
this.foxxList = new window.FoxxCollection();
this.notificationList = new window.NotificationCollection();
this.footerView = new window.FooterView();
this.naviView = new window.NavigationView();
// this.statView = new window.StatisticBarView();
// this.userBarView = new window.UserBarView();
this.footerView.render();
this.naviView.render();
// this.statView.render();
// this.userBarView.render();
this.graphView = new window.GraphView({
graphs: this.graphs,
collection: window.arangoCollectionsStore

View File

@ -1,37 +1,40 @@
<% var appInfos = attributes.app.split(":"); %>
<div class="iconSet">
<span class="icon_arangodb_settings2" alt="Edit collection properties" title="Edit collection properties"></span>
<span class="icon_arangodb_info" title="Show API documentation"></span>
</div>
<div class="plain">
<img src="foxxes/thumbnail/<%=attributes.app %>" height="50" width="50" alt="" class="icon">
<%if (attributes.development) {%>
<span class="badge badge-success loaded">
<div class="cornered">
development
</div>
</span>
<%} else if (attributes.active) {%>
<span class="badge badge-success loaded">
<div class="cornered">
active
</div>
</span>
<%} else {%>
<span class="badge badge-success unloaded">
<div class="cornered">
inactive
</div>
</span>
<%}%>
<h5 class="collectionName"><%= appInfos[1] %><%= attributes.isSystem ? " (system)" : "" %><%= appInfos[0] === "dev" ? " (dev)" : ""%></h5>
</div>
<!--
<small>
<div class="plain foxxElement">
<% var appInfos = attributes.app.split(":"); %>
<h5 class="applicationName"><%= appInfos[1] %><%= attributes.isSystem ? " (system)" : "" %><%= appInfos[0] === "dev" ? " (dev)" : ""%></h5>
<div class="pull-right">
<span class="icon_arangodb_info ICON" title="Show API documentation"></span>
</div>
<img src="foxxes/thumbnail/<%=attributes.app %>" alt="icon" class="foxxIcon"/>
<p class="foxxDescription">
<!--Description: <%=attributes.description %><br /> -->
Description: <%=attributes.description %><br />
<strong>Mount:</strong>&nbsp;<%=attributes.mount %><br />
<strong>Version:</strong>&nbsp;<%=appInfos[2] %><br />
<strong>Prefix:</strong>&nbsp;<%=attributes.options && attributes.options.collectionPrefix%><br />
<!--Git: <a href=<%=attributes.git %>>Repository</a>-->
</p>
<%if (attributes.development) {%>
<span class="badge badge-success loaded badge-foxx">
<div class="cornered">
development
</div>
</span>
<%} else if (attributes.active) {%>
<span class="badge badge-success loaded badge-foxx">
<div class="cornered">
active
</div>
</span>
<%} else {%>
<span class="badge badge-success unloaded badge-foxx">
<div class="cornered">
inactive
</div>
</span>
<%}%>
</div>
Git: <a href=<%=attributes.git %>>Repository</a>
</small>
-->

View File

@ -1,3 +1,19 @@
<div class="iconSet">
<span id="editCollection" class="icon_arangodb_settings2" alt="Edit collection properties" title="Edit collection properties"></span>
<% if(attributes.status === "loaded") { %>
<span class="icon_arangodb_info" title="Show collection properties"></span>
<%} else {%>
<span class="icon_arangodb_info disabled" alt="disabled"></span>
<%}%>
</div>
<div class="plain">
<img src="<%= attributes.picture %>" height="50" width="50" alt="" class="icon">
<span class="badge badge-success <%= attributes.status %>"><div class="cornered"><%= attributes.status %></div></span>
<h5 class="collectionName"><%= attributes.name %><%= attributes.isSystem ? " (system)" : "" %></h5>
</div>
<small>
<div class="plain">
<h5 class="applicationName"><%= attributes.name %><%= attributes.isSystem ? " (system)" : "" %></h5>

View File

@ -0,0 +1,10 @@
<% var i; for (i=0; i < notifications.length; i++) { %>
<li class="dropdown-item">
<div class="notificationItem">
<a class="notificationItemTitle"><%=notifications[i].attributes.title%></a>
<div class="notificationItemContent"><%=notifications[i].attributes.content%></div>
<i class="fa fa-times-circle-o"></i>
</div>
</li>
<% console.log(i); } %>

View File

@ -1,5 +1,7 @@
<ul class="navlist" id="arangoCollectionUl">
<!-- <li class="statMenu"><a id="stat_cpu" class="tab" href="#dashboard"><img src="img/tmp_dashbord_activity_yellow.jpg"></a></li>
<li class="statMenu"><a id="stat_hd" class="tab" href="#dashboard"><img src="img/tmp_dashbord_activity_green.jpg"></a></li>
<li class="statMenu"><a id="stat_ram" class="tab" href="#dashboard"><img src="img/tmp_dashbord_activity_red.jpg"></a></li>-->
</ul>
<div class="navlogo">
<a id="stat_cpu" href="#dashboard" style="padding-left: 5px">
<img src="img/tmp_dashbord_activity_yellow.jpg">
<img src="img/tmp_dashbord_activity_green.jpg">
<img height="23"src="img/tmp_dashbord_activity_red.jpg">
</a>
</div>

View File

@ -0,0 +1,41 @@
<ul class="navlist" id="userBarUl">
<div class="navlogo">
<a id="stat_hd" class="notificationButton">
<img src="img/tmpNotificationCounter.jpg">
</a>
</div>
<li class="dropdown">
<a href="#" class="tab" id="user" >
<img src="<%=img%>" id="userimage" height="23" width="23" /> <b class="caret"></b>
</a>
<ul class="user-dropdown-menu" id="user_dropdown">
<li class="dropdown-header"><%=prename%> <%=lastname%></li>
<li class="dropdown-item">
<a id="user" class="tab" href="#user">User profile</a>
</li>
<li class="dropdown-item">
<a id="user" class="tab" href="#user">User management</a>
</li>
<li class="dropdown-item">
<a id="user" class="tab" href="#user">Logout</a>
</li>
</ul>
</li>
<li class="dropdown">
<ul class="user-dropdown-menu fixedDropdown" id="notification_menu">
<li class="dropdown-header"><a>Notifications</a></li>
<ul class="innerDropdownInnerUL">
</ul>
<button id="removeAllNotifications" class="btn btn-danger">Clear</button>
</ul>
</li>
</ul>

View File

@ -131,10 +131,6 @@
}
var changeResult = window.arangoCollectionsStore.changeCollection(collid, wfs, journalSize);
if (result === true) {
arangoHelper.arangoNotification("Collection renamed");
}
if (result !== true) {
if (result !== undefined) {
arangoHelper.arangoError("Collection error: " + result);
@ -168,14 +164,12 @@
}
});
this.hideModal();
arangoHelper.arangoNotification("Collection renamed");
}
else {
arangoHelper.arangoError("Collection error: " + result2);
}
}
else {
//arangoHelper.arangoNotification("No changes.");
this.hideModal();
}
}
@ -209,10 +203,7 @@
var self = this;
var collName = self.myCollection.name;
var returnval = window.arangoCollectionsStore.deleteCollection(collName);
if (returnval === true) {
arangoHelper.arangoNotification('Collection deleted successfully.');
}
else {
if (returnval === false) {
arangoHelper.arangoError('Could not delete collection.');
}
self.hideModal();

View File

@ -105,7 +105,6 @@
self.handleError(err.status, err.statusText, name);
},
success: function(data) {
arangoHelper.arangoNotification("Database " + name + " created.");
self.hideModal();
self.updateDatabases();
}

View File

@ -93,10 +93,7 @@
}
result = window.arangoDocumentStore.saveDocument(this.colid, this.docid, model);
if (result === true) {
arangoHelper.arangoNotification('Document saved');
}
else if (result === false) {
if (result === false) {
arangoHelper.arangoError('Document error');
}
}
@ -104,10 +101,7 @@
editor = ace.edit("sourceEditor");
model = editor.getValue();
result = window.arangoDocumentStore.saveEdge(this.colid, this.docid, model);
if (result === true) {
arangoHelper.arangoNotification('Edge saved');
}
else if (result === false) {
if (result === false) {
arangoHelper.arangoError('Edge error');
}
}

View File

@ -350,7 +350,6 @@
//Success
if (result !== false) {
window.location.hash = "collection/" + result;
arangoHelper.arangoNotification('Document created');
return;
}
//Error
@ -424,18 +423,16 @@
result = window.arangoDocumentStore.deleteDocument(this.colid, this.docid);
if (result === true) {
//on success
arangoHelper.arangoNotification('Document deleted');
deleted = true;
}
else if (result === false) {
arangoHelper.arangoError('Could not delete document');
arangoHelper.arangoError('Doc error');
}
}
else if (this.type === 'edge') {
result = window.arangoDocumentStore.deleteEdge(this.colid, this.docid);
if (result === true) {
//on success
arangoHelper.arangoNotification('Edge deleted');
deleted = true;
}
else if (result === false) {

View File

@ -34,7 +34,6 @@
success: function(data) {
if (self.isOffline === true) {
self.isOffline = false;
arangoHelper.removeNotifications();
if (!self.firstLogin) {
window.setTimeout(function(){
arangoHelper.arangoNotification("Server connected");

View File

@ -6,7 +6,7 @@
window.FoxxActiveView = Backbone.View.extend({
tagName: 'li',
className: "span3",
className: "tile",
template: templateEngine.createTemplate("foxxActiveView.ejs"),
events: {

View File

@ -18,8 +18,8 @@
collection: window.arangoDatabase,
current: window.currentDB
});
// this.userBarView = new window.UserBarView({});
// this.statisticBarView = new window.StatisticBarView({});
this.userBarView = new window.UserBarView({});
this.statisticBarView = new window.StatisticBarView({});
},
handleSelectDatabase: function () {
@ -34,8 +34,8 @@
isSystem: window.currentDB.get("isSystem")
}));
this.dbSelectionView.render($("#dbSelect"));
// this.userBarView.render($("#userBar"));
// this.statisticBarView.render($("#statisticBar"));
this.userBarView.render($("#userBar"));
this.statisticBarView.render($("#statisticBar"));
return this;
},

View File

@ -85,7 +85,6 @@
if (returnobj.status === true) {
self.hidden();
$("#add-collection").modal('hide');
arangoHelper.arangoNotification("Collection created");
window.App.navigate("collection/" + collName + "/documents/1", {trigger: true});
}

View File

@ -0,0 +1,25 @@
/*jslint indent: 2, nomen: true, maxlen: 100, vars: true, white: true, plusplus: true */
/*global window, document, Backbone, EJS, SwaggerUi, hljs, $, arangoHelper, templateEngine */
(function() {
"use strict";
window.notificationView = Backbone.View.extend({
el: '#content',
template: templateEngine.createTemplate("notificationView.ejs"),
events: {
},
initialize: function() {
//this.collection.fetch({async:false});
},
render: function(){
$(this.el).html(this.template.render({}));
return this;
}
});
}());

View File

@ -13,7 +13,9 @@
template: templateEngine.createTemplate("statisticBarView.ejs"),
render: function () {
$(this.el).html(this.template.render({isSystem: window.currentDB.get("isSystem")}));
$(this.el).html(this.template.render({
isSystem: window.currentDB.get("isSystem")
}));
return this;
},

View File

@ -1,21 +1,94 @@
/*jslint indent: 2, nomen: true, maxlen: 100, vars: true, white: true, plusplus: true */
/*global Backbone, templateEngine, $, window*/
(function () {
"use strict";
"use strict";
window.UserBarView = Backbone.View.extend({
el: '#statisticBar',
window.UserBarView = Backbone.View.extend({
events: {
events: {
"change #userBarSelect": "navigateBySelect",
"click .tab": "navigateByTab",
"mouseenter .dropdown": "showDropdown",
"mouseleave .dropdown": "hideDropdown",
"click .navlogo #stat_hd" : "toggleNotification"
},
},
initialize: function () {
this.notificationList = new window.NotificationCollection();
},
template: templateEngine.createTemplate("userBarView.ejs"),
notificationItem: templateEngine.createTemplate("notificationItem.ejs"),
render: function() {
$(this.el).html(this.template.render(this.template.text));
return this;
template: templateEngine.createTemplate("userBarView.ejs"),
}
});
}());
navigateBySelect: function () {
var navigateTo = $("#arangoCollectionSelect").find("option:selected").val();
window.App.navigate(navigateTo, {trigger: true});
},
navigateByTab: function (e) {
var tab = e.target || e.srcElement;
tab = $(tab).closest("a");
var navigateTo = tab.attr("id");
if (navigateTo === "user") {
$("#user_dropdown").slideToggle(200);
e.preventDefault();
return;
}
window.App.navigate(navigateTo, {trigger: true});
e.preventDefault();
},
toggleNotification: function (e) {
$('#notification_menu').toggle();
},
showDropdown: function (e) {
var tab = e.target || e.srcElement;
var navigateTo = tab.id;
if (navigateTo === "user") {
$("#user_dropdown").show(200);
return;
}
},
hideDropdown: function (e) {
var tab = e.target || e.srcElement;
var navigateTo = tab.id;
if (navigateTo === "") {
tab = $(tab).closest(".user-dropdown-menu");
navigateTo = tab.attr("id");
}
if (navigateTo === "user" || navigateTo === "user_dropdown" || navigateTo === "userimage" ) {
$("#user_dropdown").hide();
return;
}
},
updateNotifications: function() {
this.renderNotifications();
},
renderNotifications: function() {
$('.innerDropdownInnerUL').html(this.notificationItem.render({
notifications : this.notificationList.models
}));
},
render: function (el) {
this.$el = el;
this.$el.html(this.template.render({
img : "https://s.gravatar.com/avatar/9c53a795affc3c3c03801ffae90e2e11?s=80",
prename : "Floyd",
lastname : "Pepper",
notifications : this.notificationList.models
}));
this.renderNotifications();
this.delegateEvents();
this.updateNotifications();
return this.$el;
}
});
}());

View File

@ -0,0 +1,25 @@
/*jslint indent: 2, nomen: true, maxlen: 100, vars: true, white: true, plusplus: true */
/*global window, document, Backbone, EJS, SwaggerUi, hljs, $, arangoHelper, templateEngine */
(function() {
"use strict";
window.userManagementView = Backbone.View.extend({
el: '#content',
template: templateEngine.createTemplate("userManagementView.ejs"),
events: {
},
initialize: function() {
//this.collection.fetch({async:false});
},
render: function(){
$(this.el).html(this.template.render({}));
return this;
}
});
}());

View File

@ -0,0 +1,25 @@
/*jslint indent: 2, nomen: true, maxlen: 100, vars: true, white: true, plusplus: true */
/*global window, document, Backbone, EJS, SwaggerUi, hljs, $, arangoHelper, templateEngine */
(function() {
"use strict";
window.userProfileView = Backbone.View.extend({
el: '#content',
template: templateEngine.createTemplate("userProfileView.ejs"),
events: {
},
initialize: function() {
//this.collection.fetch({async:false});
},
render: function(){
$(this.el).html(this.template.render({}));
return this;
}
});
}());

View File

@ -22,3 +22,4 @@ $c_dark_grey: #999999;
$c_transp: transparent;
$c_semi_transp: rgba(0, 0, 0, 0.2);
$c_very_transp: rgba(0, 0, 0, 0.05);

View File

@ -9,6 +9,8 @@ li.tile {
text-align:center;
height:100px;
width: 230px;
list-style: none;
background-color: $c_very_transp;
margin: {
left: 6px;
right: 6px;

View File

@ -189,6 +189,8 @@ li.tile {
text-align: center;
height: 100px;
width: 230px;
list-style: none;
background-color: rgba(0, 0, 0, 0.05);
margin-left: 6px;
margin-right: 6px;
margin-bottom: 13px;

View File

@ -2,7 +2,6 @@
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<!-- ArangoDB web interface -->
<meta charset="utf-8">
<title>ArangoDB Web Interface</title>
<meta name="description" content="ArangoDB Admin Web Interface">

View File

@ -126,6 +126,7 @@ module.exports = function(karma) {
'frontend/js/models/arangoStatistics.js',
'frontend/js/models/arangoStatisticsDescription.js',
'frontend/js/models/foxx.js',
'frontend/js/models/notification.js',
'frontend/js/models/graph.js',
'frontend/js/models/clusterServer.js',
'frontend/js/models/clusterCoordinator.js',
@ -149,6 +150,7 @@ module.exports = function(karma) {
'frontend/js/collections/clusterDatabases.js',
'frontend/js/collections/clusterCollections.js',
'frontend/js/collections/clusterShards.js',
'frontend/js/collections/notificationCollection.js',
// Views
'frontend/js/views/navigationView.js',

View File

@ -69,16 +69,4 @@ describe("Arango Helper", function() {
});
describe("arango gritter ", function() {
it("warn. notification", function() {
var dummy = arangoHelper.arangoNotification("test");
expect(dummy).toBe(true);
});
it("crit. notification", function() {
var dummy = arangoHelper.arangoError("test");
expect(dummy).toBe(true);
$.gritter.removeAll();
});
});
});

View File

@ -31,6 +31,7 @@
var internal = require("internal"); // OK: time
var arangodb = require("org/arangodb");
var crypto = require("org/arangodb/crypto");
var _ = require("underscore");
var db = arangodb.db;
var ArangoError = arangodb.ArangoError;
@ -439,6 +440,32 @@ exports.document = function (username) {
};
};
////////////////////////////////////////////////////////////////////////////////
/// @fn JSF_allUser
/// @brief gets all existing users
///
/// @FUN{users.all()}
///
/// Fetches all existing ArangoDB users from the database.
////////////////////////////////////////////////////////////////////////////////
exports.all = function () {
var cursor = getStorage().all();
var result = [ ];
while (cursor.hasNext()) {
var doc = cursor.next();
var user = {
user: doc.user,
active: doc.active,
extra: doc.extra || { }
};
result.push(user);
}
return result;
};
////////////////////////////////////////////////////////////////////////////////
/// @fn JSF_reloadUsers
/// @brief reloads the user authentication data

View File

@ -2751,6 +2751,36 @@ function UNION_DISTINCT () {
return result;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief extract a slice from a list
////////////////////////////////////////////////////////////////////////////////
function SLICE (value, from, to) {
"use strict";
if (TYPEWEIGHT(value) !== TYPEWEIGHT_LIST) {
THROW(INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH, "SLICE");
}
if (TYPEWEIGHT(from) !== TYPEWEIGHT_NUMBER) {
THROW(INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH, "SLICE");
}
if (TYPEWEIGHT(to) === TYPEWEIGHT_NULL) {
to = undefined;
}
else if (TYPEWEIGHT(to) !== TYPEWEIGHT_NUMBER) {
THROW(INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH, "SLICE");
}
else {
if (to >= 0) {
to += from;
}
}
return value.slice(from, to);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief subtract lists from other lists
////////////////////////////////////////////////////////////////////////////////
@ -4238,6 +4268,7 @@ exports.RANGE = RANGE;
exports.UNIQUE = UNIQUE;
exports.UNION = UNION;
exports.UNION_DISTINCT = UNION_DISTINCT;
exports.SLICE = SLICE;
exports.MINUS = MINUS;
exports.INTERSECTION = INTERSECTION;
exports.MAX = MAX;

View File

@ -557,6 +557,74 @@ function ahuacatlFunctionsTestSuite () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN UNIQUE({ })");
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test slice function
////////////////////////////////////////////////////////////////////////////////
testSlice : function () {
var expected, actual;
actual = getQueryResults("RETURN SLICE([ ], 0, 1)");
assertEqual([ [ ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], 0, 1)");
assertEqual([ [ 1 ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], 0, 2)");
assertEqual([ [ 1, 2 ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], 1, 2)");
assertEqual([ [ 2, 3 ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], 0)");
assertEqual([ [ 1, 2, 3, 4, 5 ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], 3)");
assertEqual([ [ 4, 5 ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], 0, -1)");
assertEqual([ [ 1, 2, 3, 4 ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], 0, -2)");
assertEqual([ [ 1, 2, 3 ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], 2, -1)");
assertEqual([ [ 3, 4 ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], 10)");
assertEqual([ [ ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], 1000)");
assertEqual([ [ ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], -1000)");
assertEqual([ [ 1, 2, 3, 4, 5 ] ], actual);
actual = getQueryResults("RETURN SLICE([ 1, 2, 3, 4, 5 ], 1, -10)");
assertEqual([ [ ] ], actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test slice function
////////////////////////////////////////////////////////////////////////////////
testSliceInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN SLICE()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN SLICE(true)");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN SLICE(1)");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN SLICE('foo')");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN SLICE({ })");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN SLICE([ ])");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN SLICE([ ], { })");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN SLICE([ ], true)");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN SLICE([ ], 'foo')");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN SLICE([ ], [ ])");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN SLICE([ ], { })");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN SLICE([ ], 1, false)");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN SLICE([ ], 1, 'foo')");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH.code, "RETURN SLICE([ ], 1, [ ])");
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test left function
////////////////////////////////////////////////////////////////////////////////