瀏覽代碼

HUE-6359 [editor] Shell and MR types are missing environment variable form fields

Romain Rigaux 8 年之前
父節點
當前提交
eafd85b

+ 4 - 4
apps/oozie/src/oozie/models2.py

@@ -833,9 +833,9 @@ class Node():
         self.data['properties']['shell_command'] = action['properties']['command_path']
         self.data['properties']['env_var'] = [{'value': prop} for prop in action['properties']['env_var']]
         self.data['properties']['capture_output'] = action['properties']['capture_output']
-        self.data['properties']['arguments'] = []
+        self.data['properties']['arguments'] = [{'value': prop} for prop in action['properties']['arguments']]
 
-        self.data['properties']['files'] = [{'value': action['properties']['command_path']}] + [{'value': prop} for prop in action['properties']['files']]
+        self.data['properties']['files'] = ([{'value': action['properties']['command_path']}] if not action['properties'].get('command_path', '').startswith('/') else []) + [{'value': prop} for prop in action['properties']['files']]
         self.data['properties']['archives'] = [{'value': prop} for prop in action['properties']['archives']]
 
     elif self.data['type'] == MapReduceDocumentAction.TYPE:
@@ -3964,7 +3964,7 @@ class WorkflowBuilder():
     }
 
   def get_shell_document_node(self, document, user):
-    node = self._get_shell_node(document.uuid, is_document_node=True)
+    node = self._get_shell_node(document.uuid)
 
     node['properties']['uuid'] = document.uuid
 
@@ -3991,7 +3991,7 @@ class WorkflowBuilder():
         "type": "shell-document-widget",
         "properties":{
               "command_path": "",
-              "env_var": "",
+              "env_var": [],
               "arguments": [],
               "java_opts": [],
               "retry_max": [],

+ 1 - 0
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -229,6 +229,7 @@ var EditorViewModel = (function() {
     }
     else if (snippetType == 'shell') {
       properties['command_path'] = '';
+      properties['arguments'] = [];
       properties['env_var'] = [];
       properties['capture_output'] = true;
     }

+ 5 - 4
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -1514,9 +1514,10 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
         </div>
       </div>
       <div class="control-group">
-        <label class="control-label">${_('Environment variables')}</label>
+        <label class="control-label">${_('Variables')}</label>
         <div class="controls">
-          <!-- ko template: { if: typeof properties().env_var != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko('Arguments') }', value: properties().env_var, title: '${ _ko('Environment variable for the script') }', placeholder: '${ _ko('e.g. MAX=10, PATH=$PATH:/user/path') }'}} --><!-- /ko -->
+          <!-- ko template: { if: typeof properties().arguments != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko("Arguments") }', value: properties().arguments, title: '${ _ko("Arguments for the script") }', placeholder: '${ _ko("e.g. MAX=10, PATH=$PATH:/user/path") }' } } --><!-- /ko -->
+          <!-- ko template: { if: typeof properties().env_var != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko("Environment") }', value: properties().env_var, title: '${ _ko("Environment variable for the script") }', placeholder: '${ _ko("e.g. CLASSPATH=/path/file.jar") }' } } --><!-- /ko -->
         </div>
       </div>
       <!-- /ko -->
@@ -1528,9 +1529,9 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, ENABLE_
         </div>
       </div>
       <div class="control-group">
-        <label class="control-label">${_('Hadoop properties')}</label>
+        <label class="control-label">${_('Properties')}</label>
         <div class="controls">
-          <!-- ko template: { if: typeof properties().hadoopProperties != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko('Properties') }', value: properties().hadoopProperties, title: '${ _ko('Name and values of Hadoop properties') }', placeholder: '${ _ko('e.g. mapred.job.queue.name=production, mapred.map.tasks.speculative.execution=false') }'}} --><!-- /ko -->
+          <!-- ko template: { if: typeof properties().hadoopProperties != 'undefined', name: 'property', data: { type: 'csv-hdfs-files', label: '${ _ko('Hadoop Properties') }', value: properties().hadoopProperties, title: '${ _ko('Name and values of Hadoop properties') }', placeholder: '${ _ko('e.g. mapred.job.queue.name=production, mapred.map.tasks.speculative.execution=false') }'}} --><!-- /ko -->
         </div>
       </div>
       <!-- /ko -->