Преглед на файлове

HUE-5304 [indexer] Made mini sample table scroll horizontally and big sample table sortable with fixed headers

Enrico Berti преди 8 години
родител
ревизия
4e577ce090

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
apps/metastore/src/metastore/static/metastore/css/metastore.css


+ 1 - 1
apps/metastore/src/metastore/static/metastore/less/metastore.less

@@ -32,7 +32,7 @@
   border-bottom: none !important;
 }
 
-.sampleTable td, .sampleTable th, .table-nowrap td, .table-nowrap th {
+.sampleTable td, .sampleTable th {
   white-space: nowrap;
 }
 

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
desktop/core/src/desktop/static/desktop/css/hue.css


Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
desktop/core/src/desktop/static/desktop/css/hue3-extra.css


+ 4 - 0
desktop/core/src/desktop/static/desktop/less/components/hue-tables.less

@@ -545,3 +545,7 @@ div.box {
     margin-top: -12px;
   }
 }
+
+.table-nowrap td, .table-nowrap th {
+  white-space: nowrap;
+}

+ 67 - 2
desktop/libs/indexer/src/indexer/templates/indexes.mako

@@ -24,6 +24,10 @@
 <%namespace name="assist" file="/assist.mako" />
 <%namespace name="actionbar" file="actionbar.mako" />
 
+<%
+MAIN_SCROLLABLE = is_embeddable and ".page-content" or ".content-panel"
+%>
+
 %if not is_embeddable:
 ${ commonheader(_("Index Browser"), "search", user, request, "60px") | n,unicode }
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery-ui-1.10.4.custom.min.js') }"></script>
@@ -304,7 +308,7 @@ ${ assist.assistPanel() }
     </div>
 
     <div class="tab-pane" id="index-sample">
-      <!-- ko template: { if: $root.tab() == 'index-sample', name: 'indexes-index-sample', data: sample() }--><!-- /ko -->
+      <!-- ko template: { if: $root.tab() == 'index-sample', name: 'indexes-index-sample', data: sample(), full: true }--><!-- /ko -->
     </div>
   </div>
 </script>
@@ -321,7 +325,9 @@ ${ assist.assistPanel() }
 
     <br><br>
 
-    <!-- ko template: { name: 'indexes-index-sample', data: samplePreview }--><!-- /ko -->
+    <div style="overflow: auto">
+      <!-- ko template: { name: 'indexes-index-sample', data: samplePreview, full: false }--><!-- /ko -->
+    </div>
     <a class="pointer" data-bind="visible: sample().length > samplePreview().length, click: function() { $('li a[href=\'#index-sample\']').click(); }">
       ${_('View more...')}
     </a>
@@ -534,6 +540,65 @@ ${ assist.assistPanel() }
 
       self.section = ko.observable('list-indexes');
       self.tab = ko.observable('');
+      self.tab.subscribe(function(tab){
+        if (tab === 'index-sample'){
+          var selector = '#index-sample .sample-table';
+          % if conf.CUSTOM.BANNER_TOP_HTML.get():
+            var bannerTopHeight = 30;
+          % else:
+            var bannerTopHeight = 0;
+          % endif
+          if ($(selector).parents('.dataTables_wrapper').length == 0){
+            hueUtils.waitForRendered(selector, function(el){ return el.find('td').length > 0 }, function(){
+              $(selector).dataTable({
+                "bPaginate": false,
+                "bLengthChange": false,
+                "bInfo": false,
+                "bDestroy": true,
+                "bFilter": false,
+                "bAutoWidth": false,
+                "oLanguage": {
+                  "sEmptyTable": "${_('No data available')}",
+                  "sZeroRecords": "${_('No matching records')}"
+                },
+                "fnDrawCallback": function (oSettings) {
+                  $(selector).parents('.dataTables_wrapper').css('overflow-x', 'hidden');
+                  $(selector).jHueTableExtender2({
+                    fixedHeader: true,
+                    fixedFirstColumn: true,
+                    includeNavigator: false,
+                    parentId: 'index-sample',
+                    classToRemove: 'sample-table',
+                    mainScrollable: '${ MAIN_SCROLLABLE }',
+                    % if is_embeddable:
+                      stickToTopPosition: 51 + bannerTopHeight,
+                    % else:
+                      stickToTopPosition: 76 + bannerTopHeight,
+                    % endif
+                    clonedContainerPosition: 'fixed',
+                    app: 'indexes'
+                  });
+                  $(selector).jHueHorizontalScrollbar();
+                },
+                "aoColumnDefs": [
+                  {
+                    "sType": "numeric",
+                    "aTargets": [ "sort-numeric" ]
+                  },
+                  {
+                    "sType": "string",
+                    "aTargets": [ "sort-string" ]
+                  },
+                  {
+                    "sType": "date",
+                    "aTargets": [ "sort-date" ]
+                  }
+                ]
+              });
+            });
+          }
+        }
+      });
 
       self.indexes = ko.observableArray([]);
       self.alias = new Alias(self);

Някои файлове не бяха показани, защото твърде много файлове са промени