mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-09-21 11:53:13 +08:00
feat: export panel is updated (#3099)
Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
This commit is contained in:
parent
54899930b0
commit
e746bae8db
@ -1,9 +0,0 @@
|
|||||||
export const MENU_KEY = {
|
|
||||||
EXPORT: 'export',
|
|
||||||
CREATE_ALERTS: 'create-alerts',
|
|
||||||
};
|
|
||||||
|
|
||||||
export const MENU_LABEL = {
|
|
||||||
EXPORT: 'Export Panel',
|
|
||||||
CREATE_ALERTS: 'Create Alerts',
|
|
||||||
};
|
|
@ -1,12 +1,12 @@
|
|||||||
import { Button, Dropdown, MenuProps, Modal } from 'antd';
|
import { AlertOutlined, AreaChartOutlined } from '@ant-design/icons';
|
||||||
|
import { Button, Modal, Space } from 'antd';
|
||||||
import { queryParamNamesMap } from 'constants/queryBuilderQueryNames';
|
import { queryParamNamesMap } from 'constants/queryBuilderQueryNames';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { Dashboard } from 'types/api/dashboard/getAll';
|
import { Dashboard } from 'types/api/dashboard/getAll';
|
||||||
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
|
|
||||||
import { MENU_KEY, MENU_LABEL } from './config';
|
|
||||||
import ExportPanelContainer from './ExportPanel';
|
import ExportPanelContainer from './ExportPanel';
|
||||||
|
|
||||||
function ExportPanel({
|
function ExportPanel({
|
||||||
@ -28,45 +28,30 @@ function ExportPanel({
|
|||||||
);
|
);
|
||||||
}, [query]);
|
}, [query]);
|
||||||
|
|
||||||
const onMenuClickHandler: MenuProps['onClick'] = useCallback(
|
|
||||||
(e: OnClickProps) => {
|
|
||||||
if (e.key === MENU_KEY.EXPORT) {
|
|
||||||
onModalToggle(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.key === MENU_KEY.CREATE_ALERTS) {
|
|
||||||
onCreateAlertsHandler();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[onModalToggle, onCreateAlertsHandler],
|
|
||||||
);
|
|
||||||
|
|
||||||
const menu: MenuProps = useMemo(
|
|
||||||
() => ({
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
key: MENU_KEY.EXPORT,
|
|
||||||
label: MENU_LABEL.EXPORT,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: MENU_KEY.CREATE_ALERTS,
|
|
||||||
label: MENU_LABEL.CREATE_ALERTS,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
onClick: onMenuClickHandler,
|
|
||||||
}),
|
|
||||||
[onMenuClickHandler],
|
|
||||||
);
|
|
||||||
|
|
||||||
const onCancel = (value: boolean) => (): void => {
|
const onCancel = (value: boolean) => (): void => {
|
||||||
onModalToggle(value);
|
onModalToggle(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onAddToDashboard = (): void => {
|
||||||
|
setIsExport(true);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Dropdown trigger={['click']} menu={menu}>
|
<Space size={24}>
|
||||||
<Button>Actions</Button>
|
<Button
|
||||||
</Dropdown>
|
icon={<AreaChartOutlined />}
|
||||||
|
onClick={onAddToDashboard}
|
||||||
|
type="primary"
|
||||||
|
>
|
||||||
|
Add to Dashboard
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button onClick={onCreateAlertsHandler} icon={<AlertOutlined />}>
|
||||||
|
Setup Alerts
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
footer={null}
|
footer={null}
|
||||||
onOk={onCancel(false)}
|
onOk={onCancel(false)}
|
||||||
@ -85,10 +70,6 @@ function ExportPanel({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnClickProps {
|
|
||||||
key: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ExportPanelProps {
|
export interface ExportPanelProps {
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
onExport: (dashboard: Dashboard | null) => void;
|
onExport: (dashboard: Dashboard | null) => void;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user