Browse Source

[oozie] Move new Editor templates to a separate directory

Romain Rigaux 10 năm trước cách đây
mục cha
commit
a05db1c
37 tập tin đã thay đổi với 56 bổ sung14 xóa
  1. 4 4
      apps/oozie/src/oozie/models2.py
  2. 0 0
      apps/oozie/src/oozie/templates/editor2/bundle_editor.mako
  3. 0 0
      apps/oozie/src/oozie/templates/editor2/coordinator_editor.mako
  4. 42 0
      apps/oozie/src/oozie/templates/editor2/coordinator_utils.mako
  5. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/bundle.xml.mako
  6. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/coordinator.xml.mako
  7. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-common.xml.mako
  8. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-decision.xml.mako
  9. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-distcp.xml.mako
  10. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-email.xml.mako
  11. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-end.xml.mako
  12. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-fork.xml.mako
  13. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-fs.xml.mako
  14. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-generic.xml.mako
  15. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-graph-status.xml.mako
  16. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-graph.xml.mako
  17. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-hive.xml.mako
  18. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-hive2.xml.mako
  19. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-java.xml.mako
  20. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-join.xml.mako
  21. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-kill.xml.mako
  22. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-mapreduce.xml.mako
  23. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-pig.xml.mako
  24. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-shell.xml.mako
  25. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-sqoop.xml.mako
  26. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-ssh.xml.mako
  27. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-start.xml.mako
  28. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-streaming.xml.mako
  29. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow-subworkflow.xml.mako
  30. 0 0
      apps/oozie/src/oozie/templates/editor2/gen/workflow.xml.mako
  31. 0 0
      apps/oozie/src/oozie/templates/editor2/list_editor_bundles.mako
  32. 0 0
      apps/oozie/src/oozie/templates/editor2/list_editor_coordinators.mako
  33. 0 0
      apps/oozie/src/oozie/templates/editor2/list_editor_workflows.mako
  34. 0 0
      apps/oozie/src/oozie/templates/editor2/submit_job_popup.mako
  35. 0 0
      apps/oozie/src/oozie/templates/editor2/workflow_editor.mako
  36. 9 9
      apps/oozie/src/oozie/views/editor2.py
  37. 1 1
      desktop/core/src/desktop/api.py

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

@@ -169,7 +169,7 @@ class Workflow(Job):
   def to_xml(self, mapping=None):
     if mapping is None:
       mapping = {}
-    tmpl = 'editor/gen2/workflow.xml.mako'
+    tmpl = 'editor2/gen/workflow.xml.mako'
 
     data = self.get_data()
     nodes = [node for node in self.nodes if node.name != 'End'] + [node for node in self.nodes if node.name == 'End'] # End at the end
@@ -319,7 +319,7 @@ class Node():
       self.data['properties']['sla'] = []
 
   def get_template_name(self):
-    return 'editor/gen2/workflow-%s.xml.mako' % self.data['type']
+    return 'editor2/gen/workflow-%s.xml.mako' % self.data['type']
 
   def find_parameters(self):
     return find_parameters(self)
@@ -1627,7 +1627,7 @@ class Coordinator(Job):
     if mapping is None:
       mapping = {}
 
-    tmpl = "editor/gen2/coordinator.xml.mako"
+    tmpl = "editor2/gen/coordinator.xml.mako"
     return re.sub(re.compile('\s*\n+', re.MULTILINE), '\n', django_mako.render_to_string(tmpl, {'coord': self, 'mapping': mapping})).encode('utf-8', 'xmlcharrefreplace')
 
   @property
@@ -1758,7 +1758,7 @@ class Bundle(Job):
       mapping = {}
 
     mapping.update(dict(list(Document2.objects.filter(type='oozie-coordinator2', uuid__in=self.data['coordinators']).values('uuid', 'name'))))
