Skip to content

Commit

Permalink
[logging] Add data_age for cached chart (#9121)
Browse files Browse the repository at this point in the history
* [logging] Add data_age for cached chart

* set data_age be null when is not cached data
  • Loading branch information
Grace Guo authored Feb 11, 2020
1 parent 2913063 commit a005e45
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions superset-frontend/src/chart/chartAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
/* eslint no-undef: 'error' */
/* eslint no-param-reassign: ["error", { "props": false }] */
import moment from 'moment';
import { t } from '@superset-ui/translation';
import { SupersetClient } from '@superset-ui/connection';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
Expand Down Expand Up @@ -254,6 +255,9 @@ export function exploreJSON(
has_extra_filters:
formData.extra_filters && formData.extra_filters.length > 0,
viz_type: formData.viz_type,
data_age: json.is_cached
? moment(new Date()).diff(moment.utc(json.cached_dttm))
: null,
}),
);
return dispatch(chartUpdateSucceeded(json, key));
Expand Down

0 comments on commit a005e45

Please sign in to comment.