Skip to content

Commit

Permalink
Get workflow rest api (#668)
Browse files Browse the repository at this point in the history
* group history events

* timeline load more

* Initialize Queries UI (#665)

* Init commit

* more commit

* Add more changes

* Add tests

* clean up code

* Init queries UI

* Add unit tests

* Fix unsaved merge conflict

* Fix tests and merge conflicts again

* update snapshot

* Fix snapshot

* Reorder some props in tile

* resolve comments

* Fix tests

* Fix tests and make design responsive

* Remove snapshots

* Update tests for tile input

* get workflow rest api

* add type to decaode url param

* add 404 case and fix typo

* Timeline load more component (#667)

* group history events

* timeline load more

* Initialize Queries UI (#665)

* Init commit

* more commit

* Add more changes

* Add tests

* clean up code

* Init queries UI

* Add unit tests

* Fix unsaved merge conflict

* Fix tests and merge conflicts again

* update snapshot

* Fix snapshot

* Reorder some props in tile

* resolve comments

* Fix tests

* Fix tests and make design responsive

* Remove snapshots

* Update tests for tile input

* fix retry link spacing

* fix lint

---------

Co-authored-by: Adhitya Mamallan <[email protected]>

* Timeline group component (#669)

* group history events

* timeline load more

* Initialize Queries UI (#665)

* Init commit

* more commit

* Add more changes

* Add tests

* clean up code

* Init queries UI

* Add unit tests

* Fix unsaved merge conflict

* Fix tests and merge conflicts again

* update snapshot

* Fix snapshot

* Reorder some props in tile

* resolve comments

* Fix tests

* Fix tests and make design responsive

* Remove snapshots

* Update tests for tile input

* get workflow rest api

* add type to decaode url param

* timeline group component

* add animations

* lint fix

---------

Co-authored-by: Adhitya Mamallan <[email protected]>

---------

Co-authored-by: Adhitya Mamallan <[email protected]>
Co-authored-by: Assem Hafez <[email protected]>
  • Loading branch information
3 people authored Sep 20, 2024
1 parent b693a19 commit 8511def
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
18 changes: 16 additions & 2 deletions src/route-handlers/get-workflow-history/get-workflow-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import {
type RouteParams,
type RequestParams,
} from './get-workflow-history.types';
import getWorkflowHistoryQueryParamSchema from './schemas/get-workflow-history-query-params-schema';
import getWorkflowHistoryQueryParamsSchema from './schemas/get-workflow-history-query-params-schema';

export default async function getWorkflowHistory(
request: NextRequest,
requestParams: RequestParams
) {
const decodedParams = decodeUrlParams<RouteParams>(requestParams.params);
const { data: queryParams, error } =
getWorkflowHistoryQueryParamSchema.safeParse(
getWorkflowHistoryQueryParamsSchema.safeParse(
Object.fromEntries(request.nextUrl.searchParams)
);

Expand Down Expand Up @@ -49,6 +49,20 @@ export default async function getWorkflowHistory(

return Response.json(res);
} catch (e) {
if (
e instanceof GRPCError &&
e.message ===
'Requested workflow history not found, may have passed retention period.'
) {
return NextResponse.json(
{
message: 'Workflow not found',
cause: e,
},
{ status: 404 }
);
}

logger.error<RouteHandlerErrorPayload>(
{ requestParams: decodedParams, cause: e },
'Error fetching workflow history'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from 'zod';

const getWorkflowHistoryQueryParamSchema = z.object({
const getWorkflowHistoryQueryParamsSchema = z.object({
pageSize: z
.string()
.transform((val) => parseInt(val, 10))
Expand All @@ -16,4 +16,4 @@ const getWorkflowHistoryQueryParamSchema = z.object({
.optional(),
});

export default getWorkflowHistoryQueryParamSchema;
export default getWorkflowHistoryQueryParamsSchema;

0 comments on commit 8511def

Please sign in to comment.