1
0
Fork 0

Bug fix 3.3/internal issue 2035 (#6806)

This commit is contained in:
Heiko 2018-10-11 11:30:39 +02:00 committed by Jan
parent 093350821f
commit 9022e3c64b
3 changed files with 73 additions and 24 deletions

View File

@ -1,6 +1,9 @@
v3.3.18 (XXXX-XX-XX) v3.3.18 (XXXX-XX-XX)
-------------------- --------------------
* fix internal issue #2035: the Web UI now updates its indices view to check
whether new indices exist or not.
* fix internal issue #6808: newly created databases within the Web UI did not * fix internal issue #6808: newly created databases within the Web UI did not
appear when used Internet Explorer 11 as a browser. appear when used Internet Explorer 11 as a browser.

View File

@ -659,6 +659,9 @@
this.arangoCollectionsStore.fetch({ this.arangoCollectionsStore.fetch({
cache: false, cache: false,
success: function () { success: function () {
if (self.indicesView) {
self.indicesView.remove();
}
self.indicesView = new window.IndicesView({ self.indicesView = new window.IndicesView({
collectionName: colname, collectionName: colname,
collection: self.arangoCollectionsStore.findWhere({ collection: self.arangoCollectionsStore.findWhere({

View File

@ -9,42 +9,79 @@
el: '#content', el: '#content',
initialize: function (options) { initialize: function (options) {
var self = this;
this.collectionName = options.collectionName; this.collectionName = options.collectionName;
this.model = this.collection; this.model = this.collection;
// rerender
self.interval = window.setInterval(function () {
if (window.location.hash.indexOf('cIndices/' + self.collectionName) !== -1 && window.VISIBLE) {
if ($('#collectionEditIndexTable').is(':visible') && !$('#indexDeleteModal').is(':visible')) {
self.rerender();
}
}
}, self.refreshRate);
}, },
interval: null,
refreshRate: 10000,
template: templateEngine.createTemplate('indicesView.ejs'), template: templateEngine.createTemplate('indicesView.ejs'),
events: { events: {
}, },
remove: function () {
if (this.interval) {
window.clearInterval(this.interval);
}
this.$el.empty().off(); /* off to unbind the events */
this.stopListening();
this.unbind();
delete this.el;
return this;
},
render: function () { render: function () {
var self = this; var self = this;
$.ajax({ var continueFunction = function (data) {
type: 'GET', $(self.el).html(self.template.render({
cache: false, model: self.model,
url: arangoHelper.databaseUrl('/_api/engine'), supported: data.supports.indexes
contentType: 'application/json', }));
processData: false,
success: function (data) {
$(self.el).html(self.template.render({
model: self.model,
supported: data.supports.indexes
}));
self.breadcrumb(); self.breadcrumb();
window.arangoHelper.buildCollectionSubNav(self.collectionName, 'Indexes'); window.arangoHelper.buildCollectionSubNav(self.collectionName, 'Indexes');
self.getIndex(); self.getIndex();
// check permissions and adjust views // check permissions and adjust views
arangoHelper.checkCollectionPermissions(self.collectionName, self.changeViewToReadOnly); arangoHelper.checkCollectionPermissions(self.collectionName, self.changeViewToReadOnly);
}, };
error: function () {
arangoHelper.arangoNotification('Index', 'Could not fetch index information.'); if (!this.engineData) {
} $.ajax({
}); type: 'GET',
cache: false,
url: arangoHelper.databaseUrl('/_api/engine'),
contentType: 'application/json',
processData: false,
success: function (data) {
self.engineData = data;
continueFunction(data);
},
error: function () {
arangoHelper.arangoNotification('Index', 'Could not fetch index information.');
}
});
} else {
continueFunction(this.engineData);
}
},
rerender: function () {
this.getIndex(true);
}, },
changeViewToReadOnly: function () { changeViewToReadOnly: function () {
@ -61,12 +98,12 @@
); );
}, },
getIndex: function () { getIndex: function (rerender) {
var callback = function (error, data, id) { var callback = function (error, data, id) {
if (error) { if (error) {
window.arangoHelper.arangoError('Index', data.errorMessage); window.arangoHelper.arangoError('Index', data.errorMessage);
} else { } else {
this.renderIndex(data, id); this.renderIndex(data, id, rerender);
} }
}.bind(this); }.bind(this);
@ -152,6 +189,8 @@
} else { } else {
arangoHelper.arangoError('Document error', 'Could not create index.'); arangoHelper.arangoError('Document error', 'Could not create index.');
} }
} else {
arangoHelper.arangoNotification('Index', 'Creation in progress. This may take a while.');
} }
// toggle back // toggle back
self.toggleNewIndexView(); self.toggleNewIndexView();
@ -272,7 +311,7 @@
'<i class="fa fa-circle-o-notch fa-spin"></i>' '<i class="fa fa-circle-o-notch fa-spin"></i>'
); );
}, },
renderIndex: function (data, id) { renderIndex: function (data, id, rerender) {
this.index = data; this.index = data;
// get pending jobs // get pending jobs
@ -325,6 +364,10 @@
var fieldString = ''; var fieldString = '';
var actionString = ''; var actionString = '';
if (rerender) {
$('#collectionEditIndexTable tbody').empty();
}
_.each(this.index.indexes, function (v) { _.each(this.index.indexes, function (v) {
if (v.type === 'primary' || v.type === 'edge') { if (v.type === 'primary' || v.type === 'edge') {
actionString = '<span class="icon_arangodb_locked" ' + actionString = '<span class="icon_arangodb_locked" ' +