1
0
Fork 0

Merge branch 'devel' of https://github.com/arangodb/arangodb into devel

This commit is contained in:
Kaveh Vahedipour 2016-02-12 17:06:03 +00:00
commit 8ac5ccfdff
15 changed files with 468 additions and 557 deletions

View File

@ -613,17 +613,12 @@ else ()
install_readme(LICENSES-OTHER-COMPONENTS.md share/doc/arangodb LICENSES-OTHER-COMPONENTS.md)
endif ()
# Tests
# Tests -----------------------------------------------------------------------
set(TEST_BASICS_SUITE basics_suite)
set(TEST_GEO_SUITE geo_suite)
# Enable testing ---------------------------------------------------------------
set(TEST_GEO_SUITE geo_suite)
enable_testing()
# Test definitions -------------------------------------------------------------
add_subdirectory(UnitTests)
# Build package ----------------------------------------------------------------
# Posible options are:
# - dmg-cli: Mac OS X shell client application

View File

@ -77,6 +77,8 @@ macro(AutodetectHostArchitecture)
set(TARGET_ARCHITECTURE "haswell")
elseif(_cpu_model EQUAL 62)
set(TARGET_ARCHITECTURE "ivy-bridge")
elseif(_cpu_model EQUAL 61)
set(TARGET_ARCHITECTURE "broadwell")
elseif(_cpu_model EQUAL 60)
set(TARGET_ARCHITECTURE "haswell")
elseif(_cpu_model EQUAL 60)
@ -150,7 +152,7 @@ macro(AutodetectHostArchitecture)
endmacro()
macro(OptimizeForArchitecture)
set(TARGET_ARCHITECTURE "auto" CACHE STRING "CPU architecture to optimize for. Using an incorrect setting here can result in crashes of the resulting binary because of invalid instructions used.\nSetting the value to \"auto\" will try to optimize for the architecture where cmake is called.\nOther supported values are: \"none\", \"generic\", \"core\", \"merom\" (65nm Core2), \"penryn\" (45nm Core2), \"nehalem\", \"westmere\", \"sandy-bridge\", \"ivy-bridge\", \"haswell\", \"atom\", \"k8\", \"k8-sse3\", \"barcelona\", \"istanbul\", \"magny-cours\", \"bulldozer\", \"interlagos\", \"piledriver\", \"AMD 14h\", \"AMD 16h\".")
set(TARGET_ARCHITECTURE "auto" CACHE STRING "CPU architecture to optimize for. Using an incorrect setting here can result in crashes of the resulting binary because of invalid instructions used.\nSetting the value to \"auto\" will try to optimize for the architecture where cmake is called.\nOther supported values are: \"none\", \"generic\", \"core\", \"merom\" (65nm Core2), \"penryn\" (45nm Core2), \"nehalem\", \"westmere\", \"sandy-bridge\", \"ivy-bridge\", \"haswell\", \"broadwell\", \"atom\", \"k8\", \"k8-sse3\", \"barcelona\", \"istanbul\", \"magny-cours\", \"bulldozer\", \"interlagos\", \"piledriver\", \"AMD 14h\", \"AMD 16h\".")
set(_force)
if(NOT _last_target_arch STREQUAL "${TARGET_ARCHITECTURE}")
message(STATUS "target changed from \"${_last_target_arch}\" to \"${TARGET_ARCHITECTURE}\"")
@ -202,6 +204,12 @@ macro(OptimizeForArchitecture)
list(APPEND _march_flag_list "corei7-avx")
list(APPEND _march_flag_list "core2")
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2" "avx" "avx2" "rdrnd" "f16c" "fma")
elseif(TARGET_ARCHITECTURE STREQUAL "broadwell")
list(APPEND _march_flag_list "core-avx2")
list(APPEND _march_flag_list "core-avx-i")
list(APPEND _march_flag_list "corei7-avx")
list(APPEND _march_flag_list "core2")
list(APPEND _available_vector_units_list "sse" "sse2" "sse3" "ssse3" "sse4.1" "sse4.2" "avx" "avx2" "rdrnd" "f16c" "fma")
elseif(TARGET_ARCHITECTURE STREQUAL "ivy-bridge")
list(APPEND _march_flag_list "core-avx-i")
list(APPEND _march_flag_list "corei7-avx")

