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
14 changes: 7 additions & 7 deletions superset/assets/spec/javascripts/visualizations/table_spec.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
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';

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it'd be useful to put this into the spec/helpers/browser.js file, that's where other things like this currently are. but once we move to packages, this type of config should be specific to each package.


describe('table viz', () => {
const div = '<div id="slice-container"><div class="dataTables_wrapper"></div></div>';
const baseSlice = {
Expand All @@ -18,10 +19,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
18 changes: 10 additions & 8 deletions superset/assets/src/visualizations/table.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.slice-grid .widget.table .slice_container {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly good news: anything with .widget I think can be removed. this is what grid cells on the old dashboard used to be called.

overflow: auto !important;
overflow: auto !important;
}

.slice_container.table table.table {
Expand All @@ -9,21 +9,22 @@
}

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

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

.widget.table tr>td {
padding: 1px 5px !important;
font-size: small !important;
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 {
Expand All @@ -34,6 +35,7 @@ table.table thead th.sorting:after, table.table thead th.sorting_asc:after, tabl
width: auto;
max-width: unset;
}

.widget.table thead tr {
height: 25px;
}
Loading