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

Sync catalpa w/ apache #1

Merged
merged 15 commits into from
Aug 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ persistent=yes
load-plugins=

# Use multiple processes to speed up Pylint.
jobs=1
jobs=2

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
Expand Down
1 change: 1 addition & 0 deletions superset/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"classnames": "^2.2.5",
"d3": "^3.5.17",
"d3-cloud": "^1.2.1",
"d3-color": "^1.2.0",
"d3-hierarchy": "^1.1.5",
"d3-sankey": "^0.4.2",
"d3-svg-legend": "^1.x",
Expand Down
17 changes: 14 additions & 3 deletions superset/assets/src/explore/components/controls/SpatialControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default class SpatialControl extends React.Component {
};
this.toggleCheckbox = this.toggleCheckbox.bind(this);
this.onChange = this.onChange.bind(this);
this.renderReverseCheckbox = this.renderReverseCheckbox.bind(this);
}
componentDidMount() {
this.onChange();
Expand All @@ -75,6 +76,7 @@ export default class SpatialControl extends React.Component {
}
} else if (type === spatialTypes.geohash) {
value.geohashCol = this.state.geohashCol;
value.reverseCheckbox = this.state.reverseCheckbox;
if (!value.geohashCol) {
errors.push(errMsg);
}
Expand Down Expand Up @@ -120,6 +122,13 @@ export default class SpatialControl extends React.Component {
/>
);
}
renderReverseCheckbox() {
return (
<span>
{t('Reverse lat/long ')}
<Checkbox checked={this.state.reverseCheckbox} onChange={this.toggleCheckbox} />
</span>);
}
renderPopover() {
return (
<Popover id="filter-popover">
Expand Down Expand Up @@ -150,12 +159,11 @@ export default class SpatialControl extends React.Component {
>
<Row>
<Col md={6}>
Column
{t('Column')}
{this.renderSelect('lonlatCol', spatialTypes.delimited)}
</Col>
<Col md={6}>
{t('Reverse lat/long ')}
<Checkbox checked={this.state.reverseCheckbox} onChange={this.toggleCheckbox} />
{this.renderReverseCheckbox()}
</Col>
</Row>
</PopoverSection>
Expand All @@ -169,6 +177,9 @@ export default class SpatialControl extends React.Component {
Column
{this.renderSelect('geohashCol', spatialTypes.geohash)}
</Col>
<Col md={6}>
{this.renderReverseCheckbox()}
</Col>
</Row>
</PopoverSection>
<div className="clearfix">
Expand Down
19 changes: 17 additions & 2 deletions superset/assets/src/explore/controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -551,11 +551,13 @@ export const controls = {
'Italy',
'Portugal',
'Morocco',
'Myanmar',
'Netherlands',
'Russia',
'Singapore',
'Spain',
'Thailand',
'Timorleste',
'Uk',
'Ukraine',
'Usa',
Expand Down Expand Up @@ -838,6 +840,7 @@ export const controls = {

link_length: {
type: 'SelectControl',
renderTrigger: true,
freeForm: true,
label: t('Link Length'),
default: '200',
Expand All @@ -847,6 +850,7 @@ export const controls = {

charge: {
type: 'SelectControl',
renderTrigger: true,
freeForm: true,
label: t('Charge'),
default: '-500',
Expand Down Expand Up @@ -896,7 +900,7 @@ export const controls = {
time_grain_sqla: {
type: 'SelectControl',
label: t('Time Grain'),
default: control => control.choices && control.choices.length ? control.choices[0][0] : null,
default: 'P1D',
description: t('The time granularity for the visualization. This ' +
'applies a date transformation to alter ' +
'your time column and defines a new time granularity. ' +
Expand Down Expand Up @@ -1293,7 +1297,8 @@ export const controls = {
type: 'SelectControl',
label: t('Rotation'),
choices: formatSelectOptions(['random', 'flat', 'square']),
default: 'random',
renderTrigger: true,
default: 'square',
description: t('Rotation to apply to words in the cloud'),
},

Expand Down Expand Up @@ -1354,6 +1359,7 @@ export const controls = {
type: 'TextControl',
isInt: true,
label: t('Font Size From'),
renderTrigger: true,
default: '20',
description: t('Font size for the smallest value in the list'),
},
Expand All @@ -1362,6 +1368,7 @@ export const controls = {
type: 'TextControl',
isInt: true,
label: t('Font Size To'),
renderTrigger: true,
default: '150',
description: t('Font size for the biggest value in the list'),
},
Expand Down Expand Up @@ -1490,6 +1497,14 @@ export const controls = {
description: t('Whether to display the legend (toggles)'),
},

send_time_range: {
type: 'CheckboxControl',
label: t('Propagate'),
renderTrigger: true,
default: false,
description: t('Send range filter events to other charts'),
},

show_labels: {
type: 'CheckboxControl',
label: t('Show Labels'),
Expand Down
23 changes: 16 additions & 7 deletions superset/assets/src/explore/visTypes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const visTypes = {
expanded: true,
controlSetRows: [
['color_scheme'],
['show_brush', 'show_legend'],
['show_brush', 'send_time_range', 'show_legend'],
['rich_tooltip', 'show_markers'],
['line_interpolation'],
],
Expand Down Expand Up @@ -759,7 +759,8 @@ export const visTypes = {
{
label: t('Arc'),
controlSetRows: [
['color_picker', null],
['color_picker', 'legend_position'],
['dimension', 'color_scheme'],
['stroke_width', null],
],
},
Expand All @@ -773,6 +774,16 @@ export const visTypes = {
],
},
],
controlOverrides: {
dimension: {
label: t('Categorical Color'),
description: t('Pick a dimension from which categorical colors are defined'),
},
size: {
validators: [],
},
time_grain_sqla: timeGrainSqlaAnimationOverrides,
},
},

deck_scatter: {
Expand Down Expand Up @@ -937,9 +948,6 @@ export const visTypes = {
metrics: {
validators: [],
},
time_grain_sqla: {
default: null,
},
},
},

Expand Down Expand Up @@ -1042,9 +1050,9 @@ export const visTypes = {
label: t('Query'),
expanded: true,
controlSetRows: [
['series'],
['metric'],
['adhoc_filters'],
['series'],
['row_limit', null],
],
},
Expand Down Expand Up @@ -1247,6 +1255,7 @@ export const visTypes = {
['compare_lag', 'compare_suffix'],
['y_axis_format', null],
['show_trend_line', 'start_y_axis_at_zero'],
['color_picker', null],
],
},
],
Expand Down Expand Up @@ -1398,7 +1407,7 @@ export const visTypes = {
},

directed_force: {
label: t('Directed Force Layout'),
label: t('Force-directed Graph'),
controlPanelSections: [
{
label: t('Query'),
Expand Down
5 changes: 4 additions & 1 deletion superset/assets/src/visualizations/BigNumber.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import * as color from 'd3-color';
import { XYChart, AreaSeries, CrossHair, LinearGradient } from '@data-ui/xy-chart';

import { brandColor } from '../modules/colors';
Expand Down Expand Up @@ -230,12 +231,14 @@ BigNumberVis.defaultProps = defaultProps;
function adaptor(slice, payload) {
const { formData, containerId } = slice;
const { data, subheader, compare_suffix: compareSuffix } = payload.data;
const { r, g, b } = formData.color_picker;
const compareLag = Number(payload.data.compare_lag);
const supportTrendline = formData.viz_type === 'big_number';
const showTrendline = supportTrendline && formData.show_trend_line;
const startYAxisAtZero = formData.start_y_axis_at_zero;
const formatValue = d3FormatPreset(formData.y_axis_format);
const bigNumber = supportTrendline ? data[data.length - 1][1] : data[0][0];
const userColor = color.rgb(r, g, b).hex();

let percentChange = 0;
let formattedSubheader = subheader;
Expand Down Expand Up @@ -271,7 +274,7 @@ function adaptor(slice, payload) {
showTrendline={showTrendline}
startYAxisAtZero={startYAxisAtZero}
trendlineData={trendlineData}
mainColor={brandColor}
mainColor={userColor}
gradientId={`big_number_${containerId}`}
renderTooltip={renderTooltipFactory(formatValue)}
/>,
Expand Down
1 change: 1 addition & 0 deletions superset/assets/src/visualizations/Legend.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default class Legend extends React.PureComponent {
const vertical = this.props.position.charAt(0) === 't' ? 'top' : 'bottom';
const horizontal = this.props.position.charAt(1) === 'r' ? 'right' : 'left';
const style = {
position: 'absolute',
[vertical]: '0px',
[horizontal]: '10px',
};
Expand Down
8 changes: 6 additions & 2 deletions superset/assets/src/visualizations/PlaySlider.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.play-slider {
position: absolute;
bottom: -16px;
position: relative;
height: 20px;
width: 100%;
margin: 0;
}

.slider-selection {
Expand All @@ -21,3 +21,7 @@
color: #b3b3b3;
margin-right: 5px;
}

div.slider > div.tooltip.tooltip-main.top.in {
margin-left: 0 !important;
}
34 changes: 20 additions & 14 deletions superset/assets/src/visualizations/PlaySlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const propTypes = {
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
reversed: PropTypes.bool,
disabled: PropTypes.bool,
range: PropTypes.bool,
};

const defaultProps = {
Expand All @@ -30,6 +31,7 @@ const defaultProps = {
orientation: 'horizontal',
reversed: false,
disabled: false,
range: true,
};

export default class PlaySlider extends React.PureComponent {
Expand Down Expand Up @@ -84,15 +86,17 @@ export default class PlaySlider extends React.PureComponent {
this.setState({ intervalId: null });
}
step() {
if (this.props.disabled) {
const { start, end, step, values, disabled } = this.props;

if (disabled) {
return;
}
let values = this.props.values.map(value => value + this.increment);
if (values[1] > this.props.end) {
const cr = values[0] - this.props.start;
values = values.map(value => value - cr);
}
this.props.onChange(values);

const currentValues = Array.isArray(values) ? values : [values, values + step];
const nextValues = currentValues.map(value => value + this.increment);
const carriageReturn = (nextValues[1] > end) ? (nextValues[0] - start) : 0;

this.props.onChange(nextValues.map(value => value - carriageReturn));
}
formatter(values) {
if (this.props.disabled) {
Expand All @@ -108,6 +112,7 @@ export default class PlaySlider extends React.PureComponent {
return parts.map(value => (new Date(value)).toUTCString()).join(' : ');
}
render() {
const { start, end, step, orientation, reversed, disabled, range, values } = this.props;
return (
<Row className="play-slider">
<Col md={1} className="padded">
Expand All @@ -116,15 +121,16 @@ export default class PlaySlider extends React.PureComponent {
</Col>
<Col md={11} className="padded">
<ReactBootstrapSlider
value={this.props.values}
value={range ? values : values[0]}
range={range}
formatter={this.formatter}
change={this.onChange}
min={this.props.start}
max={this.props.end}
step={this.props.step}
orientation={this.props.orientation}
reversed={this.props.reversed}
disabled={this.props.disabled ? 'disabled' : 'enabled'}
min={start}
max={end}
step={step}
orientation={orientation}
reversed={reversed}
disabled={disabled ? 'disabled' : 'enabled'}
/>
</Col>
</Row>
Expand Down
Loading