Permalink
Browse files

MB-7398 Ability to specify server hostname in wizard.

Change-Id: Idb39a8987c8ee9b8e414649f016367bd00ed6b57
Reviewed-on: http://review.couchbase.org/25322
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
  • Loading branch information...
1 parent 3fc9d9d commit c2b0108ade6657966d68ac40a7416d326868b267 @aartamonau aartamonau committed with alk Mar 23, 2013
Showing with 67 additions and 8 deletions.
  1. +11 −0 priv/public/css/screen.css
  2. +20 −0 priv/public/index.html
  3. +36 −8 priv/public/js/app.js
View
@@ -930,6 +930,17 @@ html>/**/body #servers .list_button span, x:-moz-any-link, x:default {float:none
.disk_setup_block input { border: 1px solid #ccd3d7;width: 366px; padding: 3px;}
.disk_setup_block .when-enterprise {font-size: 11px;}
+.hostname_setup_block {margin:6px 0 0 84px;line-height:25px;overflow:hidden;}
+.hostname_setup_block > div {float:left;width:500px;}
+.hostname_setup_block > div + div {padding:0 0 0 11px}
+.hostname_setup_block > .warning {float:none;width:auto;clear:both;}
+.hostname_setup_block label {
+ margin-right: 6px;
+ float: left;
+ width: 120px;
+}
+.hostname_setup_block input { border: 1px solid #ccd3d7;width: 366px; padding: 3px;}
+
#overview_servers_block .actservers + ul li.is-zero a { color: #0095D6;}
#overview_servers_block .when-zero {display:none;}
#overview_servers_block .is-zero .when-zero {display:inline;color:black;}
View
@@ -2352,6 +2352,26 @@ <h2 class="question">Configure Disk Storage</h2>
</div>
<div class="warning pat_10 init_cluster_dialog_errors_container" style="display:none;"></div>
</div>
+
+ <h2 class="question">Configure Server Hostname</h2>
+ <div class="hostname_setup_block">
+ <div>
+ <form>
+ <input type="submit" style="width:0px; height: 0px; visibility: hidden;">
+
+ <div>
+ <label for="setup_hostname">Hostname:</label>
+ <input type="text" name="hostname" id="setup_hostname" />
+ <br class="clear" />
+ </div>
+
+ </form>
+ </div>
+ <div class="warning pat_10"
+ id="init_cluster_dialog_hostname_errors_container"
+ style="display:none;"></div>
+ </div>
+
<h2 class="question">Join Cluster / Start new Cluster</h2>
<p class="pad_10">
If you want to add this server to an existing Couchbase Cluster, select "Join a
View
@@ -562,6 +562,9 @@ var SetupWizard = {
data['node'] = data['node'] || node;
+ var hostname = dialog.find('[name=hostname]');
+ hostname.val(data['otpNode'].split('@')[1] || '127.0.0.1');
+
var storageTotals = data.storageTotals;
var totalRAMMegs = Math.floor(storageTotals.ram.total/Math.Mi);
@@ -657,14 +660,18 @@ var SetupWizard = {
var dbPath = dialog.find('[name=db_path]').val() || "";
var ixPath = dialog.find('[name=index_path]').val() || "";
+ var hostname = dialog.find('[name=hostname]').val() || "";
+
var m = dialog.find('[name=dynamic-ram-quota]').val() || "";
if (m == "") {
m = "none";
}
var pathErrorsContainer = dialog.find('.init_cluster_dialog_errors_container');
+ var hostnameErrorsContainer = $('#init_cluster_dialog_hostname_errors_container');
var memoryErrorsContainer = $('#init_cluster_dialog_memory_errors_container');
pathErrorsContainer.hide();
+ hostnameErrorsContainer.hide();
memoryErrorsContainer.hide();
var spinner = overlayWithSpinner(dialog);
@@ -676,36 +683,57 @@ var SetupWizard = {
afterDisk);
var diskArguments;
+ var hostnameArguments;
function afterDisk() {
// remember our arguments so that we can display validation
// errors later. We're doing that to display validation errors
// from memory quota and disk path posts simultaneously
diskArguments = arguments;
+
+ jsonPostWithErrors('/node/controller/rename',
+ $.param({hostname: hostname}),
+ afterHostname);
+ }
+
+ function handleDiskStatus(data, status) {
+ saving = false;
+ spinner.remove();
+ var ok = (status == 'success');
+ if (!ok) {
+ renderTemplate('join_cluster_dialog_errors', data, pathErrorsContainer[0]);
+ pathErrorsContainer.show();
+ }
+ return ok;
+ }
+
+ function afterHostname() {
+ hostnameArguments = arguments;
+
if ($('#no-join-cluster')[0].checked) {
jsonPostWithErrors('/pools/default',
$.param({memoryQuota: m}),
memPost);
return;
}
- if (handleDiskStatus.apply(null, diskArguments))
+ if (handleDiskStatus.apply(null, diskArguments) &&
+ handleHostnameStatus.apply(null, hostnameArguments))
SetupWizard.doClusterJoin();
}
- function handleDiskStatus(data, status) {
- saving = false;
- spinner.remove();
- var ok = (status == 'success')
+ function handleHostnameStatus(data, status) {
+ var ok = (status == 'success') ;
if (!ok) {
- renderTemplate('join_cluster_dialog_errors', data, pathErrorsContainer[0]);
- pathErrorsContainer.show();
+ hostnameErrorsContainer.text(data[0]);
+ hostnameErrorsContainer.show();
}
return ok;
}
function memPost(data, status) {
- var ok = handleDiskStatus.apply(null, diskArguments);
+ var ok = handleDiskStatus.apply(null, diskArguments) &&
+ handleHostnameStatus.apply(null, hostnameArguments);
if (status == 'success') {
if (ok) {

0 comments on commit c2b0108

Please sign in to comment.