-    tmpl = "editor/gen2/bundle.xml.mako"
+    tmpl = "editor2/gen/bundle.xml.mako"
     return force_unicode(
               re.sub(re.compile('\s*\n+', re.MULTILINE), '\n', django_mako.render_to_string(tmpl, {
                 'bundle': self,

+ 0 - 0
apps/oozie/src/oozie/templates/editor/bundle_editor.mako → apps/oozie/src/oozie/templates/editor2/bundle_editor.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/coordinator_editor.mako → apps/oozie/src/oozie/templates/editor2/coordinator_editor.mako


+ 42 - 0
apps/oozie/src/oozie/templates/editor2/coordinator_utils.mako

@@ -0,0 +1,42 @@
+## Licensed to Cloudera, Inc. under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  Cloudera, Inc. licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+
+<%!
+  from django.utils.translation import ugettext as _
+  from liboozie.oozie_api import get_oozie
+%>
+
+
+<%def name="frequency_fields()">
+  <div class="control-group">
+    <label class="control-label">${ _('When') }</label>
+    <div class="controls">
+      <div class="row-fluid">
+        <div class="span9">
+          <a data-bind="visible: isAdvancedCron" href="http://quartz-scheduler.org/api/2.0.0/org/quartz/CronExpression.html" class="pull-right" target="_blank">&nbsp;<i class="fa fa-question-circle" title="${ _('Check syntax ?') }"></i></a>
+          <input data-bind="visible: isAdvancedCron" id="coord-frequency" name="cron_frequency" class="pull-right"/>
+          <span data-bind="visible: isAdvancedCron" class="pull-right" style="padding-right:20px">
+            ${ _('Crontab') }
+          </span>&nbsp;
+          <label class="checkbox" style="display: inline-block"><input type="checkbox" name="isAdvancedCron" data-bind="checked: isAdvancedCron" /> (${ _('advanced') })</label>
+        </div>
+        <div class="span3">
+        </div>
+      </div>
+      <span class="help-block">${ _('The time frequency at which interval a workflow should be submitted by the coordinator. For example, once a day, every Monday at midnight, every week days, every three days...') }</span>
+    </div>
+  </div>
+</%def>

+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/bundle.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/bundle.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/coordinator.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/coordinator.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-common.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-common.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-decision.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-decision.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-distcp.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-distcp.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-email.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-email.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-end.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-end.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-fork.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-fork.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-fs.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-fs.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-generic.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-generic.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-graph-status.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-graph-status.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-graph.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-graph.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-hive.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-hive.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-hive2.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-hive2.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-java.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-java.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-join.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-join.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-kill.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-kill.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-mapreduce.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-mapreduce.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-pig.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-pig.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-shell.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-shell.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-sqoop.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-sqoop.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-ssh.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-ssh.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-start.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-start.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-streaming.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-streaming.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow-subworkflow.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow-subworkflow.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/gen2/workflow.xml.mako → apps/oozie/src/oozie/templates/editor2/gen/workflow.xml.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/list_editor_bundles.mako → apps/oozie/src/oozie/templates/editor2/list_editor_bundles.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/list_editor_coordinators.mako → apps/oozie/src/oozie/templates/editor2/list_editor_coordinators.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/list_editor_workflows.mako → apps/oozie/src/oozie/templates/editor2/list_editor_workflows.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/submit_job_popup2.mako → apps/oozie/src/oozie/templates/editor2/submit_job_popup.mako


+ 0 - 0
apps/oozie/src/oozie/templates/editor/workflow_editor.mako → apps/oozie/src/oozie/templates/editor2/workflow_editor.mako


+ 9 - 9
apps/oozie/src/oozie/views/editor2.py

@@ -55,7 +55,7 @@ def list_editor_workflows(request):
   if workflows_v1:
     workflows.extend(workflows_v1)
   
-  return render('editor/list_editor_workflows.mako', request, {
+  return render('editor2/list_editor_workflows.mako', request, {
       'workflows_json': json.dumps(workflows, cls=JSONEncoderForHTML)
   })
 
@@ -98,7 +98,7 @@ def _edit_workflow(request, doc, workflow):
   except Exception, e:
     LOG.error(smart_str(e))
 
-  return render('editor/workflow_editor.mako', request, {
+  return render('editor2/workflow_editor.mako', request, {
       'layout_json': json.dumps(workflow_data['layout'], cls=JSONEncoderForHTML),
       'workflow_json': json.dumps(workflow_data['workflow'], cls=JSONEncoderForHTML),
       'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),
@@ -347,7 +347,7 @@ def submit_workflow(request, doc_id):
     initial_params = ParameterForm.get_initial_params(dict([(param['name'], param['value']) for param in parameters]))
     params_form = ParametersFormSet(initial=initial_params)
 
-    popup = render('editor/submit_job_popup2.mako', request, {
+    popup = render('editor2/submit_job_popup.mako', request, {
                      'params_form': params_form,
                      'name': workflow.name,
                      'action': reverse('oozie:editor_submit_workflow', kwargs={'doc_id': workflow.id})
@@ -378,7 +378,7 @@ def list_editor_coordinators(request):
   if coordinators_v1:
     coordinators.extend(coordinators_v1)
 
-  return render('editor/list_editor_coordinators.mako', request, {
+  return render('editor2/list_editor_coordinators.mako', request, {
       'coordinators_json': json.dumps(coordinators, cls=JSONEncoderForHTML)
   })
 
@@ -409,7 +409,7 @@ def edit_coordinator(request):
   if coordinator_id and not filter(lambda a: a['uuid'] == coordinator.data['properties']['workflow'], workflows):
     raise PopupException(_('You don\'t have access to the workflow of this coordinator.'))
 
-  return render('editor/coordinator_editor.mako', request, {
+  return render('editor2/coordinator_editor.mako', request, {
       'coordinator_json': coordinator.to_json_for_html(),
       'credentials_json': json.dumps(credentials.credentials.keys(), cls=JSONEncoderForHTML),
       'workflows_json': json.dumps(workflows, cls=JSONEncoderForHTML),
@@ -526,7 +526,7 @@ def submit_coordinator(request, doc_id):
     initial_params = ParameterForm.get_initial_params(dict([(param['name'], param['value']) for param in parameters]))
     params_form = ParametersFormSet(initial=initial_params)
 
-  popup = render('editor/submit_job_popup2.mako', request, {
+  popup = render('editor2/submit_job_popup.mako', request, {
                  'params_form': params_form,
                  'name': coordinator.name,
                  'action': reverse('oozie:editor_submit_coordinator',  kwargs={'doc_id': coordinator.id})
@@ -560,7 +560,7 @@ def list_editor_bundles(request):
   if bundles_v1:
     bundles.extend(bundles_v1)
 
-  return render('editor/list_editor_bundles.mako', request, {
+  return render('editor2/list_editor_bundles.mako', request, {
       'bundles_json': json.dumps(bundles, cls=JSONEncoderForHTML)
   })
 
@@ -580,7 +580,7 @@ def edit_bundle(request):
   coordinators = [dict([('uuid', d.content_object.uuid), ('name', d.content_object.name)])
                       for d in Document.objects.get_docs(request.user, Document2, extra='coordinator2')]
 
-  return render('editor/bundle_editor.mako', request, {
+  return render('editor2/bundle_editor.mako', request, {
       'bundle_json': bundle.to_json_for_html(),
       'coordinators_json': json.dumps(coordinators, cls=JSONEncoderForHTML),
       'doc1_id': doc.doc.get().id if doc else -1,
@@ -683,7 +683,7 @@ def submit_bundle(request, doc_id):
     initial_params = ParameterForm.get_initial_params(dict([(param['name'], param['value']) for param in parameters]))
     params_form = ParametersFormSet(initial=initial_params)
 
-  popup = render('editor/submit_job_popup2.mako', request, {
+  popup = render('editor2/submit_job_popup.mako', request, {
                  'params_form': params_form,
                  'name': bundle.name,
                  'action': reverse('oozie:editor_submit_bundle',  kwargs={'doc_id': bundle.id})

+ 1 - 1
desktop/core/src/desktop/api.py

@@ -51,7 +51,7 @@ def _get_docs(user):
           'documentpermission_set',
         )
         .defer(None)
-        .order_by('-last_modified')[:500],
+        .order_by('-last_modified')[:50],
       Document.objects.get_docs(user)
         .exclude(tags__in=[history_tag])
         .select_related(