Selaa lähdekoodia

HUE-3086 [oozie] Upgrade email action to 0.2

krish 9 vuotta sitten
vanhempi
commit
dd11d28

+ 1 - 0
apps/oozie/src/oozie/importlib/xslt2/workflows/0.5/action.xslt

@@ -4,6 +4,7 @@
 
 <xsl:import href="extensions/distcp.0.1.xslt"/>
 <xsl:import href="extensions/email.0.1.xslt"/>
+<xsl:import href="extensions/email.0.2.xslt"/>
 <xsl:import href="extensions/hive.0.1.xslt"/>
 <xsl:import href="extensions/hive.0.2.xslt"/>
 <xsl:import href="extensions/shell.0.1.xslt"/>

+ 15 - 0
apps/oozie/src/oozie/importlib/xslt2/workflows/0.5/extensions/email.0.2.xslt

@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:workflow="uri:oozie:workflow:0.5" xmlns:email="uri:oozie:email-action:0.2" exclude-result-prefixes="workflow email">
+
+<xsl:template match="email:email">
+
+  ,"email": {
+    "to": "<xsl:value-of select="*[local-name()='to']"/>",
+    "subject": "<xsl:value-of select="*[local-name()='subject']"/>",
+    "body": "<xsl:value-of select="*[local-name()='body']"/>"
+   }
+
+</xsl:template>
+
+</xsl:stylesheet>

+ 27 - 1
apps/oozie/src/oozie/models2.py

@@ -717,6 +717,11 @@ def _upgrade_older_node(node):
     node['properties']['subject'] = ''
     node['properties']['body'] = ''
 
+  if node['type'] == 'email-widget' and 'bcc' not in node['properties']:
+    node['properties']['bcc'] = ''
+    node['properties']['content_type'] = 'text/plain'
+    node['properties']['attachment'] = ''
+
 
 class Action(object):
 
@@ -1504,7 +1509,14 @@ class EmailAction(Action):
      },
      'cc': {
           'name': 'cc',
-          'label': _('Cc addresses (optional)'),
+          'label': _('cc'),
+          'value': '',
+          'help_text': _('Comma-separated values'),
+          'type': 'text'
+     },
+     'bcc': {
+          'name': 'bcc',
+          'label': _('bcc'),
           'value': '',
           'help_text': _('Comma-separated values'),
           'type': 'text'
@@ -1523,6 +1535,20 @@ class EmailAction(Action):
           'help_text': _('Plain-text'),
           'type': 'textarea'
      },
+     'attachment': {
+          'name': 'attachment',
+          'label': _('Attachment'),
+          'value': '',
+          'help_text': _('Comma separated list of HDFS files.'),
+          'type': ''
+     },
+     'content_type': {
+          'name': 'content_type',
+          'label': _('Content-type'),
+          'value': 'text/plain',
+          'help_text': _('Default is text/plain'),
+          'type': 'text'
+     },
      # Common
      'retry_max': {
           'name': 'retry_max',

+ 23 - 0
apps/oozie/src/oozie/templates/editor2/common_workflow.mako

@@ -1578,6 +1578,28 @@
           <input type="text" class="seventy" data-bind="value: properties.to, attr: { placeholder: $root.workflow_properties.to.help_text }" validate="nonempty"/>
         </div>
 
+        <div class="airy">
+          <span class="widget-label" data-bind="text: $root.workflow_properties.cc.label"></span>
+          <input type="text" class="seventy" data-bind="value: properties.cc, attr: { placeholder: $root.workflow_properties.cc.help_text }"/>
+        </div>
+
+        <div class="airy">
+          <span class="widget-label" data-bind="text: $root.workflow_properties.bcc.label"></span>
+          <input type="text" class="seventy" data-bind="value: properties.bcc, attr: { placeholder: $root.workflow_properties.bcc.help_text }"/>
+        </div>
+
+        <div data-bind="visible: $root.isEditing">
+          <div data-bind="visible: ! $parent.ooziePropertiesExpanded()" class="nowrap">
+            <span class="widget-label" data-bind="text: $root.workflow_properties.attachment.label"></span>
+            <input type="text" class="filechooser-input seventy" data-bind="filechooser: properties.attachment, filechooserOptions: globalFilechooserOptions, hdfsAutocomplete: properties.attachment, value: properties.attachment, attr: { placeholder: $root.workflow_properties.bcc.help_text }"/>
+          </div>
+        </div>
+
+        <div class="airy">
+          <span class="widget-label" data-bind="text: $root.workflow_properties.content_type.label"></span>
+          <input type="text" class="seventy" data-bind="value: properties.content_type, attr: { placeholder: $root.workflow_properties.content_type.help_text }" validate="nonempty"/>
+        </div>
+
         <div class="airy">
           <span class="widget-label" data-bind="text: $root.workflow_properties.subject.label"></span>
           <input type="text" class="seventy" data-bind="value: properties.subject, attr: { placeholder: $root.workflow_properties.subject.help_text }" />
@@ -1587,6 +1609,7 @@
           <span class="widget-label" data-bind="text: $root.workflow_properties.body.label"></span>
           <textarea class="seventy" style="resize:both" data-bind="value: properties.body, attr: { placeholder: $root.workflow_properties.body.help_text }"></textarea>
         </div>
+
       </div>
     </div>
 

+ 10 - 1
apps/oozie/src/oozie/templates/editor2/gen/workflow-email.xml.mako

@@ -18,13 +18,22 @@
 <%namespace name="common" file="workflow-common.xml.mako" />
 
     <action name="${ node['name'] }"${ common.credentials(node['properties']['credentials']) }${ common.retry_max(node['properties']['retry_max']) }${ common.retry_interval(node['properties']['retry_interval']) }>
-        <email xmlns="uri:oozie:email-action:0.1">
+        <email xmlns="uri:oozie:email-action:0.2">
             <to>${ node['properties']['to'] }</to>
             % if node['properties']['cc']:
             <cc>${ node['properties']['cc'] }</cc>
             % endif
+            % if node['properties']['bcc']:
+            <bcc>${ node['properties']['bcc'] }</bcc>
+            % endif
             <subject>${ node['properties']['subject'] }</subject>
             <body>${ node['properties']['body'] }</body>
+            % if node['properties']['content_type']:
+            <content_type>${ node['properties']['content_type'] }</content_type>
+            % endif
+            % if node['properties']['attachment']:
+            <attachment>${ node['properties']['attachment'] }</attachment>
+            % endif
         </email>
         <ok to="${ node_mapping[node['children'][0]['to']].name }"/>
         <error to="${ node_mapping[node['children'][1]['error']].name }"/>

+ 1 - 1
apps/oozie/src/oozie/templates/editor2/gen/workflow-kill.xml.mako

@@ -17,7 +17,7 @@
 
 %if node['properties']['enableMail']:
     <action name="${ node['name'] }">
-        <email xmlns="uri:oozie:email-action:0.1">
+        <email xmlns="uri:oozie:email-action:0.2">
             <to>${ node['properties']['to'] }</to>
             % if node['properties']['cc']:
             <cc>${ node['properties']['cc'] }</cc>

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
apps/oozie/src/oozie/tests2.py


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä