You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2013/10/22 17:09:32 UTC

git commit: AMBARI-3575. Wrong reinstall popup. (onechiporenko)

Updated Branches:
  refs/heads/trunk 9404fc004 -> 3e1a60aa4


AMBARI-3575. Wrong reinstall popup. (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/3e1a60aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/3e1a60aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/3e1a60aa

Branch: refs/heads/trunk
Commit: 3e1a60aa4be02cf3d9ff4fbf157953051534a09f
Parents: 9404fc0
Author: Oleg Nechiporenko <cv...@yahoo.com>
Authored: Tue Oct 22 18:06:41 2013 +0300
Committer: Oleg Nechiporenko <cv...@yahoo.com>
Committed: Tue Oct 22 18:09:26 2013 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 138 +++++++------------
 ambari-web/app/messages.js                      |   3 +-
 .../main/host/details/addComponentPopup.hbs     |  20 +++
 .../main/host/details/doDeleteHostPopup.hbs     |  28 ++++
 .../main/host/details/installComponentPopup.hbs |  20 +++
 .../details/raiseDeleteComponentErrorPopup.hbs  |  24 ++++
 6 files changed, 142 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3e1a60aa/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 0de20d6..72092bd 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -181,33 +181,6 @@ App.MainHostDetailsController = Em.Controller.extend({
       async: false,
       success: function (data) {
         deleted = null;
-        // If ZooKeeper Server component was removed, 
-        // restart ZooKeeper service.
-        /*
-         * Commenting it out as user can restart service
-         * whenever they want. We mention in message.
-        if (component.get('componentName') === 'ZOOKEEPER_SERVER') {
-          App.ajax.send({
-            'name': 'service.item.start_stop',
-            'sender': this,
-            'data': {
-              'requestInfo': 'Stop ZooKeeper',
-              'serviceName': 'ZOOKEEPER',
-              'state': 'INSTALLED'
-            },
-            'callback': function() {
-              App.ajax.send({
-                'name': 'service.item.start_stop',
-                'sender': this,
-                'data': {
-                  'requestInfo': 'Start ZooKeeper',
-                  'serviceName': 'ZOOKEEPER',
-                  'state': 'STARTED'
-                }
-              });
-            }
-          });
-        }*/
       },
       error: function (xhr, textStatus, errorThrown) {
         console.log('Error deleting host component');
@@ -360,15 +333,15 @@ App.MainHostDetailsController = Em.Controller.extend({
         });
         dn += " ("+dns.join(", ")+")";
       }
-      var dialogContent = 
-        [Em.I18n.t('hosts.host.addComponent.msg').format(dn) + "<br><br>",
-        '{{t hosts.host.addComponent.note}}'];
       App.ModalPopup.show({
         primary: Em.I18n.t('yes'),
         secondary: Em.I18n.t('no'),
         header: Em.I18n.t('popup.confirmation.commonHeader'),
+        addComponentMsg: function() {
+          return Em.I18n.t('hosts.host.addComponent.msg').format(dn);
+        }.property(),
         bodyClass: Ember.View.extend({
-          template: Ember.Handlebars.compile(dialogContent.join(''))
+          templateName: require('templates/main/host/details/addComponentPopup')
         }),
         onPrimary: function () {
           this.hide();
@@ -390,6 +363,7 @@ App.MainHostDetailsController = Em.Controller.extend({
       });
     }
   },
+
   primary: function(component) {
     var self = this;
     var componentName = component.get('componentName').toUpperCase().toString();
@@ -461,11 +435,11 @@ App.MainHostDetailsController = Em.Controller.extend({
       primary: Em.I18n.t('yes'),
       secondary: Em.I18n.t('no'),
       header: Em.I18n.t('popup.confirmation.commonHeader'),
+      installComponentMessage: function(){
+        return Em.I18n.t('hosts.host.installComponent.msg').format(displayName);
+      }.property(),
       bodyClass: Ember.View.extend({
-        template: Ember.Handlebars.compile([
-          '{{t hosts.delete.popup.body}}<br /><br />',
-          '{{t hosts.host.addComponent.note}}'
-        ].join(''))
+        templateName: require('templates/main/host/details/installComponentPopup')
       }),
       onPrimary: function () {
         this.hide();
@@ -602,7 +576,7 @@ App.MainHostDetailsController = Em.Controller.extend({
         console.log(textStatus);
         console.log(errorThrown);
       }
-    }
+    };
     jQuery.ajax(configsAjax);
   },
 
@@ -704,47 +678,42 @@ App.MainHostDetailsController = Em.Controller.extend({
        });
      }
      if (masterComponents.length > 0) {
-       var bodyHtml = "<p><i class=\"icon-warning-sign\"></i> ";
-       bodyHtml += Em.I18n.t('hosts.cant.do.popup.masterList.body').format(masterComponents.length);
-       bodyHtml += "</p><i>";
-       bodyHtml += masterComponents.join(", ");
-       bodyHtml += "</i>";
-       this.raiseDeleteComponentsError(bodyHtml);
+       this.raiseDeleteComponentsError(masterComponents, 'masterList');
        return;
      } else if (nonDeletableComponents.length > 0) {
-       var bodyHtml = "<p><i class=\"icon-warning-sign\"></i> ";
-       bodyHtml += Em.I18n.t('hosts.cant.do.popup.nonDeletableList.body').format(nonDeletableComponents.length);
-       bodyHtml += "</p><i>";
-       bodyHtml += nonDeletableComponents.join(", ");
-       bodyHtml += "</i>";
-       this.raiseDeleteComponentsError(bodyHtml);
+       this.raiseDeleteComponentsError(nonDeletableComponents, 'nonDeletableList');
        return;
      } else if(runningComponents.length > 0) {
-       var bodyHtml = "<p><i class=\"icon-warning-sign\"></i> ";
-       bodyHtml += Em.I18n.t('hosts.cant.do.popup.runningList.body').format(runningComponents.length);
-       bodyHtml += "</p><i>";
-       bodyHtml += runningComponents.join(", ");
-       bodyHtml += "</i><br><br><p>";
-       bodyHtml += Em.I18n.t('hosts.cant.do.popup.runningList.body.end');
-       bodyHtml += "</p>";
-       this.raiseDeleteComponentsError(bodyHtml);
+       this.raiseDeleteComponentsError(runningComponents, 'runningList');
        return;
      }
      this._doDeleteHost(unknownComponents);
   },
   
-  raiseDeleteComponentsError: function (bodyHtml) {
-    var self = this;
+  raiseDeleteComponentsError: function (components, type) {
     App.ModalPopup.show({
       header: Em.I18n.t('hosts.cant.do.popup.title'),
-      html: true,
-      encodeBody: false,
-      body: bodyHtml,
-      primary: Em.I18n.t('ok'),
-      secondary: null,
-      onPrimary: function() {
-        this.hide();
-      }
+      type: type,
+      showBodyEnd: function() {
+        return this.get('type') === 'runningList';
+      }.property(),
+      components: components,
+      componentsStr: function() {
+        return this.get('components').join(", ");
+      }.property(),
+      componentsBody: function() {
+        return Em.I18n.t('hosts.cant.do.popup.'+type+'.body').format(this.get('components').length);
+      }.property(),
+      componentsBodyEnd: function() {
+        if (this.get('showBodyEnd')) {
+          return Em.I18n.t('hosts.cant.do.popup.'+type+'.body.end');
+        }
+        return '';
+      }.property(),
+      bodyClass: Em.View.extend({
+        templateName: require('templates/main/host/details/raiseDeleteComponentErrorPopup')
+      }),
+      secondary: null
     })
   },
 
@@ -753,31 +722,20 @@ App.MainHostDetailsController = Em.Controller.extend({
    */
   _doDeleteHost: function(unknownComponents) {
     var self = this;
-    var bodyHtml = "<p><i class=\"icon-warning-sign\"></i> ";
-    bodyHtml += Em.I18n.t('hosts.delete.popup.body').format("<i>"+this.get('content.publicHostName')+"</i>");
-    bodyHtml += "</p>";
-    if (unknownComponents!=null && unknownComponents.length > 0) {
-      bodyHtml += "<div class=\"alert\">";
-      bodyHtml += Em.I18n.t('hosts.delete.popup.unknownComponents') + "<br>";
-      bodyHtml += "<i>"
-      bodyHtml += unknownComponents.join(", ");
-      bodyHtml += "</i></div>";
-    }
-    bodyHtml += "<p>";
-    bodyHtml += Em.I18n.t('hosts.delete.popup.body.msg1');
-    bodyHtml += "</p><p>";
-    bodyHtml += Em.I18n.t('hosts.delete.popup.body.msg2');
-    bodyHtml += "</p><p>";
-    bodyHtml += "<span class=\"label label-important\">"+Em.I18n.t('common.important')+"</span>  ";
-    bodyHtml += Em.I18n.t('hosts.delete.popup.body.msg3');
-    bodyHtml += "</p>";
     App.ModalPopup.show({
       header: Em.I18n.t('hosts.delete.popup.title'),
-      html: true,
-      encodeBody: false,
-      body: bodyHtml,
-      primary: Em.I18n.t('ok'),
-      secondary: Em.I18n.t('common.cancel'),
+      deletePopupBody: function() {
+        return Em.I18n.t('hosts.delete.popup.body').format(self.get('content.publicHostName'));
+      }.property(),
+      unknownComponents: function() {
+        if (unknownComponents && unknownComponents.length) {
+          return unknownComponents.join(", ");
+        }
+        return '';
+      }.property(),
+      bodyClass: Em.View.extend({
+        templateName: require('templates/main/host/details/doDeleteHostPopup')
+      }),
       onPrimary: function() {
         var dialogSelf = this;
         var allComponents = self.get('content.hostComponents');
@@ -820,4 +778,4 @@ App.MainHostDetailsController = Em.Controller.extend({
       }
     })
   }
-})
\ No newline at end of file
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3e1a60aa/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 5aff45c..ad1eb3b 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1267,6 +1267,7 @@ Em.I18n.translations = {
   'host.host.componentFilter.master':'Master Components',
   'host.host.componentFilter.slave':'Slave Components',
   'host.host.componentFilter.client':'Client Components',
+  'hosts.host.installComponent.msg':'Are you sure you want to install {0}?',
   'hosts.host.addComponent.msg':'Are you sure you want to add {0}?',
   'hosts.host.addComponent.note':'Note: After this component is installed, go to Services -> Nagios to restart the Nagios service.  This is required for the alerts and notifications to work properly.',
   'hosts.host.addComponent.securityNote':'You are running your cluster in secure mode. You must set up the keytab for {0} on {1} before you proceed. Otherwise, the component will not be able to start properly.',
@@ -1290,7 +1291,7 @@ Em.I18n.translations = {
   'hosts.host.alerts.st':'&nbsp;!&nbsp;',
   'hosts.decommission.popup.body':'Are you sure?',
   'hosts.decommission.popup.header':'Confirmation',
-  'hosts.delete.popup.body':'Are you sure you want to delete host {0}?',
+  'hosts.delete.popup.body':'Are you sure you want to delete host <i>{0}</i>?',
   'hosts.delete.popup.body.msg1':'This will remove the host from Ambari\'s management. Ambari will ignore any communications from this host.',
   'hosts.delete.popup.body.msg2':'Installed bits of service components will not be removed from the system. Individual service components should not be restarted later to join the cluster. This will introduce inconsistencies in monitoring data.',
   'hosts.delete.popup.body.msg3':'Nagios service should be restarted for alerts and notifications to work properly. ZooKeeper service should be restarted if any ZooKeeper components are removed. Go to the <i>Services</i> page to restart services.',

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3e1a60aa/ambari-web/app/templates/main/host/details/addComponentPopup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/details/addComponentPopup.hbs b/ambari-web/app/templates/main/host/details/addComponentPopup.hbs
new file mode 100644
index 0000000..d8b6645
--- /dev/null
+++ b/ambari-web/app/templates/main/host/details/addComponentPopup.hbs
@@ -0,0 +1,20 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+{{addComponentMsg}}<br /><br />
+{{t hosts.host.addComponent.note}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3e1a60aa/ambari-web/app/templates/main/host/details/doDeleteHostPopup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/details/doDeleteHostPopup.hbs b/ambari-web/app/templates/main/host/details/doDeleteHostPopup.hbs
new file mode 100644
index 0000000..7690bc8
--- /dev/null
+++ b/ambari-web/app/templates/main/host/details/doDeleteHostPopup.hbs
@@ -0,0 +1,28 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+<p><i class="icon-warning-sign"></i> {{{deletePopupBody}}}</p>
+{{#if unknownComponents}}
+  <div class="alert">
+  {{t hosts.delete.popup.unknownComponents}}<br />
+    <i>{{unknownComponents}}</i>
+  </div>
+{{/if}}
+<p>{{t hosts.delete.popup.body.msg1}}</p>
+<p>{{t hosts.delete.popup.body.msg2}}</p>
+<p><span class="label label-important">{{t common.important}}</span> {{t hosts.delete.popup.body.msg3}}</p>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3e1a60aa/ambari-web/app/templates/main/host/details/installComponentPopup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/details/installComponentPopup.hbs b/ambari-web/app/templates/main/host/details/installComponentPopup.hbs
new file mode 100644
index 0000000..a8241bb
--- /dev/null
+++ b/ambari-web/app/templates/main/host/details/installComponentPopup.hbs
@@ -0,0 +1,20 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+{{installComponentMessage}}<br /><br />
+{{t hosts.host.addComponent.note}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/3e1a60aa/ambari-web/app/templates/main/host/details/raiseDeleteComponentErrorPopup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/details/raiseDeleteComponentErrorPopup.hbs b/ambari-web/app/templates/main/host/details/raiseDeleteComponentErrorPopup.hbs
new file mode 100644
index 0000000..33d70b7
--- /dev/null
+++ b/ambari-web/app/templates/main/host/details/raiseDeleteComponentErrorPopup.hbs
@@ -0,0 +1,24 @@
+{{!
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+}}
+
+<p><i class="icon-warning-sign"></i> {{componentsBody}}</p>
+<i>{{componentsStr}}</i>
+{{#if showBodyEnd}}
+    <br /><br />
+    <p>{{componentsBodyEnd}}</p>
+{{/if}}
\ No newline at end of file