Przeglądaj źródła

[oozie] Added parameter and file content to the isDirty observables

Enrico Berti 11 lat temu
rodzic
commit
684a95e

+ 2 - 21
apps/oozie/src/oozie/templates/editor/workflow_editor.mako

@@ -143,6 +143,8 @@ ${ commonheader(_("Workflow Editor"), "Oozie", user, "40px") | n,unicode }
 <div class="search-bar">
   <div class="pull-right" style="padding-right:50px">
 
+    <span data-bind="visible: workflow.isDirty" class="muted">${ _('Unsaved') }&nbsp;&nbsp;&nbsp;</span>
+
     <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>
@@ -196,11 +198,6 @@ ${ commonheader(_("Workflow Editor"), "Oozie", user, "40px") | n,unicode }
   </form>
 </div>
 
-<div class="ribbon-wrapper" data-bind="visible: workflow.isDirty">
-  <div class="ribbon">${ _('Unsaved') }</div>
-</div>
-
-
 
 <div id="emptyDashboard" data-bind="fadeVisible: !isEditing() && oozieColumns().length == 0">
   <div style="float:left; padding-top: 90px; margin-right: 20px; text-align: center; width: 260px">${ _('Click on the pencil to get started with your dashboard!') }</div>
@@ -2075,22 +2072,6 @@ ${ dashboard.import_bindings() }
 
     $.jHueScrollUp();
 
-    window.onbeforeunload = function (e) {
-      if (viewModel.workflow.isDirty()) {
-        var message = "${ _('You have unsaved changes in this workflow.') }";
-
-        if (!e) e = window.event;
-        e.cancelBubble = true;
-        e.returnValue = message;
-
-        if (e.stopPropagation) {
-          e.stopPropagation();
-          e.preventDefault();
-        }
-        return message;
-      }
-    };
-
   });
 
 </script>

+ 9 - 3
apps/oozie/static/js/workflow-editor.ko.js

@@ -193,9 +193,15 @@ var Workflow = function (vm, workflow) {
     var isDirtyContainer = [];
     $.each(self.nodes(), function (index, node) {
       for(var property in node.properties) {
-         if (typeof node.properties[property] == "function"){
-           isDirtyContainer.push(node.properties[property]()); 
-         }
+        if (typeof node.properties[property] == "function"){
+          var _obs = node.properties[property]();
+           isDirtyContainer.push(_obs);
+           if ($.isArray(_obs)){
+             _obs.forEach(function(item){
+               isDirtyContainer.push(item.value());
+             });
+           }
+        }
       }
     });
     return isDirtyContainer;