-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: reworked worklow definition page & added ui definition page (#2596
- Loading branch information
1 parent
1ca8635
commit ba6f631
Showing
13 changed files
with
125 additions
and
54 deletions.
There are no files selected for viewing
7 changes: 6 additions & 1 deletion
7
apps/workflows-dashboard/src/domains/ui-definitions/query-keys.ts
This file contains 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 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 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
49 changes: 49 additions & 0 deletions
49
apps/workflows-dashboard/src/pages/UIDefinition/UIDefinition.tsx
This file contains 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,49 @@ | ||
import { LoadingSpinner } from '@/components/atoms/LoadingSpinner'; | ||
import { DashboardLayout } from '@/components/layouts/DashboardLayout'; | ||
import { useUIDefinitionQuery } from '@/pages/UIDefinition/hooks/useUIDefinitionQuery'; | ||
import { UIDefinitionEditor } from '@/pages/WorkflowDefinition/components/UIDefinitionEditor'; | ||
import { isAxiosError } from 'axios'; | ||
import { Link, useParams } from 'react-router-dom'; | ||
|
||
export const UIDefinition = () => { | ||
const id = useParams<{ id: string }>().id; | ||
const { data, isLoading, error } = useUIDefinitionQuery({ uiDefinitionId: id! }); | ||
|
||
if (isLoading) { | ||
return ( | ||
<DashboardLayout pageName="Loading"> | ||
<div className="flex h-full w-full justify-center"> | ||
<LoadingSpinner /> | ||
</div> | ||
</DashboardLayout> | ||
); | ||
} | ||
|
||
if (isAxiosError(error)) { | ||
if (error.response?.status === 404) { | ||
return ( | ||
<DashboardLayout pageName="UI Definition"> | ||
<h1 className="flex flex-col gap-4">UI Definition not found.</h1> | ||
<h2> | ||
Back to{' '} | ||
<Link to="/ui-definitions"> | ||
<span className="underline">list.</span> | ||
</Link> | ||
</h2> | ||
</DashboardLayout> | ||
); | ||
} | ||
|
||
return ( | ||
<DashboardLayout pageName="UI Definition">Failed to fetch ui definition.</DashboardLayout> | ||
); | ||
} | ||
|
||
if (!data) return null; | ||
|
||
return ( | ||
<DashboardLayout pageName={`UI Definition - ${data?.id}`}> | ||
<UIDefinitionEditor uiDefinition={data} /> | ||
</DashboardLayout> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
apps/workflows-dashboard/src/pages/UIDefinition/hooks/useUIDefinitionQuery/index.ts
This file contains 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 @@ | ||
export * from './useUIDefinitionQuery'; |
17 changes: 17 additions & 0 deletions
17
...flows-dashboard/src/pages/UIDefinition/hooks/useUIDefinitionQuery/useUIDefinitionQuery.ts
This file contains 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,17 @@ | ||
import { GetUIDefinitionByIdDto, uiDefinitionsQueryKeys } from '@/domains/ui-definitions'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
export const useUIDefinitionQuery = (query: GetUIDefinitionByIdDto) => { | ||
const { isLoading, data, error } = useQuery({ | ||
...uiDefinitionsQueryKeys.get(query), | ||
// @ts-ignore | ||
retry: false, | ||
keepPreviousData: true, | ||
}); | ||
|
||
return { | ||
isLoading, | ||
data, | ||
error, | ||
}; | ||
}; |
This file contains 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 @@ | ||
export * from './UIDefinition'; |
This file contains 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 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 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 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 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
Submodule data-migrations
updated
from 624503 to 2808c6