1
0
Fork 0

Merge branch '1.1' of github.com:triAGENS/ArangoDB into 1.1

This commit is contained in:
a-brandt 2012-11-23 08:51:52 +01:00
commit 6d53970f90
19 changed files with 929 additions and 573 deletions

View File

@ -1,6 +1,16 @@
v1.1.beta3 (XXXX-XX-XX) v1.1.beta3 (XXXX-XX-XX)
----------------------- -----------------------
* added collection type label to web interface
* fixed issue #290: the web interface now disallows creating non-edges in edge collections
when creating collections via the web interface, the collection type must also be
specified (default is document collection)
* fixed issue #289: tab-completion does not insert any spaces
* fixed issue #282: fix escaping in web interface
* made AQL function NOT_NULL take any number of arguments. Will now return its * made AQL function NOT_NULL take any number of arguments. Will now return its
first argument that is not null, or null if all arguments are null. This is downwards first argument that is not null, or null if all arguments are null. This is downwards
compatible. compatible.

View File

@ -80,6 +80,7 @@ WIKI = \
JSModules \ JSModules \
Key-Value \ Key-Value \
NamingConventions \ NamingConventions \
NewFeatures11 \
RefManual \ RefManual \
RestDocument \ RestDocument \
RestEdge \ RestEdge \

View File

