فهرست منبع

HUE-3797 [editor] Add basic coordinator submit

Romain Rigaux 9 سال پیش
والد
کامیت
5e8bd50

+ 3 - 2
apps/oozie/src/oozie/templates/editor2/common_scheduler.inc.mako

@@ -477,11 +477,12 @@ from django.utils.translation import ugettext as _
   <script src="${ static('desktop/ext/js/tzdetect.js') }" type="text/javascript" charset="utf-8"></script>
 
   <script type="text/javascript">
-  function showChooseWorkflow() {
-  }
+    function showChooseWorkflow() {
+    }
   </script>
 </%def>
 
+
 <%def name="import_sla_cron(coordinator_json)">
   <script type="text/javascript">
   var datasetTypeaheadSource = ["/data/${'${'}YEAR}/${'${'}MONTH}/${'${'}DAY}", "${'${'}MINUTE}", "${'${'}HOUR}", "${'${'}DAY}", "${'${'}MONTH}", "${'${'}YEAR}", "${'${'}coord:nominalTime()}", "${'${'}coord:formatTime(coord:nominalTime(), 'yyyyMMdd')}"]

+ 20 - 8
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -1132,8 +1132,8 @@
     });
     self.directoryUuid = ko.observable(typeof notebook.directoryUuid != "undefined" && notebook.directoryUuid != null ? notebook.directoryUuid : null);
     self.dependents = ko.mapping.fromJS(typeof notebook.dependents != "undefined" && notebook.dependents != null ? notebook.dependents : []);
-    self.dependentsWorkflows = ko.computed(function() {
-      return $.grep(self.dependents(), function(doc) { return doc.type() == 'oozie-workflow2' ;})
+    self.dependentsCoordinator = ko.computed(function() {
+      return $.grep(self.dependents(), function(doc) { return doc.type() == 'oozie-coordinator2' ;})
     });
     self.history = ko.observableArray(vm.selectedNotebook() ? vm.selectedNotebook().history() : []);
     self.historyFilter = ko.observable('');
@@ -1562,7 +1562,7 @@
       $.get('/oozie/editor/coordinator/' + _action + '/', {
         format: 'json',
         document: self.uuid(),
-        uuid: self.coordinatorUuid()
+        coordinator: self.coordinatorUuid()
       }, function (data) {
         $("#schedulerEditor").html(data.layout);
         self.schedulerViewModel = new CoordinatorEditorViewModel(data.coordinator, data.credentials, data.workflows, data.can_edit);
@@ -1577,8 +1577,8 @@
       });
     };
 
-    self.saveScheduler = function() {
-      if (self.schedulerViewModel.coordinator.isDirty()) {
+    self.saveScheduler = function() { console.log(self.coordinatorUuid());
+      if (! self.coordinatorUuid() || self.schedulerViewModel.coordinator.isDirty()) {
         self.schedulerViewModel.coordinator.name('My daily run');  // TODO Temp fix until js errors are gone
         self.schedulerViewModel.save(function(data) {
     	  self.coordinatorUuid(data.uuid);
@@ -1586,6 +1586,16 @@
       }
     };
 
+    self.showSubmitPopup = function () {
+      $.get('/oozie/editor/coordinator/submit/' + 52687, {
+      }, function (data) {
+        $(document).trigger("showSubmitPopup", data);
+      }).fail(function (xhr, textStatus, errorThrown) {
+        $(document).trigger("error", xhr.responseText);
+      });
+    };
+
+    
     self.viewSchedulerId = ko.observable('0000000-160519110441280-oozie-oozi-C');
     self.viewScheduler = function() {
       logGA('schedule/view');
@@ -1660,9 +1670,6 @@
         });
       }
     }
-    if (self.isSaved()) {
-      self.loadScheduler();
-    }
   };
 
 
@@ -1852,6 +1859,11 @@
           notebook.snippets()[0].currentQueryTab(queryTab);
         }
       }
+
+      if (notebook.isSaved()) {
+        notebook.loadScheduler();
+      }
+
       self.selectedNotebook(notebook);
     };
 

+ 7 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -164,6 +164,8 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING
 <script src="${ static('desktop/js/ko.common-dashboard.js') }" type="text/javascript" charset="utf-8"></script>
 ## <script src="${ static('oozie/js/coordinator-editor.ko.js') }" type="text/javascript" charset="utf-8"></script>
 ## <script src="${ static('oozie/js/editor2-utils.js') }" type="text/javascript" charset="utf-8"></script>
+## submit popup
+<script src="${ static('oozie/js/editor2-utils.js') }" type="text/javascript" charset="utf-8"></script>
 
 ${ require.config() }
 
@@ -1046,7 +1048,8 @@ ${ hueIcons.symbols() }
       <!-- ko if: $root.selectedNotebook() -->
       <!-- ko with: $root.selectedNotebook() -->
         <!-- ko if: $root.selectedNotebook().isSaved() -->
-           Start</br>
+           Refresh</br>
+          <a data-bind="click: showSubmitPopup">Start</a></br>
           <a href="#scheduledJobsTab" data-toggle="tab">${_('View')}</a>
 
           <div id="schedulerEditor">
@@ -2002,6 +2005,9 @@ ${ hueIcons.symbols() }
   </div>
 </div>
 
+
+<div class="submit-modal modal hide"></div>
+
 </%def>