View File

@ -91,43 +91,41 @@
return data2;
},
createIndex: function (postParameter) {
var returnVal = false;
createIndex: function (postParameter, callback) {
$.ajax({
cache: false,
type: "POST",
url: "/_api/index?collection="+ this.get("id"),
data: JSON.stringify(postParameter),
contentType: "application/json",
processData: false,
async: true,
success: function() {
callback(false);
},
error: function(data) {
callback(true, data);
}
});
callback();
},
deleteIndex: function (id, callback) {
$.ajax({
cache: false,
type: "POST",
url: "/_api/index?collection="+ this.get("id"),
data: JSON.stringify(postParameter),
contentType: "application/json",
processData: false,
type: 'DELETE',
url: "/_api/index/"+ this.get("name") +"/"+encodeURIComponent(id),
async: false,
success: function() {
returnVal = true;
success: function () {
callback(false);
},
error: function(data) {
returnVal = data;
error: function (data) {
callback(true, data);
}
});
return returnVal;
},
deleteIndex: function (id) {
var returnval = false;
$.ajax({
cache: false,
type: 'DELETE',
url: "/_api/index/"+ this.get("name") +"/"+encodeURIComponent(id),
async: false,
success: function () {
returnval = true;
},
error: function () {
returnval = false;
}
});
return returnval;
},
callback();
},
truncateCollection: function () {
$.ajax({
@ -194,8 +192,9 @@
},
error: function(data) {
try {
var parsed = JSON.parse(data.responseText);
result = parsed.errorMessage;
console.log("error");
//var parsed = JSON.parse(data.responseText);
//result = parsed.errorMessage;
}
catch (e) {
result = false;

View File

@ -114,4 +114,20 @@
</div>
</div>
</div>
<!-- Delete Index Modal -->
<div id="indexDeleteModal" style="display:none" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<a class="arangoHeader">Delete Index?</a>
</div>
<div class="modal-body" id="deleteIndex">
<p>There is no way back…</p>
</div>
<div class="modal-footer">
<button class="button-close" data-dismiss="modal" aria-hidden="true">Close</button>
<button id="confirmDeleteIndexBtn" class="button-danger" style="float:right">Delete</button>
</div>
</div>
</script>

View File

@ -45,11 +45,6 @@
<span title="Download documents as JSON file"><i class="fa fa-download"></i></span>
</a>
</li>
<li class="enabled">
<a id="indexCollection" class="headerButton">
<span class="icon_arangodb_checklist" title="Index collection"></span>
</a>
</li>
<li class="enabled" style="margin-right: 15px">
<a id="filterCollection" class="headerButton">
<span class="icon_arangodb_filter" title="Filter collection"></span>
@ -107,247 +102,6 @@
</div>
</div>
<div id="indexHeader" class="headerDropdown">
<div class="contentIn" id="indexHeaderContent">
<div id="indexEditView">
<span class="arangoHeader">Indexes:</span>
<table id="collectionEditIndexTable" class="edit-index-table">
<thead>
<tr class="figuresHeader">
<th class="collectionInfoTh">ID</th>
<th class="collectionInfoTh">Type</th>
<th class="collectionInfoTh">Unique</th>
<th class="collectionInfoTh">Sparse</th>
<th class="collectionInfoTh">Selectivity Est.</th>
<th class="collectionInfoTh">Fields</th>
<th class="collectionInfoTh">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="index-button-bar">
<button id="addIndex" class="button-success">Add Index</button>
</div>
</div>
<div id="newIndexView" class="new-index-view" style="display:none">
<span id="newIndexHeader" class="arangoHeader">Add Index:</span>
<table>
<tr>
<th class="collectionTh">Type:</th>
<th class="">
<select id="newIndexType">
<option value="Cap">Cap Constraint</option>
<option value="Geo">Geo Index</option>
<option value="Hash">Hash Index</option>
<option value="Fulltext">Fulltext Index</option>
<option value="Skiplist">Skip-List Index</option>
</select>
</th>
<th class="" style="width: 18px"/>
</tr>
</table>
<div id="newIndexTypeCap" class="newIndexClass">
<table>
<tr>
<th class="collectionTh">Size:</th>
<th><input type="text" id="newCapSize" value=""/></th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="The maximal number of documents for the collection.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Bytesize:</th>
<th><input type="text" id="newCapByteSize" value=""/></th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="The maximal size of the active document data in the collection. (min = 16384)">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
</table>
</div>
<div id="newIndexTypeGeo" class="newIndexClass" style="display: none">
<table>
<tr>
<th class="collectionTh">Fields:</th>
<th><input type="text" id="newGeoFields" value=""/></th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="A list with one or two attribute paths.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Geo JSON:</th>
<th>
<input id="newGeoJson" type="checkbox" name="newGeoJson" value="true">
</th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="If a geo-spatial index on a location is constructed and geoJson is true, then the order within the list is longitude followed by latitude.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Constraint:</th>
<th>
<input id="newGeoConstraint" type="checkbox" name="newGeoConstraint" value="true">
</th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="If constraint is true, then a geo-spatial constraint is created.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Ignore Null:</th>
<th>
<input id="newGeoIgnoreNull" type="checkbox" name="newGeoIgnoreNull" value="true">
</th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="If a geo-spatial constraint is created and ignoreNull is true, then documents with a null in location or at least one null in latitude or longitude are ignored.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
</table>
</div>
<div id="newIndexTypeHash" class="newIndexClass" style="display:none">
<table>
<tr>
<th class="collectionTh">Fields:</th>
<th><input type="text" id="newHashFields" value=""/></th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="A list of attribute paths.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Unique:</th>
<th>
<input id="newHashUnique" type="checkbox" name="newHashUnique" value="true">
</th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="If true, then create a unique index.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Sparse:</th>
<th>
<input id="newHashSparse" type="checkbox" name="newHashSparse" value="true">
</th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="If true, then create a sparse index.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
</table>
</div>
<div id="newIndexTypeFulltext" class="newIndexClass" style="display:none">
<table>
<tr>
<th class="collectionTh">Fields:</th>
<th><input type="text" id="newFulltextFields" value=""/></th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title='A list of attribute names. Currently, the list is limited to exactly one attribute, so the value of fields should look like this for example: [ "text" ].'>
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Min. length:</th>
<th><input type="text" id="newFulltextMinLength" value=""/></th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="Minimum character length of words to index. Will default to a server-defined value if unspecified. It is thus recommended to set this value explicitly when creating the index.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
</table>
</div>
<div id="newIndexTypeSkiplist" class="newIndexClass" style="display:none">
<table>
<tr>
<th class="collectionTh">Fields:</th>
<th><input type="text" id="newSkiplistFields" value=""/></th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="A list of attribute paths.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Unique:</th>
<th>
<input id="newSkiplistUnique" type="checkbox" name="newSkiplistUnique" value="true">
</th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="If true, then create a unique index.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
<tr>
<th class="collectionTh">Sparse:</th>
<th>
<input id="newSkiplistSparse" type="checkbox" name="newSkiplistSparse" value="true">
</th>
<th class="tooltipInfoTh">
<div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="If true, then create a sparse index.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a>
</div>
</th>
</tr>
</table>
</div>
<div class="index-button-bar">
<button id="createIndex" class="button-success">Save</button>
<button id="cancelIndex" class="button-danger">Cancel</button>
</div>
</div>
</div>
</div>
</div>
<div id="documentsDiv" class="innerContent">
@ -377,19 +131,4 @@
</div>
</div>
<!-- Delete Index Modal -->
<div id="indexDeleteModal" style="display:none" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<a class="arangoHeader">Delete Index?</a>
</div>
<div class="modal-body" id="deleteIndex">
<p>There is no way back…</p>
</div>
<div class="modal-footer">
<button class="button-close" data-dismiss="modal" aria-hidden="true">Close</button>
<button id="confirmDeleteIndexBtn" class="button-danger" style="float:right">Delete</button>
</div>
</div>
</script>

View File

@ -8,8 +8,42 @@
</div>
<%}%>
<% if (tabBar) { %>
<div class="modal-tabbar">
<ul id="infoTab" class="nav nav-tabs">
<% var counter = 0; %>
<% _.each(tabBar, function(value) { %>
<% if (counter === 0) { %>
<li class="active"><a href="#<%=value%>" data-toggle="tab"><%=value%></a></li>
<%} else {%>
<li><a href="#<%=value%>" data-toggle="tab"><%=value%></a></li>
<% } %>
<% counter++; %>
<% }); %>
</ul>
</div>
<%}%>
<div class="modal-body">
<% if (tabBar) { %>
<div class="tab-content">
<% var counter = 0; %>
<% _.each(tabBar, function(value) { %>
<% if (counter === 0) { %>
<div class="tab-pane tab-pane-modal active" id="<%=value%>">
</div>
<%} else {%>
<div class="tab-pane tab-pane-modal" id="<%=value%>">
</div>
<% } %>
<% counter++; %>
<% }); %>
</div>
<%}%>
</div>
<% if (!hideFooter) { %>
<div class="modal-footer">
<%

View File

@ -1,6 +1,6 @@
/*jshint browser: true */
/*jshint unused: false */
/*global window, exports, Backbone, EJS, $, templateEngine, arangoHelper, Joi*/
/*global window, exports, Backbone, EJS, _, $, templateEngine, arangoHelper, Joi*/
(function() {
"use strict";
@ -14,11 +14,11 @@
initialize: function () {
this.collectionsView = this.options.collectionsView;
},
events: {
'click .iconSet.icon_arangodb_settings2': 'createEditPropertiesModal',
'click .pull-left' : 'noop',
'click .icon_arangodb_settings2' : 'editProperties',
// 'click #editCollection' : 'editProperties',
'click .spanInfo' : 'showProperties',
'click': 'selectCollection'
},
@ -39,11 +39,6 @@
showProperties: function(event) {
event.stopPropagation();
this.createInfoModal();
/*
window.App.navigate(
"collectionInfo/" + encodeURIComponent(this.model.get("id")), {trigger: true}
);
*/
},
selectCollection: function(event) {
@ -301,7 +296,6 @@
);
}
tableContent.push(
window.modalView.createReadOnlyEntry(
"change-collection-id", "ID", this.model.get('id'), ""
@ -352,12 +346,75 @@
)
);
var tabBar = ["General", "Indices"],
templates = ["modalTable.ejs", "indicesView.ejs"];
window.modalView.show(
"modalTable.ejs",
templates,
"Modify Collection",
buttons,
tableContent
tableContent, null, null,
this.events, null,
tabBar
);
this.getIndex();
this.bindIndexEvents();
},
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) {
self.prepDeleteIndex(e);
});
$('#infoTab a').bind('click', function(e) {
if ($(e.currentTarget).html() === 'Indices') {
$('.modal-footer .button-danger').hide();
$('.modal-footer .button-success').hide();
$('.modal-footer .button-notification').hide();
}
else {
$('.modal-footer .button-danger').show();
$('.modal-footer .button-success').show();
$('.modal-footer .button-notification').show();
}
});
},
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() {
@ -369,6 +426,215 @@
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);
}
else {
arangoHelper.arangoError("Document error", "Could not create index.");
}
}
};
window.modalView.hide();
this.getIndex();
this.createEditPropertiesModal();
$($('#infoTab').children()[1]).find('a').click();
self.model.createIndex(postParameter, callback);
},
lastTarget: null,
prepDeleteIndex: function (e) {
var self = this;
this.lastTarget = e;
this.lastId = $(this.lastTarget.currentTarget).
parent().
parent().
first().
children().
first().
text();
window.modalView.hide();
//delete modal
$("#indexDeleteModal").modal('show');
$('#confirmDeleteIndexBtn').unbind('click');
$('#confirmDeleteIndexBtn').bind('click', function() {
self.deleteIndex();
});
},
deleteIndex: function () {
var callback = function(error) {
if (error) {
arangoHelper.arangoError("Could not delete index");
}
}
$("#indexDeleteModal").modal('hide');
this.model.deleteIndex(this.lastId, callback);
this.createEditPropertiesModal();
$($('#infoTab').children()[1]).find('a').click();
},
selectIndexType: function () {
$('.newIndexClass').hide();
var type = $('#newIndexType').val();
$('#newIndexType'+type).show();
},
getIndex: function () {
this.index = this.model.getIndex();
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") ?
(v.selectivityEstimate * 100).toFixed(2) + "%" :
"n/a"
);
var sparse = (v.hasOwnProperty("sparse") ? v.sparse : "n/a");
$('#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>' +
'<th class=' + JSON.stringify(cssClass) + '>' + sparse + '</th>' +
'<th class=' + JSON.stringify(cssClass) + '>' + selectivity + '</th>' +
'<th class=' + JSON.stringify(cssClass) + '>' + fieldString + '</th>' +
'<th class=' + JSON.stringify(cssClass) + '>' + actionString + '</th>' +
'</tr>'
);
});
}
},
toggleNewIndexView: function () {
if ($('#indexEditView').is(':visible')) {
$('#indexEditView').hide();
$('#newIndexView').show();
}
else {
$('#indexEditView').show();
$('#newIndexView').hide();
}
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');
}
});

