mirror of https://gitee.com/bigwinds/arangodb
Bug fix 3.3/ui issue 2668 document not found (#3914)
* added better not found information if a document or a collection was not found * UI: added not found views for documents and collections
This commit is contained in:
parent
4397ebf3c7
commit
6e0bc341ac
|
@ -1,6 +1,8 @@
|
||||||
v3.3.rc7 (2017-XX-XX)
|
v3.3.rc7 (2017-XX-XX)
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
* UI: added not found views for documents and collections
|
||||||
|
|
||||||
* UI: using default user database api during database creation now
|
* UI: using default user database api during database creation now
|
||||||
|
|
||||||
* UI: the graph viewer backend now picks one random start vertex of the
|
* UI: the graph viewer backend now picks one random start vertex of the
|
||||||
|
|
|
@ -837,6 +837,9 @@
|
||||||
var callback = function (error, data, toRun) {
|
var callback = function (error, data, toRun) {
|
||||||
if (error) {
|
if (error) {
|
||||||
arangoHelper.arangoError('Error', 'Could not detect collection type');
|
arangoHelper.arangoError('Error', 'Could not detect collection type');
|
||||||
|
if (toRun) {
|
||||||
|
toRun(error);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.CollectionTypes[identifier] = data.type;
|
this.CollectionTypes[identifier] = data.type;
|
||||||
if (this.CollectionTypes[identifier] === 3) {
|
if (this.CollectionTypes[identifier] === 3) {
|
||||||
|
|
|
@ -146,17 +146,22 @@ window.ArangoDocument = Backbone.Collection.extend({
|
||||||
data: JSON.stringify(data),
|
data: JSON.stringify(data),
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
self.add(data.documents[0]);
|
if (data.documents[0]) {
|
||||||
if (data.documents[0]._from && data.documents[0]._to) {
|
self.add(data.documents[0]);
|
||||||
callback(false, data, 'edge');
|
if (data.documents[0]._from && data.documents[0]._to) {
|
||||||
|
callback(false, data, 'edge');
|
||||||
|
} else {
|
||||||
|
callback(false, data, 'document');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
callback(false, data, 'document');
|
self.add(true, data);
|
||||||
|
callback(true, data, colid + '/' + dockey);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
|
self.add(true, data);
|
||||||
arangoHelper.arangoError('Error', data.responseJSON.errorMessage + ' - error number: ' + data.responseJSON.errorNum);
|
arangoHelper.arangoError('Error', data.responseJSON.errorMessage + ' - error number: ' + data.responseJSON.errorNum);
|
||||||
callback(true, data, colid + '/' + dockey);
|
callback(true, data, colid + '/' + dockey);
|
||||||
self.add(true, data);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -82,9 +82,11 @@
|
||||||
editor: 0,
|
editor: 0,
|
||||||
|
|
||||||
setType: function () {
|
setType: function () {
|
||||||
|
var self = this;
|
||||||
var callback = function (error, data, type) {
|
var callback = function (error, data, type) {
|
||||||
if (error) {
|
if (error) {
|
||||||
arangoHelper.arangoError('Error', 'Could not fetch data.');
|
arangoHelper.arangoError('Error', 'Document not found.');
|
||||||
|
self.renderNotFound(type);
|
||||||
} else {
|
} else {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.breadcrumb();
|
this.breadcrumb();
|
||||||
|
@ -97,6 +99,17 @@
|
||||||
this.collection.getDocument(this.colid, this.docid, callback);
|
this.collection.getDocument(this.colid, this.docid, callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
renderNotFound: function (id) {
|
||||||
|
$('.document-info-div').remove();
|
||||||
|
$('.headerButton').remove();
|
||||||
|
$('.document-content-div').html(
|
||||||
|
'<div class="infoBox errorBox">' +
|
||||||
|
'<h4>Error</h4>' +
|
||||||
|
'<p>Document not found. Requested ID was: "' + id + '".</p>' +
|
||||||
|
'</div>'
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
deleteDocumentModal: function () {
|
deleteDocumentModal: function () {
|
||||||
if (!this.readOnly) {
|
if (!this.readOnly) {
|
||||||
var buttons = []; var tableContent = [];
|
var buttons = []; var tableContent = [];
|
||||||
|
|
|
@ -66,17 +66,23 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
setCollectionId: function (colid, page) {
|
setCollectionId: function (colid, page) {
|
||||||
|
var self = this;
|
||||||
this.collection.setCollection(colid);
|
this.collection.setCollection(colid);
|
||||||
this.collection.setPage(page);
|
this.collection.setPage(page);
|
||||||
this.page = page;
|
this.page = page;
|
||||||
|
|
||||||
var callback = function (error, type) {
|
var callback = function (error, type) {
|
||||||
if (error) {
|
if (error) {
|
||||||
arangoHelper.arangoError('Error', 'Could not get collection properties.');
|
self.renderNotFound(this.collection.collectionID);
|
||||||
} else {
|
} else {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.collection.getDocuments(this.getDocsCallback.bind(this));
|
this.collection.getDocuments(this.getDocsCallback.bind(this));
|
||||||
this.collectionModel = this.collectionsStore.get(colid);
|
this.collectionModel = this.collectionsStore.get(colid);
|
||||||
|
|
||||||
|
// fill navigation and breadcrumb
|
||||||
|
this.breadcrumb();
|
||||||
|
// render pagination
|
||||||
|
this.renderPaginationElements();
|
||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
|
@ -100,6 +106,19 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
renderNotFound: function (name) {
|
||||||
|
$('.headerButton').remove();
|
||||||
|
// $('#documentsToolbar').remove();
|
||||||
|
$('#documentSize').hide();
|
||||||
|
$('#docPureTable').html(
|
||||||
|
'<div class="infoBox errorBox">' +
|
||||||
|
'<h4>Error</h4>' +
|
||||||
|
'<p>Collection not found. Requested name was: "' + name + '".</p>' +
|
||||||
|
'</div>'
|
||||||
|
);
|
||||||
|
$('#subNavigationBar .breadcrumb').html();
|
||||||
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click #collectionPrev': 'prevCollection',
|
'click #collectionPrev': 'prevCollection',
|
||||||
'click #collectionNext': 'nextCollection',
|
'click #collectionNext': 'nextCollection',
|
||||||
|
@ -975,14 +994,10 @@
|
||||||
this.uploadSetup();
|
this.uploadSetup();
|
||||||
|
|
||||||
arangoHelper.fixTooltips(['.icon_arangodb', '.arangoicon', 'top', '[data-toggle=tooltip]', '.upload-info']);
|
arangoHelper.fixTooltips(['.icon_arangodb', '.arangoicon', 'top', '[data-toggle=tooltip]', '.upload-info']);
|
||||||
this.renderPaginationElements();
|
|
||||||
this.selectActivePagesize();
|
this.selectActivePagesize();
|
||||||
this.markFilterToggle();
|
this.markFilterToggle();
|
||||||
this.resize();
|
this.resize();
|
||||||
|
|
||||||
// fill navigation and breadcrumb
|
|
||||||
this.breadcrumb();
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -570,4 +570,12 @@
|
||||||
h4 {
|
h4 {
|
||||||
color: $c-info-blue;
|
color: $c-info-blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.errorBox {
|
||||||
|
border-left-color: $c-negative;
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
color: $c-negative;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue