11import React , { startTransition } from "react" ;
2- import { FlowType , NamespaceProject } from "@code0-tech/sagittarius-graphql-types" ;
2+ import { FlowType , Namespace , NamespaceProject } from "@code0-tech/sagittarius-graphql-types" ;
33import { IconArrowDown , IconArrowUp , IconCornerDownLeft , IconFile } from "@tabler/icons-react" ;
44import {
55 Badge ,
@@ -10,7 +10,8 @@ import {
1010 DialogContent ,
1111 DialogOverlay ,
1212 DialogPortal ,
13- Flex , hashToColor ,
13+ Flex ,
14+ hashToColor ,
1415 InputDescription ,
1516 InputLabel ,
1617 InputMessage ,
@@ -34,6 +35,7 @@ import {useParams, useRouter} from "next/navigation";
3435import { ProjectService } from "@edition/project/services/Project.service" ;
3536import { RuntimeService } from "@edition/runtime/services/Runtime.service" ;
3637import { FlowService } from "@edition/flow/services/Flow.service" ;
38+ import Link from "next/link" ;
3739
3840export interface FlowCreateDialogComponentProps {
3941 open ?: boolean
@@ -55,6 +57,8 @@ export const FlowCreateDialogComponent: React.FC<FlowCreateDialogComponentProps>
5557 const runtimeService = useService ( RuntimeService )
5658 const runtimeStore = useStore ( RuntimeService )
5759
60+ const namespaceIndex = params . namespaceId as any as number
61+ const namespaceId : Namespace [ 'id' ] = `gid://sagittarius/Namespace/${ namespaceIndex } `
5862 const projectIndex = params . projectId as any as number
5963 const projectId : NamespaceProject [ 'id' ] = `gid://sagittarius/NamespaceProject/${ projectIndex } `
6064
@@ -76,7 +80,7 @@ export const FlowCreateDialogComponent: React.FC<FlowCreateDialogComponentProps>
7680 )
7781
7882 const primaryRuntime = React . useMemo (
79- ( ) => runtimeService . values ( { namespaceId : project ?. namespace ?. id } ) . find ( runtime => runtime . id == project ?. primaryRuntime ?. id ) ,
83+ ( ) => [ ... runtimeService . values ( ) , ... runtimeService . values ( { namespaceId : project ?. namespace ?. id } ) ] . find ( runtime => runtime . id == project ?. primaryRuntime ?. id ) ,
8084 [ project , runtimeStore ]
8185 )
8286
@@ -152,15 +156,44 @@ export const FlowCreateDialogComponent: React.FC<FlowCreateDialogComponentProps>
152156 < Button color = { "tertiary" } > No, go back!</ Button >
153157 </ DialogClose >
154158 < ButtonGroup color = { "tertiary" } >
155- < Button color = { "tertiary" } variant = { "filled" } >
156- < Text > Assign</ Text >
157- </ Button >
158- < Button color = { "tertiary" } variant = { "filled" } >
159- < Text > Create</ Text >
160- </ Button >
159+ < Link href = { `/namespace/${ namespaceIndex } /project/${ projectIndex } /settings` } >
160+ < Button color = { "info" } variant = { "none" } >
161+ < Text > Assign</ Text >
162+ </ Button >
163+ </ Link >
164+ < Link href = { `/namespace/${ namespaceIndex } /runtimes/create` } >
165+ < Button color = { "success" } variant = { "none" } >
166+ < Text > Create</ Text >
167+ </ Button >
168+ </ Link >
161169 </ ButtonGroup >
162170 </ Flex >
163- </ > : (
171+ </ > : flowTypes . length <= 0 ? (
172+ < >
173+ < Text size = { "md" } >
174+ Their is no flow type available for the primary runtime, assign and/or create another
175+ runtime to be able to create flows.
176+ </ Text >
177+ < Spacing spacing = { "xl" } />
178+ < Flex justify = { "space-between" } align = { "center" } >
179+ < DialogClose asChild >
180+ < Button color = { "tertiary" } > No, go back!</ Button >
181+ </ DialogClose >
182+ < ButtonGroup color = { "tertiary" } >
183+ < Link href = { `/namespace/${ namespaceIndex } /project/${ projectIndex } /settings` } >
184+ < Button color = { "info" } variant = { "none" } >
185+ < Text > Assign</ Text >
186+ </ Button >
187+ </ Link >
188+ < Link href = { `/namespace/${ namespaceIndex } /runtimes/create` } >
189+ < Button color = { "success" } variant = { "none" } >
190+ < Text > Create</ Text >
191+ </ Button >
192+ </ Link >
193+ </ ButtonGroup >
194+ </ Flex >
195+ </ >
196+ ) : (
164197 < >
165198 < InputLabel > Type of flow</ InputLabel >
166199 < InputDescription > You can choose a flow type here</ InputDescription >
0 commit comments