Browse Source

AMBARI-15037. When saving a SCRIPT edit, it loses the script path (Joe Wang via rzang)

Richard Zang 9 years ago
parent
commit
d036fc0170

+ 2 - 2
ambari-web/app/controllers/main/alerts/definition_configs_controller.js

@@ -542,10 +542,10 @@ App.MainAlertDefinitionConfigsController = Em.Controller.extend({
 
     // `source.parameters` is an array and should be updated separately from other configs
     if (this.get('content.parameters.length')) {
-      propertiesToUpdate['AlertDefinition/source/parameters'] = this.get('content.rawSourceData.parameters');
+      propertiesToUpdate['AlertDefinition/source'] = this.get('content.rawSourceData');
       var parameterConfigs = this.get('configs').filterProperty('name', 'parameter');
       parameterConfigs.forEach(function (parameter) {
-        propertiesToUpdate['AlertDefinition/source/parameters'].findProperty('name', parameter.get('apiProperty')).value = parameter.get('apiFormattedValue');
+        propertiesToUpdate['AlertDefinition/source'].parameters.findProperty('name', parameter.get('apiProperty')).value = parameter.get('apiFormattedValue');
       });
     }
 

+ 2 - 2
ambari-web/test/controllers/main/alerts/definitions_configs_controller_test.js

@@ -537,8 +537,8 @@ describe('App.MainAlertDefinitionConfigsController', function () {
       });
 
       it('should update parameters', function () {
-        expect(this.result['AlertDefinition/source/parameters']).to.have.property('length').equal(4);
-        expect(this.result['AlertDefinition/source/parameters'].mapProperty('value')).to.be.eql(['v11', 'v21', 'v31', 'v41']);
+        expect(this.result['AlertDefinition/source'].parameters).to.have.property('length').equal(4);
+        expect(this.result['AlertDefinition/source'].parameters.mapProperty('value')).to.be.eql(['v11', 'v21', 'v31', 'v41']);
       });
 
     });