Skip to content

Commit

Permalink
Changed the metrics Filter to show only the desired row after filtering
Browse files Browse the repository at this point in the history
Linting fixed
  • Loading branch information
ananya-agarwal committed Nov 15, 2024
1 parent 236c80c commit 0445e52
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions desktop/core/src/desktop/js/apps/admin/Metrics/MetricsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ const Metrics: React.FC = (): JSX.Element => {
return;
}

const filteredData = parseMetricsData(metrics).filter(tableData =>
tableData.dataSource.some(data => data.name.toLowerCase().includes(searchQuery.toLowerCase()))
);
const filteredData = parseMetricsData(metrics)
.map(tableData => ({
...tableData,
dataSource: tableData.dataSource.filter(data =>
data.name.toLowerCase().includes(searchQuery.toLowerCase())
)
}))
.filter(tableData => tableData.dataSource.length > 0);

setFilteredMetricsData(filteredData);
}, [searchQuery, metrics]);
Expand Down

0 comments on commit 0445e52

Please sign in to comment.