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 2018/07/09 07:04:18 UTC

[ambari] 01/01: AMBARI-24266 Error in Validating And Submitting Workflow With Node as Hive

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

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

commit 0904bbf21f52ba6080d439ccf824901bc984dbde
Author: Venkata Sairam <ve...@gmail.com>
AuthorDate: Mon Jul 9 12:33:39 2018 +0530

    AMBARI-24266 Error in Validating And Submitting Workflow With Node as Hive
---
 .../main/resources/ui/app/components/flow-designer.js  | 18 +++++++++++++++++-
 .../src/main/resources/ui/app/components/job-config.js |  3 ++-
 .../resources/ui/app/components/workflow-actions.js    |  1 +
 .../resources/ui/app/domain/cytoscape-flow-renderer.js | 11 +++++++++--
 .../ui/app/templates/components/flow-designer.hbs      |  6 ++++++
 .../ui/app/templates/components/workflow-actions.hbs   |  4 +++-
 .../src/main/resources/ui/app/utils/constants.js       |  1 +
 .../views/wfmanager/src/main/resources/ui/bower.json   |  2 +-
 8 files changed, 40 insertions(+), 6 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..730b8e9 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
@@ -365,7 +365,7 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
   },
   importWorkflowFromString(data){
     this.showSparkMasterFieldError(data);
-
+    this.hiveActionStatus(data);
     var wfObject=this.get("workflowImporter").importWorkflow(data);
     this.set("errors", wfObject.errors);
     if (wfObject.workflow === null) {
@@ -388,6 +388,7 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
   },
   importWorkflowFromJSON(data){
     this.showSparkMasterFieldError(data);
+    this.hiveActionStatus(data);
     var workflowImporter=WorkflowJsonImporter.create({});
     var workflow=workflowImporter.importWorkflow(data);
     this.resetDesigner();
@@ -417,6 +418,21 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
       }
     }
   },
