فهرست منبع

[oozie] Add a link for scheduling a workflow from the editor page

Also automatically set to edit mode for a new workflow
Romain Rigaux 10 سال پیش
والد
کامیت
c8b64eeff1

+ 1 - 1
apps/oozie/src/oozie/templates/editor2/workflow_editor.mako

@@ -148,7 +148,7 @@ ${ commonheader(_("Workflow Editor"), "Oozie", user, "40px") | n,unicode }
     <a title="${ _('Submit') }" rel="tooltip" data-placement="bottom" data-bind="click: showSubmitPopup, css: {'btn': true, 'disabled': workflow.isDirty()}, visible: workflow.id() != null">
       <i class="fa fa-fw fa-play"></i>
     </a>
-    <a title="${ _('Schedule') }" rel="tooltip" data-placement="bottom" data-bind="click: showSubmitPopup, css: {'btn': true, 'disabled': workflow.isDirty()}, visible: workflow.id() != null">
+    <a title="${ _('Schedule') }" rel="tooltip" data-placement="bottom" data-bind="click: schedule, css: {'btn': true, 'disabled': workflow.isDirty()}, visible: workflow.id() != null">
       <i class="fa fa-fw fa-calendar"></i>
     </a>
 

+ 4 - 0
apps/oozie/src/oozie/views/editor2.py

@@ -395,6 +395,10 @@ def edit_coordinator(request):
     coordinator = Coordinator()
     coordinator.set_workspace(request.user)
 
+  workflow_uuid = request.GET.get('workflow')
+  if workflow_uuid:
+    coordinator.data['properties']['workflow'] = workflow_uuid
+
   api = get_oozie(request.user)
   credentials = Credentials()
   

+ 5 - 1
apps/oozie/static/js/workflow-editor.ko.js

@@ -489,7 +489,7 @@ var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_
   self.isNested = ko.observable(true);
 
   self.canEdit = ko.mapping.fromJS(can_edit_json);
-  self.isEditing = ko.observable(false);
+  self.isEditing = ko.observable(workflow_json.id == null);
   self.isEditing.subscribe(function (newVal) {
     $(document).trigger("editingToggled");
   });
@@ -1099,6 +1099,10 @@ var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_
       $(document).trigger("error", xhr.responseText);
     });
   };
+  
+  self.schedule = function () {
+    window.location.replace('/oozie/editor/coordinator/new/?workflow=' + self.workflow.uuid());
+  };
 
   function bareWidgetBuilder(name, type) {
     return new ExtendedWidget({