feat(workflows, runs, api): parameter metadata search/filter/display across workflows and runs (#3718)
Co-authored-by: Jonathan Dobson <jon.m.dobson@gmail.com>
This commit is contained in:
@@ -14,19 +14,27 @@ type Props = {
|
||||
workflowPermanentId?: string;
|
||||
statusFilters?: Array<Status>;
|
||||
page: number;
|
||||
search?: string;
|
||||
} & UseQueryOptions;
|
||||
|
||||
function useWorkflowRunsQuery({
|
||||
workflowPermanentId,
|
||||
statusFilters,
|
||||
page,
|
||||
search,
|
||||
...queryOptions
|
||||
}: Props) {
|
||||
const { data: globalWorkflows } = useGlobalWorkflowsQuery();
|
||||
const credentialGetter = useCredentialGetter();
|
||||
|
||||
return useQuery<Array<WorkflowRunApiResponse>>({
|
||||
queryKey: ["workflowRuns", { statusFilters }, workflowPermanentId, page],
|
||||
queryKey: [
|
||||
"workflowRuns",
|
||||
{ statusFilters },
|
||||
workflowPermanentId,
|
||||
page,
|
||||
search,
|
||||
],
|
||||
queryFn: async () => {
|
||||
const client = await getClient(credentialGetter);
|
||||
const params = new URLSearchParams();
|
||||
@@ -42,6 +50,9 @@ function useWorkflowRunsQuery({
|
||||
params.append("status", status);
|
||||
});
|
||||
}
|
||||
if (search) {
|
||||
params.append("search_key", search);
|
||||
}
|
||||
|
||||
return client
|
||||
.get(`/workflows/${workflowPermanentId}/runs`, {
|
||||
|
||||
Reference in New Issue
Block a user