فهرست منبع

HUE-6012 [metastore] Support dropping a single table in responsive

Romain Rigaux 8 سال پیش
والد
کامیت
372a0ad
2فایلهای تغییر یافته به همراه14 افزوده شده و 6 حذف شده
  1. 8 3
      apps/metastore/src/metastore/templates/metastore.mako
  2. 6 3
      desktop/core/src/desktop/templates/responsive.mako

+ 8 - 3
apps/metastore/src/metastore/templates/metastore.mako

@@ -607,7 +607,6 @@ ${ components.menubar() }
     % endif
     % if has_write_access:
       <a class="inactive-action" href="#dropSingleTable" data-toggle="modal" data-bind="tooltip: { placement: 'bottom', delay: 750 }, attr: { 'title' : tableDetails() && tableDetails().is_view ? '${_('Drop View')}' : '${_('Drop Table')}' }"><i class="fa fa-times fa-fw"></i></a>
-      ## 
     % endif
     <!-- ko if: tableDetails() -->
       <!-- ko if: tableDetails().partition_keys.length -->
@@ -1098,7 +1097,12 @@ ${ components.menubar() }
   </div>
 
   <div id="dropSingleTable" class="modal hide fade">
+    % if is_embeddable:
+    <form data-bind="submit: dropTables" method="POST">
+      <input type="hidden" name="is_embeddable" value="true"/>
+    % else:
     <form method="POST">
+    % endif
       ${ csrf_token(request) | n,unicode }
       <div class="modal-header">
         <a href="#" class="close" data-dismiss="modal">&times;</a>
@@ -1127,10 +1131,11 @@ ${ components.menubar() }
       success: function(resp) {
         if (resp.history_uuid) {
           huePubSub.publish('notebook.task.submitted', resp.history_uuid);
-        } else {
-          $(document).trigger("error", data.message);
+        } else if (resp && resp.message) {
+          $(document).trigger("error", resp.message);
         }
         $("#dropTable").modal('hide');
+        $("#dropSingleTable").modal('hide');
       },
       error: function (xhr, textStatus, errorThrown) {
         $(document).trigger("error", xhr.responseText);

+ 6 - 3
desktop/core/src/desktop/templates/responsive.mako

@@ -677,9 +677,12 @@ ${ assist.assistPanel() }
               self.currentApp('importer');
               self.getActiveAppViewModel(function (viewModel) {
                 var arguments = href.match(/\/indexer\/importer\/prefill\/?([^/]+)\/?([^/]+)\/?([^/]+)/);
-                viewModel.createWizard.prefill.source_type(arguments[1] ? arguments[1] : '');
-                viewModel.createWizard.prefill.target_type(arguments[2] ? arguments[2] : '');
-                viewModel.createWizard.prefill.target_path(arguments[3] ? arguments[3] : '');
+                if (! arguments) {
+                  console.warn('Could not match ' + href)
+                }
+                viewModel.createWizard.prefill.source_type(arguments && arguments[1] ? arguments[1] : '');
+                viewModel.createWizard.prefill.target_type(arguments && arguments[2] ? arguments[2] : '');
+                viewModel.createWizard.prefill.target_path(arguments && arguments[3] ? arguments[3] : '');
               })
           } else if (href.startsWith('/notebook')){
             self.currentApp('notebook');