This is an automated email from the ASF dual-hosted git repository.
wuzhiguo pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new 33509ce7f3 AMBARI-25424: Failed to edit workflow from Ambari workflow
Manager while accessing Ambari UI over Knox (#3517)
33509ce7f3 is described below
commit 33509ce7f3b6da418e07bcaf900d8f698caeb035
Author: Zhiguo Wu <[email protected]>
AuthorDate: Thu Nov 17 16:37:10 2022 +0800
AMBARI-25424: Failed to edit workflow from Ambari workflow Manager while
accessing Ambari UI over Knox (#3517)
---
.../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 2c77b5b3ec..c5d2a45cf8 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);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]