feat: connect inbox confirmation workflow
This commit is contained in:
@@ -3,6 +3,7 @@ import { ConfigProvider, Message, Spin } from '@arco-design/web-react'
|
||||
import '@arco-design/web-react/dist/css/arco.css'
|
||||
import '../App.css'
|
||||
import { login, setApiBaseUrl, type ApiSession } from '../api/client'
|
||||
import { analyzeInboxItem, confirmInboxItem } from '../api/inbox'
|
||||
import { mapWorkspace } from '../api/mappers'
|
||||
import {
|
||||
createCronPlan,
|
||||
@@ -229,6 +230,24 @@ function App() {
|
||||
Message.success('项目设置已更新')
|
||||
}
|
||||
|
||||
async function handleAnalyzeInbox(inboxId: string) {
|
||||
const response = await analyzeInboxItem(requireSession(), inboxId)
|
||||
return response.suggestions
|
||||
}
|
||||
|
||||
async function handleConfirmInbox(inboxId: string, suggestionIds: string[]) {
|
||||
const response = await confirmInboxItem(requireSession(), inboxId, suggestionIds)
|
||||
try {
|
||||
await refreshAfterAction()
|
||||
return { createdCount: response.createdCount }
|
||||
} catch {
|
||||
return {
|
||||
createdCount: response.createdCount,
|
||||
refreshError: '对象已创建,但工作区刷新失败,请稍后重新进入项目',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleSelectSearchResult(result: SearchResultDTO) {
|
||||
const target = searchResultTarget(result.type)
|
||||
if (!target) {
|
||||
@@ -296,6 +315,8 @@ function App() {
|
||||
onSearchQueryChange={workspaceSearch.onQueryChange}
|
||||
onSearch={() => void workspaceSearch.onSearch()}
|
||||
onSelectSearchResult={handleSelectSearchResult}
|
||||
onAnalyzeInbox={handleAnalyzeInbox}
|
||||
onConfirmInbox={handleConfirmInbox}
|
||||
/>
|
||||
) : (
|
||||
<Spin loading />
|
||||
|
||||
Reference in New Issue
Block a user