Repository: ambari
Updated Branches:
  refs/heads/trunk 7924fce7f -> 84d642fb1


AMBARI-8854. Alerts UI: Misc Config Tab is broken on Add Service Wizard 
(onechiporenko)


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

Branch: refs/heads/trunk
Commit: 84d642fb1d65eb27b4cd72835a4f433c4de16561
Parents: 7924fce
Author: Oleg Nechiporenko <[email protected]>
Authored: Mon Dec 22 15:44:34 2014 +0200
Committer: Oleg Nechiporenko <[email protected]>
Committed: Mon Dec 22 15:44:34 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |  1 +
 .../notification_configs_view.js                |  9 ++-
 .../notification_configs_view_test.js           | 61 ++++++++++++++++++++
 3 files changed, 69 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/84d642fb/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js 
b/ambari-web/app/assets/test/tests.js
index 384735f..f718384 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -214,6 +214,7 @@ var files = ['test/init_model_test',
   'test/views/main/admin/highAvailability/nameNode/wizard_view_test',
   'test/views/common/configs/overriddenProperty_view_test',
   'test/views/common/configs/services_config_test',
+  
'test/views/common/configs/custom_category_views/notification_configs_view_test',
   'test/views/wizard/step3/hostLogPopupBody_view_test',
   'test/views/wizard/step3/hostWarningPopupBody_view_test',
   'test/views/wizard/step3/hostWarningPopupFooter_view_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/84d642fb/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js
 
b/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js
index 0b4cb09..d0e95eb 100644
--- 
a/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js
+++ 
b/ambari-web/app/views/common/configs/custom_category_views/notification_configs_view.js
@@ -21,7 +21,7 @@ var App = require('app');
 /**
  * Custom view for Notification section for MISC tab
  * Used only in the Install Wizard
- * Show configs for creating Init Notification (@see 
'data/HDP2/site_properties' for list of the configs used here)
+ * Show configs for creating Init Notification (@see 'data/site_properties' 
for list of the configs used here)
  *
  * @type {App.NotificationsConfigsView}
  */
@@ -53,8 +53,13 @@ App.NotificationsConfigsView = 
App.ServiceConfigsByCategoryView.extend({
     return this.get('categoryConfigs').findProperty('name', 'smtp_use_auth');
   }.property(),
 
-  willInsertElement: function () {
+  /**
+   * Empty categoryConfigsAll means that user isn't at Installer, so manage 
notification view shouldn't be processed
+   * @method didInsertElement
+   */
+  didInsertElement: function () {
     this._super();
+    if (!this.get('categoryConfigsAll.length')) return;
     this.set('createNotification', 
this.get('categoryConfigsAll').findProperty('name', 
'create_notification').get('value'));
     this.set('tlsOrSsl', this.get('categoryConfigsAll').findProperty('name', 
'mail.smtp.starttls.enable').get('value') ? 'tls' : 'ssl');
     var smtp_use_auth = this.get('categoryConfigsAll').findProperty('name', 
'smtp_use_auth');

http://git-wip-us.apache.org/repos/asf/ambari/blob/84d642fb/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
 
b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
new file mode 100644
index 0000000..0cf2992
--- /dev/null
+++ 
b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
@@ -0,0 +1,61 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+require('views/common/configs/custom_category_views/notification_configs_view');
+var view;
+
+describe('App.NotificationsConfigsView', function () {
+
+  beforeEach(function () {
+    view = App.NotificationsConfigsView.create({
+      $: function() {
+        return {show: Em.K, hide: Em.K};
+      },
+      category: {
+        name: 'name'
+      },
+      serviceConfigs: [],
+      parentView: Em.View.create({
+        filter: '',
+        columns: []
+      })
+    });
+  });
+
+  describe('#didInsertElement', function () {
+
+    beforeEach(function () {
+      sinon.stub(view, 'updateCategoryConfigs', Em.K);
+    });
+
+    afterEach(function () {
+      view.updateCategoryConfigs.restore();
+    });
+
+    it('should not do nothing if no configs', function () {
+
+      view.set('categoryConfigsAll', []);
+      view.didInsertElement();
+      expect(view.updateCategoryConfigs.called).to.equal(false);
+
+    });
+
+  });
+
+});

Reply via email to