Skip to content

Commit

Permalink
Merge pull request #28 from andres-rubio-go/revert-sort-column-series…
Browse files Browse the repository at this point in the history
…-order

Revert sort column series order changes.
  • Loading branch information
AnnaSerova authored Aug 22, 2023
2 parents e517a0f + cf14e06 commit bd92f40
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 30 deletions.
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 1. Install ns-beautify using `npm install -g js-beautify`
#
# 2. Define the following textconv in your global ~/.gitconfig to make use of it.
#
# [diff "minjs"]
# textconv = js-beautify
# cachetextconv = true
# [diff "mincss"]
# textconv = js-beautify --css
# cachetextconv = true
#
# 3. Uncomment the following lines to use the textconv to diff your JS and CSS.
#*.js diff=minjs
#*.css diff=mincss
4 changes: 2 additions & 2 deletions report_table.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion report_table.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/layout_auto.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#visContainer {
position: absolute;
z-index: 0;
}

#visSvg {
position: absolute;
z-index: 1;
}

Expand Down
2 changes: 0 additions & 2 deletions src/layout_fixed.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#visContainer {
position: absolute;
z-index: 0;
}

#visSvg {
position: absolute;
z-index: 1;
}

Expand Down
37 changes: 21 additions & 16 deletions src/report_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,11 @@ const buildReportTable = function (
.append('tr')
.selectAll('th')
.data((level, i) =>
sortByColumnSeries(dataTable.getTableHeaderCells(i)).map(
column => column.levels[i]
)
dataTable.getTableHeaderCells(i).map(column => column.levels[i])
)
// FIXME: This breaks a lot of stuff. We need to fix this feature
// before making a release.
// .data((level, i) => sortByColumnSeries(dataTable.getTableHeaderCells(i)).map( column => column.levels[i]))
.enter();

header_cells
Expand Down Expand Up @@ -285,10 +286,13 @@ const buildReportTable = function (
})
.selectAll('td')
.data(row =>
sortByColumnSeries(dataTable.getTableRowColumns(row)).map(
column => row.data[column.id]
)
dataTable.getTableRowColumns(row).map(column => row.data[column.id])
)
// .data(row =>
// sortByColumnSeries(dataTable.getTableRowColumns(row)).map(
// column => row.data[column.id]
// )
// )
.enter();

table_rows
Expand Down Expand Up @@ -591,16 +595,17 @@ looker.plugins.visualizations.add({
this.clearErrors();

// empty pivot(s)...no measures
if (
queryResponse.fields.pivots.length > 0 &&
queryResponse.fields.measures.length === 0
) {
this.addError({
title: 'Empty Pivot(s)',
message: 'Add a measure or table calculation to pivot on.',
});
return;
}
// FIXME: temporarily disabled until we test this feature.
// if (
// queryResponse.fields.pivots.length > 0 &&
// queryResponse.fields.measures.length === 0
// ) {
// this.addError({
// title: 'Empty Pivot(s)',
// message: 'Add a measure or table calculation to pivot on.',
// });
// return;
// }

// max pivot check
if (queryResponse.fields.pivots.length > 2) {
Expand Down
29 changes: 22 additions & 7 deletions src/vis_table_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,28 @@ class VisPluginTableModel {
this.headers.push({type: 'pivot' + i, modelField: pivot_field});
});

var measureHeaders = [];
if (!this.transposeTable || queryResponse.fields.measures.length > 0) {
measureHeaders.push({
type: 'field',
modelField: {label: '(will be replaced by field for column)'},
});
}
var measureHeaders = this.useHeadings
? [
{
type: 'heading',
modelField: {label: '(will be replaced by header for column)s'},
},
]
: [];

measureHeaders.push({
type: 'field',
modelField: {label: '(will be replaced by field for column)'},
});

// FIXME: test this feature before making a release.
// var measureHeaders = [];
// if (!this.transposeTable || queryResponse.fields.measures.length > 0) {
// measureHeaders.push({
// type: 'field',
// modelField: { label: '(will be replaced by field for column)' },
// });
// }

if (this.sortColsBy === 'pivots') {
this.headers.push(...measureHeaders);
Expand Down

0 comments on commit bd92f40

Please sign in to comment.