refactor: move delete button into more button dropdown
This commit is contained in:
parent
e9b783f047
commit
70c60b5ee1
@ -94,14 +94,24 @@ export const MonitorInfo: React.FC<MonitorInfoProps> = React.memo((props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleDelete = useEvent(async () => {
|
const handleDelete = useEvent(async () => {
|
||||||
await deleteMutation.mutateAsync({
|
Modal.confirm({
|
||||||
workspaceId,
|
title: 'Warning',
|
||||||
monitorId,
|
content: 'Did you sure delete this monitor?',
|
||||||
|
okButtonProps: {
|
||||||
|
danger: true,
|
||||||
|
},
|
||||||
|
onOk: async () => {
|
||||||
|
await deleteMutation.mutateAsync({
|
||||||
|
workspaceId,
|
||||||
|
monitorId,
|
||||||
|
});
|
||||||
|
await trpcUtils.monitor.all.refetch();
|
||||||
|
|
||||||
|
navigate('/monitor', {
|
||||||
|
replace: true,
|
||||||
|
});
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
trpcUtils.monitor.all.refetch();
|
|
||||||
|
|
||||||
navigate('/monitor');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleClearEvents = useEvent(() => {
|
const handleClearEvents = useEvent(() => {
|
||||||
@ -205,13 +215,6 @@ export const MonitorInfo: React.FC<MonitorInfoProps> = React.memo((props) => {
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Popconfirm
|
|
||||||
title="Did you sure delete this monitor?"
|
|
||||||
onConfirm={handleDelete}
|
|
||||||
>
|
|
||||||
<Button danger={true}>Delete</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
|
|
||||||
<Dropdown
|
<Dropdown
|
||||||
trigger={['click']}
|
trigger={['click']}
|
||||||
placement="bottomRight"
|
placement="bottomRight"
|
||||||
@ -222,6 +225,15 @@ export const MonitorInfo: React.FC<MonitorInfoProps> = React.memo((props) => {
|
|||||||
label: 'Show Badge',
|
label: 'Show Badge',
|
||||||
onClick: () => setShowBadge(true),
|
onClick: () => setShowBadge(true),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'divider',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'delete',
|
||||||
|
label: 'Delete',
|
||||||
|
danger: true,
|
||||||
|
onClick: handleDelete,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user