You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2017/11/11 00:10:14 UTC
[GitHub] graceguo-supercat closed pull request #3832: [Dashboard bug] fix the display for each chart's cache status and dttm.
graceguo-supercat closed pull request #3832: [Dashboard bug] fix the display for each chart's cache status and dttm.
URL: https://github.com/apache/incubator-superset/pull/3832
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/superset/assets/javascripts/dashboard/components/GridCell.jsx b/superset/assets/javascripts/dashboard/components/GridCell.jsx
index 1a59a92dd6..26d8eeb6ea 100644
--- a/superset/assets/javascripts/dashboard/components/GridCell.jsx
+++ b/superset/assets/javascripts/dashboard/components/GridCell.jsx
@@ -11,6 +11,8 @@ const propTypes = {
timeout: PropTypes.number,
datasource: PropTypes.object,
isLoading: PropTypes.bool,
+ isCached: PropTypes.bool,
+ cachedDttm: PropTypes.number,
isExpanded: PropTypes.bool,
widgetHeight: PropTypes.number,
widgetWidth: PropTypes.number,
@@ -78,8 +80,9 @@ class GridCell extends React.PureComponent {
render() {
const {
- exploreChartUrl, exportCSVUrl, isExpanded, isLoading, removeSlice, updateSliceName,
- toggleExpandSlice, forceRefresh, chartKey, slice, datasource, formData, timeout,
+ exploreChartUrl, exportCSVUrl, isExpanded, isLoading, isCached, cachedDttm,
+ removeSlice, updateSliceName, toggleExpandSlice, forceRefresh,
+ chartKey, slice, datasource, formData, timeout,
} = this.props;
return (
<div
@@ -92,6 +95,8 @@ class GridCell extends React.PureComponent {
exploreChartUrl={exploreChartUrl}
exportCSVUrl={exportCSVUrl}
isExpanded={isExpanded}
+ isCached={isCached}
+ cachedDttm={cachedDttm}
removeSlice={removeSlice}
updateSliceName={updateSliceName}
toggleExpandSlice={toggleExpandSlice}
diff --git a/superset/assets/javascripts/dashboard/components/GridLayout.jsx b/superset/assets/javascripts/dashboard/components/GridLayout.jsx
index 22d4b59c44..002d59b1bd 100644
--- a/superset/assets/javascripts/dashboard/components/GridLayout.jsx
+++ b/superset/assets/javascripts/dashboard/components/GridLayout.jsx
@@ -127,6 +127,45 @@ class GridLayout extends React.Component {
}
render() {
+ const cells = this.props.dashboard.slices.map((slice) => {
+ const chartKey = `slice_${slice.slice_id}`;
+ const currentChart = this.props.charts[chartKey];
+ const queryResponse = currentChart.queryResponse || {};
+ return (
+ <div
+ id={'slice_' + slice.slice_id}
+ key={slice.slice_id}
+ data-slice-id={slice.slice_id}
+ className={`widget ${slice.form_data.viz_type}`}
+ ref={this.getWidgetId(slice)}
+ >
+ <GridCell
+ slice={slice}
+ chartKey={chartKey}
+ datasource={this.props.datasources[slice.form_data.datasource]}
+ filters={this.props.filters}
+ formData={this.props.getFormDataExtra(slice)}
+ timeout={this.props.timeout}
+ widgetHeight={this.getWidgetHeight(slice)}
+ widgetWidth={this.getWidgetWidth(slice)}
+ exploreChartUrl={getExploreUrl(this.props.getFormDataExtra(slice))}
+ exportCSVUrl={getExploreUrl(this.props.getFormDataExtra(slice), 'csv')}
+ isExpanded={!!this.isExpanded(slice)}
+ isLoading={[undefined, 'loading'].indexOf(currentChart.chartStatus) !== -1}
+ isCached={queryResponse.is_cached}
+ cachedDttm={queryResponse.cached_dttm}
+ toggleExpandSlice={this.props.toggleExpandSlice}
+ forceRefresh={this.forceRefresh}
+ removeSlice={this.removeSlice}
+ updateSliceName={this.updateSliceName}
+ addFilter={this.props.addFilter}
+ getFilters={this.props.getFilters}
+ clearFilter={this.props.clearFilter}
+ removeFilter={this.props.removeFilter}
+ />
+ </div>);
+ });
+
return (
<ResponsiveReactGridLayout
className="layout"
@@ -140,39 +179,7 @@ class GridLayout extends React.Component {
useCSSTransforms
draggableHandle=".drag"
>
- {this.props.dashboard.slices.map(slice => (
- <div
- id={'slice_' + slice.slice_id}
- key={slice.slice_id}
- data-slice-id={slice.slice_id}
- className={`widget ${slice.form_data.viz_type}`}
- ref={this.getWidgetId(slice)}
- >
- <GridCell
- slice={slice}
- chartKey={'slice_' + slice.slice_id}
- datasource={this.props.datasources[slice.form_data.datasource]}
- filters={this.props.filters}
- formData={this.props.getFormDataExtra(slice)}
- timeout={this.props.timeout}
- widgetHeight={this.getWidgetHeight(slice)}
- widgetWidth={this.getWidgetWidth(slice)}
- exploreChartUrl={getExploreUrl(this.props.getFormDataExtra(slice))}
- exportCSVUrl={getExploreUrl(this.props.getFormDataExtra(slice), 'csv')}
- isExpanded={!!this.isExpanded(slice)}
- isLoading={[undefined, 'loading']
- .indexOf(this.props.charts['slice_' + slice.slice_id].chartStatus) !== -1}
- toggleExpandSlice={this.props.toggleExpandSlice}
- forceRefresh={this.forceRefresh}
- removeSlice={this.removeSlice}
- updateSliceName={this.updateSliceName}
- addFilter={this.props.addFilter}
- getFilters={this.props.getFilters}
- clearFilter={this.props.clearFilter}
- removeFilter={this.props.removeFilter}
- />
- </div>
- ))}
+ {cells}
</ResponsiveReactGridLayout>
);
}
diff --git a/superset/assets/javascripts/dashboard/components/SliceHeader.jsx b/superset/assets/javascripts/dashboard/components/SliceHeader.jsx
index d1a2d9ec94..8360017d44 100644
--- a/superset/assets/javascripts/dashboard/components/SliceHeader.jsx
+++ b/superset/assets/javascripts/dashboard/components/SliceHeader.jsx
@@ -11,6 +11,8 @@ const propTypes = {
exploreChartUrl: PropTypes.string,
exportCSVUrl: PropTypes.string,
isExpanded: PropTypes.bool,
+ isCached: PropTypes.bool,
+ cachedDttm: PropTypes.number,
formDataExtra: PropTypes.object,
removeSlice: PropTypes.func,
updateSliceName: PropTypes.func,
@@ -40,9 +42,9 @@ class SliceHeader extends React.PureComponent {
render() {
const slice = this.props.slice;
- const isCached = slice.is_cached;
+ const isCached = this.props.isCached;
const isExpanded = !!this.props.isExpanded;
- const cachedWhen = moment.utc(slice.cached_dttm).fromNow();
+ const cachedWhen = moment.utc(this.props.cachedDttm).fromNow();
const refreshTooltip = isCached ?
t('Served from data cached %s . Click to force refresh.', cachedWhen) :
t('Force refresh data');
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services