Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat: search capability is added on export panel (#3083)

Palash Gupta54899930b0c5
diff --git a/frontend/src/container/ExportPanel/ExportPanel.tsx b/frontend/src/container/ExportPanel/ExportPanel.tsx
index 80092c75dc..24e9ed210e 100644
--- a/frontend/src/container/ExportPanel/ExportPanel.tsx
+++ b/frontend/src/container/ExportPanel/ExportPanel.tsx
@@ -1,8 +1,7 @@
import { Button, Typography } from 'antd';
import createDashboard from 'api/dashboard/create';
-import axios from 'axios';
import { useGetAllDashboard } from 'hooks/dashboard/useGetAllDashboard';
-import { useNotifications } from 'hooks/useNotifications';
+import useAxiosError from 'hooks/useAxiosError';
import { useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useMutation } from 'react-query';
@@ -15,10 +14,9 @@ import {
Title,
Wrapper,
} from './styles';
-import { getSelectOptions } from './utils';
+import { filterOptions, getSelectOptions } from './utils';
function ExportPanel({ isLoading, onExport }: ExportPanelProps): JSX.Element {
- const { notifications } = useNotifications();
const { t } = useTranslation(['dashboard']);
const [selectedDashboardId, setSelectedDashboardId] = useState<string | null>(
@@ -31,21 +29,19 @@ function ExportPanel({ isLoading, onExport }: ExportPanelProps): JSX.Element {
refetch,
} = useGetAllDashboard();
+ const handleError = useAxiosError();
+
const {
mutate: createNewDashboard,
isLoading: createDashboardLoading,
} = useMutation(createDashboard, {
onSuccess: (data) => {
- onExport(data?.payload || null);
- refetch();
- },
- onError: (error) => {
- if (axios.isAxiosError(error)) {
- notifications.error({
- message: error.message,
- });
+ if (data.payload) {
+ onExport(data?.payload);
}
+ refetch();
},
+ onError: handleError,
});
const options = useMemo(() => getSelectOptions(data?.payload || []), [data]);
@@ -90,10 +86,12 @@ function ExportPanel({ isLoading, onExport }: ExportPanelProps): JSX.Element {
<DashboardSelect
placeholder="Select Dashboard"
options={options}
+ showSearch
loading={isDashboardLoading}
disabled={isDashboardLoading}
value={selectedDashboardId}
onSelect={handleSelect}
+ filterOption={filterOptions}
/>
<Button
type="primary"
diff --git a/frontend/src/container/ExportPanel/index.tsx b/frontend/src/container/ExportPanel/index.tsx
index c9c7d29383..467051cb3f 100644
--- a/frontend/src/container/ExportPanel/index.tsx
+++ b/frontend/src/container/ExportPanel/index.tsx
@@ -73,6 +73,7 @@ function ExportPanel({
onCancel={onCancel(false)}
open={isExport}
centered
+ destroyOnClose
>
<ExportPanelContainer
query={query}
diff --git a/frontend/src/container/ExportPanel/utils.ts b/frontend/src/container/ExportPanel/utils.ts
index 128de92324..f2d36a278b 100644
--- a/frontend/src/container/ExportPanel/utils.ts
+++ b/frontend/src/container/ExportPanel/utils.ts
@@ -8,3 +8,11 @@ export const getSelectOptions = (
label: data.title,
value: uuid,
}));
+
+export const filterOptions: SelectProps['filterOption'] = (
+ input,
+ options,
+): boolean =>
+ (options?.label?.toString() ?? '')
+ ?.toLowerCase()
+ .includes(input.toLowerCase());