1
0
Fork 0

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

This commit is contained in:
Dan Larkin 2017-04-26 15:23:29 -04:00
commit da03ae693e
4 changed files with 326 additions and 298 deletions

View File

@ -1,247 +1,249 @@
<script id="indicesView.ejs" type="text/template"> <script id="indicesView.ejs" type="text/template">
<div class="contentIn" id="indexHeaderContent"> <% if (typeof supported !== 'undefined') { %>
<div id="indexEditView"> <div class="contentIn" id="indexHeaderContent">
<table id="collectionEditIndexTable" class="edit-index-table arango-table"> <div id="indexEditView">
<thead> <table id="collectionEditIndexTable" class="edit-index-table arango-table">
<tr class="figuresHeader"> <thead>
<th class="collectionInfoTh">ID</th> <tr class="figuresHeader">
<th class="collectionInfoTh">Type</th> <th class="collectionInfoTh">ID</th>
<th class="collectionInfoTh">Unique</th> <th class="collectionInfoTh">Type</th>
<th class="collectionInfoTh">Sparse</th> <th class="collectionInfoTh">Unique</th>
<th class="collectionInfoTh">Selectivity Est.</th> <th class="collectionInfoTh">Sparse</th>
<th class="collectionInfoTh">Fields</th> <th class="collectionInfoTh">Selectivity Est.</th>
<th class="collectionInfoTh">Action</th> <th class="collectionInfoTh">Fields</th>
</tr> <th class="collectionInfoTh">Action</th>
</thead> </tr>
<tbody> </thead>
</tbody> <tbody>
<tfoot> </tbody>
<tr> <tfoot>
<td></td> <tr>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td><i class="fa fa-plus-circle" id="addIndex"></i></td> <td></td>
</tr> <td><i class="fa fa-plus-circle" id="addIndex"></i></td>
</tfoot> </tr>
</table> </tfoot>
</div> </table>
</div>
<div id="newIndexView" class="new-index-view" style="display:none"> <div id="newIndexView" class="new-index-view" style="display:none">
<table> <table>
<tr> <tr>
<th class="collectionTh">Type:</th> <th class="collectionTh">Type:</th>
<th class=""> <th class="">
<select id="newIndexType"> <select id="newIndexType">
<% if (supported.indexOf('geo') > -1) { %> <% if (supported.indexOf('geo') > -1) { %>
<option value="Geo">Geo Index</option> <option value="Geo">Geo Index</option>
<% } %> <% } %>
<% if (supported.indexOf('hash') > -1) { %> <% if (supported.indexOf('hash') > -1) { %>
<option value="Hash">Hash Index</option> <option value="Hash">Hash Index</option>
<% } %> <% } %>
<% if (supported.indexOf('persistent') > -1) { %> <% if (supported.indexOf('persistent') > -1) { %>
<option value="Persistent">Persistent Index</option> <option value="Persistent">Persistent Index</option>
<% } %> <% } %>
<% if (supported.indexOf('fulltext') > -1) { %> <% if (supported.indexOf('fulltext') > -1) { %>
<option value="Fulltext">Fulltext Index</option> <option value="Fulltext">Fulltext Index</option>
<% } %> <% } %>
<% if (supported.indexOf('skiplist') > -1) { %> <% if (supported.indexOf('skiplist') > -1) { %>
<option value="Skiplist">Skip-List Index</option> <option value="Skiplist">Skip-List Index</option>
<% } %> <% } %>
</select> </select>
</th> </th>
<th class="" style="width: 18px"/> <th class="" style="width: 18px"/>
</tr> </tr>
</table> </table>
<div id="newIndexTypeGeo" class="newIndexClass" style="display: none"> <div id="newIndexTypeGeo" class="newIndexClass" style="display: none">
<table> <table>
<tr> <tr>
<th class="collectionTh">Fields:</th> <th class="collectionTh">Fields:</th>
<th><input type="text" id="newGeoFields" value=""/></th> <th><input type="text" id="newGeoFields" value=""/></th>
<th class="tooltipInfoTh"> <th class="tooltipInfoTh">
<div> <div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="A comma-separated list with one or two attribute paths. Example: latitude,longitude"> <a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="A comma-separated list with one or two attribute paths. Example: latitude,longitude">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span> <span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a> </a>
</div> </div>
</th> </th>
</tr> </tr>
<tr> <tr>
<th class="collectionTh">Geo JSON:</th> <th class="collectionTh">Geo JSON:</th>
<th> <th>
<input id="newGeoJson" type="checkbox" name="newGeoJson" value="true"> <input id="newGeoJson" type="checkbox" name="newGeoJson" value="true">
</th> </th>
<th class="tooltipInfoTh"> <th class="tooltipInfoTh">
<div> <div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="Set geoJson to true if the coordinates stored in the specified attribute are arrays in the form [longitude,latitude]."> <a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="Set geoJson to true if the coordinates stored in the specified attribute are arrays in the form [longitude,latitude].">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span> <span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a> </a>
</div> </div>
</th> </th>
</tr> </tr>
</table> </table>
</div> </div>
<div id="newIndexTypePersistent" class="newIndexClass" style="display:none"> <div id="newIndexTypePersistent" class="newIndexClass" style="display:none">
<table> <table>
<tr> <tr>
<th class="collectionTh">Fields:</th> <th class="collectionTh">Fields:</th>
<th><input type="text" id="newPersistentFields" value=""/></th> <th><input type="text" id="newPersistentFields" value=""/></th>
<th class="tooltipInfoTh"> <th class="tooltipInfoTh">
<div> <div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="A comma-separated list of attribute paths."> <a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="A comma-separated list of attribute paths.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span> <span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a> </a>
</div> </div>
</th> </th>
</tr> </tr>
<tr> <tr>
<th class="collectionTh">Unique:</th> <th class="collectionTh">Unique:</th>
<th> <th>
<input id="newPersistentUnique" type="checkbox" name="newPersistentUnique" value="true"> <input id="newPersistentUnique" type="checkbox" name="newPersistentUnique" value="true">
</th> </th>
<th class="tooltipInfoTh"> <th class="tooltipInfoTh">
<div> <div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="If true, then create a unique index."> <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> <span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a> </a>
</div> </div>
</th> </th>
</tr> </tr>
<tr> <tr>
<th class="collectionTh">Sparse:</th> <th class="collectionTh">Sparse:</th>
<th> <th>
<input id="newPersistentSparse" type="checkbox" name="newPersistentSparse" value="true"> <input id="newPersistentSparse" type="checkbox" name="newPersistentSparse" value="true">
</th> </th>
<th class="tooltipInfoTh"> <th class="tooltipInfoTh">
<div> <div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="If true, then create a sparse index."> <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> <span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a> </a>
</div> </div>
</th> </th>
</tr> </tr>
</table> </table>
</div> </div>
<div id="newIndexTypeHash" class="newIndexClass" style="display:none"> <div id="newIndexTypeHash" class="newIndexClass" style="display:none">
<table> <table>
<tr> <tr>
<th class="collectionTh">Fields:</th> <th class="collectionTh">Fields:</th>
<th><input type="text" id="newHashFields" value=""/></th> <th><input type="text" id="newHashFields" value=""/></th>
<th class="tooltipInfoTh"> <th class="tooltipInfoTh">
<div> <div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="A comma-separated list of attribute paths."> <a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="A comma-separated list of attribute paths.">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span> <span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a> </a>
</div> </div>
</th> </th>
</tr> </tr>
<tr> <tr>
<th class="collectionTh">Unique:</th> <th class="collectionTh">Unique:</th>
<th> <th>
<input id="newHashUnique" type="checkbox" name="newHashUnique" value="true"> <input id="newHashUnique" type="checkbox" name="newHashUnique" value="true">
</th> </th>
<th class="tooltipInfoTh"> <th class="tooltipInfoTh">
<div> <div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="If true, then create a unique index."> <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> <span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a> </a>
</div> </div>
</th> </th>
</tr> </tr>
<tr> <tr>
<th class="collectionTh">Sparse:</th> <th class="collectionTh">Sparse:</th>
<th> <th>
<input id="newHashSparse" type="checkbox" name="newHashSparse" value="true"> <input id="newHashSparse" type="checkbox" name="newHashSparse" value="true">
</th> </th>
<th class="tooltipInfoTh"> <th class="tooltipInfoTh">
<div> <div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="If true, then create a sparse index."> <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> <span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a> </a>
</div> </div>
</th> </th>
</tr> </tr>
</table> </table>
</div> </div>
<div id="newIndexTypeFulltext" class="newIndexClass" style="display:none"> <div id="newIndexTypeFulltext" class="newIndexClass" style="display:none">
<table> <table>
<tr> <tr>
<th class="collectionTh">Fields:</th> <th class="collectionTh">Fields:</th>
<th><input type="text" id="newFulltextFields" value=""/></th> <th><input type="text" id="newFulltextFields" value=""/></th>
<th class="tooltipInfoTh"> <th class="tooltipInfoTh">
<div> <div>
<a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="A single attribute path. Example: message.text"> <a class="index-tooltip" data-toggle="tooltip" data-placement="left" title="A single attribute path. Example: message.text">
<span rel="tooltip" class="arangoicon icon_arangodb_info"></span> <span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a> </a>
</div> </div>
</th> </th>
</tr> </tr>
<tr> <tr>
<th class="collectionTh">Min. length:</th> <th class="collectionTh">Min. length:</th>
<th><input type="text" id="newFulltextMinLength" value=""/></th> <th><input type="text" id="newFulltextMinLength" value=""/></th>
<th class="tooltipInfoTh"> <th class="tooltipInfoTh">
<div> <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."> <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> <span rel="tooltip" class="arangoicon icon_arangodb_info"></span>
</a> </a>
</div> </div>
</th> </th>
</tr> </tr>
</table> </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 comma-separated 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 index-button-bar2">
<button id="createIndex" class="button-success" style="margin-left: 15px;">Create</button>
<button id="cancelIndex" class="button-close" style="margin-left: 0;"><i class="fa fa-arrow-left"></i>
<span style="margin-left: 5px;">Back</span>
</button>
</div>
</div> </div>
<div id="newIndexTypeSkiplist" class="newIndexClass" style="display:none"> <div id="modal-dialog">
<table> <div class="modal-footer" style="border: none"></div>
<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 comma-separated 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>
<div class="index-button-bar index-button-bar2"> </div>
<button id="createIndex" class="button-success" style="margin-left: 15px;">Create</button> <% } %>
<button id="cancelIndex" class="button-close" style="margin-left: 0;"><i class="fa fa-arrow-left"></i>
<span style="margin-left: 5px;">Back</span>
</button>
</div>
</div>
<div id="modal-dialog">
<div class="modal-footer" style="border: none"></div>
</div>
</div>
</script> </script>

