diff --git a/arangosh/ArangoShell/ArangoClient.cpp b/arangosh/ArangoShell/ArangoClient.cpp index 3fd26827d9..efda7493a3 100644 --- a/arangosh/ArangoShell/ArangoClient.cpp +++ b/arangosh/ArangoShell/ArangoClient.cpp @@ -382,6 +382,11 @@ void ArangoClient::parse (ProgramOptions& options, TRI_SetUserTempPath((char*) _tempPath.c_str()); } + if (options.has("server.username")) { + // if a username is specified explicitly, assume authentication is desired + _disableAuthentication = false; + } + // check if have a password _hasPassword = options.has("server.password") || _disableAuthentication diff --git a/js/apps/system/aardvark/clusterFrontend/js/templates/symmetricPlan.ejs b/js/apps/system/aardvark/clusterFrontend/js/templates/symmetricPlan.ejs index 90b0ae8de6..26b11a535d 100644 --- a/js/apps/system/aardvark/clusterFrontend/js/templates/symmetricPlan.ejs +++ b/js/apps/system/aardvark/clusterFrontend/js/templates/symmetricPlan.ejs @@ -1,20 +1,23 @@ diff --git a/js/apps/system/aardvark/clusterFrontend/js/views/planSymmetricView.js b/js/apps/system/aardvark/clusterFrontend/js/views/planSymmetricView.js index 4b2d8a8d70..f9642dc0c8 100644 --- a/js/apps/system/aardvark/clusterFrontend/js/views/planSymmetricView.js +++ b/js/apps/system/aardvark/clusterFrontend/js/views/planSymmetricView.js @@ -11,10 +11,12 @@ modal: templateEngine.createTemplate("waitModal.ejs"), events: { - "click #startSymmetricPlan": "startPlan", - "click .add": "addEntry", - "click .delete": "removeEntry", - "click #cancel": "cancel" + "click #startSymmetricPlan" : "startPlan", + "click .add" : "addEntry", + "click .delete" : "removeEntry", + "click #cancel" : "cancel", + "focusout .host" : "autoCheckConnections", + "focusout .port" : "autoCheckConnections" }, cancel: function() { @@ -95,6 +97,9 @@ }, addEntry: function() { + //disable launch button + this.disableLaunchButton(); + $("#server_list").append(this.entryTemplate.render({ isSymmetric: this.isSymmetric, isFirst: false, @@ -107,6 +112,7 @@ removeEntry: function(e) { $(e.currentTarget).closest(".control-group").remove(); + this.checkAllConnections(); }, render: function(isSymmetric) { @@ -157,10 +163,94 @@ port: '' })); } + //initially disable lunch button + this.disableLaunchButton(); + $(this.el).append(this.modal.render({})); + }, + + autoCheckConnections: function (e) { + var host, + port, + currentTarget = $(e.currentTarget); + //eval which field was left + if(currentTarget.attr('class').indexOf('host') !== -1) { + host = currentTarget.val(); + //eval value of port + port = currentTarget.nextAll('.port').val(); + } else { + port = currentTarget.val(); + //eval value of port + host = currentTarget.prevAll('.host').val(); + } + if (host !== '' && port !== '') { + this.checkAllConnections(); + } + }, + + checkConnection: function(host, port, target) { + $(target).find('.cluster-connection-check-success').remove(); + $(target).find('.cluster-connection-check-fail').remove(); + var result = false; + try { + $.ajax({ + async: false, + cache: false, + type: "GET", + url: "http://" + host + ":" + port + "/_api/version", + success: function() { + $(target).append( + 'Connection: ok' + ); + result = true; + }, + error: function() { + $(target).append( + 'Connection: fail' + ); + } + }); + } catch (e) { + this.disableLaunchButton(); + } + return result; + }, + + checkAllConnections: function() { + var self = this; + var hasError = false; + $('.dispatcher').each( + function(i, dispatcher) { + var target = $('.controls', dispatcher)[0]; + var host = $('.host', dispatcher).val(); + var port = $('.port', dispatcher).val(); + if (!self.checkConnection(host, port, target)) { + hasError = true; + } + } + ); + if (!hasError) { + this.enableLaunchButton(); + } else { + this.disableLaunchButton(); + } + }, + + disableLaunchButton: function() { + $('#startSymmetricPlan').attr('disabled', 'disabled'); + $('#startSymmetricPlan').removeClass('button-success'); + $('#startSymmetricPlan').addClass('button-neutral'); + }, + + enableLaunchButton: function() { + $('#startSymmetricPlan').attr('disabled', false); + $('#startSymmetricPlan').removeClass('button-neutral'); + $('#startSymmetricPlan').addClass('button-success'); } + }); }()); + diff --git a/js/apps/system/aardvark/frontend/css/screenSizes.css b/js/apps/system/aardvark/frontend/css/screenSizes.css deleted file mode 100644 index 6779e3d9c2..0000000000 --- a/js/apps/system/aardvark/frontend/css/screenSizes.css +++ /dev/null @@ -1,25 +0,0 @@ -@media (max-width: 798px) { - #arangoCollectionUl { - display: none; - } - #collectionsDropdown ul { - width: auto !important; - } - #arangoCollectionSelect { - display: inline-block; - } -} - -@media (min-width: 799px) and (max-width: 1041px) { - #arangoCollectionUl a { - font-size: 11px; - padding: 7px 5px 10px; - } -} - - -@media (min-width: 1042px) and (max-width: 1284px) { - #arangoCollectionUl a { - font-size: 13px; - } -} diff --git a/js/apps/system/aardvark/frontend/js/templates/navigationView.ejs b/js/apps/system/aardvark/frontend/js/templates/navigationView.ejs index d5fea66ef5..bb2e3f1883 100644 --- a/js/apps/system/aardvark/frontend/js/templates/navigationView.ejs +++ b/js/apps/system/aardvark/frontend/js/templates/navigationView.ejs @@ -1,5 +1,5 @@