fix: fix webhook ui

This commit is contained in:
JustSong
2024-11-10 18:02:18 +08:00
parent 981539b8e9
commit 109756674f

View File

@@ -1,5 +1,12 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Button, Form, Label, Pagination, Table, Popup } from 'semantic-ui-react'; import {
Button,
Form,
Label,
Pagination,
Popup,
Table,
} from 'semantic-ui-react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { API, copy, showError, showSuccess, showWarning } from '../helpers'; import { API, copy, showError, showSuccess, showWarning } from '../helpers';
@@ -239,36 +246,28 @@ const WebhooksTable = () => {
</Table.Cell> </Table.Cell>
<Table.Cell> <Table.Cell>
<div> <div>
<Popup content={webhookUrl} hoverable trigger={ <Popup
<Button content={webhookUrl}
size={'small'} hoverable
positive trigger={
onClick={async () => { <Button
if ( size={'small'}
await copy( positive
webhookUrl onClick={async () => {
) if (await copy(webhookUrl)) {
) { showSuccess('已复制到剪贴板!');
showSuccess('已复制到剪贴板!'); } else {
} else { showWarning('无法复制到剪贴板!');
showWarning('无法复制到剪贴板!'); }
} }}
}} >
> 复制 Webhook 链接
复制 Webhook 链接 </Button>
</Button> }
} /> />
<Button
size={'small'}
negative
onClick={() => {
manageWebhook(webhook.id, 'delete', idx).then();
}}
>
删除
</Button>
<Button <Button
size={'small'} size={'small'}
color={'yellow'}
onClick={() => { onClick={() => {
manageWebhook( manageWebhook(
webhook.id, webhook.id,
@@ -281,11 +280,32 @@ const WebhooksTable = () => {
</Button> </Button>
<Button <Button
size={'small'} size={'small'}
primary
as={Link} as={Link}
to={'/webhook/edit/' + webhook.id} to={'/webhook/edit/' + webhook.id}
> >
编辑 编辑
</Button> </Button>
<Popup
trigger={
<Button size='small' negative>
删除
</Button>
}
on='click'
flowing
hoverable
>
<Button
size={'small'}
negative
onClick={() => {
manageWebhook(webhook.id, 'delete', idx).then();
}}
>
删除 {webhook.name}
</Button>
</Popup>
</div> </div>
</Table.Cell> </Table.Cell>
</Table.Row> </Table.Row>