修复删除日志命令

This commit is contained in:
whyour
2024-08-24 22:43:09 +08:00
parent 4e5ad6d5f3
commit 8b042d90f3
5 changed files with 47 additions and 42 deletions
+15 -17
View File
@@ -267,22 +267,7 @@ const Crontab = () => {
{
title: intl.get('关联订阅'),
width: 185,
render: (text, record: any) =>
record.sub_id ? (
<Name
service={() =>
request.get(`${config.apiPrefix}subscriptions/${record.sub_id}`, {
onError: noop,
})
}
options={{
ready: record?.sub_id,
cacheKey: record.sub_id,
}}
/>
) : (
'-'
),
render: (text, record: any) => record?.subscription?.name || '-',
},
{
title: intl.get('操作'),
@@ -392,14 +377,27 @@ const Crontab = () => {
}
request
.get(url)
.then(({ code, data: _data }) => {
.then(async ({ code, data: _data }) => {
if (code === 200) {
const { data, total } = _data;
const subscriptions = await request.get(
`${config.apiPrefix}subscriptions?ids=${JSON.stringify([
...new Set(data.map((x) => x.sub_id).filter(Boolean)),
])}`,
{
onError: noop,
},
);
const subscriptionMap = Object.fromEntries(
subscriptions?.data?.map((x) => [x.id, x]),
);
setValue(
data.map((x) => {
return {
...x,
nextRunTime: getCrontabsNextDate(x.schedule, x.extra_schedules),
subscription: subscriptionMap?.[x.sub_id],
};
}),
);