Skip to content

Commit 0c5f623

Browse files
Revert "Merge branch 'upstream/master'"
This reverts commit adb66a3, reversing changes made to 6363e97. Conflicts: conf/zeppelin-site.xml.template zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
1 parent 5ad02a2 commit 0c5f623

File tree

3 files changed

+104
-3
lines changed

3 files changed

+104
-3
lines changed

zeppelin-web/src/app/notebook/paragraph/paragraph-chart-selector.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141
ng-click="setGraphMode('scatterChart', true)"><i class="cf cf-scatter-chart"></i>
4242
</button>
4343
</div>
44+
45+
<div id="{{paragraph.id}}_search"
46+
ng-if="paragraph.result.type == 'TABLE' && !asIframe && !viewOnly"
47+
class="btn-group"
48+
style='margin-bottom: 10px;'>
49+
<input type="search" class="form-control input-sm" id="{{paragraph.id}}_search_input" placeholder="Search records" >
50+
</div>
51+
4452
<span ng-if="getResultType()=='TABLE' && getGraphMode()!='table' && !asIframe && !viewOnly"
4553
style="margin-left:10px; cursor:pointer; display: inline-block; vertical-align:top; position: relative; line-height:30px;">
4654
<a class="btnText" ng-click="toggleGraphOption()">

zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ angular.module('zeppelinWebApp')
12411241

12421242
var renderTable = function() {
12431243
var html = '';
1244-
html += '<table class="table table-hover table-condensed">';
1244+
html += '<table class="table table-hover table-condensed compact display">';
12451245
html += ' <thead>';
12461246
html += ' <tr style="background-color: #F6F6F6; font-weight: bold;">';
12471247
for (var titleIndex in $scope.paragraph.result.columnNames) {
@@ -1252,7 +1252,7 @@ angular.module('zeppelinWebApp')
12521252
html += ' <tbody>';
12531253
for (var r in $scope.paragraph.result.msgTable) {
12541254
var row = $scope.paragraph.result.msgTable[r];
1255-
html += ' <tr>';
1255+
html += ' <tr>';
12561256
for (var index in row) {
12571257
var v = row[index].value;
12581258
if (getTableContentFormat(v) !== 'html') {
@@ -1268,14 +1268,68 @@ angular.module('zeppelinWebApp')
12681268
html += '</table>';
12691269

12701270
angular.element('#p' + $scope.paragraph.id + '_table').html(html);
1271+
var dataTableTitle = ($scope.paragraph.title && $scope.paragraph.title.trim()) ? $scope.paragraph.title.trim() : $scope.paragraph.id;
1272+
1273+
var oTable = angular.element('#p' + $scope.paragraph.id + '_table').children(1).DataTable({
1274+
paging: false,
1275+
info: false,
1276+
autoWidth: true,
1277+
lengthChange: false,
1278+
language: {
1279+
search: '_INPUT_',
1280+
searchPlaceholder: 'Search records'
1281+
},
1282+
dom : "<'row'<'col-sm-12't>>",
1283+
buttons: [
1284+
{
1285+
extend: 'csvHtml5',
1286+
text: 'TSV',
1287+
className: 'btn btn-default btn-sm',
1288+
title: dataTableTitle,
1289+
fieldSeparator: '\t',
1290+
extension: '.tsv',
1291+
exportOptions: {
1292+
modifier: {
1293+
search: 'none'
1294+
}
1295+
}
1296+
},
1297+
{
1298+
extend: 'csvHtml5',
1299+
text: 'CSV',
1300+
className: 'btn btn-default btn-sm',
1301+
title: dataTableTitle,
1302+
extension: '.csv',
1303+
exportOptions: {
1304+
modifier: {
1305+
search: 'none'
1306+
}
1307+
}
1308+
}
1309+
]
1310+
1311+
});
1312+
1313+
if($('#'+$scope.paragraph.id+'_switch').parent().parent().find(".btn-group").length <= 2 ){
1314+
oTable.buttons( 0, null ).containers().appendTo( '#'+$scope.paragraph.id+'_switch' );
1315+
}
1316+
1317+
$('#'+$scope.paragraph.id+'_search_input').keyup(function(){
1318+
oTable.search($(this).val()).draw() ;
1319+
});
1320+
//
1321+
12711322
if ($scope.paragraph.result.msgTable.length > 10000) {
12721323
angular.element('#p' + $scope.paragraph.id + '_table').css('overflow', 'scroll');
12731324
// set table height
12741325
var height = $scope.paragraph.config.graph.height;
12751326
angular.element('#p' + $scope.paragraph.id + '_table').css('height', height);
12761327
} else {
12771328
var dataTable = angular.element('#p' + $scope.paragraph.id + '_table .table');
1329+
var tableHead = dataTable.offset().top;
12781330
dataTable.floatThead({
1331+
position:'fixed',
1332+
top: tableHead+5000,
12791333
scrollContainer: function (dataTable) {
12801334
return angular.element('#p' + $scope.paragraph.id + '_table');
12811335
}

zeppelin-web/src/app/notebook/paragraph/paragraph.css

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,45 @@
4848
margin-bottom: 0;
4949
}
5050

51+
table.dataTable {
52+
/* clear: both; */
53+
margin-top: 0px !important;
54+
margin-bottom: 0px !important;
55+
top: 41px;
56+
/* max-width: none !important; */
57+
}
58+
.dropdown-menu {
59+
position: absolute;
60+
top: 100%;
61+
left: 0;
62+
z-index: @zindex-dropdown;
63+
display: none; // none by default, but block on "open" of the menu
64+
float: left;
65+
min-width: 50px;
66+
padding: 5px 0;
67+
margin: 2px 0 0; // override default ul
68+
list-style: none;
69+
font-size: @font-size-base;
70+
text-align: left;
71+
}
72+
73+
74+
div.dataTables_wrapper {
75+
overflow: hidden;
76+
padding-right: 10px;
77+
}
78+
79+
div.dataTables_filter input.form-control {
80+
width: 100%;
81+
}
82+
83+
a.buttons-collection {
84+
margin-left: 1em;
85+
}
86+
.paragraph p {
87+
margin: 0;
88+
}
89+
5190
.paragraph div svg {
5291
width: 100%;
5392
}
@@ -317,7 +356,7 @@
317356
}
318357

319358
.tableDisplay .btn-group span {
320-
margin: 10px 0 0 10px;
359+
margin: 10px 0 0 0px;
321360
font-size: 12px;
322361
}
323362
.tableDisplay .btn-group span a {

0 commit comments

Comments
 (0)