mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-18 04:05:56 +08:00
fix: update search logic in dashboard to search for title, description, tags (#4427)
This commit is contained in:
parent
0626081eee
commit
6d67ca72a0
@ -28,7 +28,11 @@ import AppReducer, { User } from 'types/reducer/app';
|
||||
import { extractDomain, isCloudUser, isEECloudUser } from 'utils/app';
|
||||
|
||||
import PrivateRoute from './Private';
|
||||
import defaultRoutes, { AppRoutes, SUPPORT_ROUTE } from './routes';
|
||||
import defaultRoutes, {
|
||||
AppRoutes,
|
||||
LIST_LICENSES,
|
||||
SUPPORT_ROUTE,
|
||||
} from './routes';
|
||||
|
||||
function App(): JSX.Element {
|
||||
const themeConfig = useThemeConfig();
|
||||
@ -150,6 +154,10 @@ function App(): JSX.Element {
|
||||
if (isCloudUserVal || isEECloudUser()) {
|
||||
const newRoutes = [...routes, SUPPORT_ROUTE];
|
||||
|
||||
setRoutes(newRoutes);
|
||||
} else {
|
||||
const newRoutes = [...routes, LIST_LICENSES];
|
||||
|
||||
setRoutes(newRoutes);
|
||||
}
|
||||
|
||||
|
@ -191,13 +191,6 @@ const routes: AppRoutes[] = [
|
||||
component: AllErrors,
|
||||
key: 'ALL_ERROR',
|
||||
},
|
||||
{
|
||||
path: ROUTES.LIST_LICENSES,
|
||||
exact: true,
|
||||
component: LicensePage,
|
||||
isPrivate: true,
|
||||
key: 'LIST_LICENSES',
|
||||
},
|
||||
{
|
||||
path: ROUTES.ERROR_DETAIL,
|
||||
exact: true,
|
||||
@ -320,6 +313,14 @@ export const SUPPORT_ROUTE: AppRoutes = {
|
||||
isPrivate: true,
|
||||
};
|
||||
|
||||
export const LIST_LICENSES: AppRoutes = {
|
||||
path: ROUTES.LIST_LICENSES,
|
||||
exact: true,
|
||||
component: LicensePage,
|
||||
isPrivate: true,
|
||||
key: 'LIST_LICENSES',
|
||||
};
|
||||
|
||||
export interface AppRoutes {
|
||||
component: RouteProps['component'];
|
||||
path: RouteProps['path'];
|
||||
|
@ -4,17 +4,24 @@ export const filterDashboard = (
|
||||
searchValue: string,
|
||||
dashboardList: Dashboard[],
|
||||
): Dashboard[] => {
|
||||
// Convert the searchValue to lowercase for case-insensitive search
|
||||
const searchValueLowerCase = searchValue.toLowerCase();
|
||||
// Use the filter method to find matching objects
|
||||
const searchValueLowerCase = searchValue?.toLowerCase();
|
||||
|
||||
// Filter by title, description, tags
|
||||
return dashboardList.filter((item: Dashboard) => {
|
||||
// Convert each property value to lowercase for case-insensitive search
|
||||
const itemValues = Object.values(item?.data).map((value) => {
|
||||
if (value === null || value === undefined) return '';
|
||||
return value.toString().toLowerCase();
|
||||
});
|
||||
const { title, description, tags } = item.data;
|
||||
const itemValuesNew = [title, description];
|
||||
|
||||
if (tags && tags.length > 0) {
|
||||
itemValuesNew.push(...tags);
|
||||
}
|
||||
|
||||
// Check if any property value contains the searchValue
|
||||
return itemValues.some((value) => value.includes(searchValueLowerCase));
|
||||
return itemValuesNew.some((value) => {
|
||||
if (value) {
|
||||
return value.toLowerCase().includes(searchValueLowerCase);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -199,10 +199,7 @@ function SideNav({
|
||||
|
||||
useEffect(() => {
|
||||
if (isCloudUser() || isEECloudUser()) {
|
||||
const updatedUserManagementMenuItems = [
|
||||
helpSupportMenuItem,
|
||||
manageLicenseMenuItem,
|
||||
];
|
||||
const updatedUserManagementMenuItems = [helpSupportMenuItem];
|
||||
|
||||
setUserManagementMenuItems(updatedUserManagementMenuItems);
|
||||
} else if (currentVersion && latestVersion) {
|
||||
|
@ -211,7 +211,6 @@ function DateTimeSelection({
|
||||
};
|
||||
|
||||
const onCustomDateHandler = (dateTimeRange: DateTimeRangeType): void => {
|
||||
console.log('dateTimeRange', dateTimeRange);
|
||||
if (dateTimeRange !== null) {
|
||||
const [startTimeMoment, endTimeMoment] = dateTimeRange;
|
||||
if (startTimeMoment && endTimeMoment) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user