Explorar o código

[oozie] Enable picker for every parameter

Enrico Berti %!s(int64=11) %!d(string=hai) anos
pai
achega
f66a90d

+ 1 - 10
apps/oozie/src/oozie/templates/editor/workflow_editor.mako

@@ -611,7 +611,7 @@ ${ commonheader(_("Workflow Editor"), "Oozie", user, "40px") | n,unicode }
   </h6>
   <ul class="unstyled" data-bind="foreach: properties.parameters">
     <li style="margin-bottom: 3px">
-      <input type="text" class="filechooser-input seventy" data-bind="value: value, filechooser: value, filechooserOptions: globalFilechooserOptions, filechooserDisabled: true, filechooserPrefixSeparator: '=', event: { change: enableFilechooser, keyup: enableFilechooser }, attr: { placeholder: ' ${ _("Fill me up!") }' }, typeahead: { target: value, source: $parent.actionParametersUI, sourceSuffix: '=', triggerOnFocus: true }"/>
+      <input type="text" class="filechooser-input seventy" data-bind="value: value, filechooser: value, filechooserOptions: globalFilechooserOptions, filechooserPrefixSeparator: '=', attr: { placeholder: ' ${ _("Fill me up!") }' }, typeahead: { target: value, source: $parent.actionParametersUI, sourceSuffix: '=', triggerOnFocus: true }"/>
       <span data-bind='template: { name: "param-fs-link", data: {path: value()} }'></span>
       <a href="#" data-bind="click: function(){ $parent.properties.parameters.remove(this); $(document).trigger('drawArrows') }">
         <i class="fa fa-minus"></i>
@@ -1805,15 +1805,6 @@ ${ dashboard.import_bindings() }
     }
   }
 
-  function enableFilechooser(va, evt) {
-    if ($(evt.target).val().indexOf('=') > 0) {
-      $(evt.target).next().removeAttr('disabled').removeClass('disabled');
-    }
-    else {
-      $(evt.target).next().attr('disabled', 'disabled').addClass('disabled');
-    }
-  }
-
   function columnDropAdditionalHandler(widget) {
     widgetDraggedAdditionalHandler(widget);
   }

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

@@ -88,6 +88,9 @@ var Node = function (node) {
   self.actionParametersUI = ko.computed(function() {
 	if (typeof self.properties.parameters != "undefined") {
       var _vars = $.map(self.properties.parameters(), function(p, i) { return p.value().split('=', 1)[0]; });
+      if (typeof self.actionParameters() == "undefined"){
+        return _vars;
+      }
       return $.grep(self.actionParameters(), function(param) {
         return _vars.indexOf(param) == -1;
       });
@@ -138,7 +141,7 @@ var Node = function (node) {
 	  }, function (data) {
 	    self.actionParametersFetched(true);
 	    self.actionParameters(data.parameters);
-	    if (data.parameters.length > 0 && self.properties.parameters().length == 0) { // If new node with variables, give a hint by adding a parameter
+	    if (data.parameters && data.parameters.length > 0 && self.properties.parameters().length == 0) { // If new node with variables, give a hint by adding a parameter
 	      self.properties.parameters.push(ko.mapping.fromJS({'value': ''}));
 	    }
 	  }).fail(function (xhr, textStatus, errorThrown) {