-
Notifications
You must be signed in to change notification settings - Fork 405
feat: task ingest dialog #1685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: task ingest dialog #1685
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
c16b358
update style for oss of the failed task in the task panel
ee99d06
keep logic on click, remove unecessary useeffect
d3f05c1
fix padding
1d4f425
wip implementing Saas style
e1fa26d
utils to reshape error until backend provide info we need
1e5e7e3
utils to reshape error until backend provide info we need
550b759
utils to reshape error until backend provide info we need and fixinf …
4cadb5f
utils to reshape error until backend provide into
45d782c
have Saas style for failed and complete labelstatus and width and border
8a7b330
few style adjustment to follow codebase pattern
5984d90
adjust succeed and partially succeed case
a30991d
adding comment for TODO implementation or more clarity
0f877c2
Merge branch 'main' into task-panel-expend-error-style
Wallgau 8acdc31
Merge branch 'main' into task-ingest-dialog
357ca70
Introduce a modular TaskDialog for reviewing task files from the error
1246fa6
Merge branch 'main' into task-ingest-dialog
Wallgau d51cfe2
Backend
f418f5f
style: ruff autofix (auto)
autofix-ci[bot] f15efa0
Merge branch 'main' into task-ingest-dialog
Wallgau 4fff47b
lint fix and re-rendering in gridRows changes
42816a1
style: ruff autofix (auto)
autofix-ci[bot] 8a9b701
normalize task dialog styling with tokens and brand-aware surfaces:
b85bf44
style: ruff autofix (auto)
autofix-ci[bot] 7a3dbb1
adjust backend retry to work for connectors too
cb4722a
Treat disconnect / remote protocol errors as RETRYABLE Langflow fail…
12d6c26
addressed rabbit code comments
b3d1ad1
style: ruff autofix (auto)
autofix-ci[bot] bfec39a
addressed rabbit code comments
145773b
use regenerated-key retry safely
5e94758
Merge branch 'main' into task-ingest-dialog
Wallgau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| import { | ||
| type UseMutationOptions, | ||
| useMutation, | ||
| useQueryClient, | ||
| } from "@tanstack/react-query"; | ||
| import { taskDetailQueryKey } from "@/app/api/queries/useGetTaskQuery"; | ||
| import { TASKS_QUERY_KEY } from "@/app/api/queries/useGetTasksQuery"; | ||
|
|
||
| export interface RetryTaskRequest { | ||
| taskId: string; | ||
| /** When set, only these task file paths are retried. Omit to retry all failed RETRYABLE files. */ | ||
| filePaths?: string[]; | ||
| } | ||
|
|
||
| export interface RetryTaskSkippedFile { | ||
| file_path: string; | ||
| filename?: string; | ||
| reason: | ||
| | "not_retryable" | ||
| | "source_file_missing" | ||
| | "file_not_in_task" | ||
| | "not_failed" | ||
| | string; | ||
| } | ||
|
|
||
| export interface RetryTaskResponse { | ||
| task_id: string; | ||
| retried: number; | ||
| skipped: RetryTaskSkippedFile[]; | ||
| status: string; | ||
| message?: string; | ||
| error?: string; | ||
| } | ||
|
|
||
| export const useRetryTaskMutation = ( | ||
| options?: Omit< | ||
| UseMutationOptions<RetryTaskResponse, Error, RetryTaskRequest>, | ||
| "mutationFn" | ||
| >, | ||
| ) => { | ||
| const queryClient = useQueryClient(); | ||
|
|
||
| async function retryTask( | ||
| variables: RetryTaskRequest, | ||
| ): Promise<RetryTaskResponse> { | ||
| const body = JSON.stringify( | ||
| variables.filePaths != null ? { file_paths: variables.filePaths } : {}, | ||
| ); | ||
|
|
||
| const response = await fetch(`/api/tasks/${variables.taskId}/retry`, { | ||
| method: "POST", | ||
| headers: { "Content-Type": "application/json" }, | ||
| body, | ||
| }); | ||
|
|
||
| const payload = (await response | ||
| .json() | ||
| .catch(() => ({}))) as RetryTaskResponse; | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error( | ||
| payload.message || payload.error || "Failed to retry task files", | ||
| ); | ||
| } | ||
|
|
||
| return payload; | ||
| } | ||
|
|
||
| const { onSuccess, onError, onSettled, ...restOptions } = options ?? {}; | ||
|
|
||
| return useMutation({ | ||
| mutationFn: retryTask, | ||
| ...restOptions, | ||
| onSuccess: (data, variables, context) => { | ||
| queryClient.invalidateQueries({ queryKey: [...TASKS_QUERY_KEY] }); | ||
| queryClient.invalidateQueries({ | ||
| queryKey: taskDetailQueryKey(variables.taskId), | ||
| }); | ||
| onSuccess?.(data, variables, context); | ||
| }, | ||
| onError, | ||
| onSettled, | ||
| }); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { type UseQueryOptions, useQuery } from "@tanstack/react-query"; | ||
| import type { Task } from "@/app/api/queries/useGetTasksQuery"; | ||
| export const TASK_DETAIL_QUERY_KEY = ["tasks", "detail"] as const; | ||
|
|
||
| export function taskDetailQueryKey(taskId: string) { | ||
| return [...TASK_DETAIL_QUERY_KEY, taskId] as const; | ||
| } | ||
|
|
||
| export function useGetTaskQuery( | ||
| taskId: string | null, | ||
| options?: Omit<UseQueryOptions<Task | null>, "queryKey" | "queryFn">, | ||
| ) { | ||
| return useQuery({ | ||
| queryKey: taskId | ||
| ? taskDetailQueryKey(taskId) | ||
| : [...TASK_DETAIL_QUERY_KEY, "idle"], | ||
| queryFn: async (): Promise<Task | null> => { | ||
| if (!taskId) { | ||
| return null; | ||
| } | ||
| const response = await fetch(`/api/tasks/${taskId}/enhanced`); | ||
| if (response.status === 404) { | ||
| return null; | ||
| } | ||
| if (!response.ok) { | ||
| throw new Error("Failed to fetch task"); | ||
| } | ||
| return response.json() as Promise<Task>; | ||
| }, | ||
| ...options, | ||
| enabled: options?.enabled ?? !!taskId, | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.