Skip to content

Commit

Permalink
[SIP-5] Refactor table (apache#5707)
Browse files Browse the repository at this point in the history
* update indent

* extract formData and data.

* take filter

* remove dependencies

* remove removeFilter

* add comment

* remove columnFormats and verboseMap from props. clarify a few more props

* fix linting issue

* minor syntax

* syntax fix

* Move check to adaptor

* update unit test

* remove code related to .widget

* rename variables for clarity

* move Option fix to browser.js
  • Loading branch information
kristw authored and williaster committed Aug 31, 2018
1 parent 5e3f833 commit 8a4b1b7
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 126 deletions.
4 changes: 4 additions & 0 deletions superset/assets/spec/helpers/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ global.navigator = {
appName: 'Netscape',
};

// Fix `Option is not defined`
// https://stackoverflow.com/questions/39501589/jsdom-option-is-not-defined-when-running-my-mocha-test
global.Option = window.Option;

// Configuration copied from https://github.com/sinonjs/sinon/issues/657
// allowing for sinon.fakeServer to work

Expand Down
10 changes: 3 additions & 7 deletions superset/assets/spec/javascripts/visualizations/table_spec.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { describe, it } from 'mocha';
import { expect } from 'chai';
import $ from 'jquery';

import '../../helpers/browser';
import { d3format } from '../../../src/modules/utils';

import tableVis from '../../../src/visualizations/table';

describe('table viz', () => {
Expand All @@ -18,10 +15,9 @@ describe('table viz', () => {
datasource: {
verbose_map: {},
},
getFilters: () => {},
d3format,
removeFilter: null,
addFilter: null,
getFilters: () => ({}),
removeFilter() {},
addFilter() {},
height: () => 0,
};
const basePayload = {
Expand Down
8 changes: 0 additions & 8 deletions superset/assets/src/chart/Chart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Tooltip } from 'react-bootstrap';

import { d3format } from '../modules/utils';
import ChartBody from './ChartBody';
import Loading from '../components/Loading';
import { Logger, LOG_ACTIONS_RENDER_CHART } from '../logger';
Expand Down Expand Up @@ -167,13 +166,6 @@ class Chart extends React.PureComponent {
);
}

d3format(col, number) {
const { datasource } = this.props;
const format = (datasource.column_formats && datasource.column_formats[col]) || '0.3s';

return d3format(format, number);
}

error(e) {
this.props.actions.chartRenderingFailed(e, this.props.chartId);
}
Expand Down
28 changes: 1 addition & 27 deletions superset/assets/src/visualizations/table.css
Original file line number Diff line number Diff line change
@@ -1,39 +1,13 @@
.slice-grid .widget.table .slice_container {
overflow: auto !important;
}

.slice_container.table table.table {
margin: 0px !important;
background: transparent;
background-color: white;
}

.widget.table td.filtered {
background-color: #005a63;
color: white;
}

.widget.table tr>th {
padding: 1px 5px !important;
font-size: small !important;
}

.widget.table tr>td {
padding: 1px 5px !important;
font-size: small !important;
}
table.table thead th.sorting:after, table.table thead th.sorting_asc:after, table.table thead th.sorting_desc:after {
top: 0px;
top: 0px;
}

.like-pre {
white-space: pre-wrap;
}

.widget.table {
width: auto;
max-width: unset;
}
.widget.table thead tr {
height: 25px;
}
Loading

0 comments on commit 8a4b1b7

Please sign in to comment.