Repository: ambari Updated Branches: refs/heads/trunk 0a86fc083 -> f8c34a088
AMBARI-20001. Workflow manager- preview workflow has xml encodings.(Padma priya N via gauravn7) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f8c34a08 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f8c34a08 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f8c34a08 Branch: refs/heads/trunk Commit: f8c34a088180a40cb5b02f3b4a499252b80f96d3 Parents: 0a86fc0 Author: Gaurav Nagar <[email protected]> Authored: Tue Feb 14 18:09:02 2017 +0530 Committer: Gaurav Nagar <[email protected]> Committed: Tue Feb 14 18:09:02 2017 +0530 ---------------------------------------------------------------------- .../src/main/resources/ui/app/components/job-config.js | 6 ++++-- .../src/main/resources/ui/app/components/preview-dialog.js | 4 ++++ .../wfmanager/src/main/resources/ui/app/components/save-wf.js | 2 +- .../resources/ui/app/templates/components/preview-dialog.hbs | 2 +- .../wfmanager/src/main/resources/ui/app/utils/common-utils.js | 3 +++ 5 files changed, 13 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f8c34a08/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 dde012d..f364e30 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 @@ -17,6 +17,7 @@ import Ember from 'ember'; import Constants from '../utils/constants'; +import CommonUtils from '../utils/common-utils'; import { validator, buildValidations } from 'ember-cp-validations'; const Validations = buildValidations({ @@ -36,7 +37,6 @@ const Validations = buildValidations({ export default Ember.Component.extend(Validations, { systemConfigs : Ember.A([]), showingFileBrowser : false, - jobXml : "", overwritePath : false, configMap : Ember.A([]), configPropsExists : false, @@ -74,13 +74,15 @@ export default Ember.Component.extend(Validations, { }), initialize :function(){ this.configureExecutionSettings(); - this.set("jobXml", this.get("jobConfigs").xml); this.set('filePath', Ember.copy(this.get('jobFilePath'))); Object.keys(this.get('validations.attrs')).forEach((attr)=>{ var field = 'validations.attrs.'+ attr +'.isDirty'; this.set(field, false); }, this); }.on('init'), + jobXml : Ember.computed('jobConfigs.xml', function(){ + return CommonUtils.decodeXml(this.get('jobConfigs.xml')); + }), rendered : function(){ this.$("#configureJob").on('hidden.bs.modal', function () { this.sendAction('closeJobConfigs'); http://git-wip-us.apache.org/repos/asf/ambari/blob/f8c34a08/contrib/views/wfmanager/src/main/resources/ui/app/components/preview-dialog.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/preview-dialog.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/preview-dialog.js index cd6c171..4842d27 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/preview-dialog.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/preview-dialog.js @@ -16,8 +16,12 @@ * limitations under the License. */ import Ember from 'ember'; +import CommonUtils from '../utils/common-utils'; export default Ember.Component.extend({ + decodedXml : Ember.computed('previewXml', function(){ + return CommonUtils.decodeXml(this.get('previewXml')); + }), elementsInserted :function(){ this.$('#previewModal').modal({ backdrop: 'static', http://git-wip-us.apache.org/repos/asf/ambari/blob/f8c34a08/contrib/views/wfmanager/src/main/resources/ui/app/components/save-wf.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/save-wf.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/save-wf.js index a2210a6..75cdaf9 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/components/save-wf.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/save-wf.js @@ -45,7 +45,7 @@ export default Ember.Component.extend(Validations, { } }), jobXml : Ember.computed('jobConfigs', function(){ - return this.get('jobConfigs.xml'); + return CommonUtils.decodeXml(this.get('jobConfigs.xml')); }), jobJson : Ember.computed('jobConfigs', function(){ return this.get('jobConfigs.json'); http://git-wip-us.apache.org/repos/asf/ambari/blob/f8c34a08/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/preview-dialog.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/preview-dialog.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/preview-dialog.hbs index bbf7ce1..ad55fe1 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/preview-dialog.hbs +++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/preview-dialog.hbs @@ -24,7 +24,7 @@ </div> <div class="modal-body"> <div id="xmlCode"> - {{ivy-codemirror value=previewXml options=(hash lineNumbers=false mode="xml" indentWithTabs=true readOnly=true)}} + {{ivy-codemirror value=decodedXml options=(hash lineNumbers=false mode="xml" indentWithTabs=true readOnly=true)}} </div> <!--pre class="preview-xml">{{previewXml}}</pre--> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/f8c34a08/contrib/views/wfmanager/src/main/resources/ui/app/utils/common-utils.js ---------------------------------------------------------------------- diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/utils/common-utils.js b/contrib/views/wfmanager/src/main/resources/ui/app/utils/common-utils.js index e793aac..309c281 100644 --- a/contrib/views/wfmanager/src/main/resources/ui/app/utils/common-utils.js +++ b/contrib/views/wfmanager/src/main/resources/ui/app/utils/common-utils.js @@ -29,5 +29,8 @@ export default Ember.Object.create({ }, isSupportedAction(actionType){ return Constants.actions.findBy('name', actionType)? true : false; + }, + decodeXml(xml){ + return xml && xml.length > 0 ? xml.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '\"').replace(/'/g, '\'') : xml; } });