@ -23,6 +23,9 @@ The HTML and PDF versions of the manual can be found
Please contact @EXTREF_S{http://www.arangodb.org/connect,us} if you Please contact @EXTREF_S{http://www.arangodb.org/connect,us} if you
have any questions. have any questions.
New Features in ArangoDB 1.1 {#NewFeatures11}
=============================================
Upgrading to ArangoDB 1.1 {#ArangoDBUpgrading} Upgrading to ArangoDB 1.1 {#ArangoDBUpgrading}
============================================== ==============================================

View File

@ -0,0 +1,339 @@
New Features in ArangoDB 1.1 {#NewFeatures11}
=============================================
## Batch requests
ArangoDB 1.1 provides a new REST API for batch requests at `/_api/batch`.
Clients can use the API to send multiple requests to ArangoDB at once. They can
package multiple requests into just one aggregated request.
ArangoDB will then unpack the aggregated request and process the contained requests
one-by-one. When done it will send an aggregated response to the client, that the
client can then unpack to get the list of individual responses.
Using the batch request API may save network overhead because it reduces the
number of HTTP requests and responses that clients and ArangoDB need to exchange.
This may be especially important if the network is slow or if the individual
requests are small and the network overhead per request would be significant.
It should be noted that packing multiple individual requests into one aggregate
request on the client side introduces some overhead itself. The same is true
for the aggregate request unpacking and assembling on the server side. Using
batch requests may still be beneficial in many cases, but it should be obvious
that they should be used only when they replace a considerable amount of
individual requests.
For more information see @ref HttpBatch.
## More fine grained control of sync behavior
ArangoDB stores all document data in memory-mapped files. When adding new documents,
updating existing documents or deleting documents, these modifications are appended at
the end of the currently used memory-mapped datafile.
It is configurable whether ArangoDB should directly respond then and synchronise the
changes to disk asynchronously, or if it should force the synchronisation before
responding. The parameter to control this is named `waitForSync` and can be set on a
per-collection level.
Often, sychronisation is not required on collection level, but on operation level.
ArangoDB 1.1 tries to improve on this by providing extra parameters for the REST
and Javascript _document_ and _edge_ modification operations.
This parameter can be used to force synchronisation for operations that work on
collections that have `waitForSync` set to `false`.
The following REST API methods support the parameter `waitForSync` to force
synchronisation:
* `POST /_api/document`: adding a document
* `POST /_api/edge`: adding an edge
* `PATCH /_api/document`: partially update a document
* `PATCH /_api/edge`: partially update an edge
* `PUT /_api/document`: replace a document
* `PUT /_api/edge`: replace an edge
* `DELETE /_api/document`: delete a document
* `DELETE /_api/edge`: delete an edge
If the `waitForSync` parameter is omitted or set to `false`, the collection-level
synchronisation behavior will be applied. Setting the parameter to `true`
will force synchronisation.
The following Javascript methods support forcing synchronisation, too:
* save()
* update()
* relace()
* delete()
Force synchronisation of a save operation:
> db.users.save({"name":"foo"}, true);
If the second parameter is omitted or set to `false`, the collection-level
synchronisation behavior will be applied. Setting the parameter to `true`
will force synchronisation.
## Synchronisation of shape data
ArangoDB 1.1 provides an option `--database.force-sync-shapes` that controls whether
shape data (information about document attriubte names and attribute value types)
should be synchronised to disk directly after each write, or if synchronisation is
allowed to happen asynchronously.
The latter options allows ArangoDB to return faster from operations that involve new
document shapes.
In ArangoDB 1.0, shape information was always synchronised to disk, and users did not
have any options. The default value of `--database.force-sync-shapes` in ArangoDB 1.1
is `true` so it is fully compatible with ArangoDB 1.0.
However, in ArangoDB 1.1 the direct synchronisation can be turned off by setting the
value to `false`. Direct synchronisation of shape data will then be disabled for
collections that have a `waitForSync` value of `false`.
Shape data will always be synchronised directly for collections that have a `waitForSync`
value of `true`.
Still, ArangoDB 1.1 may need to perform less synchronisation when it writes shape data
(attribute names and attribute value types of collection documents).
Users may benefit if they save documents with many different structures (in terms of
document attribute names and attribute value types) in the same collection. If only
small amounts of distinct document shapes are used, the effect will not be noticable.
## Collection types
In ArangoDB 1.1, collections are now explicitly typed:
- regular documents go into _document_-only collections,
- and edges go into _edge_ collections.
In 1.0, collections were untyped, and edges and documents could be mixed in the same collection.
Whether or not a collection was to be treated as an _edge_ or _document_ collection was
decided at runtime by looking at the prefix used (e.g. `db.xxx` vs. `edges.xxx`).
The explicit collection types used in ArangoDB allow users to query the collection type at
runtime and make decisions based on the type:
arangosh> db.users.type();
Extra Javascript functions have been introduced to create collections:
arangosh> db._createDocumentCollection("users");
arangosh> db._createEdgeCollection("relationships");
The "traditional" functions are still available:
arangosh> db._create("users");
arangosh> edges._create("relationships");
The ArangoDB web interface also allows the explicit creation of _edge_
collections.
## Support for partial updates
The REST API for documents now offers the HTTP PATCH method to partially update
documents. A partial update allows specifying only the attributes the change instead
of the full document. Internally, it will merge the supplied attributes into the
existing document.
Completely overwriting/replacing entire documents is still available via the HTTP PUT
method in ArangoDB 1.0.
In _arangosh_, the partial update method is named _update_, and the previously existing
_replace_ method still performs a replacement of the entire document as before.
This call with replace just the `active` attribute of the document `user`. All other
attributes will remain unmodified. The document revision number will of course be updated
as updating creates a new revision:
arangosh> db.users.update(user, { "active" : false });
Contrary, the `replace` method will replace the entire existing document with the data
supplied. All other attributes will be removed. Replacing will also create a new revision:
arangosh> db.users.replace(user, { "active" : false });
For more information, please check @ref JS_UpdateVocbaseCol and @ref JS_ReplaeVocbaseCol.
## AQL
The following functions have been added or extended in the ArangoDB Query Language
(AQL) in ArangoDB 1.1:
- `MERGE_RECURSIVE()`: new function that merges documents recursively. Especially, it will merge
sub-attributes, a functionality not provided by the previously existing `MERGE()` function.
- `NOT_NULL()`: now works with any number of arguments and returns the first non-null argument.
If all arguments are `null`, the function will return `null`, too.
- `FIRST_LIST()`: new function that returns the first argument that is a list, and `null`
if none of the arguments are lists.
- `FIRST_DOCUMENT()`: new function that returns the first argument that is a document, and `null`
if none of the arguments are documents.
- `TO_LIST()`: converts the argument into a list.
## Endpoints
ArangoDB can now listen to incoming connections on one or many "endpoint" of different
types. In ArangoDB lingo, an endpoint is the combination of a protocol and some
configuration for it.
The currently supported protocol types are:
- `tcp`: for unencrypted connection over TCP/IP
- `ssl`: for secure connections using SSL over TCP/IP
- `unix`: for connections over Unix domain sockets
You should note that the data transferred inside the protocol is still HTTP, regardless
of the chosen protocol. The endpoint protocol can thus be understood as the envelope
that all HTTP communication is shipped inside.
To specify an endpoint, ArangoDB 1.1 introduces a new option `--server.endpoint`. The
values accepted by this option have the following specification syntax:
- `tcp://host:port (HTTP over IPv4)`
- `tcp://[host]:port (HTTP over IPv6)`
- `ssl://host:port (HTTP over SSL-encrypted IPv4)`
- `ssl://[host]:port (HTTP over SSL-encrypted IPv6)`
- `unix://path/to/socket (HTTP over Unix domain socket)`
### TCP endpoints
The configuration options for the `tcp` endpoint type are hostname/ip address and an
optional port number. If the port is ommitted, the default port number of 8529 is used.
To make the server listen to connections coming in for IP 192.168.173.13 on TCP/IP port 8529:
> bin/arangod --server.endpoint tcp://192.168.173.13:8529
To make the server listen to connections coming in for IP 127.0.0.1 TCP/IP port 999:
> bin/arangod --server.endpoint tcp://127.0.0.1:999
### SSL endpoints
SSL endpoints can be used for secure, encrypted connections to ArangoDB. The connection is
secured using SSL. SSL is computationally intensive so using it will result in an
(unavoidable) performance degradation when compared to plain-text requests.
The configuration options for the `ssl` endpoint type are the same as for `tcp` endpoints.
To make the server listen to SSL connections coming in for IP 192.168.173.13 on TCP/IP port 8529:
> bin/arangod --server.endpoint ssl://192.168.173.13:8529
As multiple endpoints can be configured, ArangoDB can serve SSL and non-SSL requests in
parallel, provided they use different ports:
> bin/arangod --server.endpoint tcp://192.168.173.13:8529 --server.endpoint ssl://192.168.173.13:8530
### Unix domain socket endpoints
The `unix` endpoint type can only be used if clients are on the same host as the _arangod_ server.
Connections will then be estabished using a Unix domain socket, which is backed by a socket descriptor
file. This type of connection should be slightly more efficient than TCP/IP.
The configuration option for a `unix` endpoint type is the socket descriptor filename:
To make the server use a Unix domain socket with filename `/var/run/arango.sock`:
> bin/arangod --server.endpoint unix:///var/run/arango.sock
## Blueprints API
Blueprints is a property graph model interface with provided implementations.
Databases that implement the Blueprints interfaces automatically support
Blueprints-enabled applications (@EXTREF{http://tinkerpop.com/,http://tinkerpop.com}).
For more information please refer to @ref HttpBluePrints.
## Server statistics
ArangoDB 1.1 allows querying the server status via REST API methods.
The following methods are available:
- `GET /_admin/connection-statistics`: provides connection statistics
- `GET /_admin/request-statistics`: provides request statistics
Both methods return the current figures and historical values. The historical
figures are aggregated. They can be used to monitor the current server status as
well as to get an overview of how the figures developed over time and look for
trends.
The ArangoDB web interface is using these APIs to provide charts with the
server connection statistics figures. It has a new tab "Statistics" for this purpose.
For more information on the APIs, please refer to @ref HttpSystemConnectionStatistics
and @ref HttpSystemRequestStatistics.
## Improved HTTP request handling
### Error codes
ArangoDB 1.1 better handles malformed HTTP requests than ArangoDB 1.0 did.
When it encounters an invalid HTTP request, it might answer with some HTTP status
codes that ArangoDB 1.0 did not use:
- `HTTP 411 Length Required` will be returned for requests that have a negative
value in their `Content-Length` HTTP header.
- `HTTP 413 Request Entity Too Large` will be returned for too big requests. The
maximum size is 512 MB at the moment.
- `HTTP 431 Request Header Field Too Large` will be returned for requests with too
long HTTP headers. The maximum size per header field is 1 MB at the moment.
For requests that are not completely shipped from the client to the server, the
server will allow the client 90 seconds of time before closing the dangling connection.
If the `Content-Length` HTTP header in an incoming request is set and contains a
value that is less than the length of the HTTP body sent, the server will return
a `HTTP 400 Bad Request`.
### Keep-Alive
In version 1.1, ArangoDB will behave as follows when it comes to HTTP keep-alive:
- if a client sends a `Connection: close` HTTP header, the server will close the connection as
requested
- if a client sends a `Connection: keep-alive` HTTP header, the server will not close the
connection but keep it alive as requested
- if a client does not send any `Connection` HTTP header, the server will assume _keep-alive_
if the request was an HTTP/1.1 request, and _close_ if the request was an HTTP/1.0 request
- dangling keep-alive connections will be closed automatically by the server after a configurable
amount of seconds. To adjust the value, use the new server option `--server.keep-alive-timeout`.
- Keep-alive can be turned off in ArangoDB by setting `--server.keep-alive-timeout` to a value of `0`.
### Configurable backlog
ArangoDB 1.1 adds an option `--server.backlog-size` to configure the system backlog size.
The backlog size controls the maximum number of queued connections and is used by the listen()
system call.
The default value in ArangoDB is 10, the maximum value is platform-dependent.
## Using V8 options
To use arbitrary options the V8 engine provides, ArangoDB 1.1 introduces a new startup
option `--javascript.v8-options`.
All options that shall be passed to V8 without being interpreted by ArangoDB can be put
inside this option. ArangoDB itself will ignore these options and will let V8 handle them.
It is up to V8 to handle these options and complain about wrong options. In case of invalid
options, V8 may refuse to start, which will also abort the startup of ArangoDB.
To get a list of all options that the V8 engine in the currently used version of ArangoDB
supports, you can use the value `--help`, which will just be passed through to V8:
> bin/arangod --javascript.v8-options "--help" /tmp/voctest
## Smaller hash indexes
Some internal structures have been adjusted in ArangoDB 1.1 so that hash index entries
consume considerably less memory.
Installations may benefit if they use unique or non-unqiue hash indexes on collections.
## arangoimp
_arangoimp_ now allows specifiying the end-of-line (EOL) character of the input file.
This allows better support for files created on Windows systems with `\r\n` EOLs.
_arangoimp_ also supports importing input files in TSV format. TSV is a simple separated
format such as CSV, but with the tab character as the separator, no quoting for values
and thus no support for line breaks inside the values.

View File

@ -10,6 +10,12 @@ The following list contains changes in ArangoDB 1.1 that are not 100% downwards-
Existing users of ArangoDB 1.0 should read the list carefully and make sure they have undertaken all Existing users of ArangoDB 1.0 should read the list carefully and make sure they have undertaken all
necessary steps and precautions before upgrading from ArangoDB 1.0 to ArangoDB 1.1. necessary steps and precautions before upgrading from ArangoDB 1.0 to ArangoDB 1.1.
## New dependencies
As ArangoDB 1.1 supports SSL connections, ArangoDB can only be built on servers with the OpenSSL
library installed. The OpenSSL is not bundled with ArangoDB and must be installed separately.
## Database directory version check and upgrade ## Database directory version check and upgrade
Starting with ArangoDB 1.1, _arangod_ will perform a database version check at startup. Starting with ArangoDB 1.1, _arangod_ will perform a database version check at startup.
@ -109,16 +115,24 @@ The following _arangod_ startup options have been removed in ArangoDB 1.1:
- `--server.require-keep-alive` - `--server.require-keep-alive`
- `--server.secure-require-keep-alive` - `--server.secure-require-keep-alive`
In version 1.1, The server will now behave as follows automatically which should be more In version 1.1, the server will behave as follows automatically which should be more
conforming to the HTTP standard: conforming to the HTTP standard:
- if a client sends a `Connection: close` HTTP header, the server will close the connection as - if a client sends a `Connection: close` HTTP header, the server will close the connection as
requested requested
- if a client sends a `Connection: keep-alive` HTTP header, the server will not close the - if a client sends a `Connection: keep-alive` HTTP header, the server will not close the
connection but keep it alive as requested connection but keep it alive as requested
- if a client does not send any `Connection` HTTP header, the server will assume _keep-alive_ - if a client does not send any `Connection` HTTP header, the server will assume _keep-alive_
if the request was an HTTP/1.1 request, and "close" if the request was an HTTP/1.0 request if the request was an HTTP/1.1 request, and _close_ if the request was an HTTP/1.0 request
- dangling keep-alive connections will be closed automatically by the server after a configurable - dangling keep-alive connections will be closed automatically by the server after a configurable
amount of seconds. To adjust the value, use the new server option `--server.keep-alive-timeout` amount of seconds. To adjust the value, use the new server option `--server.keep-alive-timeout`.
- Keep-alive can be turned off in ArangoDB by setting `--server.keep-alive-timeout` to a value of `0`.
As ArangoDB 1.1 will use keep-alive by default for incoming HTTP/1.1 requests without a
`Connection` header, using ArangoDB 1.1 from a browser will likely result in the same connection
being re-used. This may be unintuitive because requests from a browser to ArangoDB will
effectively be serialised, not parallelised. To conduct parallel requests from a browser, you
should either set `--server.keep-alive-timeout` to a value of `0`, or make your browser send
`Connection: close` HTTP headers with its requests.
## Start / stop scripts ## Start / stop scripts
@ -163,9 +177,13 @@ If one of the documents contains either a `_from` or a `_to` attribute, the coll
_edge_ collection. Otherwise, the collection is marked as a _document_ collection. _edge_ collection. Otherwise, the collection is marked as a _document_ collection.
This distinction is important because edges can only be created in _edge_ collections starting This distinction is important because edges can only be created in _edge_ collections starting
with 1.1. Client code may need to be adjusted to work with ArangoDB 1.1 if it tries to insert with 1.1. User code may need to be adjusted to work with ArangoDB 1.1 if it tries to insert
edges into _document_-only collections. edges into _document_-only collections.
User code must also be adjusted if it uses the `ArangoEdges` or `ArangoEdgesCollection` objects
that were present in ArangoDB 1.0 on the server. This only affects user code that was intended
to be run on the server, directly in ArangoDB. The `ArangoEdges` or `ArangoEdgesCollection`
objects were not exposed to _arangosh_ or any other clients.
## arangoimp / arangosh ## arangoimp / arangosh
@ -187,3 +205,9 @@ to the _arangod_ server. If no password is given on the command line, _arangoimp
will interactively prompt for a password. will interactively prompt for a password.
If no username is specified on the command line, the default user _root_ will be used but there If no username is specified on the command line, the default user _root_ will be used but there
will still be a password prompt. will still be a password prompt.
## Removed functionality
In 1.0, there were unfinished REST APIs available at the `/_admin/config` URL suffix.
These APIs were stubs only and have been removed in ArangoDB 1.1.

131
UPGRADING
View File

@ -1,130 +1 @@
Changes that should be considered when installing or upgrading ArangoDB Please refer to Documentation/Manual/Upgrading.md
-----------------------------------------------------------------------
* Starting the server
Starting with ArangoDB 1.1, arangod will perform a database version check at startup.
It will look for a file named "VERSION" in its database directory. If the file is not
present (it will not be present in an ArangoDB 1.0 database), arangod in version 1.1
will refuse to start and ask the user to run the script "arango-upgrade" first.
If the VERSION file is present but is from a non-matching version of ArangoDB, arangod
will also refuse to start and ask the user to run the upgrade script first.
This procedure shall ensure that users have full control over when they perform any
updates/upgrades of their data, and do not risk running an incompatible server/database
state tandem.
ArangoDB users are asked to run arango-upgrade when upgrading from one version of
ArangoDB to a higher version (e.g. from 1.0 to 1.1), but also after pulling the latest
ArangoDB source code while staying in the same minor version (e.g. when updating from
1.1-beta1 to 1.1-beta2).
When installing ArangoDB from scratch, users should also run arango-upgrade once to
initialise their database directory with some system collections that ArangoDB requires.
When not run, arangod will refuse to start as mentioned before.
The startup options "--port", "--server.port", "--server.http-port", and
"--server.admin-port" have all been removed for arangod in version 1.1.
All these options have been replaced by the new "--server.endpoint" option.
This option allows to specify protocol, hostname and port the server should use for
incoming connections.
The "--server.endpoint" option must be specified on server start, otherwise arangod
will refuse to start.
The server can be bound to one or multiple endpoints at once. The following endpoint
specification sytnax is currently supported:
- tcp://host:port or http@tcp://host:port (HTTP over IPv4)
- tcp://[host]:port or http@tcp://[host]:port (HTTP over IPv6)
- ssl://host:port or http@tcp://host:port (HTTP over SSL-encrypted IPv4)
- ssl://[host]:port or http@tcp://[host]:port (HTTP over SSL-encrypted IPv6)
- unix://path/to/socket or http@unix:///path/to/socket (HTTP over UNIX socket)
An example value for the option is --server.endpoint tcp://127.0.0.1:8529. This will
make the server listen to request coming in on IP address 127.0.0.1 on port 8529, and
that use HTTP over TCP/IPv4.
The arangod startup options "--server.require-keep-alive" and
"--server.secure-require-keep-alive" have been removed in 1.1. The server will now
behave as follows which should be more conforming to the HTTP standard:
* if a client sends a "Connection: close" header, the server will close the
connection as request
* if a client sends a "Connection: keep-alive" header, the server will not
close the connection but keep it alive as requested
* if a client does not send any "Connection" header, the server will assume
"keep-alive" if the request was an HTTP/1.1 request, and "close" if the
request was an HTTP/1.0 request
* dangling keep-alive connections will be closed automatically by the server after
a configurable amount of seconds. To adjust the value, use the new server option
"--server.keep-alive-timeout"
* Start / stop scripts
The user has changed from "arango" to "arangodb", the start script name has changed from
"arangod" to "arangodb", the database directory has changed from "/var/arangodb" to
"/var/lib/arangodb" to be compliant with various Linux policies.
* Collection types
In 1.1, we have introduced types for collections: regular documents go into document
collections, and edges go into edge collections. The prefixing (db.xxx vs. edges.xxx)
works slightly different in 1.1: edges.xxx can still be used to access collections,
however, it will not determine the type of existing collections anymore. In 1.0, you
could write edges.xxx.something and xxx was automatically treated as an edge collection.
As collections know and save their type in ArangoDB 1.1, this might work slightly
differently.
In 1.1, edge collections can still be created via edges._create() as in 1.0, but
a new method was also introduced that uses the db object: db._createEdgeCollection().
To create document collections, the following methods are available: db._create()
as in 1.0, and additionally there is now db._createDocumentCollection().
Collections in 1.1 are now either document or edge collections, but the two concepts
can not be mixed in the same collection. arango-upgrade will determine the types of
existing collections from 1.0 once on upgrade, based on the inspection of the first 50
documents in the collection. If one of them contains either a _from or a _to attribute,
the collection is made an edge collection, otherwise, the colleciton is marked as a
document collection.
This distinction is important because edges can only be created in edge collections
starting with 1.1. Client code may need to be adjusted for 1.1 to insert edges only
into "pure" edge collections in 1.1.
* Authorization
Starting from 1.1, arangod may be started with authentication turned on.
When turned on, all requests incoming to arangod via the HTTP interface must carry an
HTTP authorization header with a valid username and password in order to be processed.
Clients sending requests without HTTP autorization headers or with invalid usernames/
passwords will be rejected by arangod with an HTTP 401 error.
arango-upgrade will create a default user "root" with an empty password when run
initially.
To turn authorization off, the server can be started with the command line option
--server.disable-authentication true. Of course this configuration can also be stored
in a configuration file.
* arangoimp / arangosh
The parameters "connect-timeout" and "request-timeout" for arangosh and arangoimp have
been renamed to "--server.connect-timeout" and "--server.request-timeout".
The parameter "--server" has been removed for both arangoimp and arangosh.
To specify a server to connect to, the client tools now provide an option
"--server.endpoint". This option can be used to specify the protocol, hostname and port
for the connection. The default endpoint that is used when none is specified is
tcp://127.0.0.1:8529. For more information on the endpoint specification syntax, see
above.
The options "--server.username" and "--server.password" have been added for arangoimp
and arangosh in order to use authorization from these client tools, too.
These options can be used to specify the username and password when connectiong via
client tools to the arangod server. If no password is given on the command line,
arangoimp and arangosh will interactively prompt for a password.
If no username is specified on the command line, the default user "root" will be
used but there will still be a password prompt.

View File

@ -86,40 +86,40 @@ BOOST_AUTO_TEST_CASE (tst_mersenne_int31) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE (tst_mersenne_seed) { BOOST_AUTO_TEST_CASE (tst_mersenne_seed) {
TRI_SeedMersenneTwister((uint32_t) 0); TRI_SeedMersenneTwister((uint32_t) 0UL);
BOOST_CHECK_EQUAL((uint32_t) 2357136044, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2357136044UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 2546248239, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2546248239UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 3071714933, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 3071714933UL, TRI_Int32MersenneTwister());
TRI_SeedMersenneTwister((uint32_t) 1); TRI_SeedMersenneTwister((uint32_t) 1UL);
BOOST_CHECK_EQUAL((uint32_t) 1791095845, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 1791095845UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 4282876139, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 4282876139UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 3093770124, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 3093770124UL, TRI_Int32MersenneTwister());
TRI_SeedMersenneTwister((uint32_t) 2); TRI_SeedMersenneTwister((uint32_t) 2UL);
BOOST_CHECK_EQUAL((uint32_t) 1872583848, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 1872583848UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 794921487, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 794921487UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 111352301, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 111352301UL, TRI_Int32MersenneTwister());
TRI_SeedMersenneTwister((uint32_t) 23); TRI_SeedMersenneTwister((uint32_t) 23UL);
BOOST_CHECK_EQUAL((uint32_t) 2221777491, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2221777491UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 2873750246, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2873750246UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 4067173416, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 4067173416UL, TRI_Int32MersenneTwister());
TRI_SeedMersenneTwister((uint32_t) 42); TRI_SeedMersenneTwister((uint32_t) 42UL);
BOOST_CHECK_EQUAL((uint32_t) 1608637542, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 1608637542UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 3421126067, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 3421126067UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 4083286876, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 4083286876UL, TRI_Int32MersenneTwister());
TRI_SeedMersenneTwister((uint32_t) 458735); TRI_SeedMersenneTwister((uint32_t) 458735UL);
BOOST_CHECK_EQUAL((uint32_t) 1537542272, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 1537542272UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 4131475792, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 4131475792UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 2280116031, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2280116031UL, TRI_Int32MersenneTwister());
TRI_SeedMersenneTwister((uint32_t) 395568682893); TRI_SeedMersenneTwister((uint32_t) 395568682893UL);
BOOST_CHECK_EQUAL((uint32_t) 2297195664, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2297195664UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 2381406737, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2381406737UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 4184846092, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 4184846092UL, TRI_Int32MersenneTwister());
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -127,26 +127,26 @@ BOOST_AUTO_TEST_CASE (tst_mersenne_seed) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE (tst_mersenne_reseed) { BOOST_AUTO_TEST_CASE (tst_mersenne_reseed) {
TRI_SeedMersenneTwister((uint32_t) 23); TRI_SeedMersenneTwister((uint32_t) 23UL);
BOOST_CHECK_EQUAL((uint32_t) 2221777491, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2221777491UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 2873750246, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2873750246UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 4067173416, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 4067173416UL, TRI_Int32MersenneTwister());
// re-seed with same value and compare // re-seed with same value and compare
TRI_SeedMersenneTwister((uint32_t) 23); TRI_SeedMersenneTwister((uint32_t) 23UL);
BOOST_CHECK_EQUAL((uint32_t) 2221777491, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2221777491UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 2873750246, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2873750246UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 4067173416, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 4067173416UL, TRI_Int32MersenneTwister());
// seed with different value // seed with different value
TRI_SeedMersenneTwister((uint32_t) 458735); TRI_SeedMersenneTwister((uint32_t) 458735UL);
BOOST_CHECK_EQUAL((uint32_t) 1537542272, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 1537542272UL, TRI_Int32MersenneTwister());
// re-seed with original value and compare // re-seed with original value and compare
TRI_SeedMersenneTwister((uint32_t) 23); TRI_SeedMersenneTwister((uint32_t) 23UL);
BOOST_CHECK_EQUAL((uint32_t) 2221777491, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2221777491UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 2873750246, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 2873750246UL, TRI_Int32MersenneTwister());
BOOST_CHECK_EQUAL((uint32_t) 4067173416, TRI_Int32MersenneTwister()); BOOST_CHECK_EQUAL((uint32_t) 4067173416UL, TRI_Int32MersenneTwister());
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -124,7 +124,7 @@ static bool AllocateTable (TRI_hasharray_t* array, size_t numElements) {
} }
// position array directly on a cache line boundary // position array directly on a cache line boundary
offset = ((uint64_t) data) % CACHE_LINE_SIZE; offset = ((intptr_t) data) % CACHE_LINE_SIZE;
if (offset == 0) { if (offset == 0) {
// we're already on a cache line boundary // we're already on a cache line boundary
@ -134,7 +134,7 @@ static bool AllocateTable (TRI_hasharray_t* array, size_t numElements) {
// move to start of a cache line // move to start of a cache line
table = data + (CACHE_LINE_SIZE - offset); table = data + (CACHE_LINE_SIZE - offset);
} }
assert(((uint64_t) table) % CACHE_LINE_SIZE == 0); assert(((intptr_t) table) % CACHE_LINE_SIZE == 0);
array->_data = data; array->_data = data;
array->_table = table; array->_table = table;

View File

@ -353,7 +353,7 @@ void TRI_InitSkipList (TRI_skiplist_t* skiplist, size_t elementSize,
// .......................................................................... // ..........................................................................
skiplist->_base._maxHeight = maximumHeight; skiplist->_base._maxHeight = maximumHeight;
if (maximumHeight > SKIPLIST_ABSOLUTE_MAX_HEIGHT) { if (maximumHeight > SKIPLIST_ABSOLUTE_MAX_HEIGHT) {
LOG_ERROR("Invalid maximum height for skiplist", TRI_ERROR_INTERNAL); LOG_ERROR("Invalid maximum height for skiplist");
assert(false); assert(false);
} }
@ -1413,7 +1413,7 @@ void TRI_InitSkipListMulti (TRI_skiplist_multi_t* skiplist,
// .......................................................................... // ..........................................................................
skiplist->_base._maxHeight = maximumHeight; skiplist->_base._maxHeight = maximumHeight;
if (maximumHeight > SKIPLIST_ABSOLUTE_MAX_HEIGHT) { if (maximumHeight > SKIPLIST_ABSOLUTE_MAX_HEIGHT) {
LOG_ERROR("Invalid maximum height for skiplist", TRI_ERROR_INTERNAL); LOG_ERROR("Invalid maximum height for skiplist");
assert(false); assert(false);
} }

View File

@ -352,7 +352,7 @@ static bool CheckCollection (TRI_collection_t* collection) {
collection->_lastError = datafile->_lastError; collection->_lastError = datafile->_lastError;
stop = true; stop = true;
LOG_ERROR("cannot rename sealed log-file to %s, this should not happen: %s", filename, TRI_errno()); LOG_ERROR("cannot rename sealed log-file to %s, this should not happen: %s", filename, TRI_last_error());
break; break;
} }

View File

@ -248,7 +248,7 @@ static bool Compactifier (TRI_df_marker_t const* marker, void* data, TRI_datafil
TRI_READ_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(primary); TRI_READ_UNLOCK_DOCUMENTS_INDEXES_PRIMARY_COLLECTION(primary);
if (deleted) { if (deleted) {
LOG_TRACE("found a stale document: %lu", d->_did); LOG_TRACE("found a stale document: %llu", d->_did);
return true; return true;
} }
@ -256,7 +256,7 @@ static bool Compactifier (TRI_df_marker_t const* marker, void* data, TRI_datafil
res = CopyDocument(sim, marker, &result, &fid); res = CopyDocument(sim, marker, &result, &fid);
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
LOG_FATAL("cannot write compactor file: ", TRI_last_error()); LOG_FATAL("cannot write compactor file: %s", TRI_last_error());
return false; return false;
} }
@ -277,7 +277,7 @@ static bool Compactifier (TRI_df_marker_t const* marker, void* data, TRI_datafil
dfi->_numberDead += 1; dfi->_numberDead += 1;
dfi->_sizeDead += marker->_size - markerSize; dfi->_sizeDead += marker->_size - markerSize;
LOG_DEBUG("found a stale document after copying: %lu", d->_did); LOG_DEBUG("found a stale document after copying: %llu", d->_did);
TRI_WRITE_UNLOCK_DATAFILES_DOC_COLLECTION(primary); TRI_WRITE_UNLOCK_DATAFILES_DOC_COLLECTION(primary);
return true; return true;
@ -302,7 +302,7 @@ static bool Compactifier (TRI_df_marker_t const* marker, void* data, TRI_datafil
res = CopyDocument(sim, marker, &result, &fid); res = CopyDocument(sim, marker, &result, &fid);
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
LOG_FATAL("cannot write compactor file: ", TRI_last_error()); LOG_FATAL("cannot write compactor file: %s", TRI_last_error());
return false; return false;
} }

View File

@ -169,7 +169,7 @@ static int TruncateDatafile (TRI_datafile_t* datafile, TRI_voc_size_t vocSize) {
res = TRI_UNMMFile(datafile->_data, datafile->_maximalSize, &(datafile->_fd), &(datafile->_mmHandle)); res = TRI_UNMMFile(datafile->_data, datafile->_maximalSize, &(datafile->_fd), &(datafile->_mmHandle));
if (res < 0) { if (res < 0) {
LOG_ERROR("munmap failed with: %s", res); LOG_ERROR("munmap failed with: %d", res);
return res; return res;
} }
@ -514,7 +514,7 @@ static TRI_datafile_t* OpenDatafile (char const* filename, bool ignoreErrors) {
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
TRI_set_errno(res); TRI_set_errno(res);
close(fd); close(fd);
LOG_ERROR("cannot memory map file '%s': '%s'", filename, res); LOG_ERROR("cannot memory map file '%s': '%d'", filename, res);
return NULL; return NULL;
} }
@ -626,7 +626,7 @@ TRI_datafile_t* TRI_CreateDatafile (char const* filename, TRI_voc_size_t maximal
// remove empty file // remove empty file
TRI_UnlinkFile(filename); TRI_UnlinkFile(filename);
LOG_ERROR("cannot memory map file '%s': '%s'", filename, res); LOG_ERROR("cannot memory map file '%s': '%d'", filename, res);
return NULL; return NULL;
} }
@ -1009,7 +1009,7 @@ bool TRI_CloseDatafile (TRI_datafile_t* datafile) {
res = TRI_UNMMFile(datafile->_data, datafile->_maximalSize, &(datafile->_fd), &(datafile->_mmHandle)); res = TRI_UNMMFile(datafile->_data, datafile->_maximalSize, &(datafile->_fd), &(datafile->_mmHandle));
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
LOG_ERROR("munmap failed with: %s", res); LOG_ERROR("munmap failed with: %d", res);
datafile->_state = TRI_DF_STATE_WRITE_ERROR; datafile->_state = TRI_DF_STATE_WRITE_ERROR;
datafile->_lastError = res; datafile->_lastError = res;
return false; return false;

View File

@ -2439,12 +2439,12 @@ static int FillIndex (TRI_document_collection_t* collection, TRI_index_t* idx) {
++inserted; ++inserted;
if (inserted % 10000 == 0) { if (inserted % 10000 == 0) {
LOG_DEBUG("indexed %ld documents of collection %lu", inserted, (unsigned long) primary->base._cid); LOG_DEBUG("indexed %lu documents of collection %lu", (unsigned long) inserted, (unsigned long) primary->base._cid);
} }
} }
if (scanned % 10000 == 0) { if (scanned % 10000 == 0) {
LOG_TRACE("scanned %ld of %ld datafile entries of collection %lu", scanned, n, (unsigned long) primary->base._cid); LOG_TRACE("scanned %ld of %ld datafile entries of collection %lu", (unsigned long) scanned, (unsigned long) n, (unsigned long) primary->base._cid);
} }
} }
} }
@ -3312,14 +3312,14 @@ static TRI_index_t* CreateGeoIndexDocumentCollection (TRI_document_collection_t*
if (location != NULL) { if (location != NULL) {
idx = TRI_CreateGeo1Index(&sim->base, location, loc, geoJson, constraint, ignoreNull); idx = TRI_CreateGeo1Index(&sim->base, location, loc, geoJson, constraint, ignoreNull);
LOG_TRACE("created geo-index for location '%s': %d", LOG_TRACE("created geo-index for location '%s': %ld",
location, location,
(unsigned long) loc); (unsigned long) loc);
} }
else if (longitude != NULL && latitude != NULL) { else if (longitude != NULL && latitude != NULL) {
idx = TRI_CreateGeo2Index(&sim->base, latitude, lat, longitude, lon, constraint, ignoreNull); idx = TRI_CreateGeo2Index(&sim->base, latitude, lat, longitude, lon, constraint, ignoreNull);
LOG_TRACE("created geo-index for location '%s': %d, %d", LOG_TRACE("created geo-index for location '%s': %ld, %ld",
location, location,
(unsigned long) lat, (unsigned long) lat,
(unsigned long) lon); (unsigned long) lon);

View File

@ -230,6 +230,7 @@ html.busy, html.busy * {
.hoverClass:hover { .hoverClass:hover {
background-color: #696969 !important; background-color: #696969 !important;
border-bottom: 1px solid #696969; border-bottom: 1px solid #696969;
margin-top: -1px;
color: white !important; color: white !important;
} }
@ -549,14 +550,14 @@ form {
} }
#formatJSONyesno { #formatJSONyesno {
margin-top: -40px; margin-top: -50px;
float:right; float:right;
margin-right: 120px; margin-right: 120px;
color: #797979; color: #797979;
} }
#aqlinfo { #aqlinfo {
line-height: 150%; line-height: 250%;
} }
#submitQuery { #submitQuery {
@ -565,19 +566,26 @@ form {
} }
#refreshShell{ #refreshShell{
padding-bottom: 3px; padding-bottom: 3px;
margin-top: -10px; margin-top: -6px;
width: 9.5% !important; width: 9.5% !important;
} }
#queryOutput a, .queryError, .querySuccess { #queryOutput a, .queryError, .querySuccess {
font-size: 0.9em !important; font-size: 0.9em !important;
font-family: "courier"; font-family: "courier";
padding-left: 10px;
padding-top: 10px !important;
} }
#queryOutput pre {
padding-left: 10px;
padding-top: 10px;
}
#queryOutput { #queryOutput {
margin-bottom: 5px; margin-bottom: 5px;
height:35%; height:35%;
padding-top: 10px;
overflow-y: auto; overflow-y: auto;
border: 1px solid black; border: 1px solid black;
background: white; background: white;
@ -587,10 +595,13 @@ form {
} }
#queryContent { #queryContent {
padding-top: 10px;
height: 45%; height: 45%;
font-family: "courier"; font-family: "courier";
width: 100%; width: 100%;
resize: vertical; resize: vertical;
padding-left: 10px;
margin-top: 2px;
} }
#avocshWindow { #avocshWindow {
@ -626,6 +637,7 @@ form {
height: 30px; height: 30px;
background-color: white; background-color: white;
margin-right: 0.5%; margin-right: 0.5%;
padding-left: 10px;
} }
.avocshSuccess { .avocshSuccess {
@ -707,7 +719,7 @@ form {
#menue-right { #menue-right {
padding-top:11px; padding-top:11px;
padding-right:14px; padding-right:10px;
height:40px; height:40px;
width:auto; width:auto;
float:right; float:right;
@ -826,6 +838,12 @@ form {
#logTableID_info { #logTableID_info {
} }
#logTableID, #warnLogTableID, #critLogTableID, #infoLogTableID, #debugLogTableID {
border-left: 1px solid #AAAAAA;
border-right: 1px solid #AAAAAA;
}
.ui-dialog { .ui-dialog {
height:100px; height:100px;
font-size: 0.8em; font-size: 0.8em;
@ -834,9 +852,9 @@ form {
.fg-toolbar { .fg-toolbar {
font-size: 0.7em; font-size: 0.7em;
border: 1px solid #D3D3D3 !important; border: 1px solid #D3D3D3 !important;
// -webkit-box-shadow: inset 0 0 1px 1px #f6f6f6; -webkit-box-shadow: inset 0 0 1px 1px #f6f6f6;
// -moz-box-shadow: inset 0 0 1px 1px #f6f6f6; -moz-box-shadow: inset 0 0 1px 1px #f6f6f6;
// box-shadow: inset 0 0 1px 1px #f6f6f6; box-shadow: inset 0 0 1px 1px #f6f6f6;
} }
/* /*
@ -848,29 +866,16 @@ form {
background: #e3e3e3; background: #e3e3e3;
padding: 9px 0 8px; padding: 9px 0 8px;
border: 1px solid #bbb; border: 1px solid #bbb;
// -webkit-box-shadow: inset 0 0 1px 1px #f6f6f6;
// -moz-box-shadow: inset 0 0 1px 1px #f6f6f6;
// box-shadow: inset 0 0 1px 1px #f6f6f6;
color: #333; color: #333;
font: 0.7em Verdana,Arial,sans-serif; font: 0.7em Verdana,Arial,sans-serif;
line-height: 1; line-height: 1;
text-align: center; text-align: center;
text-shadow: 0 1px 0 #fff;
width: 90px; width: 90px;
} }
#menue button.minimal:hover { #menue button.minimal:hover {
background: #d9d9d9; /* background: #d9d9d9; */
// -webkit-box-shadow: inset 0 0 1px 1px #eaeaea; /* color: #222; */
// -moz-box-shadow: inset 0 0 1px 1px #eaeaea;
// box-shadow: inset 0 0 1px 1px #eaeaea;
color: #222;
cursor: pointer; } cursor: pointer; }
#menue button.minimal:active {
background: #d0d0d0;
// -webkit-box-shadow: inset 0 0 1px 1px #e3e3e3;
// -moz-box-shadow: inset 0 0 1px 1px #e3e3e3;
// box-shadow: inset 0 0 1px 1px #e3e3e3;
color: #000; }
/* /*
############################################################################## ##############################################################################
### CollectionView subView Buttons ### CollectionView subView Buttons
@ -909,7 +914,7 @@ form {
} }
#queryForm { #queryForm {
margin-top: -5px; margin-top: -3px;
} }
#queryView { #queryView {
@ -962,3 +967,42 @@ form {
#iInfo { #iInfo {
font-size: 0.8em; font-size: 0.8em;
} }
#shellInfo {
line-height: 200%;
}
#formatJSONyesno {
padding-top: 5px !important
}
@media screen
and (-webkit-min-device-pixel-ratio:0)
{
#submitAvoc {
padding-top: 4px !important;
height: 30px !important;
}
#refreshShell {
margin-top: -4px !important;
margin-right: 2px !important;
}
#refrehShellTextRefresh {
line-height:230% !important;
}
#formatshellJSONyesno {
padding-top: 5px;
}
}
.leftCell {
border-left: 1px solid #D3D3D3 !important;
}
.rightCell {
border-right: 1px solid #D3D3D3 !important;
}

View File

@ -10,30 +10,30 @@
@import "css/jquery-ui-1.8.19.custom.css"; @import "css/jquery-ui-1.8.19.custom.css";
@import "css/jquery.dataTables_themeroller.css"; @import "css/jquery.dataTables_themeroller.css";
</style> </style>
<script type="text/javascript" language="javascript" src="js/jquery-1.7.2.js"></script> <script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.snippet.js"></script> <script type="text/javascript" src="js/jquery.snippet.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.qtip.js"></script> <script type="text/javascript" src="js/jquery.qtip.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.flot.js"></script> <script type="text/javascript" src="js/jquery.flot.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.flot.stack.js"></script> <script type="text/javascript" src="js/jquery.flot.stack.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.flot.resize.js"></script> <script type="text/javascript" src="js/jquery.flot.resize.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.flot.crosshair.js"></script> <script type="text/javascript" src="js/jquery.flot.crosshair.js"></script>
<script type="text/javascript" language="javascript" src="js/json2.js"></script> <script type="text/javascript" src="js/json2.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.sha256.js"></script> <script type="text/javascript" src="js/jquery.sha256.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.layout-latest.js"></script> <script type="text/javascript" src="js/jquery.layout-latest.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.address-1.4.js"></script> <script type="text/javascript" src="js/jquery.address-1.4.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script> <script type="text/javascript" src="js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.autogrow.js"></script> <script type="text/javascript" src="js/jquery.autogrow.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.jeditable.js"></script> <script type="text/javascript" src="js/jquery.jeditable.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.jeditable.autogrow.js"></script> <script type="text/javascript" src="js/jquery.jeditable.autogrow.js"></script>
<script type="text/javascript" language="javascript" src="js/master.js"></script> <script type="text/javascript" src="js/master.js"></script>
<script type="text/javascript" language="javascript" src="js/avocsh1.js"></script> <script type="text/javascript" src="js/avocsh1.js"></script>
<script type="text/javascript" language="javascript" src="js/print.js"></script> <script type="text/javascript" src="js/print.js"></script>
<script type="text/javascript" language="javascript" src="js/errors.js"></script> <script type="text/javascript" src="js/errors.js"></script>
<script type="text/javascript" language="javascript" src="js/modules/simple-query-basics.js"></script> <script type="text/javascript" src="js/modules/simple-query-basics.js"></script>
<script type="text/javascript" language="javascript" src="js/modules/simple-query.js"></script> <script type="text/javascript" src="js/modules/simple-query.js"></script>
<script type="text/javascript" language="javascript" src="js/modules/statement-basics.js"></script> <script type="text/javascript" src="js/modules/statement-basics.js"></script>
<script type="text/javascript" language="javascript" src="js/client.js"></script> <script type="text/javascript" src="js/client.js"></script>
<style> <style>
a:link {color: #797979; text-decoration: none;} a:link {color: #797979; text-decoration: none;}
a:visited {color: #797979; text-decoration: none;} a:visited {color: #797979; text-decoration: none;}
@ -47,7 +47,7 @@
<div id="menue" class="ui-layout-north"> <div id="menue" class="ui-layout-north">
<div id="menue-left"> <div id="menue-left">
<a href="/_admin/html/index.html"><img src="../html/media/images/ArangoDB_Logo.png"></a> <a href="/_admin/html/index.html"><img src="../html/media/images/ArangoDB_Logo.png" alt="ArangoDB Logo"></a>
</div> </div>
<div id="menue-right"> <div id="menue-right">
@ -56,8 +56,8 @@
<button class="minimal" id="AvocSH">Shell</button> <button class="minimal" id="AvocSH">Shell</button>
<button class="minimal" id="Logs">Logs</button> <button class="minimal" id="Logs">Logs</button>
<button class="minimal" id="Status">Statistics</button> <button class="minimal" id="Status">Statistics</button>
<a href="http://www.arangodb.org/manuals/" target="_blank"> <a href="http://www.arangodb.org/manuals/current" target="_blank">
<img class="externalLink" src="../html/media/icons/expand16icon.png" alt=""></img> <img class="externalLink" src="../html/media/icons/expand16icon.png" alt="External Link Icon"></img>
<button class="minimal" id="Documentation">Documentation</button></a> <button class="minimal" id="Documentation">Documentation</button></a>
</div> </div>
@ -86,6 +86,7 @@
<th></th> <th></th>
<th>ID</th> <th>ID</th>
<th>Name</th> <th>Name</th>
<th>Type</th>
<th>Status</th> <th>Status</th>
<th>Size Documents</th> <th>Size Documents</th>
<th>Number of Documents</th> <th>Number of Documents</th>
@ -130,13 +131,13 @@
<td class="longTD">If true then the data is synchronised to disk before returning from a create or update of an document. <td class="longTD">If true then the data is synchronised to disk before returning from a create or update of an document.
</td> </td>
</tr> </tr>
<tr><td>isSystem:</td><td> <tr><td>type:</td><td>
<form action="#" id="isSystemForm"> <form action="#" id="typeForm">
<input type="radio" name="isSystem" value=true>yes</input> <input type="radio" name="type" value="2" checked>document</input>
<input type="radio" name="isSystem" value=false checked>no</input> <input type="radio" name="type" value="3">edge</input>
</form> </form>
</td> </td>
<td class="longTD">If true, create a system collection. In this case collection-name should start with an underscore. <td class="longTD">The type of the collection to create.
</td> </td>
</table> </table>
@ -437,7 +438,7 @@
<input type="radio" name="formatshellJSONyesno" value=true checked>yes</input> <input type="radio" name="formatshellJSONyesno" value=true checked>yes</input>
<input type="radio" name="formatshellJSONyesno" value=false>no</input> <input type="radio" name="formatshellJSONyesno" value=false>no</input>
</form> </form>
<a href="http://www.arangodb.org/manuals/UserManual.html" target="_blank" style="font-size:0.8em">ArangoDB Shell - click for more information</a> <a href="http://www.arangodb.org/manuals/current/UserManualArangosh.html" target="_blank" style="font-size:0.8em">ArangoDB Shell - click for more information</a><br></br>
</div> </div>
<div id="queryView" style="display: none"> <div id="queryView" style="display: none">
@ -453,7 +454,7 @@
<form id="queryForm" method="post" onsubmit="return false"> <form id="queryForm" method="post" onsubmit="return false">
<textarea placeholder="Type in your query..." class="editBox" id="queryContent"></textarea><br> <textarea placeholder="Type in your query..." class="editBox" id="queryContent"></textarea><br>
<button class="minimal" id="submitQuery">Execute</button> <button class="minimal" id="submitQuery">Execute</button>
<a style="font-size:0.8em;" id="aqlinfo" href="http://www.arangodb.org/manuals/Aql.html" target="_blank">ArangoDB Query Language - click for more information</a> <a style="font-size:0.8em;" id="aqlinfo" href="http://www.arangodb.org/manuals/current/Aql.html" target="_blank">ArangoDB Query Language - click for more information</a>
<br></br> <br></br>
</form> </form>
<form action="#" id="formatJSONyesno" style="font-size:0.8em;"> <form action="#" id="formatJSONyesno" style="font-size:0.8em;">

View File

@ -15,18 +15,19 @@ var welcomeMSG = ""
var existingCharts; var existingCharts;
var statDivCount; var statDivCount;
// documents global vars // documents global vars
var collectionCount; var collectionTotalPages;
var totalCollectionCount;
var collectionCurrentPage; var collectionCurrentPage;
var globalCollectionName; var globalCollectionName;
var globalCollectionID; var globalCollectionID;
var globalCollectionRev;
var checkCollectionName; var checkCollectionName;
var printedHelp = false; var printedHelp = false;
var open = false; var open = false;
var rowCounter = 0; var rowCounter = 0;
var shArray = []; var shArray = [];
// a static cache
var CollectionTypes = { };
$(document).ready(function() { $(document).ready(function() {
showCursor(); showCursor();
//hide incomplete functions //hide incomplete functions
@ -221,8 +222,8 @@ var collectionTable = $('#collectionsTableID').dataTable({
"bAutoWidth": false, "bAutoWidth": false,
"iDisplayLength": -1, "iDisplayLength": -1,
"bJQueryUI": true, "bJQueryUI": true,
"aoColumns": [{"sWidth":"150px", "bSortable":false}, {"sWidth": "200px"}, {"sWidth": "200px"}, null, {"sWidth": "200px"}, {"sWidth": "200px"} ], "aoColumns": [{"sWidth":"150px", "bSortable":false, "sClass":"leftCell"}, {"sWidth": "200px"}, {"sWidth": "200px"}, {"sWidth": "150px"}, null, {"sWidth": "200px"}, {"sWidth": "200px", "sClass":"rightCell"} ],
"aoColumnDefs": [{ "sClass": "alignRight", "aTargets": [ 4, 5 ] }], "aoColumnDefs": [{ "sClass": "alignRight", "aTargets": [ 5, 6 ] }],
"oLanguage": {"sEmptyTable": "No collections"} "oLanguage": {"sEmptyTable": "No collections"}
}); });
@ -240,9 +241,9 @@ var documentEditTable = $('#documentEditTableID').dataTable({
"bDeferRender": true, "bDeferRender": true,
"iDisplayLength": -1, "iDisplayLength": -1,
"bJQueryUI": true, "bJQueryUI": true,
"aoColumns": [{"sClass":"read_only", "bSortable": false, "sWidth": "30px"}, "aoColumns": [{"sClass":"read_only leftCell", "bSortable": false, "sWidth": "30px"},
{"sClass":"writeable", "bSortable": false, "sWidth":"400px" }, {"sClass":"writeable", "bSortable": false, "sWidth":"400px" },
{"sClass":"writeable", "bSortable": false}, {"sClass":"writeable rightCell", "bSortable": false},
{"bVisible": false } ], {"bVisible": false } ],
"oLanguage": {"sEmptyTable": "No documents"} "oLanguage": {"sEmptyTable": "No documents"}
}); });
@ -260,9 +261,9 @@ var newDocumentTable = $('#NewDocumentTableID').dataTable({
"bAutoWidth": true, "bAutoWidth": true,
"iDisplayLength": -1, "iDisplayLength": -1,
"bJQueryUI": true, "bJQueryUI": true,
"aoColumns": [{ "sClass":"center", "sClass":"read_only","bSortable": false, "sWidth": "30px"}, "aoColumns": [{ "sClass":"read_only center leftCell","bSortable": false, "sWidth": "30px"},
{"sClass":"writeable", "bSortable": false, "sWidth":"250px" }, {"sClass":"writeable", "bSortable": false, "sWidth":"250px" },
{"sClass":"writeable", "bSortable": false }, {"sClass":"writeable rightCell", "bSortable": false },
{"bVisible": false } ] {"bVisible": false } ]
}); });
@ -279,10 +280,10 @@ var documentsTable = $('#documentsTableID').dataTable({
"bAutoWidth": false, "bAutoWidth": false,
"iDisplayLength": -1, "iDisplayLength": -1,
"bJQueryUI": true, "bJQueryUI": true,
"aoColumns": [{ "sClass":"read_only", "bSortable": false, "sWidth":"80px"}, "aoColumns": [{ "sClass":"read_only leftCell", "bSortable": false, "sWidth":"80px"},
{ "sClass":"read_only","bSortable": false, "sWidth": "200px"}, { "sClass":"read_only","bSortable": false, "sWidth": "200px"},
{ "sClass":"read_only","bSortable": false, "sWidth": "100px"}, { "sClass":"read_only","bSortable": false, "sWidth": "100px"},
{ "bSortable": false, "sClass": "cuttedContent"}], { "bSortable": false, "sClass": "cuttedContent rightCell"}],
"oLanguage": { "sEmptyTable": "No documents"} "oLanguage": { "sEmptyTable": "No documents"}
}); });
@ -398,6 +399,7 @@ var logTable = $('#logTableID').dataTable({
$('#collectionsView').show(); $('#collectionsView').show();
createnav("Collections"); createnav("Collections");
highlightNav("#nav1"); highlightNav("#nav1");
highlightNavButton("#Collections");
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -490,13 +492,10 @@ var logTable = $('#logTableID').dataTable({
$('#documentEditView').show(); $('#documentEditView').show();
$('#documentEditSourceView').hide(); $('#documentEditSourceView').hide();
$.each(data, function(key, val) { $.each(data, function(key, val) {
if (key == '_id') { if (isSystemAttribute(key)) {
documentEditTable.fnAddData(["", key, val, JSON.stringify(val)]); documentEditTable.fnAddData(["", key, value2html(val, true), JSON.stringify(val)]);
} }
else if (key == '_rev') { else {
documentEditTable.fnAddData(["", key, val, JSON.stringify(val)]);
}
else if (key != '_rev' && key != '_id') {
documentEditTable.fnAddData(['<button class="enabled" id="deleteEditedDocButton"><img src="/_admin/html/media/icons/delete_icon16.png" width="16" height="16"></button>',key, value2html(val), JSON.stringify(val)]); documentEditTable.fnAddData(['<button class="enabled" id="deleteEditedDocButton"><img src="/_admin/html/media/icons/delete_icon16.png" width="16" height="16"></button>',key, value2html(val), JSON.stringify(val)]);
} }
}); });
@ -514,23 +513,11 @@ var logTable = $('#logTableID').dataTable({
else if (location.hash.substr(0, 16) == "#showCollection?") { else if (location.hash.substr(0, 16) == "#showCollection?") {
$('#nav1').removeClass('highlighted'); $('#nav1').removeClass('highlighted');
var collectionID = location.hash.substr(16, location.hash.length); var found = location.hash.match(/\?(\d+)(=.+)?$/);
globalAjaxCursorChange(); if (! found) {
$.ajax({ throw "invalid URL";
type: "GET",
url: "/_api/collection/" + collectionID + "/count",
contentType: "application/json",
processData: false,
async: false,
success: function(data) {
globalCollectionName = data.name;
test = data.name;
collectionCount = data.count;
$('#nav2').text(globalCollectionName);
},
error: function(data) {
} }
}); globalAjaxCursorChange();
$('#nav1').text('Collections'); $('#nav1').text('Collections');
$('#nav1').attr('href', '#'); $('#nav1').attr('href', '#');
@ -541,29 +528,10 @@ var logTable = $('#logTableID').dataTable({
$("#nav2").removeClass("arrowbg"); $("#nav2").removeClass("arrowbg");
$("#nav1").addClass("arrowbg"); $("#nav1").addClass("arrowbg");
$.ajax({
type: 'PUT',
url: '/_api/simple/all/',
data: '{"collection":"' + globalCollectionName + '","skip":0,"limit":10}',
contentType: "application/json",
success: function(data) {
$.each(data.result, function(k, v) {
documentsTable.fnAddData(['<button class="enabled" id="deleteDoc"><img src="/_admin/html/media/icons/doc_delete_icon16.png" width="16" height="16"></button><button class="enabled" id="editDoc"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>', v._id, v._rev, '<pre class="prettify">' + cutByResolution(JSON.stringify(v)) + "</pre>"]);
});
$(".prettify").snippet("javascript", {style: "nedit", menu: false, startText: false, transparent: true, showNum: false});
showCursor();
},
error: function(data) {
}
});
documentsTable.fnClearTable();
hideAllSubDivs(); hideAllSubDivs();
$('#collectionsView').hide(); $('#collectionsView').hide();
$('#documentsView').show(); $('#documentsView').show();
totalCollectionCount = Math.ceil(collectionCount / 10); loadDocuments(found[1], collectionCurrentPage);
collectionCurrentPage = 1;
$('#documents_status').text("Showing page 1 of " + totalCollectionCount);
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -620,6 +588,7 @@ var logTable = $('#logTableID').dataTable({
$('#collectionsView').hide(); $('#collectionsView').hide();
$('#logView').show(); $('#logView').show();
createnav ("Logs"); createnav ("Logs");
highlightNavButton("#Logs");
showCursor(); showCursor();
} }
@ -634,6 +603,7 @@ var logTable = $('#logTableID').dataTable({
$('#collectionsView').hide(); $('#collectionsView').hide();
$('#statusView').show(); $('#statusView').show();
createnav ("Statistics"); createnav ("Statistics");
highlightNavButton("#Status");
makeDraggableAndResizable(); makeDraggableAndResizable();
//TODO //TODO
createChartBoxes(); createChartBoxes();
@ -650,6 +620,7 @@ var logTable = $('#logTableID').dataTable({
$('#collectionsView').hide(); $('#collectionsView').hide();
$('#configView').show(); $('#configView').show();
createnav ("Configuration"); createnav ("Configuration");
highlightNavButton("#Config");
var switcher = "primary"; var switcher = "primary";
var insertType; var insertType;
@ -741,24 +712,6 @@ var logTable = $('#logTableID').dataTable({
error: function(data) { error: function(data) {
} }
}); });
/*
var content={"Menue":{"Haha":"wert1", "ahha":"wert2"}, "Favoriten":{"top10":"content"},"Test":{"testing":"hallo 123 test"}};
$("#configContent").empty();
$.each(content, function(data) {
$('#configContent').append('<div class="customToolbar">' + data + '</div>');
$.each(content[data], function(key, val) {
if (switcher == "primary") {
$('#configContent').append('<a class="toolbar_left toolbar_primary">' + key + '</a><a class="toolbar_right toolbar_primary">' + val + '</a><br>');
switcher = "secondary";
}
else if (switcher == "secondary") {
$('#configContent').append('<a class="toolbar_left toolbar_secondary">' + key + '</a><a class="toolbar_right toolbar_secondary">' + val + '</a><br>');
switcher = "primary";
}
});
});
*/
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -771,6 +724,7 @@ var logTable = $('#logTableID').dataTable({
$('#collectionsView').hide(); $('#collectionsView').hide();
$('#queryView').show(); $('#queryView').show();
createnav ("Query"); createnav ("Query");
highlightNavButton("#Query");
$('#queryContent').focus(); $('#queryContent').focus();
} }
@ -784,6 +738,7 @@ var logTable = $('#logTableID').dataTable({
$('#collectionsView').hide(); $('#collectionsView').hide();
$('#avocshView').show(); $('#avocshView').show();
createnav ("ArangoDB Shell"); createnav ("ArangoDB Shell");
highlightNavButton("#AvocSH");
$('#avocshContent').focus(); $('#avocshContent').focus();
if (printedHelp === false) { if (printedHelp === false) {
print(welcomeMSG + require("arangosh").HELP); print(welcomeMSG + require("arangosh").HELP);
@ -804,6 +759,7 @@ var logTable = $('#logTableID').dataTable({
$('#nav1').text('Collections'); $('#nav1').text('Collections');
$('#nav2').text('Create new collection'); $('#nav2').text('Create new collection');
$('#nav1').attr('class', 'arrowbg'); $('#nav1').attr('class', 'arrowbg');
highlightNavButton("#Collections");
hideAllSubDivs(); hideAllSubDivs();
$('#collectionsView').hide(); $('#collectionsView').hide();
@ -823,12 +779,12 @@ var logTable = $('#logTableID').dataTable({
if (tableView == true) { if (tableView == true) {
var data = documentEditTable.fnGetData(); var data = documentEditTable.fnGetData();
var result = {}; var result = {};
var collectionID; var documentID;
for (row in data) { for (row in data) {
var row_data = data[row]; var row_data = data[row];
if ( row_data[1] == "_id" ) { if ( row_data[1] == "_id" ) {
collectionID = row_data[3]; documentID = row_data[3];
} }
else { else {
result[row_data[1]] = JSON.parse(row_data[3]); result[row_data[1]] = JSON.parse(row_data[3]);
@ -838,42 +794,42 @@ var logTable = $('#logTableID').dataTable({
$.ajax({ $.ajax({
type: "PUT", type: "PUT",
url: "/_api/document/" + JSON.parse(collectionID), url: "/_api/document/" + JSON.parse(documentID),
data: JSON.stringify(result), data: JSON.stringify(result),
contentType: "application/json", contentType: "application/json",
processData: false, processData: false,
success: function(data) { success: function(data) {
tableView = true; tableView = true;
var collID = JSON.parse(collectionID).split("/"); var collID = JSON.parse(documentID).split("/");
window.location.href = "#showCollection?" + collID[0]; window.location.href = "#showCollection?" + collID[0];
}, },
error: function(data) { error: function(data) {
alert(JSON.stringify(data)); alert(getErrorMessage(data));
} }
}); });
} }
else { else {
try { try {
var collectionID; var documentID;
var boxContent = $('#documentEditSourceBox').val(); var boxContent = $('#documentEditSourceBox').val();
collectionID = globalCollectionID; documentID = globalCollectionID;
boxContent = stateReplace(boxContent); boxContent = stateReplace(boxContent);
parsedContent = JSON.parse(boxContent); parsedContent = JSON.parse(boxContent);
$.ajax({ $.ajax({
type: "PUT", type: "PUT",
url: "/_api/document/" + collectionID, url: "/_api/document/" + documentID,
data: JSON.stringify(parsedContent), data: JSON.stringify(parsedContent),
contentType: "application/json", contentType: "application/json",
processData: false, processData: false,
success: function(data) { success: function(data) {
tableView = true; tableView = true;
$('#toggleEditedDocButton').val('Edit Source'); $('#toggleEditedDocButton').val('Edit Source');
var collID = collectionID.split("/"); var collID = documentID.split("/");
window.location.href = "#showCollection?" + collID[0]; window.location.href = "#showCollection?" + collID[0];
}, },
error: function(data) { error: function(data) {
alert(JSON.stringify(data)); alert(getErrorMessage(data));
} }
}); });
} }
@ -919,37 +875,27 @@ var logTable = $('#logTableID').dataTable({
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
$('#saveNewDocButton').live('click', function () { $('#saveNewDocButton').live('click', function () {
var post;
var found = location.hash.match(/\?(\d+)=.+$/);
if (! found) {
throw "invalid URL";
}
var collectionID = found[1];
if (tableView == true) { if (tableView == true) {
var data = newDocumentTable.fnGetData(); var data = newDocumentTable.fnGetData();
var result = {}; var result = {};
var collectionID = location.hash.substr(12, location.hash.length);
var collID = collectionID.split("=");
for (row in data) { for (row in data) {
var row_data = data[row]; var row_data = data[row];
result[row_data[1]] = JSON.parse(row_data[3]); result[row_data[1]] = JSON.parse(row_data[3]);
} }
$.ajax({ post = JSON.stringify(result);
type: "POST",
url: "/_api/document?collection=" + collID,
data: JSON.stringify(result),
contentType: "application/json",
processData: false,
success: function(data) {
tableView = true;
window.location.href = "#showCollection?" + collID;
},
error: function(data) {
alert(JSON.stringify(data));
}
});
} }
else { else {
try {
var collectionID = location.hash.substr(12, location.hash.length);
var collID = collectionID.split("=");
var boxContent = $('#NewDocumentSourceBox').val(); var boxContent = $('#NewDocumentSourceBox').val();
var jsonContent = JSON.parse(boxContent); var jsonContent = JSON.parse(boxContent);
$.each(jsonContent, function(row1, row2) { $.each(jsonContent, function(row1, row2) {
@ -958,25 +904,28 @@ var logTable = $('#logTableID').dataTable({
} }
}); });
$.ajax({ try {
type: "POST", post = JSON.stringify(jsonContent);
url: "/_api/document?collection=" + collID,
data: JSON.stringify(jsonContent),
contentType: "application/json",
processData: false,
success: function(data) {
tableView = true;
window.location.href = "#showCollection?" + collID;
},
error: function(data) {
alert(JSON.stringify(data));
}
});
} }
catch(e) { catch(e) {
alert("Please make sure the entered value is a valid json string."); alert("Please make sure the entered value is a valid json string.");
} }
} }
$.ajax({
type: "POST",
url: "/_api/" + collectionApiType(collectionID) + "?collection=" + collectionID,
data: post,
contentType: "application/json",
processData: false,
success: function(data) {
tableView = true;
window.location.href = "#showCollection?" + collectionID;
},
error: function(data) {
alert(getErrorMessage(data));
}
});
}); });
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -1008,10 +957,11 @@ var logTable = $('#logTableID').dataTable({
result[row_data[1]] = JSON.parse(row_data[3]); result[row_data[1]] = JSON.parse(row_data[3]);
} }
globalCollectionRev = result._rev; var copies = { }; // copy systerm attributes
globalCollectionID = result._id; for (var a in systemAttributes()) {
delete result._id; copies[a] = result[a];
delete result._rev; delete result[a];
}
var myFormattedString = FormatJSON(result); var myFormattedString = FormatJSON(result);
$('#documentEditSourceBox').val(myFormattedString); $('#documentEditSourceBox').val(myFormattedString);
@ -1028,10 +978,12 @@ var logTable = $('#logTableID').dataTable({
parsedContent = JSON.parse(boxContent); parsedContent = JSON.parse(boxContent);
documentEditTable.fnClearTable(); documentEditTable.fnClearTable();
$.each(parsedContent, function(key, val) { $.each(parsedContent, function(key, val) {
documentEditTable.fnAddData(['<button class="enabled" id="deleteEditedDocButton"><img src="/_admin/html/media/icons/delete_icon16.png" width="16" height="16"</button>',key, value2html(val), JSON.stringify(val)]); documentEditTable.fnAddData(['<button class="enabled" id="deleteEditedDocButton"><img src="/_admin/html/media/icons/delete_icon16.png" width="16" height="16"</button>', key, value2html(val), JSON.stringify(val)]);
}); });
documentEditTable.fnAddData(['', "_id", globalCollectionID, JSON.stringify(globalCollectionID)]);
documentEditTable.fnAddData(['', "_rev", globalCollectionRev, JSON.stringify(globalCollectionRev)]); for (var a in systemAttributes()) {
documentEditTable.fnAddData(['', a, value2html(copies[a], true), JSON.stringify(copies[a]) ]);
}
documentTableMakeEditable ('#documentEditTableID'); documentTableMakeEditable ('#documentEditTableID');
$('#documentEditTableView').toggle(); $('#documentEditTableView').toggle();
@ -1177,8 +1129,8 @@ var logTable = $('#logTableID').dataTable({
newDocumentTable.fnClearTable(); newDocumentTable.fnClearTable();
$.each(parsedContent, function(key, val) { $.each(parsedContent, function(key, val) {
if (key == '_id' || key == '_rev') { if (isSystemAttribute(key)) {
newDocumentTable.fnAddData(["", key, value2html(val), JSON.stringify(val)]); newDocumentTable.fnAddData(["", key, value2html(val, true), JSON.stringify(val)]);
} }
else { else {
newDocumentTable.fnAddData(['<button class="enabled" id="deleteNewDocButton"><img src="/_admin/html/media/icons/delete_icon16.png" width="16" height="16"></button>',key, value2html(val), JSON.stringify(val)]); newDocumentTable.fnAddData(['<button class="enabled" id="deleteNewDocButton"><img src="/_admin/html/media/icons/delete_icon16.png" width="16" height="16"></button>',key, value2html(val), JSON.stringify(val)]);
@ -1395,13 +1347,12 @@ var lastFormatQuestion = true;
}); });
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// delete a document /// edit / delete a document
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
$('#documentsView tr td button').live('click', function () { $('#documentsView tr td button').live('click', function () {
var aPos = documentsTable.fnGetPosition(this.parentElement); var aPos = documentsTable.fnGetPosition(this.parentElement);
var aData = documentsTable.fnGetData(aPos[0]); var aData = documentsTable.fnGetData(aPos[0]);
var row = $(this).closest("tr").get(0);
var documentID = aData[1]; var documentID = aData[1];
if (this.id == "deleteDoc") { if (this.id == "deleteDoc") {
@ -1412,12 +1363,13 @@ var lastFormatQuestion = true;
url: "/_api/document/" + documentID url: "/_api/document/" + documentID
}); });
} }
catch(e) { catch(e) {
alert(e); alert(e);
} }
var row = $(this).closest("tr").get(0);
documentsTable.fnDeleteRow(documentsTable.fnGetPosition(row)); documentsTable.fnDeleteRow(documentsTable.fnGetPosition(row));
loadDocuments(globalCollectionName, collectionCurrentPage);
} }
if (this.id == "editDoc") { if (this.id == "editDoc") {
@ -1434,24 +1386,30 @@ var lastFormatQuestion = true;
$('#subCenterView').hide(); $('#subCenterView').hide();
$('#collectionsView').show(); $('#collectionsView').show();
window.location.href = "#"; window.location.href = "#";
highlightNavButton ("#Collections");
} }
if (this.id == "Logs") { else if (this.id == "Logs") {
window.location.href = "#logs"; window.location.href = "#logs";
highlightNavButton ("#Logs");
} }
if (this.id == "Status") { else if (this.id == "Status") {
window.location.href = "#status"; window.location.href = "#status";
highlightNavButton ("#Status");
} }
if (this.id == "Configuration") { else if (this.id == "Configuration") {
window.location.href = "#config"; window.location.href = "#config";
highlightNavButton ("#Configuration");
} }
if (this.id == "Documentation") { else if (this.id == "Documentation") {
return 0; return 0;
} }
if (this.id == "Query") { else if (this.id == "Query") {
window.location.href = "#query"; window.location.href = "#query";
highlightNavButton ("#Query");
} }
if (this.id == "AvocSH") { else if (this.id == "AvocSH") {
window.location.href = "#avocsh"; window.location.href = "#avocsh";
highlightNavButton ("#AvocSH");
} }
}); });
@ -1482,8 +1440,7 @@ var lastFormatQuestion = true;
drawCollectionsTable(); drawCollectionsTable();
}, },
error: function(data) { error: function(data) {
var temp = JSON.parse(data.responseText); alert(getErrorMessage(data));
alert("Error: " + JSON.stringify(temp.errorMessage));
} }
}); });
}); });
@ -1502,10 +1459,11 @@ var lastFormatQuestion = true;
$('#saveNewCollection').live('click', function () { $('#saveNewCollection').live('click', function () {
var wfscheck = $('input:radio[name=waitForSync]:checked').val(); var wfscheck = $('input:radio[name=waitForSync]:checked').val();
var systemcheck = $('input:radio[name=isSystem]:checked').val(); var type = $('input:radio[name=type]:checked').val(); // collection type
var collName = $('#createCollName').val(); var collName = $('#createCollName').val();
var collSize = $('#createCollSize').val(); var collSize = $('#createCollSize').val();
var journalSizeString; var journalSizeString;
var isSystem = (collName.substr(0, 1) === '_');
if (collSize == '') { if (collSize == '') {
journalSizeString = ''; journalSizeString = '';
@ -1522,7 +1480,7 @@ var lastFormatQuestion = true;
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/_api/collection", url: "/_api/collection",
data: '{"name":"' + collName + '", "waitForSync":' + JSON.parse(wfscheck) + ',"isSystem":' + JSON.parse(systemcheck)+ journalSizeString + '}', data: '{"name":' + JSON.stringify(collName) + ',"waitForSync":' + JSON.stringify(wfscheck) + ',"isSystem":' + JSON.stringify(isSystem) + journalSizeString + ',"type":' + type + '}',
contentType: "application/json", contentType: "application/json",
processData: false, processData: false,
success: function(data) { success: function(data) {
@ -1533,13 +1491,7 @@ var lastFormatQuestion = true;
drawCollectionsTable(); drawCollectionsTable();
}, },
error: function(data) { error: function(data) {
try { alert(getErrorMessage(data));
var responseText = JSON.parse(data.responseText);
alert(responseText.errorMessage);
}
catch (e) {
alert(data.responseText);
}
} }
}); });
}); });
@ -1696,10 +1648,10 @@ function drawCollectionsTable () {
else if (tempStatus == 2) { else if (tempStatus == 2) {
tempStatus = "unloaded"; tempStatus = "unloaded";
items.push(['<button class="enabled" id="delete"><img src="/_admin/html/media/icons/round_minus_icon16.png" width="16" height="16"></button><button class="enabled" id="load"><img src="/_admin/html/media/icons/connect_icon16.png" width="16" height="16"></button><button><img src="/_admin/html/media/icons/zoom_icon16_nofunction.png" width="16" height="16" class="nofunction"></img></button><button><img src="/_admin/html/media/icons/doc_edit_icon16_nofunction.png" width="16" height="16" class="nofunction"></img></button>', items.push(['<button class="enabled" id="delete"><img src="/_admin/html/media/icons/round_minus_icon16.png" width="16" height="16"></button><button class="enabled" id="load"><img src="/_admin/html/media/icons/connect_icon16.png" width="16" height="16"></button><button><img src="/_admin/html/media/icons/zoom_icon16_nofunction.png" width="16" height="16" class="nofunction"></img></button><button><img src="/_admin/html/media/icons/doc_edit_icon16_nofunction.png" width="16" height="16" class="nofunction"></img></button>',
val.id, val.name, tempStatus, "", ""]); val.id, val.name, collectionType(val), tempStatus, "-", "-"]);
} }
else if (tempStatus == 3) { else if (tempStatus == 3) {
tempStatus = "<font color=green>loaded</font>"; tempStatus = "<font color=\"green\">loaded</font>";
var alive; var alive;
var size; var size;
@ -1718,16 +1670,16 @@ function drawCollectionsTable () {
}); });
items.push(['<button class="enabled" id="delete"><img src="/_admin/html/media/icons/round_minus_icon16.png" width="16" height="16" title="Delete"></button><button class="enabled" id="unload"><img src="/_admin/html/media/icons/not_connected_icon16.png" width="16" height="16" title="Unload"></button><button class="enabled" id="showdocs"><img src="/_admin/html/media/icons/zoom_icon16.png" width="16" height="16" title="Show Documents"></button><button class="enabled" id="edit" title="Edit"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>', items.push(['<button class="enabled" id="delete"><img src="/_admin/html/media/icons/round_minus_icon16.png" width="16" height="16" title="Delete"></button><button class="enabled" id="unload"><img src="/_admin/html/media/icons/not_connected_icon16.png" width="16" height="16" title="Unload"></button><button class="enabled" id="showdocs"><img src="/_admin/html/media/icons/zoom_icon16.png" width="16" height="16" title="Show Documents"></button><button class="enabled" id="edit" title="Edit"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>',
val.id, val.name, tempStatus, bytesToSize(size), alive]); val.id, val.name, collectionType(val), tempStatus, bytesToSize(size), alive]);
} }
else if (tempStatus == 4) { else if (tempStatus == 4) {
tempStatus = "in the process of being unloaded"; tempStatus = "in the process of being unloaded";
items.push(['<button id="delete"><img src="/_admin/html/media/icons/round_minus_icon16_nofunction.png" class="nofunction" width="16" height="16"></button><button class="enabled" id="load"><img src="/_admin/html/media/icons/connect_icon16.png" width="16" height="16"></button><button><img src="/_admin/html/media/icons/zoom_icon16_nofunction.png" width="16" height="16" class="nofunction"></img></button><button><img src="/_admin/html/media/icons/doc_edit_icon16_nofunction.png" width="16" height="16" class="nofunction"></img></button>', items.push(['<button id="delete"><img src="/_admin/html/media/icons/round_minus_icon16_nofunction.png" class="nofunction" width="16" height="16"></button><button class="enabled" id="load"><img src="/_admin/html/media/icons/connect_icon16.png" width="16" height="16"></button><button><img src="/_admin/html/media/icons/zoom_icon16_nofunction.png" width="16" height="16" class="nofunction"></img></button><button><img src="/_admin/html/media/icons/doc_edit_icon16_nofunction.png" width="16" height="16" class="nofunction"></img></button>',
val.id, val.name, tempStatus, "", ""]); val.id, val.name, collectionType(val), tempStatus, "-", "-"]);
} }
else if (tempStatus == 5) { else if (tempStatus == 5) {
tempStatus = "deleted"; tempStatus = "deleted";
items.push(["", val.id, val.name, tempStatus, "", ""]); items.push(["", val.id, val.name, collectionType(val), tempStatus, "-", "-"]);
} }
/* else { /* else {
tempStatus = "corrupted"; tempStatus = "corrupted";
@ -1751,7 +1703,7 @@ function documentTableMakeEditable (tableID) {
$(this).removeClass('writeable'); $(this).removeClass('writeable');
i = 0; i = 0;
} }
if (this.innerHTML == "_id" || this.innerHTML == "_rev") { if (isSystemAttribute(this.innerHTML)) {
$(this).removeClass('writeable'); $(this).removeClass('writeable');
i = 1; i = 1;
} }
@ -1823,6 +1775,7 @@ function escaped (value) {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
function getTypedValue (value) { function getTypedValue (value) {
value = value.replace(/(^\s+|\s+$)/g, '');
if (value == 'true') { if (value == 'true') {
return true; return true;
} }
@ -1855,8 +1808,17 @@ function getTypedValue (value) {
// fallback: value is a string // fallback: value is a string
value = value + ''; value = value + '';
if (value.substr(0, 1) == '"' && value.substr(-1) == '"' ) { if (value !== '' && (value.substr(0, 1) != '"' || value.substr(-1) != '"')) {
value = value.substr(1, value.length-2); alert("You have entered an invalid string value. Please review and adjust it.");
throw "error";
}
try {
value = JSON.parse(value);
}
catch (e) {
alert("You have entered an invalid string value. Please review and adjust it.");
throw e;
} }
return value; return value;
} }
@ -1865,7 +1827,8 @@ function getTypedValue (value) {
/// checks type fo typed cell value /// checks type fo typed cell value
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
function value2html (value) { function value2html (value, isReadOnly) {
var typify = function (value) {
var checked = typeof(value); var checked = typeof(value);
switch(checked) { switch(checked) {
case 'number': case 'number':
@ -1882,6 +1845,9 @@ function value2html (value) {
return ("<a class=\"sh_object\">"+ escaped(JSON.stringify(value)) + "</a>"); return ("<a class=\"sh_object\">"+ escaped(JSON.stringify(value)) + "</a>");
} }
} }
};
return (isReadOnly ? "(read-only) " : "") + typify(value);
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -1984,57 +1950,36 @@ function createLogTable(loglevel) {
}); });
} }
function createPrevDocPagination() { function createFirstPagination () {
if (collectionCurrentPage == 1) { if (collectionCurrentPage == 1) {
return 0; return 0;
} }
var prevPage = JSON.parse(collectionCurrentPage) -1;
var offset = prevPage * 10 - 10;
$('#documentsTableID').dataTable().fnClearTable(); loadDocuments(globalCollectionName, 1);
$.ajax({
type: 'PUT',
url: '/_api/simple/all/',
data: '{"collection":"' + globalCollectionName + '","skip":' + offset + ',"limit":10}',
contentType: "application/json",
success: function(data) {
$.each(data.result, function(k, v) {
$('#documentsTableID').dataTable().fnAddData(['<button class="enabled" id="deleteDoc"><img src="/_admin/html/media/icons/doc_delete_icon16.png" width="16" height="16"></button><button class="enabled" id="editDoc"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>', v._id, v._rev, '<pre class="prettify">' + cutByResolution(JSON.stringify(v)) + '</pre>']);
});
$(".prettify").snippet("javascript", {style: "nedit", menu: false, startText: false, transparent: true, showNum: false});
},
error: function(data) {
}
});
collectionCurrentPage = prevPage;
$('#documents_status').text("Showing page " + collectionCurrentPage + " of " + totalCollectionCount);
} }
function createNextDocPagination () {
if (collectionCurrentPage == totalCollectionCount) { function createLastPagination () {
if (collectionCurrentPage == collectionTotalPages) {
return 0; return 0;
} }
var nextPage = JSON.parse(collectionCurrentPage) +1; loadDocuments(globalCollectionName, collectionTotalPages);
var offset = collectionCurrentPage * 10; }
$('#documentsTableID').dataTable().fnClearTable(); function createPrevDocPagination() {
$.ajax({ if (collectionCurrentPage <= 1) {
type: 'PUT', return 0;
url: '/_api/simple/all/',
data: '{"collection":"' + globalCollectionName + '","skip":' + offset + ',"limit":10}',
contentType: "application/json",
success: function(data) {
$.each(data.result, function(k, v) {
$("#documentsTableID").dataTable().fnAddData(['<button class="enabled" id="deleteDoc"><img src="/_admin/html/media/icons/doc_delete_icon16.png" width="16" height="16"></button><button class="enabled" id="editDoc"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>', v._id, v._rev, '<pre class=prettify>' + cutByResolution(JSON.stringify(v)) + '</pre>']);
});
$(".prettify").snippet("javascript", {style: "nedit", menu: false, startText: false, transparent: true, showNum: false});
},
error: function(data) {
} }
});
collectionCurrentPage = nextPage; loadDocuments(globalCollectionName, collectionCurrentPage - 1);
$('#documents_status').text("Showing page " + collectionCurrentPage + " of " + totalCollectionCount); }
function createNextDocPagination () {
if (collectionCurrentPage >= collectionTotalPages) {
return 0;
}
loadDocuments(globalCollectionName, collectionCurrentPage + 1);
} }
function createPrevPagination(checked) { function createPrevPagination(checked) {
@ -2102,33 +2047,6 @@ function cutByResolution (string) {
return escaped(string); return escaped(string);
} }
function createFirstPagination () {
if (collectionCurrentPage == 1) {
return 0;
}
$('#documentsTableID').dataTable().fnClearTable();
$.ajax({
type: 'PUT',
url: '/_api/simple/all/',
data: '{"collection":"' + globalCollectionName + '","skip":0,"limit":10}',
contentType: "application/json",
success: function(data) {
$.each(data.result, function(k, v) {
$('#documentsTableID').dataTable().fnAddData(['<button class="enabled" id="deleteDoc"><img src="/_admin/html/media/icons/doc_delete_icon16.png" width="16" height="16"></button><button class="enabled" id="editDoc"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>', v._id, v._rev, '<pre class=prettify>' + cutByResolution(JSON.stringify(v)) + '</pre>' ]);
});
$(".prettify").snippet("javascript", {style: "nedit", menu: false, startText: false, transparent: true, showNum: false});
collectionCurrentPage = 1;
$('#documents_status').text("Showing page 1 of " + totalCollectionCount);
},
error: function(data) {
}
});
}
function createLastLogPagination (tableid) { function createLastLogPagination (tableid) {
var totalPages = Math.ceil(currentAmount / 10); var totalPages = Math.ceil(currentAmount / 10);
var offset = (totalPages * 10) - 10; var offset = (totalPages * 10) - 10;
@ -2152,33 +2070,6 @@ function createLastLogPagination (tableid) {
currentPage = totalPages; currentPage = totalPages;
$(currentTableID + '_status').text("Showing page " + currentPage + " of " + totalPages); $(currentTableID + '_status').text("Showing page " + currentPage + " of " + totalPages);
}); });
}
function createLastPagination () {
if (totalCollectionCount == collectionCurrentPage) {
return 0
}
$('#documentsTableID').dataTable().fnClearTable();
var offset = totalCollectionCount * 10 - 10;
$.ajax({
type: 'PUT',
url: '/_api/simple/all/',
data: '{"collection":"' + globalCollectionName + '","skip":' + offset + ',"limit":10}',
contentType: "application/json",
success: function(data) {
$.each(data.result, function(k, v) {
$('#documentsTableID').dataTable().fnAddData(['<button class="enabled" id="deleteDoc"><img src="/_admin/html/media/icons/doc_delete_icon16.png" width="16" height="16"></button><button class="enabled" id="editDoc"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>', v._id, v._rev, '<pre class=prettify>' + cutByResolution(JSON.stringify(v)) + '</pre>' ]);
});
$(".prettify").snippet("javascript", {style: "nedit", menu: false, startText: false, transparent: true, showNum: false});
collectionCurrentPage = totalCollectionCount;
$('#documents_status').text("Showing page " + totalCollectionCount + " of " + totalCollectionCount);
},
error: function(data) {
}
});
} }
function globalAjaxCursorChange() { function globalAjaxCursorChange() {
@ -2370,40 +2261,7 @@ function stateReplace (value) {
} }
$('#submitDocPageInput').live('click', function () { $('#submitDocPageInput').live('click', function () {
try { loadDocuments(globalCollectionName, parseInt($('#docPageInput').val()));
var enteredPage = JSON.parse($('#docPageInput').val());
if (enteredPage > 0 && enteredPage <= totalCollectionCount) {
$('#documentsTableID').dataTable().fnClearTable();
var offset = enteredPage * 10 - 10;
$.ajax({
type: 'PUT',
url: '/_api/simple/all/',
data: '{"collection":"' + globalCollectionName + '","skip":' + offset + ',"limit":10}',
contentType: "application/json",
success: function(data) {
$.each(data.result, function(k, v) {
$('#documentsTableID').dataTable().fnAddData(['<button class="enabled" id="deleteDoc"><img src="/_admin/html/media/icons/doc_delete_icon16.png" width="16" height="16"></button><button class="enabled" id="editDoc"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>', v._id, v._rev, '<pre class="prettify">' + cutByResolution(JSON.stringify(v)) + '</pre>' ]);
});
$(".prettify").snippet("javascript", {style: "nedit", menu: false, startText: false, transparent: true, showNum: false});
collectionCurrentPage = enteredPage;
$('#documents_status').text("Showing page " + enteredPage + " of " + totalCollectionCount);
return false;
},
error: function(data) {
}
});
}
else {
return false;
}
}
catch(e) {
alert("No valid Page");
return false;
}
return false; return false;
}); });
@ -2720,8 +2578,12 @@ function drawRequests (placeholder, granularity) {
} }
function updateGraphs() { function updateGraphs() {
if (location.hash == "#status") {
updateChartBoxes(); updateChartBoxes();
setTimeout(updateGraphs, 60000); setTimeout(updateGraphs, 60000);
}
else {
}
} }
$(document).delegate('#btnAddNewStat', 'mouseleave', function () { setTimeout(function(){ if (!ItemActionButtons.isHoverMenu) { $('#btnSaveExtraOptions').hide(); }}, 100, 1) }); $(document).delegate('#btnAddNewStat', 'mouseleave', function () { setTimeout(function(){ if (!ItemActionButtons.isHoverMenu) { $('#btnSaveExtraOptions').hide(); }}, 100, 1) });
@ -2998,3 +2860,179 @@ function createSingleBox (id, val, question) {
temptop = temptop + 10; temptop = temptop + 10;
stateSaving(); stateSaving();
} }
function highlightNavButton (buttonID) {
$("#Collections").css('background-color', '#E3E3E3');
$("#Collections").css('color', '#333333');
$("#Query").css('background-color', '#E3E3E3');
$("#Query").css('color', '#333333');
$("#AvocSH").css('background-color', '#E3E3E3');
$("#AvocSH").css('color', '#333333');
$("#Logs").css('background-color', '#E3E3E3');
$("#Logs").css('color', '#333333');
$("#Status").css('background-color', '#E3E3E3');
$("#Status").css('color', '#333333');
$(buttonID).css('background-color', '#9EAF5A');
$(buttonID).css('color', 'white');
}
function getCollectionInfo (identifier) {
var collectionInfo = { };
$.ajax({
type: "GET",
url: "/_api/collection/" + identifier,
contentType: "application/json",
processData: false,
async: false,
success: function(data) {
collectionInfo = data;
},
error: function(data) {
}
});
return collectionInfo;
}
function loadDocuments (collectionName, currentPage) {
var documentsPerPage = 10;
var documentCount = 0;
var totalPages;
$.ajax({
type: "GET",
url: "/_api/collection/" + collectionName + "/count",
contentType: "application/json",
processData: false,
async: false,
success: function(data) {
globalCollectionName = data.name;
totalPages = Math.ceil(data.count / documentsPerPage);
documentCount = data.count;
$('#nav2').text(globalCollectionName);
},
error: function(data) {
}
});
if (isNaN(currentPage) || currentPage == undefined || currentPage < 1) {
currentPage = 1;
}
if (totalPages == 0) {
totalPages = 1;
}
// set the global variables, argl!
collectionCurrentPage = currentPage;
collectionTotalPages = totalPages;
var offset = (currentPage - 1) * documentsPerPage; // skip this number of documents
$('#documentsTableID').dataTable().fnClearTable();
$.ajax({
type: 'PUT',
url: '/_api/simple/all/',
data: '{"collection":"' + collectionName + '","skip":' + offset + ',"limit":' + String(documentsPerPage) + '}',
contentType: "application/json",
success: function(data) {
$.each(data.result, function(k, v) {
$('#documentsTableID').dataTable().fnAddData(['<button class="enabled" id="deleteDoc"><img src="/_admin/html/media/icons/doc_delete_icon16.png" width="16" height="16"></button><button class="enabled" id="editDoc"><img src="/_admin/html/media/icons/doc_edit_icon16.png" width="16" height="16"></button>', v._id, v._rev, '<pre class="prettify" id="editDoc">' + cutByResolution(JSON.stringify(v)) + '</pre>' ]);
});
$(".prettify").snippet("javascript", {style: "nedit", menu: false, startText: false, transparent: true, showNum: false});
$('#documents_status').text(String(documentCount) + " document(s), showing page " + currentPage + " of " + totalPages);
},
error: function(data) {
}
});
showCursor();
}
function systemAttributes () {
return {
'_id' : true,
'_rev' : true,
'_from' : true,
'_to' : true,
'$id' : true
};
}
function isSystemAttribute (val) {
var a = systemAttributes();
return a[val];
}
function isSystemCollection (val) {
return val && val.name && val.name.substr(0, 1) === '_';
}
function collectionApiType (identifier) {
if (CollectionTypes[identifier] == undefined) {
CollectionTypes[identifier] = getCollectionInfo(identifier).type;
}
if (CollectionTypes[identifier] == 3) {
return "edge";
}
return "document";
}
function collectionType (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 (isSystemCollection(val)) {
type += " (system)";
}
return type;
}
function getErrorMessage (data) {
if (data && data.responseText) {
// HTTP error
try {
var json = JSON.parse(data.responseText);
if (json.errorMessage) {
return json.errorMessage;
}
}
catch (e) {
}
return data.responseText;
}
if (data && data.responseText === '') {
return "Could not connect to server";
}
if (typeof data == 'string') {
// other string error
return data;
}
if (data != undefined) {
// some other data type
return JSON.stringify(data);
}
// fallback
return "an unknown error occurred";
}

View File

@ -282,6 +282,21 @@ void TRI_FreeBufferLogging (TRI_vector_t* buffer);
/// @{ /// @{
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief macro that validates printf() style call arguments
/// the printf() call contained will never be executed but is just there to
/// enable compile-time error check. it will be optimised away after that
////////////////////////////////////////////////////////////////////////////////
#ifdef TRI_ENABLE_LOGGER
#define LOG_ARG_CHECK(...) \
if (false) { \
printf(__VA_ARGS__); \
} \
#endif
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// @brief logs fatal errors /// @brief logs fatal errors
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -290,6 +305,7 @@ void TRI_FreeBufferLogging (TRI_vector_t* buffer);
#define LOG_FATAL(...) \ #define LOG_FATAL(...) \
do { \ do { \
LOG_ARG_CHECK(__VA_ARGS__) \
if (TRI_IsHumanLogging() && TRI_IsFatalLogging()) { \ if (TRI_IsHumanLogging() && TRI_IsFatalLogging()) { \
TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_FATAL, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_FATAL, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \
} \ } \
@ -309,6 +325,7 @@ void TRI_FreeBufferLogging (TRI_vector_t* buffer);
#define LOG_ERROR(...) \ #define LOG_ERROR(...) \
do { \ do { \
LOG_ARG_CHECK(__VA_ARGS__) \
if (TRI_IsHumanLogging() && TRI_IsErrorLogging()) { \ if (TRI_IsHumanLogging() && TRI_IsErrorLogging()) { \
TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_ERROR, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_ERROR, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \
} \ } \
@ -330,6 +347,7 @@ void TRI_FreeBufferLogging (TRI_vector_t* buffer);
#define LOG_WARNING(...) \ #define LOG_WARNING(...) \
do { \ do { \
LOG_ARG_CHECK(__VA_ARGS__) \
if (TRI_IsHumanLogging() && TRI_IsWarningLogging()) { \ if (TRI_IsHumanLogging() && TRI_IsWarningLogging()) { \
TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_WARNING, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_WARNING, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \
} \ } \
@ -351,6 +369,7 @@ void TRI_FreeBufferLogging (TRI_vector_t* buffer);
#define LOG_INFO(...) \ #define LOG_INFO(...) \
do { \ do { \
LOG_ARG_CHECK(__VA_ARGS__) \
if (TRI_IsHumanLogging() && TRI_IsInfoLogging()) { \ if (TRI_IsHumanLogging() && TRI_IsInfoLogging()) { \
TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_INFO, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_INFO, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \
} \ } \
@ -372,6 +391,7 @@ void TRI_FreeBufferLogging (TRI_vector_t* buffer);
#define LOG_DEBUG(...) \ #define LOG_DEBUG(...) \
do { \ do { \
LOG_ARG_CHECK(__VA_ARGS__) \
if (TRI_IsHumanLogging() && TRI_IsDebugLogging(__FILE__)) { \ if (TRI_IsHumanLogging() && TRI_IsDebugLogging(__FILE__)) { \
TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_DEBUG, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_DEBUG, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \
} \ } \
@ -391,6 +411,7 @@ void TRI_FreeBufferLogging (TRI_vector_t* buffer);
#define LOG_TRACE(...) \ #define LOG_TRACE(...) \
do { \ do { \
LOG_ARG_CHECK(__VA_ARGS__) \
if (TRI_IsHumanLogging() && TRI_IsTraceLogging(__FILE__)) { \ if (TRI_IsHumanLogging() && TRI_IsTraceLogging(__FILE__)) { \
TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_TRACE, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \ TRI_Log(__FUNCTION__, __FILE__, __LINE__, TRI_LOG_LEVEL_TRACE, TRI_LOG_SEVERITY_HUMAN, __VA_ARGS__); \
} \ } \

View File

@ -198,14 +198,15 @@ static char** AttemptedCompletion (char const* text, int start, int end) {
if (result != 0 && result[0] != 0 && result[1] == 0) { if (result != 0 && result[0] != 0 && result[1] == 0) {
size_t n = strlen(result[0]); size_t n = strlen(result[0]);
if (result[0][n-1] == ')') { if (result[0][n - 1] == ')') {
result[0][n-1] = '\0'; result[0][n - 1] = '\0';
}
}
#if RL_READLINE_VERSION >= 0x0500 #if RL_READLINE_VERSION >= 0x0500
// issue #289
rl_completion_suppress_append = 1; rl_completion_suppress_append = 1;
#endif #endif
}
}
return result; return result;
} }
@ -250,6 +251,9 @@ V8LineEditor::V8LineEditor (v8::Handle<v8::Context> context, std::string const&
bool V8LineEditor::open (const bool autoComplete) { bool V8LineEditor::open (const bool autoComplete) {
if (autoComplete) { if (autoComplete) {
// issue #289: do not append a space after completion
rl_completion_append_character = '\0';
rl_attempted_completion_function = AttemptedCompletion; rl_attempted_completion_function = AttemptedCompletion;
rl_completer_word_break_characters = WordBreakCharacters; rl_completer_word_break_characters = WordBreakCharacters;