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