Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SIP-5] Refactor table #5707

Merged
merged 17 commits into from
Aug 31, 2018
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