mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-22 11:07:55 +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 ROUTES from 'constants/routes';
|
||||
import history from 'lib/history';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { Dashboard } from 'types/api/dashboard/getAll';
|
||||
import { Query } from 'types/api/queryBuilder/queryBuilderData';
|
||||
|
||||
import { MENU_KEY, MENU_LABEL } from './config';
|
||||
import ExportPanelContainer from './ExportPanel';
|
||||
|
||||
function ExportPanel({
|
||||
@ -28,45 +28,30 @@ function ExportPanel({
|
||||
);
|
||||
}, [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 => {
|
||||
onModalToggle(value);
|
||||
};
|
||||
|
||||
const onAddToDashboard = (): void => {
|
||||
setIsExport(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dropdown trigger={['click']} menu={menu}>
|
||||
<Button>Actions</Button>
|
||||
</Dropdown>
|
||||
<Space size={24}>
|
||||
<Button
|
||||
icon={<AreaChartOutlined />}
|
||||
onClick={onAddToDashboard}
|
||||
type="primary"
|
||||
>
|
||||
Add to Dashboard
|
||||
</Button>
|
||||
|
||||
<Button onClick={onCreateAlertsHandler} icon={<AlertOutlined />}>
|
||||
Setup Alerts
|
||||
</Button>
|
||||
</Space>
|
||||
|
||||
<Modal
|
||||
footer={null}
|
||||
onOk={onCancel(false)}
|
||||
@ -85,10 +70,6 @@ function ExportPanel({
|
||||
);
|
||||
}
|
||||
|
||||
interface OnClickProps {
|
||||
key: string;
|
||||
}
|
||||
|
||||
export interface ExportPanelProps {
|
||||
isLoading?: boolean;
|
||||
onExport: (dashboard: Dashboard | null) => void;
|
||||
|
Loading…
x
Reference in New Issue
Block a user