ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiw...@apache.org
Subject ambari git commit: AMBARI-11544. Edit Widget:Confirmation for shared widget pops up on clicking Next in Metric and Expression page.(XIWANG)
Date Fri, 29 May 2015 21:14:56 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 1296ca586 -> 01e9655cf


AMBARI-11544. Edit Widget:Confirmation for shared widget pops up on clicking Next in Metric
and Expression page.(XIWANG)


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

Branch: refs/heads/trunk
Commit: 01e9655cfbfbac946227f66a54caacf457028c72
Parents: 1296ca5
Author: Xi Wang <xiwang@apache.org>
Authored: Fri May 29 11:58:07 2015 -0700
Committer: Xi Wang <xiwang@apache.org>
Committed: Fri May 29 14:14:28 2015 -0700

----------------------------------------------------------------------
 .../main/service/widgets/create/step3_controller.js           | 7 +++++--
 .../main/service/widgets/create/step3_controller_test.js      | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/01e9655c/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js b/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js
index 4c9dc81..7eff3be 100644
--- a/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js
+++ b/ambari-web/app/controllers/main/service/widgets/create/step3_controller.js
@@ -92,8 +92,11 @@ App.WidgetWizardStep3Controller = Em.Controller.extend({
     this.set('widgetDescription', this.get('content.widgetDescription'));
     this.set('isSharedChecked', this.get('content.widgetScope') == 'CLUSTER');
     // on editing, don't allow changing from shared scope to unshare
-    this.set('isSharedCheckboxDisabled', this.get('content.widgetScope') == 'CLUSTER' &&
this.get('isEditController'));
-    this.addObserver('isSharedChecked', this, this.showConfirmationOnSharing);
+    var isSharedCheckboxDisabled = ((this.get('content.widgetScope') == 'CLUSTER') &&
this.get('isEditController'));
+    this.set('isSharedCheckboxDisabled', isSharedCheckboxDisabled);
+    if (!isSharedCheckboxDisabled) {
+      this.addObserver('isSharedChecked', this, this.showConfirmationOnSharing);
+    }
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/01e9655c/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
b/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
index 041b0ff..c603b48 100644
--- a/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
@@ -94,7 +94,8 @@ describe('App.WidgetWizardStep3Controller', function () {
         controllerName: 'widgetEditController'
       }));
       controller.initPreviewData();
-      expect(controller.addObserver.calledWith('isSharedChecked')).to.be.true;
+      controller.get('isSharedCheckboxDisabled') ? expect(controller.addObserver.calledWith('isSharedChecked')).to.be.false:
+        expect(controller.addObserver.calledWith('isSharedChecked')).to.be.true;
       expect(controller.get('widgetProperties')).to.equal('widgetProperties');
       expect(controller.get('widgetValues')).to.equal('widgetValues');
       expect(controller.get('widgetMetrics')).to.equal('widgetMetrics');


Mime
View raw message