Sfoglia il codice sorgente

AMBARI-14290 Save button is enabled without any config changes (on YARN and MAPREDUCE2). (ababiichuk)

aBabiichuk 9 anni fa
parent
commit
bb6dd3e333

+ 3 - 3
ambari-web/app/controllers/global/cluster_controller.js

@@ -361,9 +361,9 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
   },
 
   loadAuthorizationsSuccessCallback: function(response) {
-    if (response.items) {
-      App.auth = response.items.mapProperty('AuthorizationInfo.authorization_id');
-      App.db.setAuth(App.auth);
+    if (response && response.items) {
+      App.set('auth', response.items.mapProperty('AuthorizationInfo.authorization_id'));
+      App.db.setAuth(App.get('auth'));
     }
   },
 

+ 1 - 1
ambari-web/app/controllers/main/service/info/configs.js

@@ -148,7 +148,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A
    * Determines if some config value is changed
    * @type {boolean}
    */
-  isPropertiesChanged: Em.computed.someBy('stepConfigs', 'isPropertiesChanged', true),
+  isPropertiesChanged: Em.computed.alias('selectedService.isPropertiesChanged'),
 
   /**
    * Filter text will be located here

+ 3 - 3
ambari-web/app/models/configs/objects/service_config_property.js

@@ -235,10 +235,10 @@ App.ServiceConfigProperty = Em.Object.extend({
   }.property('isUserProperty', 'isOriginalSCP', 'overrides.length', 'isRequiredByAgent'),
 
   init: function () {
-    if (this.get('value') == '') {
-      if (this.get('savedValue')) {
+    if (Em.isNone(this.get('value'))) {
+      if (!Em.isNone(this.get('savedValue'))) {
         this.set('value', this.get('savedValue'));
-      } else if (this.get('recommendedValue')) {
+      } else if (!Em.isNone(this.get('recommendedValue'))) {
         this.set('value', this.get('recommendedValue'));
       }
     }

+ 2 - 2
ambari-web/app/views/common/quick_view_link_view.js

@@ -147,7 +147,7 @@ App.QuickViewLinks = Em.View.extend({
     if (hosts.length === 0 || Em.isNone(this.get('content.quickLinks'))) {
       this.setEmptyLinks();
     } else if (hosts.length === 1) {
-      this.setSingleHostLinks(hosts);
+      this.setSingleHostLinks(hosts, response);
     } else {
       this.setMultipleHostLinks(hosts);
     }
@@ -194,7 +194,7 @@ App.QuickViewLinks = Em.View.extend({
    * set links that contain only one host
    * @param {Array} hosts
    */
-  setSingleHostLinks: function (hosts) {
+  setSingleHostLinks: function (hosts, response) {
     var quickLinks = this.get('content.quickLinks').map(function (item) {
       var protocol = this.setProtocol(item.get('serviceName'), this.get('configProperties'), this.get('ambariProperties'), item);
       var publicHostName = hosts[0].publicHostName;

+ 11 - 0
ambari-web/test/models/configs/objects/service_config_property_test.js

@@ -188,6 +188,17 @@ var serviceConfigProperty,
         savedValue: 'default',
         recommendedValue: 'recommended'
       },
+      result: {
+        value: '',
+        recommendedValue: 'recommended'
+      }
+    },
+    {
+      initial: {
+        value: null,
+        savedValue: 'default',
+        recommendedValue: 'recommended'
+      },
       result: {
         value: 'default',
         recommendedValue: 'recommended'