浏览代码

HUE-7531 [frontend] Allow double click to see detail on old dataTables too

Enrico Berti 8 年之前
父节点
当前提交
5ca296afc5

+ 1 - 1
apps/metastore/src/metastore/templates/metastore.mako

@@ -254,7 +254,7 @@ ${ components.menubar(is_embeddable) }
 </script>
 
 <script type="text/html" id="metastore-samples-table">
-  <table class="table table-condensed table-nowrap sample-table">
+  <table class="table table-condensed table-nowrap sample-table old-datatable">
     <thead>
       <tr>
         <th style="width: 1%">&nbsp;</th>

+ 8 - 2
desktop/core/src/desktop/templates/common_header_footer_components.mako

@@ -529,14 +529,20 @@ from metadata.conf import has_optimizer, OPTIMIZER
       hueAnalytics.convert('hue', 'pageReloaded' + window.location.pathname);
     }
 
-    huePubSub.subscribe('table.row.dblclick', function(data){
+    huePubSub.subscribe('table.row.dblclick', function (data) {
       var $el = $(data.table);
       var $t = $('#rowDetailsModal').find('table');
       $t.html('');
       var html = '';
       $el.find('thead th').each(function (colIdx, col) {
         if (colIdx > 0) {
-          var value = $el.data('data')[data.idx][colIdx];
+          var value = '';
+          if ($el.hasClass('old-datatable')) {
+            value = $el.dataTable().fnGetData(data.idx, colIdx);
+          }
+          else {
+            value = $el.data('data')[data.idx][colIdx];
+          }
           var link = typeof value == 'string' && value.match(/^https?:\/\//i) ? '<a href="' + escapeOutput(value) + '" target="_blank">' + value + ' <i class="fa fa-external-link"></i></a>' : value;
           html += '<tr><th width="10%">' + $(col).text() + '</th><td>' + link + '</td></tr>';
         }

+ 3 - 3
desktop/libs/indexer/src/indexer/templates/indexes.mako

@@ -402,7 +402,7 @@ ${ assist.assistPanel() }
 
     <!-- ko if: copyFields() && copyFields().length > 0 -->
     <h4>${ _('Copy Fields') }</h4>
-    <table class="table table-condensed table-nowrap sample-table">
+    <table class="table table-condensed table-nowrap sample-table old-datatable">
       <thead>
         <tr>
           <th>${ _('Destination') }</th>
@@ -433,7 +433,7 @@ ${ assist.assistPanel() }
 
   <!-- ko ifnot: $root.index().loadingSample -->
   <!-- ko if: $root.index().fields().length != 0 -->
-  <table class="table table-condensed table-nowrap sample-table">
+  <table class="table table-condensed table-nowrap sample-table old-datatable">
     <thead>
       <tr>
         <th style="width: 1%">&nbsp;</th>
@@ -457,7 +457,7 @@ ${ assist.assistPanel() }
 
   ## Schemaless collections
   <!-- ko if: $root.index().fields().length == 0 && $data.length > 0 -->
-  <table class="table table-condensed table-nowrap sample-table">
+  <table class="table table-condensed table-nowrap sample-table old-datatable">
     <thead>
       <tr>
         <th style="width: 1%">&nbsp;</th>