Browse Source

HUE-1237 [jobsub] FS example broken

KO updates was missing in mapping.
Templates for CHMOD and MOVES was missing.
Abraham Elmahrek 12 years ago
parent
commit
5efec71ea1

+ 2 - 2
apps/jobsub/static/js/jobsub.templates.js

@@ -47,8 +47,8 @@ var Templates = (function($, ko) {
         mkdirs: 'static/templates/widgets/folderchooser.html',
         deletes: 'static/templates/widgets/folderchooser.html',
         touchzs: 'static/templates/widgets/filechooser.html',
-        chmods: 'static/templates/widgets/filechooser.html',
-        moves: 'static/templates/widgets/filechooser.html',
+        chmods: 'static/templates/widgets/chmods.html',
+        moves: 'static/templates/widgets/moves.html',
         job_properties: 'static/templates/widgets/properties.html',
         prepares: 'static/templates/widgets/prepares.html',
         arguments: 'static/templates/widgets/params.html',

+ 26 - 0
apps/jobsub/static/templates/widgets/chmods.html

@@ -0,0 +1,26 @@
+<div class="control-group" data-bind="attr: {'class': {{ ko.error_class }} }">
+  <label class="control-label">{{ title }}</label>
+  <div class="controls">
+    <table class="table-condensed designTable" data-bind="visible: {{ ko.condition }}">
+      <tbody>
+        <thead>
+          <tr>
+            <th>Path</th>
+            <th>Permissions</th>
+            <th>Recursive</th>
+            <th></th>
+          </tr>
+        </thead>
+        <tbody data-bind="foreach: {{ ko.items }}">
+          <tr>
+            <td><input type="text" class="input span4 required pathFolderChooserKo" data-bind="fileChooser: $data, value: path, uniqueName: false" /></td>
+            <td><input type="text" class="input span2 required propKey" data-bind="value: permissions, uniqueName: false" /></td>
+            <td><input class="span1 required" type="checkbox" data-bind="checked: recursive, uniqueName: false"></td>
+            <td><a class="btn" href="javascript:void(0);" data-bind="click: {{ delete.func }}">{{ delete.name }}</a></td>
+          </tr>
+        </tbody>
+      </tbody>
+    </table>
+    <button class="btn" data-bind="click: {{ add.func }}">{{ add.name }}</button>
+  </div>
+</div>

+ 24 - 0
apps/jobsub/static/templates/widgets/moves.html

@@ -0,0 +1,24 @@
+<div class="control-group" data-bind="attr: {'class': {{ ko.error_class }} }">
+  <label class="control-label">{{ title }}</label>
+  <div class="controls">
+    <table class="table-condensed designTable" data-bind="visible: {{ ko.condition }}">
+      <tbody>
+        <thead>
+          <tr>
+            <th>Source</th>
+            <th>Destination</th>
+            <th></th>
+          </tr>
+        </thead>
+        <tbody data-bind="foreach: {{ ko.items }}">
+          <tr>
+            <td><input type="text" class="input span3 required pathFolderChooserKo" data-bind="fileChooser: $data, value: source, uniqueName: false" /></td>
+            <td><input type="text" class="input span3 required pathFolderChooserKo" data-bind="fileChooser: $data, value: destination, uniqueName: false" /></td>
+            <td><a class="btn" href="javascript:void(0);" data-bind="click: {{ delete.func }}">{{ delete.name }}</a></td>
+          </tr>
+        </tbody>
+      </tbody>
+    </table>
+    <button class="btn" data-bind="click: {{ add.func }}">{{ add.name }}</button>
+  </div>
+</div>

+ 41 - 3
apps/oozie/static/js/workflow.models.js

@@ -171,12 +171,18 @@ var MAPPING_OPTIONS = {
   deletes: {
     create: function(options) {
       return map_params(options, function() {});
-    }
+    },
+    update: function(options) {
+      return map_params(options, function() {});
+    },
   },
   mkdirs: {
     create: function(options) {
       return map_params(options, function() {});
-    }
+    },
+    update: function(options) {
+      return map_params(options, function() {});
+    },
   },
   moves: {
     create: function(options) {
@@ -190,6 +196,19 @@ var MAPPING_OPTIONS = {
         });
       };
 
+      return map_params(options, subscribe);
+    },
+    update: function(options) {
+      var parent = options.parent;
+      var subscribe = function(mapping) {
+        mapping.source.subscribe(function(value) {
+          parent.moves.valueHasMutated();
+        });
+        mapping.destination.subscribe(function(value) {
+          parent.moves.valueHasMutated();
+        });
+      };
+
       return map_params(options, subscribe);
     }
    },
@@ -209,11 +228,30 @@ var MAPPING_OPTIONS = {
        };
 
        return map_params(options, subscribe);
-     }
+     },
+     update: function(options) {
+       var parent = options.parent;
+       var subscribe = function(mapping) {
+         mapping.path.subscribe(function(value) {
+           parent.chmods.valueHasMutated();
+         });
+         mapping.permissions.subscribe(function(value) {
+           parent.chmods.valueHasMutated();
+         });
+         mapping.recursive.subscribe(function(value) {
+           parent.chmods.valueHasMutated();
+         });
+       };
+
+       return map_params(options, subscribe);
+     },
    },
    touchzs: {
      create: function(options) {
        return map_params(options, function() {});
+     },
+     update: function(options) {
+       return map_params(options, function() {});
      }
    }
 };