+  hiveActionStatus(data) {
+    if(Constants.enableHiveAction) {
+      return;
+    }
+    let x2js = new X2JS();
+    let actionSettingsObj = x2js.xml_str2json(data);
+    let hiveActionList, hiveActionArray = [];
+    if(actionSettingsObj["workflow-app"] && actionSettingsObj["workflow-app"].action) {
+      hiveActionList = actionSettingsObj["workflow-app"].action;
+      hiveActionArray = this.migrateActionObjectToCollection(hiveActionList);
+      if(hiveActionArray.findBy('hive') && this.migrateActionObjectToCollection(hiveActionArray.findBy('hive'))) {
+        this.set('isHiveActionDisabled', true);
+      }
+    }
+  },
   getWorkflowFromHdfs(filePath){
     var url = Ember.ENV.API_URL + "/readWorkflow?workflowPath="+filePath+'&jobType=WORKFLOW';
     var deferred = Ember.RSVP.defer();
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 326cf38..d1c3400 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
@@ -140,7 +140,8 @@ export default Ember.Component.extend(Validations, {
           }
         }
       } else {
-        val = self.get("workflowManagerConfigs").getWfmConfigs()[propName];
+        let tmp = self.get("workflowManagerConfigs").getWfmConfigs();
+        val = tmp ? tmp[propName] : "";
       }
       var prop= Ember.Object.create({
         name: propName,
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-actions.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-actions.js
index 2f8cdaa..dfb1b16 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-actions.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-actions.js
@@ -24,6 +24,7 @@ export default Ember.Component.extend({
   }),
   initialize : function(){
     this.set('customActionEnabled', Constants.customActionEnabled);
+    this.set('enableHiveAction', Constants.enableHiveAction);
   }.on('init'),
   actions : {
     addAction : function(type){
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
index bee901e..8163844 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
@@ -17,6 +17,8 @@
 
 import Ember from 'ember';
 import CytoscapeStyles from '../domain/cytoscape-style';
+import Constants from '../utils/constants';
+
 var CytoscapeRenderer= Ember.Object.extend({
   currentCyNode: null,
   staticNodes: ['start', 'end', 'placeholder'],
@@ -220,10 +222,15 @@ var CytoscapeRenderer= Ember.Object.extend({
     }.bind(this));
 
     cy.on('click', 'node', function(event) {
-      this.get("context").$(".overlay-node-actions span").hide();
-      this.get("context").$(".overlay-transition-content").hide();
       var node = event.cyTarget;
       var nodeObj = cy.$('#' + node.id());
+      if(node.data().node.actionType === 'hive' && Constants.enableHiveAction !== true) {
+        return;
+      }
+
+      this.get("context").$(".overlay-node-actions span").hide();
+      this.get("context").$(".overlay-transition-content").hide();
+
       this._showNodeEditor(node, nodeObj);
       if (!(node.data().type === 'start' || node.data().type === 'end' || node.data().type === 'placeholder' ||  node.data().type === 'kill')) {
         this.get("context").$(".overlay-node-actions, .overlay-trash-icon").show();
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs
index a02db63..edff6ff 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs
@@ -145,6 +145,12 @@
                 Spark does not support YARN Client mode.Hence, YARN Client mode value will changed in xml while importing.
             </div>
         {{/if}}
+        {{#if isHiveActionDisabled}}
+            <div class="alert alert-warning">
+                <a href="#" class="close" {{action "closeInfo" "isHiveActionDisabled"}}> × </a>
+                Hive action is currently unsupported.
+            </div>
+        {{/if}}
 
       {{#if undoAvailable}}
         <div id="alert"class="alert alert-warning workflow-error" role="alert">
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-actions.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-actions.hbs
index 8907fdd..bd8f703 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-actions.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-actions.hbs
@@ -39,7 +39,9 @@
       <div {{action 'showImportActionNodeFileBrowser'}} class="btn asset-import-btn margin3"> <i class="fa fa-cloud-download"></i> <span class="font10px">Import Asset from Shared File System</span></div>
       <div class="clearfix"></div>
       <ul class="actions_list_left actionNodes">
-          <li {{action 'addAction' 'hive'}} class="dr_action enabled" data-name="Hive" data-type="hive"> <i class="fa fa-server"></i> Hive </li>
+          {{#if enableHiveAction}}
+            <li {{action 'addAction' 'hive'}} class="dr_action enabled" data-name="Hive" data-type="hive"> <i class="fa fa-server"></i> Hive </li>
+          {{/if}}
           <li {{action 'addAction' 'hive2'}} class="dr_action enabled" data-name="Hive" data-type="hive2"> <i class="fa fa-server"></i> Hive2</li>
           <li {{action 'addAction' 'sqoop'}} class="dr_action enabled" data-name="Sqoop" data-type="sqoop"> <i class="fa fa-database"></i> Sqoop </li>
           <li {{action 'addAction' 'pig'}} class="dr_action enabled" data-name="Pig" data-type="pig"> <i class="fa fa-product-hunt"></i>&nbsp; Pig </li>
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js b/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js
index ffdbdc0..efa7c52 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js
@@ -34,6 +34,7 @@ export default Ember.Object.create({
   useCytoscape : true,
   isProjectManagerEnabled : false,
   autoRestoreWorkflowEnabled : true,
+  enableHiveAction : false,
   actions: Ember.A([
     {name : "hive",supportsSchema : true, currentVersion:''},
     {name : "hive2",supportsSchema : true, currentVersion:''},
diff --git a/contrib/views/wfmanager/src/main/resources/ui/bower.json b/contrib/views/wfmanager/src/main/resources/ui/bower.json
index 9812fa6..3f9de44 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/bower.json
+++ b/contrib/views/wfmanager/src/main/resources/ui/bower.json
@@ -21,7 +21,7 @@
     "abdmob/x2js": "~1.2.0",
     "datatables": "~1.10.11",
     "vkBeautify": "https://github.com/vkiryukhin/vkBeautify.git",
-    "cytoscape": "2.7.18",
+    "cytoscape": "2.7.20",
     "cytoscape-dagre": "~1.3.0",
     "cytoscape-panzoom": "~2.4.0",
     "codemirror": "~5.15.0",