View File

@ -68,7 +68,6 @@
"click #collectionNext" : "nextCollection",
"click #filterCollection" : "filterCollection",
"click #markDocuments" : "editDocuments",
"click #indexCollection" : "indexCollection",
"click #importCollection" : "importCollection",
"click #exportCollection" : "exportCollection",
"click #filterSend" : "sendFilter",
@ -89,13 +88,6 @@
"click #resetView" : "resetView",
"click #confirmDocImport" : "startUpload",
"click #exportDocuments" : "startDownload",
"change #newIndexType" : "selectIndexType",
"click #createIndex" : "createIndex",
"click .deleteIndex" : "prepDeleteIndex",
"click #confirmDeleteIndexBtn" : "deleteIndex",
"click #documentsToolbar ul" : "resetIndexForms",
"click #indexHeader #addIndex" : "toggleNewIndexView",
"click #indexHeader #cancelIndex" : "toggleNewIndexView",
"change #documentSize" : "setPagesize",
"change #docsSort" : "setSorting"
},
@ -142,11 +134,7 @@
}
}
},
toggleNewIndexView: function () {
$('#indexEditView').toggle("fast");
$('#newIndexView').toggle("fast");
this.resetIndexForms();
},
nop: function(event) {
event.stopPropagation();
},
@ -266,7 +254,6 @@
//need to make following functions automatically!
editDocuments: function () {
$('#indexCollection').removeClass('activated');
$('#importCollection').removeClass('activated');
$('#exportCollection').removeClass('activated');
this.markFilterToggle();
@ -274,13 +261,11 @@
this.changeEditMode();
$('#filterHeader').hide();
$('#importHeader').hide();
$('#indexHeader').hide();
$('#editHeader').slideToggle(200);
$('#exportHeader').hide();
},
filterCollection : function () {
$('#indexCollection').removeClass('activated');
$('#importCollection').removeClass('activated');
$('#exportCollection').removeClass('activated');
$('#markDocuments').removeClass('activated');
@ -288,7 +273,6 @@
this.markFilterToggle();
this.activeFilter = true;
$('#importHeader').hide();
$('#indexHeader').hide();
$('#editHeader').hide();
$('#exportHeader').hide();
$('#filterHeader').slideToggle(200);
@ -303,7 +287,6 @@
},
exportCollection: function () {
$('#indexCollection').removeClass('activated');
$('#importCollection').removeClass('activated');
$('#filterHeader').removeClass('activated');
$('#markDocuments').removeClass('activated');
@ -312,41 +295,22 @@
this.markFilterToggle();
$('#exportHeader').slideToggle(200);
$('#importHeader').hide();
$('#indexHeader').hide();
$('#filterHeader').hide();
$('#editHeader').hide();
},
importCollection: function () {
this.markFilterToggle();
$('#indexCollection').removeClass('activated');
$('#markDocuments').removeClass('activated');
this.changeEditMode(false);
$('#importCollection').toggleClass('activated');
$('#exportCollection').removeClass('activated');
$('#importHeader').slideToggle(200);
$('#filterHeader').hide();
$('#indexHeader').hide();
$('#editHeader').hide();
$('#exportHeader').hide();
},
indexCollection: function () {
this.markFilterToggle();
$('#importCollection').removeClass('activated');
$('#exportCollection').removeClass('activated');
$('#markDocuments').removeClass('activated');
this.changeEditMode(false);
$('#indexCollection').toggleClass('activated');
$('#newIndexView').hide();
$('#indexEditView').show();
$('#indexHeader').slideToggle(200);
$('#importHeader').hide();
$('#editHeader').hide();
$('#filterHeader').hide();
$('#exportHeader').hide();
},
changeEditMode: function (enable) {
if (enable === false || this.editMode === true) {
$('#documentsTableID tbody tr').css('cursor', 'default');
@ -910,7 +874,6 @@
this.collection.collectionID
);
this.getIndex();
this.breadcrumb();
this.checkCollectionState();
@ -973,182 +936,7 @@
'<a class="disabledBread">'+this.collectionName+'</a>'+
'</div>'
);
},
resetIndexForms: function () {
$('#indexHeader input').val('').prop("checked", false);
$('#newIndexType').val('Cap').prop('selected',true);
this.selectIndexType();
},
stringToArray: function (fieldString) {
var fields = [];
fieldString.split(',').forEach(function(field){
field = field.replace(/(^\s+|\s+$)/g,'');
if (field !== '') {
fields.push(field);
}
});
return fields;
},
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;
}
result = self.collectionModel.createIndex(postParameter);
if (result === true) {
$('#collectionEditIndexTable tbody tr').remove();
self.getIndex();
self.toggleNewIndexView();
self.resetIndexForms();
}
else {
if (result.responseText) {
var message = JSON.parse(result.responseText);
arangoHelper.arangoError("Document error", message.errorMessage);
}
else {
arangoHelper.arangoError("Document error", "Could not create index.");
}
}
},
prepDeleteIndex: function (e) {
this.lastTarget = e;
this.lastId = $(this.lastTarget.currentTarget).
parent().
parent().
first().
children().
first().
text();
$("#indexDeleteModal").modal('show');
},
deleteIndex: function () {
var result = this.collectionModel.deleteIndex(this.lastId);
if (result === true) {
$(this.lastTarget.currentTarget).parent().parent().remove();
}
else {
arangoHelper.arangoError("Could not delete index");
}
$("#indexDeleteModal").modal('hide');
},
selectIndexType: function () {
$('.newIndexClass').hide();
var type = $('#newIndexType').val();
$('#newIndexType'+type).show();
},
checkboxToValue: function (id) {
return $(id).prop('checked');
},
getIndex: function () {
this.index = this.collectionModel.getIndex();
var cssClass = 'collectionInfoTh modal-text';
if (this.index) {
var fieldString = '';
var actionString = '';
$.each(this.index.indexes, function(k, 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") ?
(v.selectivityEstimate * 100).toFixed(2) + "%" :
"n/a"
);
var sparse = (v.hasOwnProperty("sparse") ? v.sparse : "n/a");
$('#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>' +
'<th class=' + JSON.stringify(cssClass) + '>' + sparse + '</th>' +
'<th class=' + JSON.stringify(cssClass) + '>' + selectivity + '</th>' +
'<th class=' + JSON.stringify(cssClass) + '>' + fieldString + '</th>' +
'<th class=' + JSON.stringify(cssClass) + '>' + actionString + '</th>' +
'</tr>'
);
});
arangoHelper.fixTooltips("deleteIndex", "left");
}
}
});
}());

