mirror of https://gitee.com/bigwinds/arangodb
removed async calls
This commit is contained in:
parent
8900710a44
commit
2c23eccaad
|
@ -17,59 +17,50 @@
|
||||||
desc: undefined
|
desc: undefined
|
||||||
},
|
},
|
||||||
|
|
||||||
getProperties: function () {
|
getProperties: function (callback) {
|
||||||
var data2;
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
cache: false,
|
cache: false,
|
||||||
url: "/_api/collection/" + encodeURIComponent(this.get("id")) + "/properties",
|
url: "/_api/collection/" + encodeURIComponent(this.get("id")) + "/properties",
|
||||||
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;
|
|
||||||
},
|
},
|
||||||
getFigures: function () {
|
getFigures: function (callback) {
|
||||||
var data2;
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
cache: false,
|
cache: false,
|
||||||
url: "/_api/collection/" + this.get("id") + "/figures",
|
url: "/_api/collection/" + this.get("id") + "/figures",
|
||||||
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() {
|
||||||
data2 = data;
|
callback(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return data2;
|
|
||||||
},
|
},
|
||||||
getRevision: function () {
|
getRevision: function (callback, figures) {
|
||||||
var data2;
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
cache: false,
|
cache: false,
|
||||||
url: "/_api/collection/" + this.get("id") + "/revision",
|
url: "/_api/collection/" + this.get("id") + "/revision",
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
processData: false,
|
processData: false,
|
||||||
async: false,
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
data2 = data;
|
callback(false, data, figures);
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function() {
|
||||||
data2 = data;
|
callback(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return data2;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getIndex: function (callback) {
|
getIndex: function (callback) {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<script id="modalCollectionInfo.ejs" type="text/template">
|
<script id="modalCollectionInfo.ejs" type="text/template">
|
||||||
<%
|
<%
|
||||||
var figuresData = content.getFigures();
|
var figuresData = content.figures;
|
||||||
var revision = content.getRevision();
|
var revision = content.revision;
|
||||||
var index = content.getIndex();
|
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<ul id="infoTab" class="nav nav-tabs">
|
<ul id="infoTab" class="nav nav-tabs">
|
||||||
|
@ -50,7 +49,7 @@
|
||||||
<th class="collectionInfoTh2">ID:</th>
|
<th class="collectionInfoTh2">ID:</th>
|
||||||
<th class="collectionInfoTh">
|
<th class="collectionInfoTh">
|
||||||
<div id="show-collection-id" class="modal-text">
|
<div id="show-collection-id" class="modal-text">
|
||||||
<%=content.get("id")%>
|
<%=content.model.get("id")%>
|
||||||
</div>
|
</div>
|
||||||
<th>
|
<th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -67,14 +66,14 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th class="collectionInfoTh2">Type:</th>
|
<th class="collectionInfoTh2">Type:</th>
|
||||||
<th class="collectionInfoTh">
|
<th class="collectionInfoTh">
|
||||||
<div class="modal-text"><%=content.get("type")%></div>
|
<div class="modal-text"><%=content.model.get("type")%></div>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th class="collectionInfoTh2">Status:</th>
|
<th class="collectionInfoTh2">Status:</th>
|
||||||
<th class="collectionInfoTh">
|
<th class="collectionInfoTh">
|
||||||
<div class="modal-text"><%=content.get("status")%></div>
|
<div class="modal-text"><%=content.model.get("status")%></div>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -270,9 +270,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collectionIsLoaded) {
|
if (collectionIsLoaded) {
|
||||||
// needs to be refactored. move getProperties into model
|
|
||||||
var journalSize = this.model.getProperties().journalSize;
|
var callback = function(error, data) {
|
||||||
journalSize = journalSize/(1024*1024);
|
if (error) {
|
||||||
|
arangoHelper.arangoError("Collection", "Could not fetch properties");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var journalSize = data.journalSize/(1024*1024);
|
||||||
|
var indexBuckets = data.indexBuckets;
|
||||||
|
var wfs = data.waitForSync;
|
||||||
|
|
||||||
tableContent.push(
|
tableContent.push(
|
||||||
window.modalView.createTextEntry(
|
window.modalView.createTextEntry(
|
||||||
|
@ -291,8 +297,6 @@
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
var indexBuckets = this.model.getProperties().indexBuckets;
|
|
||||||
|
|
||||||
tableContent.push(
|
tableContent.push(
|
||||||
window.modalView.createTextEntry(
|
window.modalView.createTextEntry(
|
||||||
"change-index-buckets",
|
"change-index-buckets",
|
||||||
|
@ -311,7 +315,6 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
// prevent "unexpected sync method error"
|
// prevent "unexpected sync method error"
|
||||||
var wfs = this.model.getProperties().waitForSync;
|
|
||||||
tableContent.push(
|
tableContent.push(
|
||||||
window.modalView.createSelectEntry(
|
window.modalView.createSelectEntry(
|
||||||
"change-collection-sync",
|
"change-collection-sync",
|
||||||
|
@ -320,7 +323,6 @@
|
||||||
"Synchronize to disk before returning from a create or update of a document.",
|
"Synchronize to disk before returning from a create or update of a document.",
|
||||||
[{value: false, label: "No"}, {value: true, label: "Yes"}] )
|
[{value: false, label: "No"}, {value: true, label: "Yes"}] )
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
tableContent.push(
|
tableContent.push(
|
||||||
window.modalView.createReadOnlyEntry(
|
window.modalView.createReadOnlyEntry(
|
||||||
|
@ -389,6 +391,12 @@
|
||||||
else {
|
else {
|
||||||
$($('#infoTab').children()[1]).remove();
|
$($('#infoTab').children()[1]).remove();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
this.model.getProperties(callback);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
bindIndexEvents: function() {
|
bindIndexEvents: function() {
|
||||||
|
@ -462,14 +470,38 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
createInfoModal: function() {
|
createInfoModal: function() {
|
||||||
var buttons = [],
|
|
||||||
tableContent = this.model;
|
var callbackRev = function(error, revision, figures) {
|
||||||
|
if (error) {
|
||||||
|
arangoHelper.arangoError("Figures", "Could not get revision.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var buttons = [];
|
||||||
|
var tableContent = {
|
||||||
|
figures: figures,
|
||||||
|
revision: revision,
|
||||||
|
model: this.model
|
||||||
|
};
|
||||||
window.modalView.show(
|
window.modalView.show(
|
||||||
"modalCollectionInfo.ejs",
|
"modalCollectionInfo.ejs",
|
||||||
"Collection: " + this.model.get('name'),
|
"Collection: " + this.model.get('name'),
|
||||||
buttons,
|
buttons,
|
||||||
tableContent
|
tableContent
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
var callback = function(error, data) {
|
||||||
|
if (error) {
|
||||||
|
arangoHelper.arangoError("Figures", "Could not get figures.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var figures = data;
|
||||||
|
this.model.getRevision(callbackRev, figures);
|
||||||
|
}
|
||||||
|
}.bind(this);
|
||||||
|
|
||||||
|
this.model.getFigures(callback);
|
||||||
},
|
},
|
||||||
//index functions
|
//index functions
|
||||||
resetIndexForms: function () {
|
resetIndexForms: function () {
|
||||||
|
@ -482,7 +514,6 @@
|
||||||
//e.preventDefault();
|
//e.preventDefault();
|
||||||
var self = this;
|
var self = this;
|
||||||
var indexType = $('#newIndexType').val();
|
var indexType = $('#newIndexType').val();
|
||||||
var result;
|
|
||||||
var postParameter = {};
|
var postParameter = {};
|
||||||
var fields;
|
var fields;
|
||||||
var unique;
|
var unique;
|
||||||
|
|
Loading…
Reference in New Issue