You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2019/05/15 00:52:07 UTC
[incubator-superset] 01/03: Revert "bugfix: improve 'Time Table'
(#6959)" (#7304)
This is an automated email from the ASF dual-hosted git repository.
michellet pushed a commit to branch release--0.32
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit abd4b267a2046cf9ef079ffdfb126929b3d668c5
Author: Kim Truong <47...@users.noreply.github.com>
AuthorDate: Tue Apr 16 10:32:43 2019 -0700
Revert "bugfix: improve 'Time Table' (#6959)" (#7304)
This reverts commit 9b4f5ad8e12c5f1a31929b874e9192143206fbd5.
(cherry picked from commit 154f6abf97f8bf115487c87be5b40ad867011d0f)
---
.../components/controls/CollectionControl.jsx | 11 +---
.../controls/TimeSeriesColumnControl.jsx | 63 +++++++++++-----------
.../assets/src/explore/controlPanels/TimeTable.js | 1 -
superset/assets/src/explore/controls.jsx | 1 -
superset/assets/src/utils/getClientErrorObject.js | 3 --
5 files changed, 32 insertions(+), 47 deletions(-)
diff --git a/superset/assets/src/explore/components/controls/CollectionControl.jsx b/superset/assets/src/explore/components/controls/CollectionControl.jsx
index a9e2d1b..35390e9 100644
--- a/superset/assets/src/explore/components/controls/CollectionControl.jsx
+++ b/superset/assets/src/explore/components/controls/CollectionControl.jsx
@@ -44,7 +44,6 @@ const propTypes = {
isFloat: PropTypes.bool,
isInt: PropTypes.bool,
controlName: PropTypes.string.isRequired,
- passthroughProps: PropTypes.arrayOf(PropTypes.string),
};
const defaultProps = {
@@ -56,7 +55,6 @@ const defaultProps = {
keyAccessor: o => o.key,
value: [],
addTooltip: 'Add an item',
- passthroughProps: [],
};
const SortableListGroupItem = SortableElement(ListGroupItem);
const SortableListGroup = SortableContainer(ListGroup);
@@ -86,13 +84,6 @@ export default class CollectionControl extends React.Component {
return <div className="text-muted">{this.props.placeholder}</div>;
}
const Control = controlMap[this.props.controlName];
-
- // Creating an object to pass the selected props to the children
- const passthroughPropsObj = {};
- this.props.passthroughProps.forEach((k) => {
- passthroughPropsObj[k] = this.props[k];
- });
-
return (
<SortableListGroup
useDragHandle
@@ -110,7 +101,7 @@ export default class CollectionControl extends React.Component {
</div>
<div className="pull-left">
<Control
- {...passthroughPropsObj}
+ {...this.props}
{...o}
onChange={this.onChange.bind(this, i)}
/>
diff --git a/superset/assets/src/explore/components/controls/TimeSeriesColumnControl.jsx b/superset/assets/src/explore/components/controls/TimeSeriesColumnControl.jsx
index dd8b88a..24ec401 100644
--- a/superset/assets/src/explore/components/controls/TimeSeriesColumnControl.jsx
+++ b/superset/assets/src/explore/components/controls/TimeSeriesColumnControl.jsx
@@ -22,7 +22,6 @@ import {
Row, Col, FormControl, OverlayTrigger, Popover,
} from 'react-bootstrap';
import Select from 'react-select';
-import { t } from '@superset-ui/translation';
import InfoTooltipWithTrigger from '../../../components/InfoTooltipWithTrigger';
import BoundsControl from './BoundsControl';
@@ -103,9 +102,9 @@ export default class TimeSeriesColumnControl extends React.Component {
<Popover id="ts-col-popo" title="Column Configuration">
<div style={{ width: 300 }}>
{this.formRow(
- t('Label'),
- t('The column header label'),
- 'row-label',
+ 'Label',
+ 'The column header label',
+ 'time-lag',
<FormControl
value={this.state.label}
onChange={this.onTextInputChange.bind(this, 'label')}
@@ -114,8 +113,8 @@ export default class TimeSeriesColumnControl extends React.Component {
/>,
)}
{this.formRow(
- t('Tooltip'),
- t('Column header tooltip'),
+ 'Tooltip',
+ 'Column header tooltip',
'col-tooltip',
<FormControl
value={this.state.tooltip}
@@ -125,8 +124,8 @@ export default class TimeSeriesColumnControl extends React.Component {
/>,
)}
{this.formRow(
- t('Type'),
- t('Type of comparison, value difference or percentage'),
+ 'Type',
+ 'Type of comparison, value difference or percentage',
'col-type',
<Select
value={this.state.colType}
@@ -137,8 +136,8 @@ export default class TimeSeriesColumnControl extends React.Component {
)}
<hr />
{this.state.colType === 'spark' && this.formRow(
- t('Width'),
- t('Width of the sparkline'),
+ 'Width',
+ 'Width of the sparkline',
'spark-width',
<FormControl
value={this.state.width}
@@ -148,8 +147,8 @@ export default class TimeSeriesColumnControl extends React.Component {
/>,
)}
{this.state.colType === 'spark' && this.formRow(
- t('Height'),
- t('Height of the sparkline'),
+ 'Height',
+ 'Height of the sparkline',
'spark-width',
<FormControl
value={this.state.height}
@@ -159,8 +158,8 @@ export default class TimeSeriesColumnControl extends React.Component {
/>,
)}
{['time', 'avg'].indexOf(this.state.colType) >= 0 && this.formRow(
- t('Time Lag'),
- t('Number of periods to compare against'),
+ 'Time Lag',
+ 'Number of periods to compare against',
'time-lag',
<FormControl
value={this.state.timeLag}
@@ -170,19 +169,19 @@ export default class TimeSeriesColumnControl extends React.Component {
/>,
)}
{['spark'].indexOf(this.state.colType) >= 0 && this.formRow(
- t('Time Ratio'),
- t('Number of periods to ratio against'),
+ 'Time Ratio',
+ 'Number of periods to ratio against',
'time-ratio',
<FormControl
value={this.state.timeRatio}
onChange={this.onTextInputChange.bind(this, 'timeRatio')}
bsSize="small"
- placeholder="Time Ratio"
+ placeholder="Time Lag"
/>,
)}
{this.state.colType === 'time' && this.formRow(
- t('Type'),
- t('Type of comparison, value difference or percentage'),
+ 'Type',
+ 'Type of comparison, value difference or percentage',
'comp-type',
<Select
value={this.state.comparisonType}
@@ -192,9 +191,9 @@ export default class TimeSeriesColumnControl extends React.Component {
/>,
)}
{this.state.colType === 'spark' && this.formRow(
- t('Show Y-axis'),
- t(
- 'Show Y-axis on the sparkline. Will display the manually set min/max if set or min/max values in the data otherwise.',
+ 'Show Y-axis',
+ (
+ 'Show Y-axis on the sparkline. Will display the manually set min/max if set or min/max values in the data otherwise.'
),
'show-y-axis-bounds',
<CheckboxControl
@@ -203,9 +202,9 @@ export default class TimeSeriesColumnControl extends React.Component {
/>,
)}
{this.state.colType === 'spark' && this.formRow(
- t('Y-axis bounds'),
- t(
- 'Manually set min/max values for the y-axis.',
+ 'Y-axis bounds',
+ (
+ 'Manually set min/max values for the y-axis.'
),
'y-axis-bounds',
<BoundsControl
@@ -214,11 +213,11 @@ export default class TimeSeriesColumnControl extends React.Component {
/>,
)}
{this.state.colType !== 'spark' && this.formRow(
- t('Color bounds'),
- t(
+ 'Color bounds',
+ (
`Number bounds used for color encoding from red to blue.
Reverse the numbers for blue to red. To get pure red or blue,
- you can enter either only min or max.`,
+ you can enter either only min or max.`
),
'bounds',
<BoundsControl
@@ -227,8 +226,8 @@ export default class TimeSeriesColumnControl extends React.Component {
/>,
)}
{this.formRow(
- t('Number format'),
- t('Optional d3 number format string'),
+ 'Number format',
+ 'Optional d3 number format string',
'd3-format',
<FormControl
value={this.state.d3format}
@@ -238,8 +237,8 @@ export default class TimeSeriesColumnControl extends React.Component {
/>,
)}
{this.state.colType === 'spark' && this.formRow(
- t('Date format'),
- t('Optional d3 date format string'),
+ 'Date format',
+ 'Optional d3 date format string',
'date-format',
<FormControl
value={this.state.dateFormat}
diff --git a/superset/assets/src/explore/controlPanels/TimeTable.js b/superset/assets/src/explore/controlPanels/TimeTable.js
index ad52d15..e62f57c 100644
--- a/superset/assets/src/explore/controlPanels/TimeTable.js
+++ b/superset/assets/src/explore/controlPanels/TimeTable.js
@@ -41,7 +41,6 @@ export default {
description: t(
"Templated link, it's possible to include {{ metric }} " +
'or other values coming from the controls.'),
- default: '',
},
},
};
diff --git a/superset/assets/src/explore/controls.jsx b/superset/assets/src/explore/controls.jsx
index ba4493e..d52c7d2 100644
--- a/superset/assets/src/explore/controls.jsx
+++ b/superset/assets/src/explore/controls.jsx
@@ -2313,7 +2313,6 @@ export const controls = {
description: t('Filter configuration for the filter box'),
validators: [],
controlName: 'FilterBoxItemControl',
- passthroughProps: ['datasource'],
mapStateToProps: ({ datasource }) => ({ datasource }),
},
diff --git a/superset/assets/src/utils/getClientErrorObject.js b/superset/assets/src/utils/getClientErrorObject.js
index ac5d327..8af1e54 100644
--- a/superset/assets/src/utils/getClientErrorObject.js
+++ b/superset/assets/src/utils/getClientErrorObject.js
@@ -50,9 +50,6 @@ export default function getClientErrorObject(response) {
resolve({ ...response, error: errorText });
});
});
- } else if (typeof (response) === 'object' && Object.keys(response).length === 0) {
- // Weird empty object that can get converted to string
- resolve({ ...response, error: String(response) });
} else {
// fall back to Response.statusText or generic error of we cannot read the response
resolve({ ...response, error: response.statusText || t('An error occurred') });