fix(ui) - reset drilldown filter
This commit is contained in:
parent
8c4f3b1155
commit
68c5700aa1
2 changed files with 15 additions and 4 deletions
|
|
@ -47,6 +47,12 @@ function WidgetChart(props: Props) {
|
|||
const isTableWidget = metric.metricType === 'table' && metric.viewType === 'table';
|
||||
const isPieChart = metric.metricType === 'table' && metric.viewType === 'pieChart';
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
dashboardStore.resetDrillDownFilter();
|
||||
}
|
||||
}, [])
|
||||
|
||||
const onChartClick = (event: any) => {
|
||||
if (event) {
|
||||
if (isTableWidget || isPieChart) { // get the filter of clicked row
|
||||
|
|
|
|||
|
|
@ -52,10 +52,7 @@ export default class DashboardStore {
|
|||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
|
||||
this.drillDownPeriod = Period({ rangeName: LAST_7_DAYS });
|
||||
const timeStamps = this.drillDownPeriod.toTimestamps();
|
||||
this.drillDownFilter.updateKey('startTimestamp', timeStamps.startTimestamp);
|
||||
this.drillDownFilter.updateKey('endTimestamp', timeStamps.endTimestamp);
|
||||
this.resetDrillDownFilter();
|
||||
}
|
||||
|
||||
get sortedDashboards() {
|
||||
|
|
@ -65,6 +62,14 @@ export default class DashboardStore {
|
|||
);
|
||||
}
|
||||
|
||||
resetDrillDownFilter() {
|
||||
this.drillDownFilter = new Filter();
|
||||
this.drillDownPeriod = Period({ rangeName: LAST_7_DAYS });
|
||||
const timeStamps = this.drillDownPeriod.toTimestamps();
|
||||
this.drillDownFilter.updateKey('startTimestamp', timeStamps.startTimestamp);
|
||||
this.drillDownFilter.updateKey('endTimestamp', timeStamps.endTimestamp);
|
||||
}
|
||||
|
||||
get filteredList() {
|
||||
const filterRE = this.filter.query ? getRE(this.filter.query, 'i') : null;
|
||||
return this.dashboards
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue