feat: collect JSON and XML feeds
This commit is contained in:
@@ -265,16 +265,16 @@ await page.route('http://localhost:9150/api/v1/**', async (route) => {
|
||||
}
|
||||
if (url.pathname === '/api/v1/dataset-crons/sync') {
|
||||
await route.fulfill({
|
||||
status: 202,
|
||||
status: 200,
|
||||
json: visualDatasetSources.map((source, index) => ({
|
||||
id: `019b0000-0000-7000-8000-${String(70 + index).padStart(12, '0')}`,
|
||||
sourceId: source.id,
|
||||
schedule: '@once',
|
||||
status: 'pending',
|
||||
enabled: true,
|
||||
nextRunAt: new Date().toISOString(),
|
||||
lastRunAt: null,
|
||||
lastResult: '',
|
||||
status: 'completed',
|
||||
enabled: false,
|
||||
nextRunAt: null,
|
||||
lastRunAt: new Date().toISOString(),
|
||||
lastResult: 'format=rss fetched=2 inserted=0',
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
})),
|
||||
|
||||
@@ -231,12 +231,20 @@ export function WorkspaceExplorePage({
|
||||
try {
|
||||
const crons = await onQueueSync()
|
||||
if (crons.length === 0) {
|
||||
Message.info('暂无已启用的数据源')
|
||||
Message.info('暂无已启用的 RSS 数据源')
|
||||
} else {
|
||||
Message.success(`已提交 ${crons.length} 个采集任务`)
|
||||
const failed = crons.filter((cron) => cron.status === 'failed').length
|
||||
const [nextSources, nextItems] = await Promise.all([onListSources(), onListItems()])
|
||||
setSourceRecords(nextSources)
|
||||
setItems(nextItems)
|
||||
if (failed > 0) {
|
||||
Message.warning(`${crons.length - failed} 个数据源采集完成,${failed} 个失败`)
|
||||
} else {
|
||||
Message.success(`已完成 ${crons.length} 个数据源采集任务`)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
Message.error(error instanceof Error ? error.message : '同步任务提交失败')
|
||||
Message.error(error instanceof Error ? error.message : '数据源采集失败')
|
||||
} finally {
|
||||
setSyncing(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user