Bladeren bron

HUE-7 [editor] Basic export to table name validation

Safari not supported for the visual hint.
Romain Rigaux 9 jaren geleden
bovenliggende
commit
fd8254b9f0

+ 1 - 1
desktop/core/src/desktop/templates/responsive.mako

@@ -117,7 +117,7 @@ ${ hueIcons.symbols() }
           % if 'search' in apps:
             <li><a href="javascript: void(0)" data-bind="click: function(){ onePageViewModel.currentApp('search') }"><i class="fa fa-fw fa-area-chart"></i> ${ _('Dashboard') }</a></li>
           % endif
-          <li><a href="javascript: void(0)" data-bind="click: function(){ onePageViewModel.currentApp('notebook') }"><i class="fa fa-fw fa-file-text-o inline-block"></i> ${ _('Report') }</a></li>
+          <li><a href="javascript: void(0)" data-bind="click: function(){ onePageViewModel.currentApp('notebook') }"><i class="fa fa-fw fa-file-text-o inline-block"></i> ${ _('Presentation') }</a></li>
           % if 'oozie' in apps:
           % if not user.has_hue_permission(action="disable_editor_access", app="oozie") or user.is_superuser:
             <li class="dropdown-submenu">

+ 5 - 5
desktop/libs/notebook/src/notebook/templates/notebook_ko_components.mako

@@ -256,7 +256,7 @@ except ImportError, e:
                   &nbsp;${ _('Table') }
                 </label>
                 <div data-bind="visible: saveTarget() == 'hive-table'" class="inline">
-                  <input data-bind="hivechooser: savePath" type="text" name="target_table" class="input-xlarge margin-left-10" placeholder="${_('Table name or <database>.<table>')}">
+                  <input data-bind="hivechooser: savePath" type="text" name="target_table" class="input-xlarge margin-left-10"  pattern="^[a-zA-Z0-9_]*$" title="${ _('Only alphanumeric and underscore characters') }" placeholder="${_('Table name or <database>.<table>')}">
                 </div>
               </div>
             </div>
@@ -278,7 +278,7 @@ except ImportError, e:
       </div>
       <div class="modal-footer">
         <button class="btn" data-dismiss="modal">${_('Cancel')}</button>
-        <button data-bind="click: trySaveResults, css: {'disabled': isPathEmpty}" class="btn btn-primary disable-feedback">${_('Save')}</button>
+        <button data-bind="click: trySaveResults, css: {'disabled': ! isValidDestination()}" class="btn btn-primary disable-feedback">${_('Save')}</button>
       </div>
     </div>
 
@@ -331,12 +331,12 @@ except ImportError, e:
 
         self.checkDownloadInterval = -1;
 
-        self.isPathEmpty = ko.pureComputed(function () {
-          return self.savePath() === '';
+        self.isValidDestination = ko.pureComputed(function () {
+          return self.savePath() !== '' && (self.saveTarget() != 'hive-table' || /^[a-zA-Z0-9_]*$/.test(self.savePath()));
         });
 
         self.trySaveResults = function () {
-          if (!self.isPathEmpty()) {
+          if (self.isValidDestination()) {
             self.saveResults();
             $("#saveResultsModal button.btn-primary").button('loading');
             $("#saveResultsModal .loader").show();