View File

@ -242,7 +242,7 @@
};
},
show: function(templateName, title, buttons, tableContent, advancedContent, extraInfo, events, noConfirm) {
show: function(templateName, title, buttons, tableContent, advancedContent, extraInfo, events, noConfirm, tabBar) {
var self = this, lastBtn, confirmMsg, closeButtonFound = false;
buttons = buttons || [];
noConfirm = Boolean(noConfirm);
@ -269,7 +269,8 @@
title: title,
buttons: buttons,
hideFooter: this.hideFooter,
confirm: confirmMsg
confirm: confirmMsg,
tabBar: tabBar
}));
_.each(buttons, function(b, i) {
if (b.disabled || !b.callback) {
@ -285,16 +286,34 @@
}
$("#modalButton" + i).bind("click", b.callback);
});
$(this.confirm.no).bind("click", function() {
$(self.confirm.list).css("display", "none");
});
var template = templateEngine.createTemplate(templateName);
$(".createModalDialog .modal-body").html(template.render({
content: tableContent,
advancedContent: advancedContent,
info: extraInfo
}));
var template;
if (typeof templateName === 'string') {
template = templateEngine.createTemplate(templateName);
$(".createModalDialog .modal-body").html(template.render({
content: tableContent,
advancedContent: advancedContent,
info: extraInfo
}));
}
else {
var counter = 0;
_.each(templateName, function(v) {
template = templateEngine.createTemplate(v);
$(".createModalDialog .modal-body .tab-content #" + tabBar[counter]).html(template.render({
content: tableContent,
advancedContent: advancedContent,
info: extraInfo
}));
counter++;
});
}
$('.createModalDialog .modalTooltips').tooltip({
position: {
my: "left top",

View File

@ -59,12 +59,34 @@
}
}
#collectionEditIndexTable {
thead {
border-bottom: 1px solid $c-grey;
}
}
.newIndexClass {
table {
margin-bottom: 60px;
}
}
.index-button-bar {
bottom: 0;
margin-bottom: 15px;
margin-right: 17px;
margin-top: 15px;
position: absolute;
right: 0;
button {
float: right;
margin-left: 0;
}
#cancelIndex {
margin-right: 13px;
}
}
%docs-col-no-border {

View File

@ -38,6 +38,10 @@
z-index: 9999999;
}
.modal-tabbar {
border-bottom: 1px solid $c-black;
}
.modal-body {
color: $c-btn-inverse;
font-family: 'Open Sans', sans-serif !important;
@ -269,7 +273,7 @@
}
.collectionTh {
height: 55px;
height: 50px;
}
.tab-content {
@ -281,6 +285,10 @@
padding-top: 10px;
}
.tab-pane-modal {
border-top: none !important;
}
#appstore {
max-height: 290px;
}

