From fe09e5f68408b928562456827ffeb3396ceab6f8 Mon Sep 17 00:00:00 2001 From: hkernbach Date: Wed, 26 Apr 2017 19:09:39 +0200 Subject: [PATCH 1/2] fixed issue: #2457 - (2) --- .../APP/frontend/js/templates/indicesView.ejs | 484 +++++++++--------- .../APP/frontend/js/views/collectionsView.js | 63 ++- .../APP/frontend/js/views/settingsView.js | 74 +-- 3 files changed, 325 insertions(+), 296 deletions(-) diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/templates/indicesView.ejs b/js/apps/system/_admin/aardvark/APP/frontend/js/templates/indicesView.ejs index 14b3f36031..3706cb21e0 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/templates/indicesView.ejs +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/templates/indicesView.ejs @@ -1,247 +1,249 @@ diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsView.js index ff8b7268ed..fb33e843e1 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/collectionsView.js @@ -313,10 +313,27 @@ createCollection: function (e) { 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 () { + var self = this; var callbackCoord = function (error, isCoordinator) { if (error) { arangoHelper.arangoError('DB', 'Could not check coordinator state'); @@ -383,16 +400,19 @@ window.modalView.hide(); }.bind(this); - this.collection.newCollection({ + var tmpObj = { collName: collName, wfs: wfs, isSystem: isSystem, - journalSize: collSize, replicationFactor: replicationFactor, collType: collType, shards: shards, shardBy: shardBy - }, callback); + }; + if (self.engine.name !== 'rocksdb') { + tmpObj.journalSize = collSize; + } + this.collection.newCollection(tmpObj, callback); } }.bind(this); @@ -400,6 +420,7 @@ }, createNewCollectionModal: function () { + var self = this; var callbackCoord2 = function (error, isCoordinator) { if (error) { arangoHelper.arangoError('DB', 'Could not check coordinator state'); @@ -474,22 +495,24 @@ this.submitCreateCollection.bind(this) ) ); - advancedTableContent.push( - window.modalView.createTextEntry( - 'new-collection-size', - 'Journal size', - '', - 'The maximal size of a journal or datafile (in MB). Must be at least 1.', - '', - false, - [ - { - rule: Joi.string().allow('').optional().regex(/^[0-9]*$/), - msg: 'Must be a number.' - } - ] - ) - ); + if (self.engine.name !== 'rocksdb') { + advancedTableContent.push( + window.modalView.createTextEntry( + 'new-collection-size', + 'Journal size', + '', + 'The maximal size of a journal or datafile (in MB). Must be at least 1.', + '', + false, + [ + { + rule: Joi.string().allow('').optional().regex(/^[0-9]*$/), + msg: 'Must be a number.' + } + ] + ) + ); + } if (window.App.isCluster) { advancedTableContent.push( window.modalView.createTextEntry( diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/settingsView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/settingsView.js index abcaced41e..ffed487c9e 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/settingsView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/settingsView.js @@ -281,43 +281,47 @@ if (error) { arangoHelper.arangoError('Collection', 'Could not fetch properties'); } else { - var journalSize = data.journalSize / (1024 * 1024); - var indexBuckets = data.indexBuckets; - var wfs = data.waitForSync; + if (data.journalSize) { + 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-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.' - } - ] - ) - ); + if (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" tableContent.push( From f8cee76c8f285d60b2df639736365b146291a452 Mon Sep 17 00:00:00 2001 From: hkernbach Date: Wed, 26 Apr 2017 19:16:53 +0200 Subject: [PATCH 2/2] fixed issue: #2457 - (3) --- .../system/_admin/aardvark/APP/frontend/js/views/loginView.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/loginView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/loginView.js index 2108889a54..3424e12436 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/loginView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/loginView.js @@ -63,7 +63,7 @@ } } else { if (availableDbs) { - if (availableDbs.indexOf(db) > -1) { + if (availableDbs.indexOf(rule) > -1) { $('#loginDatabase').append( '' ); @@ -87,7 +87,6 @@ successFunc(availableDbs); }); } catch (ignore) { - console.log(ignore); successFunc(); } }).error(function () {