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 {
|
else {
|
||||||
var collName = $('#new-collection-name').val(),
|
var collName = $('#new-collection-name').val(),
|
||||||
collSize = $('#new-collection-size').val(),
|
collSize = $('#new-collection-size').val(),
|
||||||
|
replicationFactor = $('#new-replication-factor').val(),
|
||||||
collType = $('#new-collection-type').val(),
|
collType = $('#new-collection-type').val(),
|
||||||
collSync = $('#new-collection-sync').val(),
|
collSync = $('#new-collection-sync').val(),
|
||||||
shards = 1,
|
shards = 1,
|
||||||
shardBy = [];
|
shardBy = [];
|
||||||
|
|
||||||
|
if (replicationFactor === '') {
|
||||||
|
replicationFactor = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (isCoordinator) {
|
if (isCoordinator) {
|
||||||
shards = $('#new-collection-shards').val();
|
shards = $('#new-collection-shards').val();
|
||||||
|
|
||||||
|
@ -393,6 +398,7 @@
|
||||||
wfs: wfs,
|
wfs: wfs,
|
||||||
isSystem: isSystem,
|
isSystem: isSystem,
|
||||||
collSize: collSize,
|
collSize: collSize,
|
||||||
|
replicationFactor: replicationFactor,
|
||||||
collType: collType,
|
collType: collType,
|
||||||
shards: shards,
|
shards: shards,
|
||||||
shardBy: shardBy
|
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(
|
advancedTableContent.push(
|
||||||
window.modalView.createSelectEntry(
|
window.modalView.createSelectEntry(
|
||||||
"new-collection-sync",
|
"new-collection-sync",
|
||||||
|
|
|
@ -381,6 +381,7 @@
|
||||||
@extend %pull-right;
|
@extend %pull-right;
|
||||||
|
|
||||||
.dashboard-legend-inner {
|
.dashboard-legend-inner {
|
||||||
|
margin-right: 25px;
|
||||||
padding: 10px 5px 5px 0;
|
padding: 10px 5px 5px 0;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@
|
||||||
background: $c-white;
|
background: $c-white;
|
||||||
border: 1px solid $c-bluegrey-border;
|
border: 1px solid $c-bluegrey-border;
|
||||||
display: none;
|
display: none;
|
||||||
margin-top: 10px !important;
|
margin-top: 55px !important;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
|
|
|
@ -307,8 +307,6 @@ function encodePassword(password) {
|
||||||
return encoded;
|
return encoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief constructor
|
/// @brief constructor
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -26,6 +26,7 @@ const assert = require('assert');
|
||||||
const internal = require('internal');
|
const internal = require('internal');
|
||||||
const arangodb = require('@arangodb');
|
const arangodb = require('@arangodb');
|
||||||
const NOT_FOUND = arangodb.errors.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code;
|
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 db = arangodb.db;
|
||||||
const aql = arangodb.aql;
|
const aql = arangodb.aql;
|
||||||
|
|
||||||
|
@ -87,9 +88,24 @@ module.exports = function systemStorage(cfg) {
|
||||||
let sid = session._key;
|
let sid = session._key;
|
||||||
const isNew = !sid;
|
const isNew = !sid;
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
const meta = db._sessions.save(payload);
|
// generate a new key
|
||||||
sid = meta._key;
|
let crypto = require("@arangodb/crypto");
|
||||||
session._key = sid;
|
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 {
|
} else {
|
||||||
db._sessions.replace(sid, payload);
|
db._sessions.replace(sid, payload);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const arangodb = require('@arangodb');
|
const arangodb = require('@arangodb');
|
||||||
const NOT_FOUND = arangodb.errors.ERROR_ARANGO_DOCUMENT_NOT_FOUND.code;
|
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 db = arangodb.db;
|
||||||
const aql = arangodb.aql;
|
const aql = arangodb.aql;
|
||||||
|
|
||||||
|
@ -95,8 +96,23 @@ module.exports = function collectionStorage(cfg) {
|
||||||
data: session.data
|
data: session.data
|
||||||
};
|
};
|
||||||
if (!session._key) {
|
if (!session._key) {
|
||||||
const meta = collection.save(payload);
|
// generate a new key
|
||||||
session._key = meta._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 {
|
} else {
|
||||||
collection.replace(session._key, payload);
|
collection.replace(session._key, payload);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue