Jelajahi Sumber

HUE-5288 [editor] Pressing enter key on the export results modal shouldn't open a file chooser

Enrico Berti 9 tahun lalu
induk
melakukan
e805d63

+ 2 - 2
desktop/core/src/desktop/templates/common_footer.mako

@@ -192,13 +192,13 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
 
 
   var _catchEnterKeyOnModals = false;
   var _catchEnterKeyOnModals = false;
 
 
-  $(".modal").on("shown", function () {
+  $(document).on("shown", ".modal", function () {
     _catchEnterKeyOnModals = true;
     _catchEnterKeyOnModals = true;
     // safe ux enhancement: focus on the first editable input
     // safe ux enhancement: focus on the first editable input
     $(".modal:visible").find('input:not(.disable-autofocus):visible:first').not($('.jHueFilechooserActions input')).focus();
     $(".modal:visible").find('input:not(.disable-autofocus):visible:first').not($('.jHueFilechooserActions input')).focus();
   });
   });
 
 
-  $(".modal").on("hidden", function () {
+  $(document).on("hidden", ".modal", function () {
     _catchEnterKeyOnModals = false;
     _catchEnterKeyOnModals = false;
   });
   });
 
 

+ 1 - 5
desktop/libs/notebook/src/notebook/static/notebook/css/notebook.css

@@ -714,12 +714,8 @@ input[type="text"].filechooser-input {
   margin-bottom: 0;
   margin-bottom: 0;
 }
 }
 
 
-.fileChooserBtn {
-  height: 31px;
-}
-
 #saveResultsForm .fileChooserBtn {
 #saveResultsForm .fileChooserBtn {
-  margin-top: -1px;
+  vertical-align: middle;
 }
 }
 
 
 table.airy tr td {
 table.airy tr td {

+ 3 - 2
desktop/libs/notebook/src/notebook/templates/notebook_ko_components.mako

@@ -361,7 +361,7 @@ except ImportError, e:
                    ${ _('A file (max %s cells)') % DOWNLOAD_CELL_LIMIT.get() }
                    ${ _('A file (max %s cells)') % DOWNLOAD_CELL_LIMIT.get() }
                 </label>
                 </label>
                 <div data-bind="visible: saveTarget() == 'hdfs-file'" class="inline">
                 <div data-bind="visible: saveTarget() == 'hdfs-file'" class="inline">
-                  <input data-bind="value: savePath, valueUpdate:'afterkeydown', filechooser: { value: savePath, isNestedModal: true }, filechooserOptions: { uploadFile: false, skipInitialPathIfEmpty: true }, hdfsAutocomplete: savePath" type="text" name="target_file" placeholder="${_('Path to CSV file')}" class="pathChooser margin-left-10">
+                  <input data-bind="value: savePath, valueUpdate:'afterkeydown', filechooser: { value: savePath, isNestedModal: true }, filechooserOptions: { uploadFile: false, skipInitialPathIfEmpty: true, linkMarkup: true }, hdfsAutocomplete: savePath" type="text" name="target_file" placeholder="${_('Path to CSV file')}" class="pathChooser margin-left-10">
                 </div>
                 </div>
                 <label class="radio" data-bind="visible: saveTarget() == 'hdfs-file'">
                 <label class="radio" data-bind="visible: saveTarget() == 'hdfs-file'">
                   <input data-bind="checked: saveOverwrite" type="checkbox" name="overwrite">
                   <input data-bind="checked: saveOverwrite" type="checkbox" name="overwrite">
@@ -376,7 +376,7 @@ except ImportError, e:
                   &nbsp;${ _('A file (large result)') }
                   &nbsp;${ _('A file (large result)') }
                 </label>
                 </label>
                 <div data-bind="visible: saveTarget() == 'hdfs-directory'" class="inline">
                 <div data-bind="visible: saveTarget() == 'hdfs-directory'" class="inline">
-                  <input data-bind="value: savePath, valueUpdate:'afterkeydown', filechooser: { value: savePath, isNestedModal: true }, filechooserOptions: { uploadFile: false, skipInitialPathIfEmpty: true, displayOnlyFolders: true }, hdfsAutocomplete: savePath" type="text" name="target_dir" placeholder="${_('Path to empty directory')}" class="pathChooser margin-left-10">
+                  <input data-bind="value: savePath, valueUpdate:'afterkeydown', filechooser: { value: savePath, isNestedModal: true }, filechooserOptions: { uploadFile: false, skipInitialPathIfEmpty: true, displayOnlyFolders: true, linkMarkup: true }, hdfsAutocomplete: savePath" type="text" name="target_dir" placeholder="${_('Path to empty directory')}" class="pathChooser margin-left-10">
                   <div class="inline-block" data-bind="tooltip: { title: '${ _ko("Use this option if you have a large result. It will rerun the entire query and save the results to the chosen HDFS directory.") }', placement: 'top' }" style="padding: 8px">
                   <div class="inline-block" data-bind="tooltip: { title: '${ _ko("Use this option if you have a large result. It will rerun the entire query and save the results to the chosen HDFS directory.") }', placement: 'top' }" style="padding: 8px">
                     <i class="fa fa-fw fa-question-circle muted"></i>
                     <i class="fa fa-fw fa-question-circle muted"></i>
                   </div>
                   </div>
@@ -448,6 +448,7 @@ except ImportError, e:
 
 
   <script type="text/javascript" charset="utf-8">
   <script type="text/javascript" charset="utf-8">
     (function () {
     (function () {
+
       function DownloadResultsViewModel (params, element) {
       function DownloadResultsViewModel (params, element) {
         var self = this;
         var self = this;
         self.$downloadForm = $(element).find(".download-form");
         self.$downloadForm = $(element).find(".download-form");