mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 23:35:58 +08:00
refactor: added null check while searching for dashboard (#4421)
* refactor: added null check while searching for dashboard * refactor: flitering null value out * chore: removed extra space * refactor: remove unnecessary null check
This commit is contained in:
parent
204cad8448
commit
199d52b39f
@ -3,16 +3,16 @@ import { Dashboard } from 'types/api/dashboard/getAll';
|
||||
export const filterDashboard = (
|
||||
searchValue: string,
|
||||
dashboardList: Dashboard[],
|
||||
): any[] => {
|
||||
): Dashboard[] => {
|
||||
// Convert the searchValue to lowercase for case-insensitive search
|
||||
const searchValueLowerCase = searchValue.toLowerCase();
|
||||
|
||||
// Use the filter method to find matching objects
|
||||
return dashboardList.filter((item: Dashboard) => {
|
||||
// Convert each property value to lowercase for case-insensitive search
|
||||
const itemValues = Object.values(item?.data).map((value) =>
|
||||
value.toString().toLowerCase(),
|
||||
);
|
||||
const itemValues = Object.values(item?.data).map((value) => {
|
||||
if (value === null || value === undefined) return '';
|
||||
return value.toString().toLowerCase();
|
||||
});
|
||||
|
||||
// Check if any property value contains the searchValue
|
||||
return itemValues.some((value) => value.includes(searchValueLowerCase));
|
||||
|
Loading…
x
Reference in New Issue
Block a user