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.x64/
|
||||||
3rdParty/libev/ARCH.ia32/
|
3rdParty/libev/ARCH.ia32/
|
||||||
3rdParty/zlib-1.2.7/
|
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/
|
build/
|
||||||
Build64/
|
Build64/
|
||||||
|
|
|
@ -445,7 +445,6 @@ void ApplicationV8::exitContext(V8Context* context) {
|
||||||
TRI_ASSERT(context->_locker->IsLocked(isolate));
|
TRI_ASSERT(context->_locker->IsLocked(isolate));
|
||||||
TRI_ASSERT(v8::Locker::IsLocked(isolate));
|
TRI_ASSERT(v8::Locker::IsLocked(isolate));
|
||||||
|
|
||||||
TRI_vocbase_t* vocbase = nullptr;
|
|
||||||
bool canceled = false;
|
bool canceled = false;
|
||||||
|
|
||||||
// update data for later garbage collection
|
// update data for later garbage collection
|
||||||
|
@ -453,11 +452,11 @@ void ApplicationV8::exitContext(V8Context* context) {
|
||||||
TRI_GET_GLOBALS();
|
TRI_GET_GLOBALS();
|
||||||
context->_hasActiveExternals = v8g->hasActiveExternals();
|
context->_hasActiveExternals = v8g->hasActiveExternals();
|
||||||
++context->_numExecutions;
|
++context->_numExecutions;
|
||||||
vocbase = v8g->_vocbase;
|
TRI_vocbase_t* vocbase = v8g->_vocbase;
|
||||||
|
|
||||||
TRI_ASSERT(vocbase != nullptr);
|
TRI_ASSERT(vocbase != nullptr);
|
||||||
// release last recently used vocbase
|
// release last recently used vocbase
|
||||||
TRI_ReleaseVocBase(static_cast<TRI_vocbase_t*>(v8g->_vocbase));
|
TRI_ReleaseVocBase(vocbase);
|
||||||
|
|
||||||
// check for cancelation requests
|
// check for cancelation requests
|
||||||
canceled = v8g->_canceled;
|
canceled = v8g->_canceled;
|
||||||
|
|
|
@ -437,28 +437,6 @@
|
||||||
|
|
||||||
isSystemCollection: function (val) {
|
isSystemCollection: function (val) {
|
||||||
return val.name.substr(0, 1) === '_';
|
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) {
|
setDocumentStore : function (a) {
|
||||||
|
|
Binary file not shown.
|
@ -10787,28 +10787,6 @@ function GraphViewer(svg, width, height, adapterConfig, config) {
|
||||||
|
|
||||||
isSystemCollection: function (val) {
|
isSystemCollection: function (val) {
|
||||||
return val.name.substr(0, 1) === '_';
|
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) {
|
setDocumentStore : function (a) {
|
||||||
|
@ -17347,7 +17325,7 @@ window.Users = Backbone.Model.extend({
|
||||||
case 3:
|
case 3:
|
||||||
return 'loaded';
|
return 'loaded';
|
||||||
case 4:
|
case 4:
|
||||||
return 'will be unloaded';
|
return 'in the process of being unloaded';
|
||||||
case 5:
|
case 5:
|
||||||
return 'deleted';
|
return 'deleted';
|
||||||
case 6:
|
case 6:
|
||||||
|
@ -20364,6 +20342,9 @@ window.ArangoUsers = Backbone.Collection.extend({
|
||||||
$('#collection_' + model.get("name") + ' .corneredBadge').removeClass('inProgress');
|
$('#collection_' + model.get("name") + ' .corneredBadge').removeClass('inProgress');
|
||||||
$('#collection_' + model.get("name") + ' .corneredBadge').addClass('loaded');
|
$('#collection_' + model.get("name") + ' .corneredBadge').addClass('loaded');
|
||||||
}
|
}
|
||||||
|
if (model.get('status') === 'unloaded') {
|
||||||
|
$('#collection_' + model.get("name") + ' .icon_arangodb_info').addClass('disabled');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -22283,9 +22264,37 @@ window.ArangoUsers = Backbone.Collection.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
saveDocument: function () {
|
saveDocument: function () {
|
||||||
var model, result;
|
|
||||||
|
|
||||||
if ($('#saveDocumentButton').attr('disabled') === undefined) {
|
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;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
model = this.editor.get();
|
model = this.editor.get();
|
||||||
|
@ -22317,7 +22326,6 @@ window.ArangoUsers = Backbone.Collection.extend({
|
||||||
this.successConfirmation();
|
this.successConfirmation();
|
||||||
this.disableSaveButton();
|
this.disableSaveButton();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
successConfirmation: function () {
|
successConfirmation: function () {
|
||||||
|
@ -25866,11 +25874,29 @@ window.ArangoUsers = Backbone.Collection.extend({
|
||||||
templateSlow: templateEngine.createTemplate("queryManagementViewSlow.ejs"),
|
templateSlow: templateEngine.createTemplate("queryManagementViewSlow.ejs"),
|
||||||
table: templateEngine.createTemplate("arangoTable.ejs"),
|
table: templateEngine.createTemplate("arangoTable.ejs"),
|
||||||
tabbar: templateEngine.createTemplate("arangoTabbar.ejs"),
|
tabbar: templateEngine.createTemplate("arangoTabbar.ejs"),
|
||||||
|
active: true,
|
||||||
|
shouldRender: true,
|
||||||
|
timer: 0,
|
||||||
|
refreshRate: 2000,
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
var self = this;
|
||||||
this.activeCollection = new window.QueryManagementActive();
|
this.activeCollection = new window.QueryManagementActive();
|
||||||
this.slowCollection = new window.QueryManagementSlow();
|
this.slowCollection = new window.QueryManagementSlow();
|
||||||
this.convertModelToJSON(true);
|
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: {
|
events: {
|
||||||
|
@ -25896,9 +25922,11 @@ window.ArangoUsers = Backbone.Collection.extend({
|
||||||
|
|
||||||
switchTab: function(e) {
|
switchTab: function(e) {
|
||||||
if (e.currentTarget.id === 'activequeries') {
|
if (e.currentTarget.id === 'activequeries') {
|
||||||
|
this.active = true;
|
||||||
this.convertModelToJSON(true);
|
this.convertModelToJSON(true);
|
||||||
}
|
}
|
||||||
else if (e.currentTarget.id === 'slowqueries') {
|
else if (e.currentTarget.id === 'slowqueries') {
|
||||||
|
this.active = false;
|
||||||
this.convertModelToJSON(false);
|
this.convertModelToJSON(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -25985,11 +26013,25 @@ window.ArangoUsers = Backbone.Collection.extend({
|
||||||
this.convertModelToJSON(true);
|
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() {
|
renderActive: function() {
|
||||||
this.$el.html(this.templateActive.render({}));
|
this.$el.html(this.templateActive.render({}));
|
||||||
$(this.id).html(this.tabbar.render({content: this.tabbarElements}));
|
$(this.id).html(this.tabbar.render({content: this.tabbarElements}));
|
||||||
$(this.id).append(this.table.render({content: this.tableDescription}));
|
$(this.id).append(this.table.render({content: this.tableDescription}));
|
||||||
$('#activequeries').addClass("arango-active-tab");
|
$('#activequeries').addClass("arango-active-tab");
|
||||||
|
this.addEvents();
|
||||||
},
|
},
|
||||||
|
|
||||||
renderSlow: function() {
|
renderSlow: function() {
|
||||||
|
@ -25999,6 +26041,7 @@ window.ArangoUsers = Backbone.Collection.extend({
|
||||||
content: this.tableDescription,
|
content: this.tableDescription,
|
||||||
}));
|
}));
|
||||||
$('#slowqueries').addClass("arango-active-tab");
|
$('#slowqueries').addClass("arango-active-tab");
|
||||||
|
this.addEvents();
|
||||||
},
|
},
|
||||||
|
|
||||||
convertModelToJSON: function (active) {
|
convertModelToJSON: function (active) {
|
||||||
|
|
Binary file not shown.
|
@ -268,6 +268,10 @@
|
||||||
<div class="corneredBadge <%= model.get('status') %>">
|
<div class="corneredBadge <%= model.get('status') %>">
|
||||||
<%= model.get('status') %>
|
<%= model.get('status') %>
|
||||||
</div>
|
</div>
|
||||||
|
<% } else { %>
|
||||||
|
<div class="corneredBadge inProgress">
|
||||||
|
<%= model.get('status') %>
|
||||||
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</span>
|
</span>
|
||||||
|
|
Binary file not shown.
|
@ -304,6 +304,10 @@
|
||||||
<div class="corneredBadge <%= model.get('status') %>">
|
<div class="corneredBadge <%= model.get('status') %>">
|
||||||
<%= model.get('status') %>
|
<%= model.get('status') %>
|
||||||
</div>
|
</div>
|
||||||
|
<% } else { %>
|
||||||
|
<div class="corneredBadge inProgress">
|
||||||
|
<%= model.get('status') %>
|
||||||
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -437,28 +437,6 @@
|
||||||
|
|
||||||
isSystemCollection: function (val) {
|
isSystemCollection: function (val) {
|
||||||
return val.name.substr(0, 1) === '_';
|
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) {
|
setDocumentStore : function (a) {
|
||||||
|
|
|
@ -154,21 +154,20 @@
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
newCollection: function (collName, wfs, isSystem, journalSize, collType, shards, keys) {
|
newCollection: function (object, callback) {
|
||||||
var returnobj = {};
|
|
||||||
var data = {};
|
var data = {};
|
||||||
data.name = collName;
|
data.name = object.collName;
|
||||||
data.waitForSync = wfs;
|
data.waitForSync = object.wfs;
|
||||||
if (journalSize > 0) {
|
if (object.journalSize > 0) {
|
||||||
data.journalSize = journalSize;
|
data.journalSize = object.journalSize;
|
||||||
}
|
}
|
||||||
data.isSystem = isSystem;
|
data.isSystem = object.isSystem;
|
||||||
data.type = parseInt(collType, 10);
|
data.type = parseInt(object.collType, 10);
|
||||||
if (shards) {
|
if (object.shards) {
|
||||||
data.numberOfShards = shards;
|
data.numberOfShards = object.shards;
|
||||||
data.shardKeys = keys;
|
data.shardKeys = object.keys;
|
||||||
}
|
}
|
||||||
returnobj.status = false;
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
cache: false,
|
cache: false,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
@ -176,17 +175,13 @@
|
||||||
data: JSON.stringify(data),
|
data: JSON.stringify(data),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
processData: false,
|
processData: false,
|
||||||
async: false,
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
returnobj.status = true;
|
callback(false, data);
|
||||||
returnobj.data = data;
|
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
returnobj.status = false;
|
callback(false, data);
|
||||||
returnobj.errorMessage = JSON.parse(data.responseText).errorMessage;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return returnobj;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
window.arangoCollectionModel = Backbone.Model.extend({
|
window.arangoCollectionModel = Backbone.Model.extend({
|
||||||
initialize: function () {
|
|
||||||
},
|
|
||||||
|
|
||||||
idAttribute: "name",
|
idAttribute: "name",
|
||||||
|
|
||||||
|
@ -74,26 +72,22 @@
|
||||||
return data2;
|
return data2;
|
||||||
},
|
},
|
||||||
|
|
||||||
getIndex: function () {
|
getIndex: function (callback) {
|
||||||
var data2;
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
cache: false,
|
cache: false,
|
||||||
url: "/_api/index/?collection=" + this.get("id"),
|
url: "/_api/index/?collection=" + this.get("id"),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
processData: false,
|
processData: false,
|
||||||
async: false,
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
data2 = data;
|
callback(false, data);
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
data2 = data;
|
callback(true, data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return data2;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
createIndex: function (postParameter, callback) {
|
createIndex: function (postParameter, callback) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -163,15 +157,14 @@
|
||||||
|
|
||||||
truncateCollection: function () {
|
truncateCollection: function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: false,
|
|
||||||
cache: false,
|
cache: false,
|
||||||
type: 'PUT',
|
type: 'PUT',
|
||||||
url: "/_api/collection/" + this.get("id") + "/truncate",
|
url: "/_api/collection/" + this.get("id") + "/truncate",
|
||||||
success: function () {
|
success: function () {
|
||||||
arangoHelper.arangoNotification('Collection truncated');
|
arangoHelper.arangoNotification('Collection truncated.');
|
||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
arangoHelper.arangoError('Collection error');
|
arangoHelper.arangoError('Collection error.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -207,36 +200,27 @@
|
||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
|
|
||||||
renameCollection: function (name) {
|
renameCollection: function (name, callback) {
|
||||||
var self = this,
|
var self = this;
|
||||||
result = false;
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
cache: false,
|
cache: false,
|
||||||
type: "PUT",
|
type: "PUT",
|
||||||
async: false, // sequential calls!
|
|
||||||
url: "/_api/collection/" + this.get("id") + "/rename",
|
url: "/_api/collection/" + this.get("id") + "/rename",
|
||||||
data: JSON.stringify({ name: name }),
|
data: JSON.stringify({ name: name }),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function() {
|
success: function() {
|
||||||
self.set("name", name);
|
self.set("name", name);
|
||||||
result = true;
|
callback(false);
|
||||||
},
|
},
|
||||||
error: function(/*data*/) {
|
error: function(data) {
|
||||||
try {
|
callback(true, data);
|
||||||
console.log("error");
|
|
||||||
//var parsed = JSON.parse(data.responseText);
|
|
||||||
//result = parsed.errorMessage;
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
changeCollection: function (wfs, journalSize, indexBuckets) {
|
changeCollection: function (wfs, journalSize, indexBuckets, callback) {
|
||||||
var result = false;
|
var result = false;
|
||||||
if (wfs === "true") {
|
if (wfs === "true") {
|
||||||
wfs = true;
|
wfs = true;
|
||||||
|
@ -253,22 +237,15 @@
|
||||||
$.ajax({
|
$.ajax({
|
||||||
cache: false,
|
cache: false,
|
||||||
type: "PUT",
|
type: "PUT",
|
||||||
async: false, // sequential calls!
|
|
||||||
url: "/_api/collection/" + this.get("id") + "/properties",
|
url: "/_api/collection/" + this.get("id") + "/properties",
|
||||||
data: JSON.stringify(data),
|
data: JSON.stringify(data),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function() {
|
success: function() {
|
||||||
result = true;
|
callback(false);
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
try {
|
callback(false, data);
|
||||||
var parsed = JSON.parse(data.responseText);
|
|
||||||
result = parsed.errorMessage;
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -138,7 +138,6 @@
|
||||||
|
|
||||||
truncateCollection: function () {
|
truncateCollection: function () {
|
||||||
this.model.truncateCollection();
|
this.model.truncateCollection();
|
||||||
this.render();
|
|
||||||
window.modalView.hide();
|
window.modalView.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -189,40 +188,42 @@
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var result;
|
var callbackChange = function(error) {
|
||||||
if (this.model.get('name') !== newname) {
|
if (error) {
|
||||||
result = this.model.renameCollection(newname);
|
arangoHelper.arangoError("Collection error: " + error.responseText);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if (result !== true) {
|
|
||||||
if (result !== undefined) {
|
|
||||||
arangoHelper.arangoError("Collection error: " + result);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
this.collectionsView.render();
|
||||||
window.modalView.hide();
|
window.modalView.hide();
|
||||||
}
|
}
|
||||||
|
}.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') {
|
else if (status === 'unloaded') {
|
||||||
if (this.model.get('name') !== newname) {
|
if (this.model.get('name') !== newname) {
|
||||||
var result2 = this.model.renameCollection(newname);
|
|
||||||
|
|
||||||
if (result2 === true) {
|
var callbackRename2 = function(error, data) {
|
||||||
|
if (error) {
|
||||||
|
arangoHelper.arangoError("Collection error: " + data.responseText);
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.collectionsView.render();
|
this.collectionsView.render();
|
||||||
window.modalView.hide();
|
window.modalView.hide();
|
||||||
}
|
}
|
||||||
else {
|
}.bind(this);
|
||||||
arangoHelper.arangoError("Collection error: " + result2);
|
|
||||||
}
|
this.model.renameCollection(newname, callbackRename2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.modalView.hide();
|
window.modalView.hide();
|
||||||
|
@ -230,10 +231,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//modal dialogs
|
|
||||||
|
|
||||||
createEditPropertiesModal: function() {
|
createEditPropertiesModal: function() {
|
||||||
|
|
||||||
var collectionIsLoaded = false;
|
var collectionIsLoaded = false;
|
||||||
|
@ -392,7 +389,6 @@
|
||||||
else {
|
else {
|
||||||
$($('#infoTab').children()[1]).remove();
|
$($('#infoTab').children()[1]).remove();
|
||||||
}
|
}
|
||||||
this.bindIndexEvents();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
bindIndexEvents: function() {
|
bindIndexEvents: function() {
|
||||||
|
@ -419,6 +415,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.deleteIndex').bind('click', function(e) {
|
$('.deleteIndex').bind('click', function(e) {
|
||||||
|
console.log("asdasd");
|
||||||
self.prepDeleteIndex(e);
|
self.prepDeleteIndex(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -643,7 +640,23 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
getIndex: function () {
|
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';
|
var cssClass = 'collectionInfoTh modal-text';
|
||||||
if (this.index) {
|
if (this.index) {
|
||||||
var fieldString = '';
|
var fieldString = '';
|
||||||
|
@ -686,6 +699,7 @@
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this.bindIndexEvents();
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleNewIndexView: function () {
|
toggleNewIndexView: function () {
|
||||||
|
|
|
@ -358,14 +358,27 @@
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var returnobj = this.collection.newCollection(
|
var callback = function(error, data) {
|
||||||
collName, wfs, isSystem, collSize, collType, shards, shardBy
|
|
||||||
);
|
if (error) {
|
||||||
if (returnobj.status !== true) {
|
arangoHelper.arangoError("Collection error", data.errorMessage);
|
||||||
arangoHelper.arangoError("Collection error", returnobj.errorMessage);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
this.updateCollectionsView();
|
this.updateCollectionsView();
|
||||||
|
}
|
||||||
window.modalView.hide();
|
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() {
|
createNewCollectionModal: function() {
|
||||||
|
|
|
@ -188,9 +188,37 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
saveDocument: function () {
|
saveDocument: function () {
|
||||||
var model, result;
|
|
||||||
|
|
||||||
if ($('#saveDocumentButton').attr('disabled') === undefined) {
|
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;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
model = this.editor.get();
|
model = this.editor.get();
|
||||||
|
@ -222,7 +250,6 @@
|
||||||
this.successConfirmation();
|
this.successConfirmation();
|
||||||
this.disableSaveButton();
|
this.disableSaveButton();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
successConfirmation: function () {
|
successConfirmation: function () {
|
||||||
|
|
|
@ -14,11 +14,29 @@
|
||||||
templateSlow: templateEngine.createTemplate("queryManagementViewSlow.ejs"),
|
templateSlow: templateEngine.createTemplate("queryManagementViewSlow.ejs"),
|
||||||
table: templateEngine.createTemplate("arangoTable.ejs"),
|
table: templateEngine.createTemplate("arangoTable.ejs"),
|
||||||
tabbar: templateEngine.createTemplate("arangoTabbar.ejs"),
|
tabbar: templateEngine.createTemplate("arangoTabbar.ejs"),
|
||||||
|
active: true,
|
||||||
|
shouldRender: true,
|
||||||
|
timer: 0,
|
||||||
|
refreshRate: 2000,
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
var self = this;
|
||||||
this.activeCollection = new window.QueryManagementActive();
|
this.activeCollection = new window.QueryManagementActive();
|
||||||
this.slowCollection = new window.QueryManagementSlow();
|
this.slowCollection = new window.QueryManagementSlow();
|
||||||
this.convertModelToJSON(true);
|
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: {
|
events: {
|
||||||
|
@ -44,9 +62,11 @@
|
||||||
|
|
||||||
switchTab: function(e) {
|
switchTab: function(e) {
|
||||||
if (e.currentTarget.id === 'activequeries') {
|
if (e.currentTarget.id === 'activequeries') {
|
||||||
|
this.active = true;
|
||||||
this.convertModelToJSON(true);
|
this.convertModelToJSON(true);
|
||||||
}
|
}
|
||||||
else if (e.currentTarget.id === 'slowqueries') {
|
else if (e.currentTarget.id === 'slowqueries') {
|
||||||
|
this.active = false;
|
||||||
this.convertModelToJSON(false);
|
this.convertModelToJSON(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -133,11 +153,25 @@
|
||||||
this.convertModelToJSON(true);
|
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() {
|
renderActive: function() {
|
||||||
this.$el.html(this.templateActive.render({}));
|
this.$el.html(this.templateActive.render({}));
|
||||||
$(this.id).html(this.tabbar.render({content: this.tabbarElements}));
|
$(this.id).html(this.tabbar.render({content: this.tabbarElements}));
|
||||||
$(this.id).append(this.table.render({content: this.tableDescription}));
|
$(this.id).append(this.table.render({content: this.tableDescription}));
|
||||||
$('#activequeries').addClass("arango-active-tab");
|
$('#activequeries').addClass("arango-active-tab");
|
||||||
|
this.addEvents();
|
||||||
},
|
},
|
||||||
|
|
||||||
renderSlow: function() {
|
renderSlow: function() {
|
||||||
|
@ -147,6 +181,7 @@
|
||||||
content: this.tableDescription,
|
content: this.tableDescription,
|
||||||
}));
|
}));
|
||||||
$('#slowqueries').addClass("arango-active-tab");
|
$('#slowqueries').addClass("arango-active-tab");
|
||||||
|
this.addEvents();
|
||||||
},
|
},
|
||||||
|
|
||||||
convertModelToJSON: function (active) {
|
convertModelToJSON: function (active) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"license": "Apache License, Version 2.0",
|
"license": "Apache License, Version 2.0",
|
||||||
"isSystem": true,
|
"isSystem": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"arangodb": "^3.0.0"
|
"arangodb": "^2.8.0"
|
||||||
},
|
},
|
||||||
|
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"license": "Apache License, Version 2.0",
|
"license": "Apache License, Version 2.0",
|
||||||
"isSystem": true,
|
"isSystem": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"arangodb": "^3.0.0"
|
"arangodb": "^2.8.0"
|
||||||
},
|
},
|
||||||
|
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"license": "Apache License, Version 2.0",
|
"license": "Apache License, Version 2.0",
|
||||||
"isSystem": true,
|
"isSystem": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"arangodb": "^3.0.0"
|
"arangodb": "^2.8.0"
|
||||||
},
|
},
|
||||||
|
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"license": "Apache License, Version 2.0",
|
"license": "Apache License, Version 2.0",
|
||||||
"isSystem": true,
|
"isSystem": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"arangodb": "^3.0.0"
|
"arangodb": "^2.8.0"
|
||||||
},
|
},
|
||||||
|
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"license": "Apache License, Version 2.0",
|
"license": "Apache License, Version 2.0",
|
||||||
"isSystem": true,
|
"isSystem": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"arangodb": "^3.0.0"
|
"arangodb": "^2.8.0"
|
||||||
},
|
},
|
||||||
|
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"license": "Apache License, Version 2.0",
|
"license": "Apache License, Version 2.0",
|
||||||
"isSystem": true,
|
"isSystem": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"arangodb": "^3.0.0"
|
"arangodb": "^2.8.0"
|
||||||
},
|
},
|
||||||
|
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
Loading…
Reference in New Issue