1
0
Fork 0

removed async calls

This commit is contained in:
hkernbach 2016-02-19 18:58:34 +01:00
parent 8900710a44
commit 2c23eccaad
3 changed files with 465 additions and 444 deletions

View File

@ -17,59 +17,50 @@
desc: undefined
},
getProperties: function () {
var data2;
getProperties: function (callback) {
$.ajax({
type: "GET",
cache: false,
url: "/_api/collection/" + encodeURIComponent(this.get("id")) + "/properties",
contentType: "application/json",
processData: false,
async: false,
success: function(data) {
data2 = data;
callback(false, data);
},
error: function(data) {
data2 = data;
callback(true, data);
}
});
return data2;
},
getFigures: function () {
var data2;
getFigures: function (callback) {
$.ajax({
type: "GET",
cache: false,
url: "/_api/collection/" + this.get("id") + "/figures",
contentType: "application/json",
processData: false,
async: false,
success: function(data) {
data2 = data;
callback(false, data);
},
error: function(data) {
data2 = data;
error: function() {
callback(true);
}
});
return data2;
},
getRevision: function () {
var data2;
getRevision: function (callback, figures) {
$.ajax({
type: "GET",
cache: false,
url: "/_api/collection/" + this.get("id") + "/revision",
contentType: "application/json",
processData: false,
async: false,
success: function(data) {
data2 = data;
callback(false, data, figures);
},
error: function(data) {
data2 = data;
error: function() {
callback(true);
}
});
return data2;
},
getIndex: function (callback) {

View File

@ -1,8 +1,7 @@
<script id="modalCollectionInfo.ejs" type="text/template">
<%
var figuresData = content.getFigures();
var revision = content.getRevision();
var index = content.getIndex();
var figuresData = content.figures;
var revision = content.revision;
%>
<ul id="infoTab" class="nav nav-tabs">
@ -50,7 +49,7 @@
<th class="collectionInfoTh2">ID:</th>
<th class="collectionInfoTh">
<div id="show-collection-id" class="modal-text">
<%=content.get("id")%>
<%=content.model.get("id")%>
</div>
<th>
</tr>
@ -67,14 +66,14 @@
<tr>
<th class="collectionInfoTh2">Type:</th>
<th class="collectionInfoTh">
<div class="modal-text"><%=content.get("type")%></div>
<div class="modal-text"><%=content.model.get("type")%></div>
</th>
</tr>
<tr>
<th class="collectionInfoTh2">Status:</th>
<th class="collectionInfoTh">
<div class="modal-text"><%=content.get("status")%></div>
<div class="modal-text"><%=content.model.get("status")%></div>
</th>
</tr>

View File

@ -270,319 +270,350 @@
}
if (collectionIsLoaded) {
// needs to be refactored. move getProperties into model
var journalSize = this.model.getProperties().journalSize;
journalSize = journalSize/(1024*1024);
tableContent.push(
window.modalView.createTextEntry(
"change-collection-size",
"Journal size",
journalSize,
"The maximal size of a journal or datafile (in MB). Must be at least 1.",
"",
true,
[
{
rule: Joi.string().allow('').optional().regex(/^[0-9]*$/),
msg: "Must be a number."
}
]
)
);
var indexBuckets = this.model.getProperties().indexBuckets;
tableContent.push(
window.modalView.createTextEntry(
"change-index-buckets",
"Index buckets",
indexBuckets,
"The number of index buckets for this collection. Must be at least 1 and a power of 2.",
"",
true,
[
{
rule: Joi.string().allow('').optional().regex(/^[1-9][0-9]*$/),
msg: "Must be a number greater than 1 and a power of 2."
}
]
)
);
// prevent "unexpected sync method error"
var wfs = this.model.getProperties().waitForSync;
tableContent.push(
window.modalView.createSelectEntry(
"change-collection-sync",
"Wait for sync",
wfs,
"Synchronize to disk before returning from a create or update of a document.",
[{value: false, label: "No"}, {value: true, label: "Yes"}] )
);
}
tableContent.push(
window.modalView.createReadOnlyEntry(
"change-collection-id", "ID", this.model.get('id'), ""
)
);
tableContent.push(
window.modalView.createReadOnlyEntry(
"change-collection-type", "Type", this.model.get('type'), ""
)
);
tableContent.push(
window.modalView.createReadOnlyEntry(
"change-collection-status", "Status", this.model.get('status'), ""
)
);
buttons.push(
window.modalView.createDeleteButton(
"Delete",
this.deleteCollection.bind(this)
)
);
buttons.push(
window.modalView.createDeleteButton(
"Truncate",
this.truncateCollection.bind(this)
)
);
if (collectionIsLoaded) {
buttons.push(
window.modalView.createNotificationButton(
"Unload",
this.unloadCollection.bind(this)
)
);
} else {
buttons.push(
window.modalView.createNotificationButton(
"Load",
this.loadCollection.bind(this)
)
);
}
buttons.push(
window.modalView.createSuccessButton(
"Save",
this.saveModifiedCollection.bind(this)
)
);
var tabBar = ["General", "Indices"],
templates = ["modalTable.ejs", "indicesView.ejs"];
window.modalView.show(
templates,
"Modify Collection",
buttons,
tableContent, null, null,
this.events, null,
tabBar
);
if (this.model.get("status") === 'loaded') {
this.getIndex();
}
else {
$($('#infoTab').children()[1]).remove();
}
},
bindIndexEvents: function() {
this.unbindIndexEvents();
var self = this;
$('#indexEditView #addIndex').bind('click', function() {
self.toggleNewIndexView();
$('#cancelIndex').unbind('click');
$('#cancelIndex').bind('click', function() {
self.toggleNewIndexView();
});
$('#createIndex').unbind('click');
$('#createIndex').bind('click', function() {
self.createIndex();
});
});
$('#newIndexType').bind('change', function() {
self.selectIndexType();
});
$('.deleteIndex').bind('click', function(e) {
console.log("asdasd");
self.prepDeleteIndex(e);
});
$('#infoTab a').bind('click', function(e) {
$('#indexDeleteModal').remove();
if ($(e.currentTarget).html() === 'Indices' && !$(e.currentTarget).parent().hasClass('active')) {
$('#newIndexView').hide();
$('#indexEditView').show();
$('#modal-dialog .modal-footer .button-danger').hide();
$('#modal-dialog .modal-footer .button-success').hide();
$('#modal-dialog .modal-footer .button-notification').hide();
//$('#addIndex').detach().appendTo('#modal-dialog .modal-footer');
}
if ($(e.currentTarget).html() === 'General' && !$(e.currentTarget).parent().hasClass('active')) {
$('#modal-dialog .modal-footer .button-danger').show();
$('#modal-dialog .modal-footer .button-success').show();
$('#modal-dialog .modal-footer .button-notification').show();
var elem = $('.index-button-bar')[0];
var elem2 = $('.index-button-bar2')[0];
//$('#addIndex').detach().appendTo(elem);
if ($('#cancelIndex').is(':visible')) {
$('#cancelIndex').detach().appendTo(elem2);
$('#createIndex').detach().appendTo(elem2);
}
}
});
},
unbindIndexEvents: function() {
$('#indexEditView #addIndex').unbind('click');
$('#newIndexType').unbind('change');
$('#infoTab a').unbind('click');
$('.deleteIndex').unbind('click');
/*
//$('#documentsToolbar ul').unbind('click');
this.markFilterToggle();
this.changeEditMode(false);
0Ads0asd0sd0f0asdf0sa0f
"click #documentsToolbar ul" : "resetIndexForms"
*/
},
createInfoModal: function() {
var buttons = [],
tableContent = this.model;
window.modalView.show(
"modalCollectionInfo.ejs",
"Collection: " + this.model.get('name'),
buttons,
tableContent
);
},
//index functions
resetIndexForms: function () {
$('#indexHeader input').val('').prop("checked", false);
$('#newIndexType').val('Cap').prop('selected',true);
this.selectIndexType();
},
createIndex: function () {
//e.preventDefault();
var self = this;
var indexType = $('#newIndexType').val();
var result;
var postParameter = {};
var fields;
var unique;
var sparse;
switch (indexType) {
case 'Cap':
var size = parseInt($('#newCapSize').val(), 10) || 0;
var byteSize = parseInt($('#newCapByteSize').val(), 10) || 0;
postParameter = {
type: 'cap',
size: size,
byteSize: byteSize
};
break;
case 'Geo':
//HANDLE ARRAY building
fields = $('#newGeoFields').val();
var geoJson = self.checkboxToValue('#newGeoJson');
var constraint = self.checkboxToValue('#newGeoConstraint');
var ignoreNull = self.checkboxToValue('#newGeoIgnoreNull');
postParameter = {
type: 'geo',
fields: self.stringToArray(fields),
geoJson: geoJson,
constraint: constraint,
ignoreNull: ignoreNull
};
break;
case 'Hash':
fields = $('#newHashFields').val();
unique = self.checkboxToValue('#newHashUnique');
sparse = self.checkboxToValue('#newHashSparse');
postParameter = {
type: 'hash',
fields: self.stringToArray(fields),
unique: unique,
sparse: sparse
};
break;
case 'Fulltext':
fields = ($('#newFulltextFields').val());
var minLength = parseInt($('#newFulltextMinLength').val(), 10) || 0;
postParameter = {
type: 'fulltext',
fields: self.stringToArray(fields),
minLength: minLength
};
break;
case 'Skiplist':
fields = $('#newSkiplistFields').val();
unique = self.checkboxToValue('#newSkiplistUnique');
sparse = self.checkboxToValue('#newSkiplistSparse');
postParameter = {
type: 'skiplist',
fields: self.stringToArray(fields),
unique: unique,
sparse: sparse
};
break;
}
var callback = function(error, msg){
if (error) {
if (msg) {
var message = JSON.parse(msg.responseText);
arangoHelper.arangoError("Document error", message.errorMessage);
var callback = function(error, data) {
if (error) {
arangoHelper.arangoError("Collection", "Could not fetch properties");
}
else {
arangoHelper.arangoError("Document error", "Could not create index.");
var journalSize = data.journalSize/(1024*1024);
var indexBuckets = data.indexBuckets;
var wfs = data.waitForSync;
tableContent.push(
window.modalView.createTextEntry(
"change-collection-size",
"Journal size",
journalSize,
"The maximal size of a journal or datafile (in MB). Must be at least 1.",
"",
true,
[
{
rule: Joi.string().allow('').optional().regex(/^[0-9]*$/),
msg: "Must be a number."
}
]
)
);
tableContent.push(
window.modalView.createTextEntry(
"change-index-buckets",
"Index buckets",
indexBuckets,
"The number of index buckets for this collection. Must be at least 1 and a power of 2.",
"",
true,
[
{
rule: Joi.string().allow('').optional().regex(/^[1-9][0-9]*$/),
msg: "Must be a number greater than 1 and a power of 2."
}
]
)
);
// prevent "unexpected sync method error"
tableContent.push(
window.modalView.createSelectEntry(
"change-collection-sync",
"Wait for sync",
wfs,
"Synchronize to disk before returning from a create or update of a document.",
[{value: false, label: "No"}, {value: true, label: "Yes"}] )
);
tableContent.push(
window.modalView.createReadOnlyEntry(
"change-collection-id", "ID", this.model.get('id'), ""
)
);
tableContent.push(
window.modalView.createReadOnlyEntry(
"change-collection-type", "Type", this.model.get('type'), ""
)
);
tableContent.push(
window.modalView.createReadOnlyEntry(
"change-collection-status", "Status", this.model.get('status'), ""
)
);
buttons.push(
window.modalView.createDeleteButton(
"Delete",
this.deleteCollection.bind(this)
)
);
buttons.push(
window.modalView.createDeleteButton(
"Truncate",
this.truncateCollection.bind(this)
)
);
if (collectionIsLoaded) {
buttons.push(
window.modalView.createNotificationButton(
"Unload",
this.unloadCollection.bind(this)
)
);
} else {
buttons.push(
window.modalView.createNotificationButton(
"Load",
this.loadCollection.bind(this)
)
);
}
buttons.push(
window.modalView.createSuccessButton(
"Save",
this.saveModifiedCollection.bind(this)
)
);
var tabBar = ["General", "Indices"],
templates = ["modalTable.ejs", "indicesView.ejs"];
window.modalView.show(
templates,
"Modify Collection",
buttons,
tableContent, null, null,
this.events, null,
tabBar
);
if (this.model.get("status") === 'loaded') {
this.getIndex();
}
else {
$($('#infoTab').children()[1]).remove();
}
}
self.refreshCollectionsView();
}.bind(this);
this.model.getProperties(callback);
}
},
bindIndexEvents: function() {
this.unbindIndexEvents();
var self = this;
$('#indexEditView #addIndex').bind('click', function() {
self.toggleNewIndexView();
$('#cancelIndex').unbind('click');
$('#cancelIndex').bind('click', function() {
self.toggleNewIndexView();
});
$('#createIndex').unbind('click');
$('#createIndex').bind('click', function() {
self.createIndex();
});
});
$('#newIndexType').bind('change', function() {
self.selectIndexType();
});
$('.deleteIndex').bind('click', function(e) {
console.log("asdasd");
self.prepDeleteIndex(e);
});
$('#infoTab a').bind('click', function(e) {
$('#indexDeleteModal').remove();
if ($(e.currentTarget).html() === 'Indices' && !$(e.currentTarget).parent().hasClass('active')) {
$('#newIndexView').hide();
$('#indexEditView').show();
$('#modal-dialog .modal-footer .button-danger').hide();
$('#modal-dialog .modal-footer .button-success').hide();
$('#modal-dialog .modal-footer .button-notification').hide();
//$('#addIndex').detach().appendTo('#modal-dialog .modal-footer');
}
if ($(e.currentTarget).html() === 'General' && !$(e.currentTarget).parent().hasClass('active')) {
$('#modal-dialog .modal-footer .button-danger').show();
$('#modal-dialog .modal-footer .button-success').show();
$('#modal-dialog .modal-footer .button-notification').show();
var elem = $('.index-button-bar')[0];
var elem2 = $('.index-button-bar2')[0];
//$('#addIndex').detach().appendTo(elem);
if ($('#cancelIndex').is(':visible')) {
$('#cancelIndex').detach().appendTo(elem2);
$('#createIndex').detach().appendTo(elem2);
}
}
});
},
unbindIndexEvents: function() {
$('#indexEditView #addIndex').unbind('click');
$('#newIndexType').unbind('change');
$('#infoTab a').unbind('click');
$('.deleteIndex').unbind('click');
/*
//$('#documentsToolbar ul').unbind('click');
this.markFilterToggle();
this.changeEditMode(false);
0Ads0asd0sd0f0asdf0sa0f
"click #documentsToolbar ul" : "resetIndexForms"
*/
},
createInfoModal: function() {
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(
"modalCollectionInfo.ejs",
"Collection: " + this.model.get('name'),
buttons,
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
resetIndexForms: function () {
$('#indexHeader input').val('').prop("checked", false);
$('#newIndexType').val('Cap').prop('selected',true);
this.selectIndexType();
},
createIndex: function () {
//e.preventDefault();
var self = this;
var indexType = $('#newIndexType').val();
var postParameter = {};
var fields;
var unique;
var sparse;
switch (indexType) {
case 'Cap':
var size = parseInt($('#newCapSize').val(), 10) || 0;
var byteSize = parseInt($('#newCapByteSize').val(), 10) || 0;
postParameter = {
type: 'cap',
size: size,
byteSize: byteSize
};
break;
case 'Geo':
//HANDLE ARRAY building
fields = $('#newGeoFields').val();
var geoJson = self.checkboxToValue('#newGeoJson');
var constraint = self.checkboxToValue('#newGeoConstraint');
var ignoreNull = self.checkboxToValue('#newGeoIgnoreNull');
postParameter = {
type: 'geo',
fields: self.stringToArray(fields),
geoJson: geoJson,
constraint: constraint,
ignoreNull: ignoreNull
};
break;
case 'Hash':
fields = $('#newHashFields').val();
unique = self.checkboxToValue('#newHashUnique');
sparse = self.checkboxToValue('#newHashSparse');
postParameter = {
type: 'hash',
fields: self.stringToArray(fields),
unique: unique,
sparse: sparse
};
break;
case 'Fulltext':
fields = ($('#newFulltextFields').val());
var minLength = parseInt($('#newFulltextMinLength').val(), 10) || 0;
postParameter = {
type: 'fulltext',
fields: self.stringToArray(fields),
minLength: minLength
};
break;
case 'Skiplist':
fields = $('#newSkiplistFields').val();
unique = self.checkboxToValue('#newSkiplistUnique');
sparse = self.checkboxToValue('#newSkiplistSparse');
postParameter = {
type: 'skiplist',
fields: self.stringToArray(fields),
unique: unique,
sparse: sparse
};
break;
}
var callback = function(error, msg){
if (error) {
if (msg) {
var message = JSON.parse(msg.responseText);
arangoHelper.arangoError("Document error", message.errorMessage);
}
else {
arangoHelper.arangoError("Document error", "Could not create index.");
}
}
self.refreshCollectionsView();
};
window.modalView.hide();
//$($('#infoTab').children()[1]).find('a').click();
self.model.createIndex(postParameter, callback);
},
window.modalView.hide();
//$($('#infoTab').children()[1]).find('a').click();
self.model.createIndex(postParameter, callback);
},
lastTarget: null,
lastTarget: null,
prepDeleteIndex: function (e) {
var self = this;
this.lastTarget = e;
prepDeleteIndex: function (e) {
var self = this;
this.lastTarget = e;
this.lastId = $(this.lastTarget.currentTarget).
parent().
parent().
first().
children().
first().
text();
//window.modalView.hide();
this.lastId = $(this.lastTarget.currentTarget).
parent().
parent().
first().
children().
first().
text();
//window.modalView.hide();
//delete modal
$("#modal-dialog .modal-footer").after(
'<div id="indexDeleteModal" style="display:block;" class="alert alert-error modal-delete-confirmation">' +
'<strong>Really delete?</strong>' +
'<button id="indexConfirmDelete" class="button-danger pull-right modal-confirm-delete">Yes</button>' +
'<button id="indexAbortDelete" class="button-neutral pull-right">No</button>' +
//delete modal
$("#modal-dialog .modal-footer").after(
'<div id="indexDeleteModal" style="display:block;" class="alert alert-error modal-delete-confirmation">' +
'<strong>Really delete?</strong>' +
'<button id="indexConfirmDelete" class="button-danger pull-right modal-confirm-delete">Yes</button>' +
'<button id="indexAbortDelete" class="button-neutral pull-right">No</button>' +
'</div>');
$('#indexConfirmDelete').unbind('click');
$('#indexConfirmDelete').bind('click', function() {
@ -596,98 +627,98 @@
});
},
},
refreshCollectionsView: function() {
window.App.arangoCollectionsStore.fetch({
success: function () {
window.App.collectionsView.render();
}
});
},
refreshCollectionsView: function() {
window.App.arangoCollectionsStore.fetch({
success: function () {
window.App.collectionsView.render();
}
});
},
deleteIndex: function () {
var callback = function(error) {
if (error) {
arangoHelper.arangoError("Could not delete index");
$("tr th:contains('"+ this.lastId+"')").parent().children().last().html(
'<span class="deleteIndex icon_arangodb_roundminus"' +
deleteIndex: function () {
var callback = function(error) {
if (error) {
arangoHelper.arangoError("Could not delete index");
$("tr th:contains('"+ this.lastId+"')").parent().children().last().html(
'<span class="deleteIndex icon_arangodb_roundminus"' +
' data-original-title="Delete index" title="Delete index"></span>'
);
this.model.set("locked", false);
this.refreshCollectionsView();
}
else if (!error && error !== undefined) {
$("tr th:contains('"+ this.lastId+"')").parent().remove();
this.model.set("locked", false);
this.refreshCollectionsView();
}
);
this.model.set("locked", false);
this.refreshCollectionsView();
}.bind(this);
}
else if (!error && error !== undefined) {
$("tr th:contains('"+ this.lastId+"')").parent().remove();
this.model.set("locked", false);
this.refreshCollectionsView();
}
this.refreshCollectionsView();
}.bind(this);
this.model.set("locked", true);
this.model.deleteIndex(this.lastId, callback);
this.model.set("locked", true);
this.model.deleteIndex(this.lastId, callback);
$("tr th:contains('"+ this.lastId+"')").parent().children().last().html(
'<i class="fa fa-circle-o-notch fa-spin"></i>'
);
},
$("tr th:contains('"+ this.lastId+"')").parent().children().last().html(
'<i class="fa fa-circle-o-notch fa-spin"></i>'
);
},
selectIndexType: function () {
$('.newIndexClass').hide();
var type = $('#newIndexType').val();
$('#newIndexType'+type).show();
},
selectIndexType: function () {
$('.newIndexClass').hide();
var type = $('#newIndexType').val();
$('#newIndexType'+type).show();
},
getIndex: function () {
getIndex: function () {
var callback = function(error, data) {
if (error) {
window.arangoHelper.arangoError('Index', data.errorMessage);
var callback = function(error, data) {
if (error) {
window.arangoHelper.arangoError('Index', data.errorMessage);
}
else {
this.renderIndex(data);
}
}.bind(this);
this.model.getIndex(callback);
},
renderIndex: function(data) {
this.index = data;
var cssClass = 'collectionInfoTh modal-text';
if (this.index) {
var fieldString = '';
var actionString = '';
_.each(this.index.indexes, function(v) {
if (v.type === 'primary' || v.type === 'edge') {
actionString = '<span class="icon_arangodb_locked" ' +
'data-original-title="No action"></span>';
}
else {
this.renderIndex(data);
actionString = '<span class="deleteIndex icon_arangodb_roundminus" ' +
'data-original-title="Delete index" title="Delete index"></span>';
}
}.bind(this);
this.model.getIndex(callback);
},
if (v.fields !== undefined) {
fieldString = v.fields.join(", ");
}
renderIndex: function(data) {
this.index = data;
var cssClass = 'collectionInfoTh modal-text';
if (this.index) {
var fieldString = '';
var actionString = '';
_.each(this.index.indexes, function(v) {
if (v.type === 'primary' || v.type === 'edge') {
actionString = '<span class="icon_arangodb_locked" ' +
'data-original-title="No action"></span>';
}
else {
actionString = '<span class="deleteIndex icon_arangodb_roundminus" ' +
'data-original-title="Delete index" title="Delete index"></span>';
}
if (v.fields !== undefined) {
fieldString = v.fields.join(", ");
}
//cut index id
var position = v.id.indexOf('/');
var indexId = v.id.substr(position + 1, v.id.length);
var selectivity = (
v.hasOwnProperty("selectivityEstimate") ?
//cut index id
var position = v.id.indexOf('/');
var indexId = v.id.substr(position + 1, v.id.length);
var selectivity = (
v.hasOwnProperty("selectivityEstimate") ?
(v.selectivityEstimate * 100).toFixed(2) + "%" :
"n/a"
);
var sparse = (v.hasOwnProperty("sparse") ? v.sparse : "n/a");
);
var sparse = (v.hasOwnProperty("sparse") ? v.sparse : "n/a");
$('#collectionEditIndexTable').append(
'<tr>' +
$('#collectionEditIndexTable').append(
'<tr>' +
'<th class=' + JSON.stringify(cssClass) + '>' + indexId + '</th>' +
'<th class=' + JSON.stringify(cssClass) + '>' + v.type + '</th>' +
'<th class=' + JSON.stringify(cssClass) + '>' + v.unique + '</th>' +
@ -696,49 +727,49 @@
'<th class=' + JSON.stringify(cssClass) + '>' + fieldString + '</th>' +
'<th class=' + JSON.stringify(cssClass) + '>' + actionString + '</th>' +
'</tr>'
);
});
}
this.bindIndexEvents();
},
toggleNewIndexView: function () {
var elem = $('.index-button-bar2')[0];
var elem2 = $('.index-button-bar')[0];
if ($('#indexEditView').is(':visible')) {
$('#indexEditView').hide();
$('#newIndexView').show();
//$('#addIndex').detach().appendTo(elem2);
$('#cancelIndex').detach().appendTo('#modal-dialog .modal-footer');
$('#createIndex').detach().appendTo('#modal-dialog .modal-footer');
}
else {
$('#indexEditView').show();
$('#newIndexView').hide();
//$('#addIndex').detach().appendTo('#modal-dialog .modal-footer');
$('#cancelIndex').detach().appendTo(elem);
$('#createIndex').detach().appendTo(elem);
}
arangoHelper.fixTooltips(".icon_arangodb, .arangoicon", "right");
this.resetIndexForms();
},
stringToArray: function (fieldString) {
var fields = [];
fieldString.split(',').forEach(function(field){
field = field.replace(/(^\s+|\s+$)/g,'');
if (field !== '') {
fields.push(field);
}
);
});
return fields;
},
checkboxToValue: function (id) {
return $(id).prop('checked');
}
this.bindIndexEvents();
},
toggleNewIndexView: function () {
var elem = $('.index-button-bar2')[0];
var elem2 = $('.index-button-bar')[0];
if ($('#indexEditView').is(':visible')) {
$('#indexEditView').hide();
$('#newIndexView').show();
//$('#addIndex').detach().appendTo(elem2);
$('#cancelIndex').detach().appendTo('#modal-dialog .modal-footer');
$('#createIndex').detach().appendTo('#modal-dialog .modal-footer');
}
else {
$('#indexEditView').show();
$('#newIndexView').hide();
//$('#addIndex').detach().appendTo('#modal-dialog .modal-footer');
$('#cancelIndex').detach().appendTo(elem);
$('#createIndex').detach().appendTo(elem);
}
arangoHelper.fixTooltips(".icon_arangodb, .arangoicon", "right");
this.resetIndexForms();
},
stringToArray: function (fieldString) {
var fields = [];
fieldString.split(',').forEach(function(field){
field = field.replace(/(^\s+|\s+$)/g,'');
if (field !== '') {
fields.push(field);
}
});
return fields;
},
checkboxToValue: function (id) {
return $(id).prop('checked');
}
});
}());