mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-17 16:06:38 +08:00
修复渠道管理没有测试按钮的bug
This commit is contained in:
parent
d6ce413c92
commit
655722641b
@ -165,6 +165,7 @@ const ChannelsTable = () => {
|
|||||||
dataIndex: 'operate',
|
dataIndex: 'operate',
|
||||||
render: (text, record, index) => (
|
render: (text, record, index) => (
|
||||||
<div>
|
<div>
|
||||||
|
<Button theme='light' type='primary' style={{marginRight: 1}} onClick={()=>testChannel(record)}>测试</Button>
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="确定是否要删除此渠道?"
|
title="确定是否要删除此渠道?"
|
||||||
content="此修改将不可逆"
|
content="此修改将不可逆"
|
||||||
@ -415,16 +416,15 @@ const ChannelsTable = () => {
|
|||||||
setSearching(false);
|
setSearching(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const testChannel = async (id, name, idx) => {
|
const testChannel = async (record) => {
|
||||||
const res = await API.get(`/api/channel/test/${id}/`);
|
const res = await API.get(`/api/channel/test/${record.id}/`);
|
||||||
const {success, message, time} = res.data;
|
const {success, message, time} = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
let newChannels = [...channels];
|
let newChannels = [...channels];
|
||||||
let realIdx = (activePage - 1) * pageSize + idx;
|
record.response_time = time * 1000;
|
||||||
newChannels[realIdx].response_time = time * 1000;
|
record.test_time = Date.now() / 1000;
|
||||||
newChannels[realIdx].test_time = Date.now() / 1000;
|
|
||||||
setChannels(newChannels);
|
setChannels(newChannels);
|
||||||
showInfo(`通道 ${name} 测试成功,耗时 ${time.toFixed(2)} 秒。`);
|
showInfo(`通道 ${record.name} 测试成功,耗时 ${time.toFixed(2)} 秒。`);
|
||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user