Browse Source

HUE-4954 [oozie] Prevent js error when schedule model is not completely loaded

Romain Rigaux 9 years ago
parent
commit
948caa6

+ 3 - 0
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -1370,6 +1370,7 @@
     });
     });
 
 
     self.schedulerViewModel = null;
     self.schedulerViewModel = null;
+    self.schedulerViewModelIsLoaded = ko.observable(false);
     self.schedulerViewerViewModel = ko.observable();
     self.schedulerViewerViewModel = ko.observable();
     self.isBatchable = ko.computed(function() {
     self.isBatchable = ko.computed(function() {
       return self.snippets().length > 0
       return self.snippets().length > 0
@@ -1823,6 +1824,8 @@
             self.schedulerViewModel.coordinator.tracker().markCurrentStateAsClean();
             self.schedulerViewModel.coordinator.tracker().markCurrentStateAsClean();
             self.schedulerViewModel.isEditing(true);
             self.schedulerViewModel.isEditing(true);
 
 
+            self.schedulerViewModelIsLoaded(true);
+
             if (_action == 'new') {
             if (_action == 'new') {
               self.coordinatorUuid(UUID());
               self.coordinatorUuid(UUID());
               self.schedulerViewModel.coordinator.uuid(self.coordinatorUuid());
               self.schedulerViewModel.coordinator.uuid(self.coordinatorUuid());

+ 2 - 2
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -1108,10 +1108,10 @@ ${ hueIcons.symbols() }
     <!-- ko with: $root.selectedNotebook() -->
     <!-- ko with: $root.selectedNotebook() -->
     <div class="tab-pane" id="scheduleTab">
     <div class="tab-pane" id="scheduleTab">
       <!-- ko if: isSaved() -->
       <!-- ko if: isSaved() -->
-        <!-- ko if: coordinatorUuid() && schedulerViewModel.coordinator.isDirty() --> 
+        <!-- ko if: schedulerViewModelIsLoaded() && schedulerViewModel.coordinator.isDirty() -->
           <a data-bind="click: $root.saveNotebook">${ _('Changes not saved') }</a>
           <a data-bind="click: $root.saveNotebook">${ _('Changes not saved') }</a>
         <!-- /ko -->
         <!-- /ko -->
-        <!-- ko if: coordinatorUuid() && ! schedulerViewModel.coordinator.isDirty() --> 
+        <!-- ko if: schedulerViewModelIsLoaded() && ! schedulerViewModel.coordinator.isDirty() -->
           <a data-bind="click: showSubmitPopup">${ _('Start') }</a>
           <a data-bind="click: showSubmitPopup">${ _('Start') }</a>
         <!-- /ko -->
         <!-- /ko -->
         </br>
         </br>