View File

@ -313,10 +313,27 @@
createCollection: function (e) { createCollection: function (e) {
e.preventDefault(); e.preventDefault();
this.createNewCollectionModal(); var self = this;
$.ajax({
type: 'GET',
cache: false,
url: arangoHelper.databaseUrl('/_api/engine'),
contentType: 'application/json',
processData: false,
success: function (data) {
self.engine = data;
console.log(self.engine);
self.createNewCollectionModal(data);
},
error: function () {
arangoHelper.arangoError('Engine', 'Could not fetch ArangoDB Engine details.');
}
});
}, },
submitCreateCollection: function () { submitCreateCollection: function () {
var self = this;
var callbackCoord = function (error, isCoordinator) { var callbackCoord = function (error, isCoordinator) {
if (error) { if (error) {
arangoHelper.arangoError('DB', 'Could not check coordinator state'); arangoHelper.arangoError('DB', 'Could not check coordinator state');
@ -383,16 +400,19 @@
window.modalView.hide(); window.modalView.hide();
}.bind(this); }.bind(this);
this.collection.newCollection({ var tmpObj = {
collName: collName, collName: collName,
wfs: wfs, wfs: wfs,
isSystem: isSystem, isSystem: isSystem,
journalSize: collSize,
replicationFactor: replicationFactor, replicationFactor: replicationFactor,
collType: collType, collType: collType,
shards: shards, shards: shards,
shardBy: shardBy shardBy: shardBy
}, callback); };
if (self.engine.name !== 'rocksdb') {
tmpObj.journalSize = collSize;
}
this.collection.newCollection(tmpObj, callback);
} }
}.bind(this); }.bind(this);
@ -400,6 +420,7 @@
}, },
createNewCollectionModal: function () { createNewCollectionModal: function () {
var self = this;
var callbackCoord2 = function (error, isCoordinator) { var callbackCoord2 = function (error, isCoordinator) {
if (error) { if (error) {
arangoHelper.arangoError('DB', 'Could not check coordinator state'); arangoHelper.arangoError('DB', 'Could not check coordinator state');
@ -474,22 +495,24 @@
this.submitCreateCollection.bind(this) this.submitCreateCollection.bind(this)
) )
); );
advancedTableContent.push( if (self.engine.name !== 'rocksdb') {
window.modalView.createTextEntry( advancedTableContent.push(
'new-collection-size', window.modalView.createTextEntry(
'Journal size', 'new-collection-size',
'', 'Journal size',
'The maximal size of a journal or datafile (in MB). Must be at least 1.', '',
'', 'The maximal size of a journal or datafile (in MB). Must be at least 1.',
false, '',
[ false,
{ [
rule: Joi.string().allow('').optional().regex(/^[0-9]*$/), {
msg: 'Must be a number.' rule: Joi.string().allow('').optional().regex(/^[0-9]*$/),
} msg: 'Must be a number.'
] }
) ]
); )
);
}
if (window.App.isCluster) { if (window.App.isCluster) {
advancedTableContent.push( advancedTableContent.push(
window.modalView.createTextEntry( window.modalView.createTextEntry(

View File

@ -63,7 +63,7 @@
} }
} else { } else {
if (availableDbs) { if (availableDbs) {
if (availableDbs.indexOf(db) > -1) { if (availableDbs.indexOf(rule) > -1) {
$('#loginDatabase').append( $('#loginDatabase').append(
'<option>' + rule + '</option>' '<option>' + rule + '</option>'
); );
@ -87,7 +87,6 @@
successFunc(availableDbs); successFunc(availableDbs);
}); });
} catch (ignore) { } catch (ignore) {
console.log(ignore);
successFunc(); successFunc();
} }
}).error(function () { }).error(function () {

View File

@ -281,43 +281,47 @@
if (error) { if (error) {
arangoHelper.arangoError('Collection', 'Could not fetch properties'); arangoHelper.arangoError('Collection', 'Could not fetch properties');
} else { } else {
var journalSize = data.journalSize / (1024 * 1024); if (data.journalSize) {
var indexBuckets = data.indexBuckets; var journalSize = data.journalSize / (1024 * 1024);
var wfs = data.waitForSync; var indexBuckets = data.indexBuckets;
var wfs = data.waitForSync;
tableContent.push( tableContent.push(
window.modalView.createTextEntry( window.modalView.createTextEntry(
'change-collection-size', 'change-collection-size',
'Journal size', 'Journal size',
journalSize, journalSize,
'The maximal size of a journal or datafile (in MB). Must be at least 1.', 'The maximal size of a journal or datafile (in MB). Must be at least 1.',
'', '',
true, true,
[ [
{ {
rule: Joi.string().allow('').optional().regex(/^[0-9]*$/), rule: Joi.string().allow('').optional().regex(/^[0-9]*$/),
msg: 'Must be a number.' msg: 'Must be a number.'
} }
] ]
) )
); );
}
tableContent.push( if (indexBuckets) {
window.modalView.createTextEntry( tableContent.push(
'change-index-buckets', window.modalView.createTextEntry(
'Index buckets', 'change-index-buckets',
indexBuckets, 'Index buckets',
'The number of index buckets for this collection. Must be at least 1 and a power of 2.', indexBuckets,
'', 'The number of index buckets for this collection. Must be at least 1 and a power of 2.',
true, '',
[ true,
{ [
rule: Joi.string().allow('').optional().regex(/^[1-9][0-9]*$/), {
msg: 'Must be a number greater than 1 and a power of 2.' 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" // prevent "unexpected sync method error"
tableContent.push( tableContent.push(