mirror of https://gitee.com/bigwinds/arangodb
prep for new notifications, cleanup
This commit is contained in:
parent
c40d930fa6
commit
238396e3c4
|
@ -101,49 +101,12 @@
|
||||||
return returnVal;
|
return returnVal;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeNotifications: function () {
|
arangoNotification: function (message) {
|
||||||
$.gritter.removeAll();
|
|
||||||
this.lastNotificationMessage = null;
|
|
||||||
},
|
},
|
||||||
arangoNotification: function (message, time) {
|
|
||||||
var returnVal = false;
|
|
||||||
$.gritter.add({
|
|
||||||
title: "Notice:",
|
|
||||||
text: message,
|
|
||||||
time: time || 3000,
|
|
||||||
before_open: function(){
|
|
||||||
returnVal = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.lastNotificationMessage = null;
|
|
||||||
|
|
||||||
return returnVal;
|
|
||||||
},
|
|
||||||
arangoError: function (message) {
|
arangoError: function (message) {
|
||||||
var returnVal = false;
|
|
||||||
$.gritter.add({
|
|
||||||
title: "Error:",
|
|
||||||
text: message,
|
|
||||||
sticky: true,
|
|
||||||
before_open: function(){
|
|
||||||
if (this.lastNotificationMessage === message) {
|
|
||||||
// prevent display the same message over & over
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if($('.gritter-item-wrapper').length === 3) {
|
|
||||||
// not more than 3 messages at once
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.lastNotificationMessage = message;
|
|
||||||
returnVal = true;
|
|
||||||
},
|
|
||||||
before_close: function(){
|
|
||||||
// reset last text when closing a specific message
|
|
||||||
this.lastNotificationMessage = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return returnVal;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getRandomToken: function () {
|
getRandomToken: function () {
|
||||||
return Math.round(new Date().getTime());
|
return Math.round(new Date().getTime());
|
||||||
},
|
},
|
||||||
|
|
|
@ -70,12 +70,8 @@
|
||||||
|
|
||||||
this.footerView = new window.FooterView();
|
this.footerView = new window.FooterView();
|
||||||
this.naviView = new window.NavigationView();
|
this.naviView = new window.NavigationView();
|
||||||
// this.statView = new window.StatisticBarView();
|
|
||||||
// this.userBarView = new window.UserBarView();
|
|
||||||
this.footerView.render();
|
this.footerView.render();
|
||||||
this.naviView.render();
|
this.naviView.render();
|
||||||
// this.statView.render();
|
|
||||||
// this.userBarView.render();
|
|
||||||
this.graphView = new window.GraphView({
|
this.graphView = new window.GraphView({
|
||||||
graphs: this.graphs,
|
graphs: this.graphs,
|
||||||
collection: window.arangoCollectionsStore
|
collection: window.arangoCollectionsStore
|
||||||
|
|
|
@ -131,10 +131,6 @@
|
||||||
}
|
}
|
||||||
var changeResult = window.arangoCollectionsStore.changeCollection(collid, wfs, journalSize);
|
var changeResult = window.arangoCollectionsStore.changeCollection(collid, wfs, journalSize);
|
||||||
|
|
||||||
if (result === true) {
|
|
||||||
arangoHelper.arangoNotification("Collection renamed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result !== true) {
|
if (result !== true) {
|
||||||
if (result !== undefined) {
|
if (result !== undefined) {
|
||||||
arangoHelper.arangoError("Collection error: " + result);
|
arangoHelper.arangoError("Collection error: " + result);
|
||||||
|
@ -168,14 +164,12 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.hideModal();
|
this.hideModal();
|
||||||
arangoHelper.arangoNotification("Collection renamed");
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
arangoHelper.arangoError("Collection error: " + result2);
|
arangoHelper.arangoError("Collection error: " + result2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//arangoHelper.arangoNotification("No changes.");
|
|
||||||
this.hideModal();
|
this.hideModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,10 +203,7 @@
|
||||||
var self = this;
|
var self = this;
|
||||||
var collName = self.myCollection.name;
|
var collName = self.myCollection.name;
|
||||||
var returnval = window.arangoCollectionsStore.deleteCollection(collName);
|
var returnval = window.arangoCollectionsStore.deleteCollection(collName);
|
||||||
if (returnval === true) {
|
if (returnval === false) {
|
||||||
arangoHelper.arangoNotification('Collection deleted successfully.');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
arangoHelper.arangoError('Could not delete collection.');
|
arangoHelper.arangoError('Could not delete collection.');
|
||||||
}
|
}
|
||||||
self.hideModal();
|
self.hideModal();
|
||||||
|
|
|
@ -105,7 +105,6 @@
|
||||||
self.handleError(err.status, err.statusText, name);
|
self.handleError(err.status, err.statusText, name);
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
arangoHelper.arangoNotification("Database " + name + " created.");
|
|
||||||
self.hideModal();
|
self.hideModal();
|
||||||
self.updateDatabases();
|
self.updateDatabases();
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,10 +93,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
result = window.arangoDocumentStore.saveDocument(this.colid, this.docid, model);
|
result = window.arangoDocumentStore.saveDocument(this.colid, this.docid, model);
|
||||||
if (result === true) {
|
if (result === false) {
|
||||||
arangoHelper.arangoNotification('Document saved');
|
|
||||||
}
|
|
||||||
else if (result === false) {
|
|
||||||
arangoHelper.arangoError('Document error');
|
arangoHelper.arangoError('Document error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,10 +101,7 @@
|
||||||
editor = ace.edit("sourceEditor");
|
editor = ace.edit("sourceEditor");
|
||||||
model = editor.getValue();
|
model = editor.getValue();
|
||||||
result = window.arangoDocumentStore.saveEdge(this.colid, this.docid, model);
|
result = window.arangoDocumentStore.saveEdge(this.colid, this.docid, model);
|
||||||
if (result === true) {
|
if (result === false) {
|
||||||
arangoHelper.arangoNotification('Edge saved');
|
|
||||||
}
|
|
||||||
else if (result === false) {
|
|
||||||
arangoHelper.arangoError('Edge error');
|
arangoHelper.arangoError('Edge error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,7 +350,6 @@
|
||||||
//Success
|
//Success
|
||||||
if (result !== false) {
|
if (result !== false) {
|
||||||
window.location.hash = "collection/" + result;
|
window.location.hash = "collection/" + result;
|
||||||
arangoHelper.arangoNotification('Document created');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Error
|
//Error
|
||||||
|
@ -424,18 +423,15 @@
|
||||||
result = window.arangoDocumentStore.deleteDocument(this.colid, this.docid);
|
result = window.arangoDocumentStore.deleteDocument(this.colid, this.docid);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
//on success
|
//on success
|
||||||
arangoHelper.arangoNotification('Document deleted');
|
|
||||||
deleted = true;
|
deleted = true;
|
||||||
}
|
}
|
||||||
else if (result === false) {
|
else if (result === false) {
|
||||||
arangoHelper.arangoError('Could not delete document');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.type === 'edge') {
|
else if (this.type === 'edge') {
|
||||||
result = window.arangoDocumentStore.deleteEdge(this.colid, this.docid);
|
result = window.arangoDocumentStore.deleteEdge(this.colid, this.docid);
|
||||||
if (result === true) {
|
if (result === true) {
|
||||||
//on success
|
//on success
|
||||||
arangoHelper.arangoNotification('Edge deleted');
|
|
||||||
deleted = true;
|
deleted = true;
|
||||||
}
|
}
|
||||||
else if (result === false) {
|
else if (result === false) {
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (self.isOffline === true) {
|
if (self.isOffline === true) {
|
||||||
self.isOffline = false;
|
self.isOffline = false;
|
||||||
arangoHelper.removeNotifications();
|
|
||||||
if (!self.firstLogin) {
|
if (!self.firstLogin) {
|
||||||
window.setTimeout(function(){
|
window.setTimeout(function(){
|
||||||
arangoHelper.arangoNotification("Server connected");
|
arangoHelper.arangoNotification("Server connected");
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
collection: window.arangoDatabase,
|
collection: window.arangoDatabase,
|
||||||
current: window.currentDB
|
current: window.currentDB
|
||||||
});
|
});
|
||||||
// this.userBarView = new window.UserBarView({});
|
this.userBarView = new window.UserBarView({});
|
||||||
// this.statisticBarView = new window.StatisticBarView({});
|
this.statisticBarView = new window.StatisticBarView({});
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSelectDatabase: function () {
|
handleSelectDatabase: function () {
|
||||||
|
@ -34,8 +34,8 @@
|
||||||
isSystem: window.currentDB.get("isSystem")
|
isSystem: window.currentDB.get("isSystem")
|
||||||
}));
|
}));
|
||||||
this.dbSelectionView.render($("#dbSelect"));
|
this.dbSelectionView.render($("#dbSelect"));
|
||||||
// this.userBarView.render($("#userBar"));
|
this.userBarView.render($("#userBar"));
|
||||||
// this.statisticBarView.render($("#statisticBar"));
|
this.statisticBarView.render($("#statisticBar"));
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,6 @@
|
||||||
if (returnobj.status === true) {
|
if (returnobj.status === true) {
|
||||||
self.hidden();
|
self.hidden();
|
||||||
$("#add-collection").modal('hide');
|
$("#add-collection").modal('hide');
|
||||||
arangoHelper.arangoNotification("Collection created");
|
|
||||||
|
|
||||||
window.App.navigate("collection/" + collName + "/documents/1", {trigger: true});
|
window.App.navigate("collection/" + collName + "/documents/1", {trigger: true});
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
render: function (el) {
|
render: function (el) {
|
||||||
|
console.log(el);
|
||||||
this.$el = el;
|
this.$el = el;
|
||||||
this.$el.html(this.template.render({
|
this.$el.html(this.template.render({
|
||||||
img : "https://s.gravatar.com/avatar/9c53a795affc3c3c03801ffae90e2e11?s=80",
|
img : "https://s.gravatar.com/avatar/9c53a795affc3c3c03801ffae90e2e11?s=80",
|
||||||
|
@ -67,4 +66,4 @@
|
||||||
return this.$el;
|
return this.$el;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
Loading…
Reference in New Issue