View File

@ -169,7 +169,9 @@ namespace arangodb {
////////////////////////////////////////////////////////////////////////////////
/// @brief LogLevel
////////////////////////////////////////////////////////////////////////////////
#ifdef TRI_UNDEF_ERR
#undef ERR
#endif
enum class LogLevel {
DEFAULT = 0,
FATAL = 1,

View File

@ -1156,17 +1156,15 @@ int TRI_CreateLockFile(char const* filename) {
}
TRI_FreeString(TRI_CORE_MEM_ZONE, buf);
TRI_CLOSE(fd);
// try to open pid file
fd = TRI_OPEN(filename, O_RDONLY | TRI_O_CLOEXEC);
if (fd < 0) {
return TRI_set_errno(TRI_ERROR_SYS_ERROR);
}
struct flock lock;
lock.l_start = 0;
lock.l_len = 0;
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
// try to lock pid file
rv = flock(fd, LOCK_EX);
rv = fcntl(fd, F_SETLK, &lock);
if (rv == -1) {
int res = TRI_set_errno(TRI_ERROR_SYS_ERROR);
@ -1237,19 +1235,20 @@ int TRI_VerifyLockFile(char const* filename) {
sizeof(buffer)); // not really necessary, but this shuts up valgrind
ssize_t n = TRI_READ(fd, buffer, sizeof(buffer));
TRI_CLOSE(fd);
if (n < 0) {
TRI_CLOSE(fd);
return TRI_ERROR_NO_ERROR;
}
// pid too long
if (n == sizeof(buffer)) {
TRI_CLOSE(fd);
return TRI_ERROR_NO_ERROR;
}
// file empty
if (n == 0) {
TRI_CLOSE(fd);
return TRI_ERROR_NO_ERROR;
}
@ -1257,26 +1256,29 @@ int TRI_VerifyLockFile(char const* filename) {
int res = TRI_errno();
if (res != TRI_ERROR_NO_ERROR) {
TRI_CLOSE(fd);
return TRI_ERROR_NO_ERROR;
}
TRI_pid_t pid = fc;
if (kill(pid, 0) == -1) {
TRI_CLOSE(fd);
return TRI_ERROR_NO_ERROR;
}
struct flock lock;
fd = TRI_OPEN(filename, O_RDONLY | TRI_O_CLOEXEC);
lock.l_start = 0;
lock.l_len = 0;
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
// try to lock pid file
int canLock = fcntl(fd, F_SETLK, &lock); // Exclusive (write) lock
if (fd < 0) {
return TRI_ERROR_NO_ERROR;
}
int canLock = flock(fd, LOCK_EX | LOCK_NB);
// file was not yet be locked
// file was not yet locken; could be locked
if (canLock == 0) {
flock(fd, LOCK_UN);
lock.l_type = F_UNLCK;
fcntl(fd, F_GETLK, &lock);
TRI_CLOSE(fd);
return TRI_ERROR_NO_ERROR;
@ -1286,7 +1288,7 @@ int TRI_VerifyLockFile(char const* filename) {
TRI_CLOSE(fd);
LOG(WARN) << "flock on lockfile '" << filename << "' failed: " << TRI_errno_string(canLock);
LOG(WARN) << "fcntl on lockfile '" << filename << "' failed: " << TRI_errno_string(canLock);
return TRI_ERROR_ARANGO_DATADIR_LOCKED;
}
@ -1337,7 +1339,14 @@ int TRI_DestroyLockFile(char const* filename) {
return TRI_ERROR_NO_ERROR;
}
int res = flock(fd, LOCK_UN);
struct flock lock;
lock.l_start = 0;
lock.l_len = 0;
lock.l_type = F_UNLCK;
lock.l_whence = SEEK_SET;
// relesae the lock
int res = fcntl(fd, F_GETLK, &lock);
TRI_CLOSE(fd);
if (res == 0) {

View File

@ -47,6 +47,8 @@
#define TRI_PLATFORM "solaris"
#define TRI_UNDEF_ERR 1
#define TRI_HAVE_PSTACK 1
////////////////////////////////////////////////////////////////////////////////

View File

@ -51,10 +51,14 @@ CODE prioritynames[] =
CODE facilitynames[] =
{
{ "auth", LOG_AUTH },
#ifdef LOG_AUTHPRIV
{ "authpriv", LOG_AUTHPRIV },
#endif
{ "cron", LOG_CRON },
{ "daemon", LOG_DAEMON },
#ifdef LOG_FTP
{ "ftp", LOG_FTP },
#endif
{ "kern", LOG_KERN },
{ "lpr", LOG_LPR },
{ "mail", LOG_MAIL },