AMBARI-20676.User should be able to visualize inherited properties while submitting the workflow .(M Madhan Mohan Reddy via padmapriyanitt)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2ee12f4c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2ee12f4c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2ee12f4c Branch: refs/heads/branch-feature-AMBARI-12556 Commit: 2ee12f4c4af62d5ce004e869f5a248e982a4245f Parents: e61d111 Author: padmapriyanitt <[email protected]> Authored: Thu Apr 6 12:12:24 2017 +0530 Committer: padmapriyanitt <[email protected]> Committed: Thu Apr 6 12:12:24 2017 +0530 ---------------------------------------------------------------------- .../resources/ui/app/components/job-config.js | 23 +++++++++------- .../src/main/resources/ui/app/routes/index.js | 5 +++- .../ui/app/services/workflow-manager-configs.js | 27 +++++++++++++++++++ .../services/workflow-manager-configs-test.js | 28 ++++++++++++++++++++ 4 files changed, 72 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/2ee12f4c/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js index 6aed9da..326cf38 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js @@ -35,6 +35,7 @@ const Validations = buildValidations({ export default Ember.Component.extend(Validations, { + workflowManagerConfigs : Ember.inject.service('workflow-manager-configs'), systemConfigs : Ember.A([]), showingFileBrowser : false, overwritePath : false, @@ -118,10 +119,10 @@ export default Ember.Component.extend(Validations, { var jobProperties = []; var jobParams = this.get("jobConfigs").params, self = this; this.get("jobProps").forEach(function(value) { - if (value!== Constants.defaultNameNodeValue && value!==Constants.rmDefaultValue){ - var propName = value.trim().substring(2, value.length-1); - var isRequired = true; - var val = null; + var propName = value.trim().substring(2, value.length-1); + var isRequired = true; + var val = null; + if (value!== Constants.defaultNameNodeValue && value!==Constants.rmDefaultValue) { if(jobParams && jobParams.configuration && jobParams.configuration.property){ var param = jobParams.configuration.property.findBy('name', propName); if(param && param.value){ @@ -138,13 +139,15 @@ export default Ember.Component.extend(Validations, { val = propVal.value } } - var prop= Ember.Object.create({ - name: propName, - value: val, - isRequired : isRequired - }); - jobProperties.push(prop); + } else { + val = self.get("workflowManagerConfigs").getWfmConfigs()[propName]; } + var prop= Ember.Object.create({ + name: propName, + value: val, + isRequired : isRequired + }); + jobProperties.push(prop); }); return jobProperties; }, http://git-wip-us.apache.org/repos/asf/ambari/blob/2ee12f4c/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js b/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js index 6d94dfe..8e7f5d4 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/routes/index.js @@ -18,10 +18,13 @@ import Ember from 'ember'; export default Ember.Route.extend({ + workflowManagerConfigs : Ember.inject.service('workflow-manager-configs'), afterModel(){ let workflowManagerConfigsPromise = this.getWorkflowManagerConfigs(); workflowManagerConfigsPromise.then(function(data){ - this.invokeServiceChecksPromises(JSON.parse(data)); + var jsonData = JSON.parse(data); + this.get('workflowManagerConfigs').setWfmConfigs(jsonData); + this.invokeServiceChecksPromises(jsonData); }.bind(this)).catch(function(errors){ this.controllerFor('index').set('errors', errors); }.bind(this)); http://git-wip-us.apache.org/repos/asf/ambari/blob/2ee12f4c/contrib/views/wfmanager/src/main/resources/ui/app/services/workflow-manager-configs.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/services/workflow-manager-configs.js b/contrib/views/wfmanager/src/main/resources/ui/app/services/workflow-manager-configs.js new file mode 100644 index 0000000..fdd7d99 --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/app/services/workflow-manager-configs.js @@ -0,0 +1,27 @@ +/* +* 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. +*/ +import Ember from 'ember'; + +export default Ember.Service.extend({ + wfmConfigs: null, + setWfmConfigs(wfmConfigs){ + this.set("wfmConfigs", wfmConfigs); + }, + getWfmConfigs(){ + return this.get("wfmConfigs"); + } +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/2ee12f4c/contrib/views/wfmanager/src/main/resources/ui/tests/unit/services/workflow-manager-configs-test.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/tests/unit/services/workflow-manager-configs-test.js b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/services/workflow-manager-configs-test.js new file mode 100644 index 0000000..a25fdc8 --- /dev/null +++ b/contrib/views/wfmanager/src/main/resources/ui/tests/unit/services/workflow-manager-configs-test.js @@ -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. + */ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('service:workflow-manager-configs', 'Unit | Service | workflow manager configs', { + // Specify the other units that are required for this test. + // needs: ['service:foo'] +}); + +// Replace this with your real tests. +test('it exists', function(assert) { + let service = this.subject(); + assert.ok(service); +});
