mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
51447ec2aa
|
@ -327,11 +327,16 @@
|
|||
else {
|
||||
var collName = $('#new-collection-name').val(),
|
||||
collSize = $('#new-collection-size').val(),
|
||||
replicationFactor = $('#new-replication-factor').val(),
|
||||
collType = $('#new-collection-type').val(),
|
||||
collSync = $('#new-collection-sync').val(),
|
||||
shards = 1,
|
||||
shardBy = [];
|
||||
|
||||
if (replicationFactor === '') {
|
||||
replicationFactor = 1;
|
||||
}
|
||||
|
||||
if (isCoordinator) {
|
||||
shards = $('#new-collection-shards').val();
|
||||
|
||||
|
@ -393,6 +398,7 @@
|
|||
wfs: wfs,
|
||||
isSystem: isSystem,
|
||||
collSize: collSize,
|
||||
replicationFactor: replicationFactor,
|
||||
collType: collType,
|
||||
shards: shards,
|
||||
shardBy: shardBy
|
||||
|
@ -496,6 +502,24 @@
|
|||
]
|
||||
)
|
||||
);
|
||||
if (window.App.isCluster) {
|
||||
advancedTableContent.push(
|
||||
window.modalView.createTextEntry(
|
||||
"new-replication-factor",
|
||||
"Replication factor",
|
||||
"",
|
||||
"Numeric value. Default is '1'. Description: TODO",
|
||||
"",
|
||||
false,
|
||||
[
|
||||
{
|
||||
rule: Joi.string().allow('').optional().regex(/^[0-9]*$/),
|
||||
msg: "Must be a number."
|
||||
}
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
advancedTableContent.push(
|
||||
window.modalView.createSelectEntry(
|
||||
"new-collection-sync",
|
||||
|
|
|
@ -381,6 +381,7 @@
|
|||
@extend %pull-right;
|
||||
|
||||
.dashboard-legend-inner {
|
||||
margin-right: 25px;
|
||||
padding: 10px 5px 5px 0;
|
||||
text-align: right;
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@
|
|||
background: $c-white;
|
||||
border: 1px solid $c-bluegrey-border;
|
||||
display: none;
|
||||
margin-top: 10px !important;
|
||||
margin-top: 55px !important;
|
||||
min-width: 200px;
|
||||
position: absolute;
|
||||
z-index: 9999;
|
||||
|
|
|
@ -307,8 +307,6 @@ function encodePassword(password) {
|
|||
return encoded;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -26,6 +26,7 @@ const assert = require('assert');
|
|||
const internal = require('internal');
|
||||
const arangodb = require('@arangodb');
|
||||
const NOT_FOUND = arangodb.errors.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code;
|
||||
const UNIQUE_CONSTRAINT = arangodb.errors.ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED.code;
|
||||
const db = arangodb.db;
|
||||
const aql = arangodb.aql;
|
||||
|
||||
|
@ -87,9 +88,24 @@ module.exports = function systemStorage(cfg) {
|
|||
let sid = session._key;
|
||||
const isNew = !sid;
|
||||
if (isNew) {
|
||||
const meta = db._sessions.save(payload);
|
||||
sid = meta._key;
|
||||
session._key = sid;
|
||||
// generate a new key
|
||||
let crypto = require("@arangodb/crypto");
|
||||
while (true) {
|
||||
payload._key = crypto.sha256(crypto.rand() + "-frontend");
|
||||
try {
|
||||
// test if key is already present in collection
|
||||
const meta = db._sessions.save(payload);
|
||||
sid = meta._key;
|
||||
session._key = sid;
|
||||
console.log(1);
|
||||
console.log(session._key);
|
||||
break;
|
||||
} catch (e) {
|
||||
if (!e.isArangoError || e.errorNum !== UNIQUE_CONSTRAINT) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
db._sessions.replace(sid, payload);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
const assert = require('assert');
|
||||
const arangodb = require('@arangodb');
|
||||
const NOT_FOUND = arangodb.errors.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code;
|
||||
const UNIQUE_CONSTRAINT = arangodb.errors.ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED.code;
|
||||
const db = arangodb.db;
|
||||
const aql = arangodb.aql;
|
||||
|
||||
|
@ -95,8 +96,23 @@ module.exports = function collectionStorage(cfg) {
|
|||
data: session.data
|
||||
};
|
||||
if (!session._key) {
|
||||
const meta = collection.save(payload);
|
||||
session._key = meta._key;
|
||||
// generate a new key
|
||||
let crypto = require("@arangodb/crypto");
|
||||
while (true) {
|
||||
payload._key = crypto.sha256(crypto.rand() + "-frontend");
|
||||
try {
|
||||
// test if key is already present in collection
|
||||
const meta = collection.save(payload);
|
||||
session._key = meta._key;
|
||||
console.log(2);
|
||||
console.log(session._key);
|
||||
break;
|
||||
} catch (e) {
|
||||
if (!e.isArangoError || e.errorNum !== UNIQUE_CONSTRAINT) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
collection.replace(session._key, payload);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue