浏览代码

HUE-4688 [metastore] Authorize the selection of a directory in the create table from a file wizard

Romain Rigaux 9 年之前
父节点
当前提交
f6a3f88be8

+ 1 - 1
apps/beeswax/src/beeswax/forms.py

@@ -309,7 +309,7 @@ class CreateByImportFileForm(forms.Form):
   comment = forms.CharField(label=_t("Description"), required=False)
 
   # File info
-  path = PathField(label=_t("Input File or Location"))
+  path = PathField(label=_t("Input File or Directory"))
   load_data = forms.ChoiceField(required=True,
     choices=[
       ("IMPORT", _("Import data")),

+ 5 - 4
apps/beeswax/src/beeswax/templates/import_wizard_choose_file.mako

@@ -242,7 +242,6 @@ ${ assist.assistPanel() }
     }
 
     $(document).ready(function () {
-
       var options = {
         user: '${ user.username }',
         i18n: {
@@ -272,11 +271,12 @@ ${ assist.assistPanel() }
           onFileChoose: handleChoice,
           onFolderChoose: handleChoice,
           createFolder: $('#id_load_data').val() === 'EXTERNAL',
-          selectFolder: $('#id_load_data').val() === 'EXTERNAL',
+          selectFolder: true,
           displayOnlyFolders: $('#id_load_data').val() === 'EXTERNAL'
         });
         $("#chooseFile").modal("show");
       });
+
       $("#id_load_data").change(function () {
         if ($(this).val() === 'IMPORT') {
           $("#fileWillBeMoved").show();
@@ -285,6 +285,7 @@ ${ assist.assistPanel() }
           $("#fileWillBeMoved").hide();
         }
       });
+
       $('.pathChooser').change(function () {
         var initialLoadValue = $('#id_load_data').val();
         if ($(this).val().toLowerCase().indexOf('s3') === 0) {
@@ -294,10 +295,12 @@ ${ assist.assistPanel() }
           $('#id_load_data').val(initialLoadValue).trigger('change').find('option[value="IMPORT"]').removeAttr('disabled');
         }
       });
+
       $("#step2").click(function (e) {
         e.preventDefault();
         $("input[name='submit_file']").click();
       });
+
       $("body").keypress(function (e) {
         if (e.which == 13) {
           e.preventDefault();
@@ -307,8 +310,6 @@ ${ assist.assistPanel() }
 
     });
   });
-
 </script>
 
-
 ${ commonfooter(request, messages) | n,unicode }