fix(dashboard): Make the View Chart In Explore menu option a link (#15668)

* hey look, it's a real anchor tag!

* get the explore chart url into the link

* add doc comments to the functions

* remove pointless test

* update weird tests

Co-authored-by: Evan Rusackas <evan@preset.io>
This commit is contained in:
David Aaron Suddjian
2021-07-14 14:12:20 -07:00
committed by GitHub
parent 5d86b8dde6
commit 985af72ac3
6 changed files with 56 additions and 69 deletions

View File

@@ -21,7 +21,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { styled } from '@superset-ui/core';
import { exploreChart, exportChart } from 'src/explore/exploreUtils';
import { exportChart, getExploreLongUrl } from 'src/explore/exploreUtils';
import ChartContainer from 'src/chart/ChartContainer';
import {
LOG_ACTIONS_CHANGE_DASHBOARD_FILTER,
@@ -110,7 +110,6 @@ export default class Chart extends React.Component {
this.changeFilter = this.changeFilter.bind(this);
this.handleFilterMenuOpen = this.handleFilterMenuOpen.bind(this);
this.handleFilterMenuClose = this.handleFilterMenuClose.bind(this);
this.exploreChart = this.exploreChart.bind(this);
this.exportCSV = this.exportCSV.bind(this);
this.exportFullCSV = this.exportFullCSV.bind(this);
this.forceRefresh = this.forceRefresh.bind(this);
@@ -221,13 +220,14 @@ export default class Chart extends React.Component {
this.props.unsetFocusedFilterField(chartId, column);
}
exploreChart() {
logExploreChart = () => {
this.props.logEvent(LOG_ACTIONS_EXPLORE_DASHBOARD_CHART, {
slice_id: this.props.slice.slice_id,
is_cached: this.props.isCached,
});
exploreChart(this.props.formData);
}
};
getChartUrl = () => getExploreLongUrl(this.props.formData);
exportCSV(isFullCSV = false) {
this.props.logEvent(LOG_ACTIONS_EXPORT_CSV_DASHBOARD_CHART, {
@@ -327,7 +327,8 @@ export default class Chart extends React.Component {
forceRefresh={this.forceRefresh}
editMode={editMode}
annotationQuery={chart.annotationQuery}
exploreChart={this.exploreChart}
logExploreChart={this.logExploreChart}
exploreUrl={this.getChartUrl()}
exportCSV={this.exportCSV}
exportFullCSV={this.exportFullCSV}
updateSliceName={updateSliceName}