Explorar o código

HUE-2343 [security] filechooser binding does not set the URI of a privilege

Passed new value to the valueAccessor in the binding
Enrico Berti %!s(int64=11) %!d(string=hai) anos
pai
achega
2b941bb
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      apps/security/static/js/common.ko.js

+ 3 - 2
apps/security/static/js/common.ko.js

@@ -128,11 +128,11 @@ ko.bindingHandlers.hivechooser = {
 ko.bindingHandlers.filechooser = {
   init: function(element, valueAccessor, allBindingsAccessor, vm) {
     var self = $(element);
-    self.after(getFileBrowseButton(self, true));
+    self.after(getFileBrowseButton(self, true, valueAccessor));
   }
 };
 
-function getFileBrowseButton(inputElement, selectFolder) {
+function getFileBrowseButton(inputElement, selectFolder, valueAccessor) {
   return $("<button>").addClass("btn").addClass("fileChooserBtn").text("..").click(function (e) {
     e.preventDefault();
     // check if it's a relative path
@@ -168,6 +168,7 @@ function getFileBrowseButton(inputElement, selectFolder) {
     function handleChoice(filePath) {
       inputElement.val("hdfs://" + filePath);
       inputElement.change();
+      valueAccessor()(inputElement.val());
     }
   });
 }