diff --git a/docs/src/resources/openapi.json b/docs/src/resources/openapi.json index cdd51639054a..7913a24f6a8b 100644 --- a/docs/src/resources/openapi.json +++ b/docs/src/resources/openapi.json @@ -154,6 +154,10 @@ "description": "Should the layer be shown", "type": "boolean" }, + "showLabel": { + "description": "Should the label always be shown", + "type": "boolean" + }, "showMarkers": { "description": "Should markers be shown. Only applies to line annotations.", "type": "boolean" @@ -201,6 +205,7 @@ "required": [ "name", "show", + "showLabel", "showMarkers", "value" ], diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts index 019bad7096ab..63473a1b99cf 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts @@ -227,6 +227,7 @@ describe('Visualization > Line', () => { value: 'y=140000', overrides: { time_range: null }, show: false, + showLabel: false, titleColumn: '', descriptionColumns: [], timeColumn: '', @@ -263,6 +264,7 @@ describe('Visualization > Line', () => { value, overrides: { time_range: null }, show: true, + showLabel: false, titleColumn: 'ds', descriptionColumns: ['ds'], timeColumn: 'ds', diff --git a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx index e6d5fbe96803..e12ca06cc943 100644 --- a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx +++ b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx @@ -58,6 +58,7 @@ const propTypes = { value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), overrides: PropTypes.object, show: PropTypes.bool, + showLabel: PropTypes.bool, titleColumn: PropTypes.string, descriptionColumns: PropTypes.arrayOf(PropTypes.string), timeColumn: PropTypes.string, @@ -85,6 +86,7 @@ const defaultProps = { overrides: {}, colorScheme: 'd3Category10', show: true, + showLabel: false, titleColumn: '', descriptionColumns: [], timeColumn: '', @@ -111,6 +113,7 @@ export default class AnnotationLayer extends React.PureComponent { value, overrides, show, + showLabel, titleColumn, descriptionColumns, timeColumn, @@ -142,6 +145,7 @@ export default class AnnotationLayer extends React.PureComponent { value, overrides, show, + showLabel, // slice titleColumn, descriptionColumns, @@ -323,6 +327,7 @@ export default class AnnotationLayer extends React.PureComponent { 'value', 'overrides', 'show', + 'showLabel', 'titleColumn', 'descriptionColumns', 'timeColumn', @@ -689,7 +694,8 @@ export default class AnnotationLayer extends React.PureComponent { } render() { - const { isNew, name, annotationType, sourceType, show } = this.state; + const { isNew, name, annotationType, sourceType, show, showLabel } = + this.state; const isValid = this.isValidForm(); const metadata = getChartMetadataRegistry().get(this.props.vizType); const supportedAnnotationTypes = metadata @@ -725,6 +731,14 @@ export default class AnnotationLayer extends React.PureComponent { value={!show} onChange={v => this.setState({ show: !v })} /> + this.setState({ showLabel: v })} + />