mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into spdvpk
This commit is contained in:
commit
ee5686b247
|
@ -32,6 +32,14 @@ js-*.h
|
|||
3rdParty/libev/ARCH.x64/
|
||||
3rdParty/libev/ARCH.ia32/
|
||||
3rdParty/zlib-1.2.7/
|
||||
3rdParty/libev/.libs/
|
||||
3rdParty/libev/config.h
|
||||
3rdParty/libev/ev.lo
|
||||
3rdParty/libev/event.lo
|
||||
3rdParty/libev/libev.la
|
||||
3rdParty/libev/libtool
|
||||
3rdParty/libev/stamp-h1
|
||||
3rdParty/libev/BUILD/
|
||||
|
||||
build/
|
||||
Build64/
|
||||
|
|
|
@ -445,7 +445,6 @@ void ApplicationV8::exitContext(V8Context* context) {
|
|||
TRI_ASSERT(context->_locker->IsLocked(isolate));
|
||||
TRI_ASSERT(v8::Locker::IsLocked(isolate));
|
||||
|
||||
TRI_vocbase_t* vocbase = nullptr;
|
||||
bool canceled = false;
|
||||
|
||||
// update data for later garbage collection
|
||||
|
@ -453,11 +452,11 @@ void ApplicationV8::exitContext(V8Context* context) {
|
|||
TRI_GET_GLOBALS();
|
||||
context->_hasActiveExternals = v8g->hasActiveExternals();
|
||||
++context->_numExecutions;
|
||||
vocbase = v8g->_vocbase;
|
||||
TRI_vocbase_t* vocbase = v8g->_vocbase;
|
||||
|
||||
TRI_ASSERT(vocbase != nullptr);
|
||||
// release last recently used vocbase
|
||||
TRI_ReleaseVocBase(static_cast<TRI_vocbase_t*>(v8g->_vocbase));
|
||||
TRI_ReleaseVocBase(vocbase);
|
||||
|
||||
// check for cancelation requests
|
||||
canceled = v8g->_canceled;
|
||||
|
|
|
@ -437,28 +437,6 @@
|
|||
|
||||
isSystemCollection: function (val) {
|
||||
return val.name.substr(0, 1) === '_';
|
||||
// the below code is completely inappropriate as it will
|
||||
// load the collection just for the check whether it
|
||||
// is a system collection. as a consequence, the below
|
||||
// code would load ALL collections when the web interface
|
||||
// is called
|
||||
/*
|
||||
var returnVal = false;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/_api/collection/" + encodeURIComponent(val) + "/properties",
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
returnVal = data.isSystem;
|
||||
},
|
||||
error: function(data) {
|
||||
returnVal = false;
|
||||
}
|
||||
});
|
||||
return returnVal;
|
||||
*/
|
||||
},
|
||||
|
||||
setDocumentStore : function (a) {
|
||||
|
|
Binary file not shown.
|
@ -10787,28 +10787,6 @@ function GraphViewer(svg, width, height, adapterConfig, config) {
|
|||
|
||||
isSystemCollection: function (val) {
|
||||
return val.name.substr(0, 1) === '_';
|
||||
// the below code is completely inappropriate as it will
|
||||
// load the collection just for the check whether it
|
||||
// is a system collection. as a consequence, the below
|
||||
// code would load ALL collections when the web interface
|
||||
// is called
|
||||
/*
|
||||
var returnVal = false;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/_api/collection/" + encodeURIComponent(val) + "/properties",
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
returnVal = data.isSystem;
|
||||
},
|
||||
error: function(data) {
|
||||
returnVal = false;
|
||||
}
|
||||
});
|
||||
return returnVal;
|
||||
*/
|
||||
},
|
||||
|
||||
setDocumentStore : function (a) {
|
||||
|
@ -17347,7 +17325,7 @@ window.Users = Backbone.Model.extend({
|
|||
case 3:
|
||||
return 'loaded';
|
||||
case 4:
|
||||
return 'will be unloaded';
|
||||
return 'in the process of being unloaded';
|
||||
case 5:
|
||||
return 'deleted';
|
||||
case 6:
|
||||
|
@ -20364,6 +20342,9 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
$('#collection_' + model.get("name") + ' .corneredBadge').removeClass('inProgress');
|
||||
$('#collection_' + model.get("name") + ' .corneredBadge').addClass('loaded');
|
||||
}
|
||||
if (model.get('status') === 'unloaded') {
|
||||
$('#collection_' + model.get("name") + ' .icon_arangodb_info').addClass('disabled');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -22283,40 +22264,67 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
},
|
||||
|
||||
saveDocument: function () {
|
||||
if ($('#saveDocumentButton').attr('disabled') === undefined) {
|
||||
if (this.collection.first().attributes._id.substr(0, 1) === '_') {
|
||||
|
||||
var buttons = [], tableContent = [];
|
||||
tableContent.push(
|
||||
window.modalView.createReadOnlyEntry(
|
||||
'doc-save-system-button',
|
||||
'Caution',
|
||||
'You are modifying a system collection. Really continue?',
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
/[<>&'"]/
|
||||
)
|
||||
);
|
||||
buttons.push(
|
||||
window.modalView.createSuccessButton('Save', this.confirmSaveDocument.bind(this))
|
||||
);
|
||||
window.modalView.show('modalTable.ejs', 'Modify System Collection', buttons, tableContent);
|
||||
}
|
||||
else {
|
||||
this.confirmSaveDocument();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
confirmSaveDocument: function () {
|
||||
|
||||
window.modalView.hide();
|
||||
|
||||
var model, result;
|
||||
|
||||
if ($('#saveDocumentButton').attr('disabled') === undefined) {
|
||||
try {
|
||||
model = this.editor.get();
|
||||
}
|
||||
catch (e) {
|
||||
this.errorConfirmation(e);
|
||||
this.disableSaveButton();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
model = this.editor.get();
|
||||
}
|
||||
catch (e) {
|
||||
this.errorConfirmation(e);
|
||||
this.disableSaveButton();
|
||||
model = JSON.stringify(model);
|
||||
|
||||
if (this.type === 'document') {
|
||||
result = this.collection.saveDocument(this.colid, this.docid, model);
|
||||
if (result === false) {
|
||||
arangoHelper.arangoError('Document error:','Could not save');
|
||||
return;
|
||||
}
|
||||
|
||||
model = JSON.stringify(model);
|
||||
|
||||
if (this.type === 'document') {
|
||||
result = this.collection.saveDocument(this.colid, this.docid, model);
|
||||
if (result === false) {
|
||||
arangoHelper.arangoError('Document error:','Could not save');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (this.type === 'edge') {
|
||||
result = this.collection.saveEdge(this.colid, this.docid, model);
|
||||
if (result === false) {
|
||||
arangoHelper.arangoError('Edge error:', 'Could not save');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (this.type === 'edge') {
|
||||
result = this.collection.saveEdge(this.colid, this.docid, model);
|
||||
if (result === false) {
|
||||
arangoHelper.arangoError('Edge error:', 'Could not save');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (result === true) {
|
||||
this.successConfirmation();
|
||||
this.disableSaveButton();
|
||||
}
|
||||
if (result === true) {
|
||||
this.successConfirmation();
|
||||
this.disableSaveButton();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -25866,11 +25874,29 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
templateSlow: templateEngine.createTemplate("queryManagementViewSlow.ejs"),
|
||||
table: templateEngine.createTemplate("arangoTable.ejs"),
|
||||
tabbar: templateEngine.createTemplate("arangoTabbar.ejs"),
|
||||
active: true,
|
||||
shouldRender: true,
|
||||
timer: 0,
|
||||
refreshRate: 2000,
|
||||
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
this.activeCollection = new window.QueryManagementActive();
|
||||
this.slowCollection = new window.QueryManagementSlow();
|
||||
this.convertModelToJSON(true);
|
||||
|
||||
window.setInterval(function() {
|
||||
if (window.location.hash === '#queryManagement' && window.VISIBLE && self.shouldRender) {
|
||||
if (self.active) {
|
||||
self.convertModelToJSON(true);
|
||||
self.renderActive();
|
||||
}
|
||||
else {
|
||||
self.convertModelToJSON(false);
|
||||
self.renderSlow();
|
||||
}
|
||||
}
|
||||
}, self.refreshRate);
|
||||
},
|
||||
|
||||
events: {
|
||||
|
@ -25896,9 +25922,11 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
|
||||
switchTab: function(e) {
|
||||
if (e.currentTarget.id === 'activequeries') {
|
||||
this.active = true;
|
||||
this.convertModelToJSON(true);
|
||||
}
|
||||
else if (e.currentTarget.id === 'slowqueries') {
|
||||
this.active = false;
|
||||
this.convertModelToJSON(false);
|
||||
}
|
||||
},
|
||||
|
@ -25985,11 +26013,25 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
this.convertModelToJSON(true);
|
||||
},
|
||||
|
||||
addEvents: function() {
|
||||
var self = this;
|
||||
$('#queryManagementContent tbody').on('mousedown', function() {
|
||||
clearTimeout(self.timer);
|
||||
self.shouldRender = false;
|
||||
});
|
||||
$('#queryManagementContent tbody').on('mouseup', function() {
|
||||
self.timer = window.setTimeout(function() {
|
||||
self.shouldRender = true;
|
||||
}, 3000);
|
||||
});
|
||||
},
|
||||
|
||||
renderActive: function() {
|
||||
this.$el.html(this.templateActive.render({}));
|
||||
$(this.id).html(this.tabbar.render({content: this.tabbarElements}));
|
||||
$(this.id).append(this.table.render({content: this.tableDescription}));
|
||||
$('#activequeries').addClass("arango-active-tab");
|
||||
this.addEvents();
|
||||
},
|
||||
|
||||
renderSlow: function() {
|
||||
|
@ -25999,6 +26041,7 @@ window.ArangoUsers = Backbone.Collection.extend({
|
|||
content: this.tableDescription,
|
||||
}));
|
||||
$('#slowqueries').addClass("arango-active-tab");
|
||||
this.addEvents();
|
||||
},
|
||||
|
||||
convertModelToJSON: function (active) {
|
||||
|
|
Binary file not shown.
|
@ -268,6 +268,10 @@
|
|||
<div class="corneredBadge <%= model.get('status') %>">
|
||||
<%= model.get('status') %>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<div class="corneredBadge inProgress">
|
||||
<%= model.get('status') %>
|
||||
</div>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</span>
|
||||
|
|
Binary file not shown.
|
@ -304,6 +304,10 @@
|
|||
<div class="corneredBadge <%= model.get('status') %>">
|
||||
<%= model.get('status') %>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<div class="corneredBadge inProgress">
|
||||
<%= model.get('status') %>
|
||||
</div>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</span>
|
||||
|
|
|
@ -437,28 +437,6 @@
|
|||
|
||||
isSystemCollection: function (val) {
|
||||
return val.name.substr(0, 1) === '_';
|
||||
// the below code is completely inappropriate as it will
|
||||
// load the collection just for the check whether it
|
||||
// is a system collection. as a consequence, the below
|
||||
// code would load ALL collections when the web interface
|
||||
// is called
|
||||
/*
|
||||
var returnVal = false;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/_api/collection/" + encodeURIComponent(val) + "/properties",
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
returnVal = data.isSystem;
|
||||
},
|
||||
error: function(data) {
|
||||
returnVal = false;
|
||||
}
|
||||
});
|
||||
return returnVal;
|
||||
*/
|
||||
},
|
||||
|
||||
setDocumentStore : function (a) {
|
||||
|
|
|
@ -154,21 +154,20 @@
|
|||
return result;
|
||||
},
|
||||
|
||||
newCollection: function (collName, wfs, isSystem, journalSize, collType, shards, keys) {
|
||||
var returnobj = {};
|
||||
newCollection: function (object, callback) {
|
||||
var data = {};
|
||||
data.name = collName;
|
||||
data.waitForSync = wfs;
|
||||
if (journalSize > 0) {
|
||||
data.journalSize = journalSize;
|
||||
data.name = object.collName;
|
||||
data.waitForSync = object.wfs;
|
||||
if (object.journalSize > 0) {
|
||||
data.journalSize = object.journalSize;
|
||||
}
|
||||
data.isSystem = isSystem;
|
||||
data.type = parseInt(collType, 10);
|
||||
if (shards) {
|
||||
data.numberOfShards = shards;
|
||||
data.shardKeys = keys;
|
||||
data.isSystem = object.isSystem;
|
||||
data.type = parseInt(object.collType, 10);
|
||||
if (object.shards) {
|
||||
data.numberOfShards = object.shards;
|
||||
data.shardKeys = object.keys;
|
||||
}
|
||||
returnobj.status = false;
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type: "POST",
|
||||
|
@ -176,17 +175,13 @@
|
|||
data: JSON.stringify(data),
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
returnobj.status = true;
|
||||
returnobj.data = data;
|
||||
callback(false, data);
|
||||
},
|
||||
error: function(data) {
|
||||
returnobj.status = false;
|
||||
returnobj.errorMessage = JSON.parse(data.responseText).errorMessage;
|
||||
callback(false, data);
|
||||
}
|
||||
});
|
||||
return returnobj;
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
window.arangoCollectionModel = Backbone.Model.extend({
|
||||
initialize: function () {
|
||||
},
|
||||
|
||||
idAttribute: "name",
|
||||
|
||||
|
@ -74,26 +72,22 @@
|
|||
return data2;
|
||||
},
|
||||
|
||||
getIndex: function () {
|
||||
var data2;
|
||||
getIndex: function (callback) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
cache: false,
|
||||
url: "/_api/index/?collection=" + this.get("id"),
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
async: false,
|
||||
success: function(data) {
|
||||
data2 = data;
|
||||
callback(false, data);
|
||||
},
|
||||
error: function(data) {
|
||||
data2 = data;
|
||||
callback(true, data);
|
||||
}
|
||||
});
|
||||
return data2;
|
||||
},
|
||||
|
||||
|
||||
createIndex: function (postParameter, callback) {
|
||||
|
||||
var self = this;
|
||||
|
@ -163,15 +157,14 @@
|
|||
|
||||
truncateCollection: function () {
|
||||
$.ajax({
|
||||
async: false,
|
||||
cache: false,
|
||||
type: 'PUT',
|
||||
url: "/_api/collection/" + this.get("id") + "/truncate",
|
||||
success: function () {
|
||||
arangoHelper.arangoNotification('Collection truncated');
|
||||
arangoHelper.arangoNotification('Collection truncated.');
|
||||
},
|
||||
error: function () {
|
||||
arangoHelper.arangoError('Collection error');
|
||||
arangoHelper.arangoError('Collection error.');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -207,36 +200,27 @@
|
|||
callback();
|
||||
},
|
||||
|
||||
renameCollection: function (name) {
|
||||
var self = this,
|
||||
result = false;
|
||||
renameCollection: function (name, callback) {
|
||||
var self = this;
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type: "PUT",
|
||||
async: false, // sequential calls!
|
||||
url: "/_api/collection/" + this.get("id") + "/rename",
|
||||
data: JSON.stringify({ name: name }),
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
success: function() {
|
||||
self.set("name", name);
|
||||
result = true;
|
||||
callback(false);
|
||||
},
|
||||
error: function(/*data*/) {
|
||||
try {
|
||||
console.log("error");
|
||||
//var parsed = JSON.parse(data.responseText);
|
||||
//result = parsed.errorMessage;
|
||||
}
|
||||
catch (e) {
|
||||
result = false;
|
||||
}
|
||||
error: function(data) {
|
||||
callback(true, data);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
changeCollection: function (wfs, journalSize, indexBuckets) {
|
||||
changeCollection: function (wfs, journalSize, indexBuckets, callback) {
|
||||
var result = false;
|
||||
if (wfs === "true") {
|
||||
wfs = true;
|
||||
|
@ -253,22 +237,15 @@
|
|||
$.ajax({
|
||||
cache: false,
|
||||
type: "PUT",
|
||||
async: false, // sequential calls!
|
||||
url: "/_api/collection/" + this.get("id") + "/properties",
|
||||
data: JSON.stringify(data),
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
success: function() {
|
||||
result = true;
|
||||
callback(false);
|
||||
},
|
||||
error: function(data) {
|
||||
try {
|
||||
var parsed = JSON.parse(data.responseText);
|
||||
result = parsed.errorMessage;
|
||||
}
|
||||
catch (e) {
|
||||
result = false;
|
||||
}
|
||||
callback(false, data);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
|
|
@ -138,7 +138,6 @@
|
|||
|
||||
truncateCollection: function () {
|
||||
this.model.truncateCollection();
|
||||
this.render();
|
||||
window.modalView.hide();
|
||||
},
|
||||
|
||||
|
@ -189,40 +188,42 @@
|
|||
return 0;
|
||||
}
|
||||
|
||||
var result;
|
||||
if (this.model.get('name') !== newname) {
|
||||
result = this.model.renameCollection(newname);
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
if (result !== undefined) {
|
||||
arangoHelper.arangoError("Collection error: " + result);
|
||||
return 0;
|
||||
var callbackChange = function(error) {
|
||||
if (error) {
|
||||
arangoHelper.arangoError("Collection error: " + error.responseText);
|
||||
}
|
||||
}
|
||||
|
||||
var wfs = $('#change-collection-sync').val();
|
||||
var changeResult = this.model.changeCollection(wfs, journalSize, indexBuckets);
|
||||
|
||||
if (changeResult !== true) {
|
||||
arangoHelper.arangoNotification("Collection error", changeResult);
|
||||
return 0;
|
||||
}
|
||||
|
||||
this.collectionsView.render();
|
||||
window.modalView.hide();
|
||||
}
|
||||
else if (status === 'unloaded') {
|
||||
if (this.model.get('name') !== newname) {
|
||||
var result2 = this.model.renameCollection(newname);
|
||||
|
||||
if (result2 === true) {
|
||||
else {
|
||||
this.collectionsView.render();
|
||||
window.modalView.hide();
|
||||
}
|
||||
else {
|
||||
arangoHelper.arangoError("Collection error: " + result2);
|
||||
}.bind(this);
|
||||
|
||||
var callbackRename = function(error) {
|
||||
if (error) {
|
||||
arangoHelper.arangoError("Collection error: " + error.responseText);
|
||||
}
|
||||
else {
|
||||
var wfs = $('#change-collection-sync').val();
|
||||
this.model.changeCollection(wfs, journalSize, indexBuckets, callbackChange);
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
this.model.renameCollection(newname, callbackRename);
|
||||
}
|
||||
else if (status === 'unloaded') {
|
||||
if (this.model.get('name') !== newname) {
|
||||
|
||||
var callbackRename2 = function(error, data) {
|
||||
if (error) {
|
||||
arangoHelper.arangoError("Collection error: " + data.responseText);
|
||||
}
|
||||
else {
|
||||
this.collectionsView.render();
|
||||
window.modalView.hide();
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
this.model.renameCollection(newname, callbackRename2);
|
||||
}
|
||||
else {
|
||||
window.modalView.hide();
|
||||
|
@ -230,10 +231,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
//modal dialogs
|
||||
|
||||
createEditPropertiesModal: function() {
|
||||
|
||||
var collectionIsLoaded = false;
|
||||
|
@ -392,7 +389,6 @@
|
|||
else {
|
||||
$($('#infoTab').children()[1]).remove();
|
||||
}
|
||||
this.bindIndexEvents();
|
||||
},
|
||||
|
||||
bindIndexEvents: function() {
|
||||
|
@ -419,6 +415,7 @@
|
|||
});
|
||||
|
||||
$('.deleteIndex').bind('click', function(e) {
|
||||
console.log("asdasd");
|
||||
self.prepDeleteIndex(e);
|
||||
});
|
||||
|
||||
|
@ -643,7 +640,23 @@
|
|||
},
|
||||
|
||||
getIndex: function () {
|
||||
this.index = this.model.getIndex();
|
||||
|
||||
var callback = function(error, data) {
|
||||
if (error) {
|
||||
window.arangoHelper.arangoError('Index', data.errorMessage);
|
||||
}
|
||||
else {
|
||||
this.renderIndex(data);
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
this.model.getIndex(callback);
|
||||
},
|
||||
|
||||
renderIndex: function(data) {
|
||||
|
||||
this.index = data;
|
||||
|
||||
var cssClass = 'collectionInfoTh modal-text';
|
||||
if (this.index) {
|
||||
var fieldString = '';
|
||||
|
@ -686,6 +699,7 @@
|
|||
);
|
||||
});
|
||||
}
|
||||
this.bindIndexEvents();
|
||||
},
|
||||
|
||||
toggleNewIndexView: function () {
|
||||
|
|
|
@ -358,14 +358,27 @@
|
|||
return 0;
|
||||
}
|
||||
|
||||
var returnobj = this.collection.newCollection(
|
||||
collName, wfs, isSystem, collSize, collType, shards, shardBy
|
||||
);
|
||||
if (returnobj.status !== true) {
|
||||
arangoHelper.arangoError("Collection error", returnobj.errorMessage);
|
||||
}
|
||||
this.updateCollectionsView();
|
||||
window.modalView.hide();
|
||||
var callback = function(error, data) {
|
||||
|
||||
if (error) {
|
||||
arangoHelper.arangoError("Collection error", data.errorMessage);
|
||||
}
|
||||
else {
|
||||
this.updateCollectionsView();
|
||||
}
|
||||
window.modalView.hide();
|
||||
|
||||
}.bind(this);
|
||||
|
||||
this.collection.newCollection({
|
||||
collName: collName,
|
||||
wfs: wfs,
|
||||
isSystem: isSystem,
|
||||
collSize: collSize,
|
||||
collType: collType,
|
||||
shards: shards,
|
||||
shardBy: shardBy
|
||||
}, callback);
|
||||
},
|
||||
|
||||
createNewCollectionModal: function() {
|
||||
|
|
|
@ -188,40 +188,67 @@
|
|||
},
|
||||
|
||||
saveDocument: function () {
|
||||
if ($('#saveDocumentButton').attr('disabled') === undefined) {
|
||||
if (this.collection.first().attributes._id.substr(0, 1) === '_') {
|
||||
|
||||
var buttons = [], tableContent = [];
|
||||
tableContent.push(
|
||||
window.modalView.createReadOnlyEntry(
|
||||
'doc-save-system-button',
|
||||
'Caution',
|
||||
'You are modifying a system collection. Really continue?',
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
/[<>&'"]/
|
||||
)
|
||||
);
|
||||
buttons.push(
|
||||
window.modalView.createSuccessButton('Save', this.confirmSaveDocument.bind(this))
|
||||
);
|
||||
window.modalView.show('modalTable.ejs', 'Modify System Collection', buttons, tableContent);
|
||||
}
|
||||
else {
|
||||
this.confirmSaveDocument();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
confirmSaveDocument: function () {
|
||||
|
||||
window.modalView.hide();
|
||||
|
||||
var model, result;
|
||||
|
||||
if ($('#saveDocumentButton').attr('disabled') === undefined) {
|
||||
try {
|
||||
model = this.editor.get();
|
||||
}
|
||||
catch (e) {
|
||||
this.errorConfirmation(e);
|
||||
this.disableSaveButton();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
model = this.editor.get();
|
||||
}
|
||||
catch (e) {
|
||||
this.errorConfirmation(e);
|
||||
this.disableSaveButton();
|
||||
model = JSON.stringify(model);
|
||||
|
||||
if (this.type === 'document') {
|
||||
result = this.collection.saveDocument(this.colid, this.docid, model);
|
||||
if (result === false) {
|
||||
arangoHelper.arangoError('Document error:','Could not save');
|
||||
return;
|
||||
}
|
||||
|
||||
model = JSON.stringify(model);
|
||||
|
||||
if (this.type === 'document') {
|
||||
result = this.collection.saveDocument(this.colid, this.docid, model);
|
||||
if (result === false) {
|
||||
arangoHelper.arangoError('Document error:','Could not save');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (this.type === 'edge') {
|
||||
result = this.collection.saveEdge(this.colid, this.docid, model);
|
||||
if (result === false) {
|
||||
arangoHelper.arangoError('Edge error:', 'Could not save');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (this.type === 'edge') {
|
||||
result = this.collection.saveEdge(this.colid, this.docid, model);
|
||||
if (result === false) {
|
||||
arangoHelper.arangoError('Edge error:', 'Could not save');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (result === true) {
|
||||
this.successConfirmation();
|
||||
this.disableSaveButton();
|
||||
}
|
||||
if (result === true) {
|
||||
this.successConfirmation();
|
||||
this.disableSaveButton();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -14,11 +14,29 @@
|
|||
templateSlow: templateEngine.createTemplate("queryManagementViewSlow.ejs"),
|
||||
table: templateEngine.createTemplate("arangoTable.ejs"),
|
||||
tabbar: templateEngine.createTemplate("arangoTabbar.ejs"),
|
||||
active: true,
|
||||
shouldRender: true,
|
||||
timer: 0,
|
||||
refreshRate: 2000,
|
||||
|
||||
initialize: function () {
|
||||
var self = this;
|
||||
this.activeCollection = new window.QueryManagementActive();
|
||||
this.slowCollection = new window.QueryManagementSlow();
|
||||
this.convertModelToJSON(true);
|
||||
|
||||
window.setInterval(function() {
|
||||
if (window.location.hash === '#queryManagement' && window.VISIBLE && self.shouldRender) {
|
||||
if (self.active) {
|
||||
self.convertModelToJSON(true);
|
||||
self.renderActive();
|
||||
}
|
||||
else {
|
||||
self.convertModelToJSON(false);
|
||||
self.renderSlow();
|
||||
}
|
||||
}
|
||||
}, self.refreshRate);
|
||||
},
|
||||
|
||||
events: {
|
||||
|
@ -44,9 +62,11 @@
|
|||
|
||||
switchTab: function(e) {
|
||||
if (e.currentTarget.id === 'activequeries') {
|
||||
this.active = true;
|
||||
this.convertModelToJSON(true);
|
||||
}
|
||||
else if (e.currentTarget.id === 'slowqueries') {
|
||||
this.active = false;
|
||||
this.convertModelToJSON(false);
|
||||
}
|
||||
},
|
||||
|
@ -133,11 +153,25 @@
|
|||
this.convertModelToJSON(true);
|
||||
},
|
||||
|
||||
addEvents: function() {
|
||||
var self = this;
|
||||
$('#queryManagementContent tbody').on('mousedown', function() {
|
||||
clearTimeout(self.timer);
|
||||
self.shouldRender = false;
|
||||
});
|
||||
$('#queryManagementContent tbody').on('mouseup', function() {
|
||||
self.timer = window.setTimeout(function() {
|
||||
self.shouldRender = true;
|
||||
}, 3000);
|
||||
});
|
||||
},
|
||||
|
||||
renderActive: function() {
|
||||
this.$el.html(this.templateActive.render({}));
|
||||
$(this.id).html(this.tabbar.render({content: this.tabbarElements}));
|
||||
$(this.id).append(this.table.render({content: this.tableDescription}));
|
||||
$('#activequeries').addClass("arango-active-tab");
|
||||
this.addEvents();
|
||||
},
|
||||
|
||||
renderSlow: function() {
|
||||
|
@ -147,6 +181,7 @@
|
|||
content: this.tableDescription,
|
||||
}));
|
||||
$('#slowqueries').addClass("arango-active-tab");
|
||||
this.addEvents();
|
||||
},
|
||||
|
||||
convertModelToJSON: function (active) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"license": "Apache License, Version 2.0",
|
||||
"isSystem": true,
|
||||
"engines": {
|
||||
"arangodb": "^3.0.0"
|
||||
"arangodb": "^2.8.0"
|
||||
},
|
||||
|
||||
"repository": {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"license": "Apache License, Version 2.0",
|
||||
"isSystem": true,
|
||||
"engines": {
|
||||
"arangodb": "^3.0.0"
|
||||
"arangodb": "^2.8.0"
|
||||
},
|
||||
|
||||
"repository": {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"license": "Apache License, Version 2.0",
|
||||
"isSystem": true,
|
||||
"engines": {
|
||||
"arangodb": "^3.0.0"
|
||||
"arangodb": "^2.8.0"
|
||||
},
|
||||
|
||||
"repository": {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"license": "Apache License, Version 2.0",
|
||||
"isSystem": true,
|
||||
"engines": {
|
||||
"arangodb": "^3.0.0"
|
||||
"arangodb": "^2.8.0"
|
||||
},
|
||||
|
||||
"repository": {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"license": "Apache License, Version 2.0",
|
||||
"isSystem": true,
|
||||
"engines": {
|
||||
"arangodb": "^3.0.0"
|
||||
"arangodb": "^2.8.0"
|
||||
},
|
||||
|
||||
"repository": {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"license": "Apache License, Version 2.0",
|
||||
"isSystem": true,
|
||||
"engines": {
|
||||
"arangodb": "^3.0.0"
|
||||
"arangodb": "^2.8.0"
|
||||
},
|
||||
|
||||
"repository": {
|
||||
|
|
Loading…
Reference in New Issue