Browse Source

[oozie] Add more properties for Pig action

Romain Rigaux 11 years ago
parent
commit
50376ef

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

@@ -207,7 +207,7 @@ class Node():
     self.data['type'] = self.data['type'].replace('-widget', '')
     self.data['uuid'] = self.data['id']
     
-    # if action node?
+    # Action Node
     if 'credentials' not in self.data['properties']:
       self.data['properties']['credentials'] = []     
     if 'prepares' not in self.data['properties']:
@@ -222,10 +222,10 @@ class Node():
       self.data['properties']['files'] = []
     if 'archives' not in self.data['properties']:
       self.data['properties']['archives'] = []
-
-
     if 'sla_enabled' not in self.data['properties']:
       self.data['properties']['sla_enabled'] = False
+    if 'sla' not in self.data['properties']:
+      self.data['properties']['sla'] = []
     
   def get_template_name(self):
     return 'editor/gen2/workflow-%s.xml.mako' % self.data['type']    

+ 5 - 2
apps/oozie/src/oozie/templates/editor/gen2/workflow-pig.xml.mako

@@ -30,8 +30,11 @@
 
             <script>${ node['properties']['script_path'] }</script>
 
-            % for param in node['properties']['params']:
-              <${ param['type'] }>${ param['value'] }</${ param['type'] }>
+            % for param in node['properties']['parameters']:
+              <param>${ param['value'] }</param>
+            % endfor
+            % for argument in node['properties']['arguments']:
+              <argument>${ argument['value'] }</argument>
             % endfor
 
             ${ common.distributed_cache(node['properties']['files'], node['properties']['archives']) }

+ 25 - 7
apps/oozie/src/oozie/templates/editor/workflow_editor.mako

@@ -192,22 +192,29 @@ ${ dashboard.layout_skeleton() }
         <div class="tab-pane active" id="action">
           <img src="/oozie/static/art/icon_pig_48.png" class="app-icon">
           <input type="text" data-bind="value: properties.script_path" />
-          
-	      ${ _('Parameters') }   
-	      <ul data-bind="foreach: properties.parameters">
+          </br>
+	      ${ _('Variables') }   
+	      <ul data-bind="foreach: properties.arguments">
 	        <li>
-	          <input data-bind="value: name"/>
 	          <input data-bind="value: value"/>
-	          <a href="#" data-bind="click: function(){ $parent.properties.parameters.remove(this); }">
+	          <a href="#" data-bind="click: function(){ $parent.properties.arguments.remove(this); }">
 	            <i class="fa fa-minus"></i>
 	          </a>
 	        </li>
 	      </ul>
-          <button data-bind="click: function(){ properties.parameters.push({'name': '', 'value': ''}); }">
+          <button data-bind="click: function(){ properties.arguments.push({'value': ''}); }">
             <i class="fa fa-plus"></i>
           </button>	      
         </div>
         <div class="tab-pane" id="files">
+          prepares <input type="text" data-bind="value: properties.prepares" /></br>
+          job_xml <input type="text" data-bind="value: properties.job_xml" /></br>
+          proeperties <input type="text" data-bind="value: properties.properties" /></br>
+          parameters <input type="text" data-bind="value: properties.parameters" /></br>
+          files <input type="text" data-bind="value: properties.files" /></br>
+          archives <input type="text" data-bind="value: properties.archives" /></br>
+          sla <input type="text" data-bind="value: properties.sla" /></br>
+          credentials <input type="text" data-bind="value: properties.credentials" /></br>
         </div>
         <div class="tab-pane" id="sla">
         </div>
@@ -348,7 +355,18 @@ ${ dashboard.import_bindings() }
         'label': '${ _("Jar Path") }',
         'value': ''
       });
-    } else {
+      viewModel.addActionProperties.push({
+        'name': 'main_class',
+        'label': '${ _("Main class") }',
+        'value': ''
+      });
+    } else if (widget.widgetType() == 'hive-widget') {
+      viewModel.addActionProperties.push({
+        'name': 'script_path',
+        'label': '${ _("Script Path") }',
+        'value': ''
+      });
+    } else if (widget.widgetType() == 'pig-widget') {
       viewModel.addActionProperties.push({
         'name': 'script_path',
         'label': '${ _("Script Path") }',

+ 2 - 1
apps/oozie/src/oozie/views/editor2.py

@@ -109,7 +109,8 @@ def add_node(request):
   
   properties = response['properties'] = dict([(property['name'], property['value']) for property in properties])
   properties.update({
-      'parameters': []
+      'parameters': [],
+      'arguments': []
   })
 
   response['status'] = 0