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)
|
||||
---------------------
|
||||
|
||||
* UI: added not found views for documents and collections
|
||||
|
||||
* UI: using default user database api during database creation now
|
||||
|
||||
* UI: the graph viewer backend now picks one random start vertex of the
|
||||
|
|
|
@ -837,6 +837,9 @@
|
|||
var callback = function (error, data, toRun) {
|
||||
if (error) {
|
||||
arangoHelper.arangoError('Error', 'Could not detect collection type');
|
||||
if (toRun) {
|
||||
toRun(error);
|
||||
}
|
||||
} else {
|
||||
this.CollectionTypes[identifier] = data.type;
|
||||
if (this.CollectionTypes[identifier] === 3) {
|
||||
|
|
|
@ -146,17 +146,22 @@ window.ArangoDocument = Backbone.Collection.extend({
|
|||
data: JSON.stringify(data),
|
||||
processData: false,
|
||||
success: function (data) {
|
||||
self.add(data.documents[0]);
|
||||
if (data.documents[0]._from && data.documents[0]._to) {
|
||||
callback(false, data, 'edge');
|
||||
if (data.documents[0]) {
|
||||
self.add(data.documents[0]);
|
||||
if (data.documents[0]._from && data.documents[0]._to) {
|
||||
callback(false, data, 'edge');
|
||||
} else {
|
||||
callback(false, data, 'document');
|
||||
}
|
||||
} else {
|
||||
callback(false, data, 'document');
|
||||
self.add(true, data);
|
||||
callback(true, data, colid + '/' + dockey);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
self.add(true, data);
|
||||
arangoHelper.arangoError('Error', data.responseJSON.errorMessage + ' - error number: ' + data.responseJSON.errorNum);
|
||||
callback(true, data, colid + '/' + dockey);
|
||||
self.add(true, data);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -82,9 +82,11 @@
|
|||
editor: 0,
|
||||
|
||||
setType: function () {
|
||||
var self = this;
|
||||
var callback = function (error, data, type) {
|
||||
if (error) {
|
||||
arangoHelper.arangoError('Error', 'Could not fetch data.');
|
||||
arangoHelper.arangoError('Error', 'Document not found.');
|
||||
self.renderNotFound(type);
|
||||
} else {
|
||||
this.type = type;
|
||||
this.breadcrumb();
|
||||
|
@ -97,6 +99,17 @@
|
|||
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 () {
|
||||
if (!this.readOnly) {
|
||||
var buttons = []; var tableContent = [];
|
||||
|
|
|
@ -66,17 +66,23 @@
|
|||
},
|
||||
|
||||
setCollectionId: function (colid, page) {
|
||||
var self = this;
|
||||
this.collection.setCollection(colid);
|
||||
this.collection.setPage(page);
|
||||
this.page = page;
|
||||
|
||||
var callback = function (error, type) {
|
||||
if (error) {
|
||||
arangoHelper.arangoError('Error', 'Could not get collection properties.');
|
||||
self.renderNotFound(this.collection.collectionID);
|
||||
} else {
|
||||
this.type = type;
|
||||
this.collection.getDocuments(this.getDocsCallback.bind(this));
|
||||
this.collectionModel = this.collectionsStore.get(colid);
|
||||
|
||||
// fill navigation and breadcrumb
|
||||
this.breadcrumb();
|
||||
// render pagination
|
||||
this.renderPaginationElements();
|
||||
}
|
||||
}.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: {
|
||||
'click #collectionPrev': 'prevCollection',
|
||||
'click #collectionNext': 'nextCollection',
|
||||
|
@ -975,14 +994,10 @@
|
|||
this.uploadSetup();
|
||||
|
||||
arangoHelper.fixTooltips(['.icon_arangodb', '.arangoicon', 'top', '[data-toggle=tooltip]', '.upload-info']);
|
||||
this.renderPaginationElements();
|
||||
this.selectActivePagesize();
|
||||
this.markFilterToggle();
|
||||
this.resize();
|
||||
|
||||
// fill navigation and breadcrumb
|
||||
this.breadcrumb();
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
|
@ -570,4 +570,12 @@
|
|||
h4 {
|
||||
color: $c-info-blue;
|
||||
}
|
||||
|
||||
&.errorBox {
|
||||
border-left-color: $c-negative;
|
||||
|
||||
h4 {
|
||||
color: $c-negative;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue