You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vs...@apache.org on 2019/12/09 06:29:56 UTC

[ambari] branch branch-2.7 updated: AMBARI-25424 Failed to edit workflow from Ambari workflow Manager while accessing Ambari UI over Knox (#3152)

This is an automated email from the ASF dual-hosted git repository.

vsairam pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new 93769b6  AMBARI-25424 Failed to edit workflow from Ambari workflow Manager while accessing Ambari UI over Knox (#3152)
93769b6 is described below

commit 93769b68e00f45b1512ccdddb031637a5fbccd3a
Author: Venkata Sairam Lanka <ve...@gmail.com>
AuthorDate: Mon Dec 9 11:59:44 2019 +0530

    AMBARI-25424 Failed to edit workflow from Ambari workflow Manager while accessing Ambari UI over Knox (#3152)
---
 .../src/main/resources/ui/app/components/flow-designer.js   | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
index 2c77b5b..c5d2a45 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
@@ -350,7 +350,10 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
     var workflowXmlDefered=this.getWorkflowFromHdfs(filePath);
     workflowXmlDefered.promise.then(function(response){
       if(response.type === 'xml'){
-        this.importWorkflowFromString(response.data);
+        var x2js = new X2JS();
+        let resData = x2js.json2xml_str(x2js.xml2json(response.data));
+
+        this.importWorkflowFromString(resData);
       }else {
         this.importWorkflowFromJSON(response.data);
       }
@@ -423,10 +426,10 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
     Ember.$.ajax({
       url: url,
       method: 'GET',
-      dataType: "text",
       beforeSend: function (xhr) {
         xhr.setRequestHeader("X-XSRF-HEADER", Math.round(Math.random()*100000));
         xhr.setRequestHeader("X-Requested-By", "Ambari");
+        xhr.setRequestHeader("accept", "text/xml");
       }
     }).done(function(data, status, xhr){
       var type = xhr.getResponseHeader("response-type") === "xml" ? 'xml' : 'json';
@@ -604,9 +607,11 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
   getWorkflowAsJsonJsoGImpl(){
    try{
     var json=JSOG.stringify(this.get("workflow")), self = this;
-    var actionVersions = JSOG.stringify(CommonUtils.toArray(this.get("workflow").schemaVersions.actionVersions));
+    var actionVersions = this.get("workflow").schemaVersions ? JSOG.stringify(CommonUtils.toArray(this.get("workflow").schemaVersions.actionVersions)) : [];
     var workflow = JSOG.parse(json);
-    workflow.schemaVersions.actionVersions = actionVersions
+    if(workflow.schemaVersions) {
+      workflow.schemaVersions.actionVersions = actionVersions
+    }
     return JSOG.stringify(workflow);
   }catch(err){
    console.error(err);