Skip to content

Commit 62614b7

Browse files
authored
Merge pull request #227 from code0-tech/feat/#202
Adding module grouping to next node dialog
2 parents 0f888d6 + 0a8dba7 commit 62614b7

19 files changed

Lines changed: 219 additions & 327 deletions

src/app/(flow)/layout.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
FunctionDefinition,
1313
Namespace,
1414
NamespaceProject,
15-
Runtime, User
15+
Runtime, RuntimeModule, User
1616
} from "@code0-tech/sagittarius-graphql-types";
1717
import {usePersistentReactiveArrayService} from "@/hooks/usePersistentReactiveArrayService";
1818
import {UserService} from "@edition/user/services/User.service";
@@ -33,6 +33,7 @@ import {ProjectView} from "@edition/project/services/Project.view";
3333
import {RoleView} from "@edition/role/services/Role.view";
3434
import {useUserSession} from "@edition/user/hooks/User.session.hook";
3535
import {Layout} from "@code0-tech/pictor/dist/components/layout/Layout";
36+
import {ModuleService} from "@ce/module/services/Module.service";
3637

3738
export default function FlowLayout({bar, tab, children}: {
3839
bar: React.ReactNode,
@@ -66,6 +67,7 @@ export default function FlowLayout({bar, tab, children}: {
6667
const functions = usePersistentReactiveArrayService<FunctionDefinition, FunctionService>(`dashboard::functions::${currentSession?.id}`, (store) => new FunctionService(graphqlClient, store))
6768
const datatype = usePersistentReactiveArrayService<DataType, DatatypeService>(`dashboard::datatypes::${currentSession?.id}`, (store) => new DatatypeService(graphqlClient, store))
6869
const flowtype = usePersistentReactiveArrayService<FlowType, FlowTypeService>(`dashboard::flowtypes::${currentSession?.id}`, (store) => new FlowTypeService(graphqlClient, store))
70+
const module = usePersistentReactiveArrayService<RuntimeModule, ModuleService>(`dashboard::modules::${currentSession?.id}`, (store) => new ModuleService(graphqlClient, store))
6971

7072

7173
const runtimeId = React.useMemo(() => project[1].getById(projectId, {namespaceId})?.primaryRuntime?.id, [projectId, project[0], namespaceId])
@@ -77,10 +79,11 @@ export default function FlowLayout({bar, tab, children}: {
7779
functions[1].values({namespaceId, projectId, runtimeId})
7880
datatype[1].values({namespaceId, projectId, runtimeId})
7981
flowtype[1].values({namespaceId, projectId, runtimeId})
82+
module[1].values({namespaceId, projectId})
8083
}, [runtimeId, namespaceId, projectId, currentSession, flow, functions, datatype, flowtype])
8184

8285
return <ContextStoreProvider
83-
services={[user, organization, member, namespace, runtime, project, role, flow, functions, datatype, flowtype]}>
86+
services={[user, organization, member, namespace, runtime, project, role, flow, functions, datatype, flowtype, module]}>
8487
<Layout layoutGap={0} style={{zIndex: 0}} showLayoutSplitter={false} leftContent={
8588
<Flex p={0.7} pt={1} align={"center"} style={{flexDirection: "column", gap: "0.7rem"}}>
8689
<div style={{

src/packages/ce/src/datatype/services/fragments/DataType.basic.fragment.graphql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@ fragment BasicDataType on DataType {
2828
runtime {
2929
id
3030
}
31+
runtimeModule {
32+
__typename
33+
id
34+
}
3135
}

src/packages/ce/src/datatype/services/fragments/DataType.fragment.graphql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ fragment DataType on DataType {
3232
id
3333
}
3434

35+
runtimeModule {
36+
__typename
37+
id
38+
}
39+
3540
rules (first: $firstRule, after: $afterRule) {
3641
__typename
3742
count

src/packages/ce/src/flow/components/panels/FlowPanelControlComponent.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import {Flow, NodeFunction} from "@code0-tech/sagittarius-graphql-types";
2+
import {Flow, LiteralValue, NodeFunction, ReferenceValue} from "@code0-tech/sagittarius-graphql-types";
33
import {
44
Badge,
55
Button,
@@ -15,7 +15,6 @@ import {Panel} from "@xyflow/react";
1515
import {ButtonGroup} from "@code0-tech/pictor/dist/components/button-group/ButtonGroup";
1616
import {FlowService} from "@edition/flow/services/Flow.service";
1717
import {SuggestionDialogComponent} from "@edition/function/components/suggestion/SuggestionDialogComponent";
18-
import {FunctionSuggestion} from "@edition/function/components/suggestion/FunctionSuggestionComponent.view";
1918
import {Suggestion} from "@edition/function/components/suggestion/Suggestion.util";
2019
import {useHotkeys} from "react-hotkeys-hook";
2120
import {useSelectedFunctionNode} from "@edition/function/hooks/FunctionNode.selected.hook";
@@ -51,14 +50,14 @@ export const FlowPanelControlComponent: React.FC<FlowPanelControlComponentProps>
5150
})
5251
}, [selectedNode, flowService, flowStore])
5352

54-
const addNodeToFlow = React.useCallback((suggestion: FunctionSuggestion | Suggestion) => {
55-
if (flowId && suggestion.value.__typename === "NodeFunction" && selectedNode?.id.includes("NodeFunction")) {
53+
const addNodeToFlow = React.useCallback((suggestion: NodeFunction | ReferenceValue | LiteralValue) => {
54+
if (flowId && suggestion.__typename === "NodeFunction" && selectedNode?.id.includes("NodeFunction")) {
5655
startTransition(async () => {
57-
await flowService.addNextNodeById(flowId, selectedNode?.id as NodeFunction['id'], suggestion.value as NodeFunction)
56+
await flowService.addNextNodeById(flowId, selectedNode?.id as NodeFunction['id'], suggestion as NodeFunction)
5857
})
59-
} else if (suggestion.value.__typename === "NodeFunction") {
58+
} else if (suggestion.__typename === "NodeFunction") {
6059
startTransition(async () => {
61-
await flowService.addNextNodeById(flowId, null, suggestion.value as NodeFunction)
60+
await flowService.addNextNodeById(flowId, null, suggestion as NodeFunction)
6261
})
6362
}
6463
}, [flowId, flowService, flowStore, selectedNode])

src/packages/ce/src/flowtype/services/fragments/FlowType.fragment.graphql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ fragment FlowType on FlowType {
2727
runtime {
2828
id
2929
}
30+
runtimeModule {
31+
__typename
32+
id
33+
}
3034
signature
3135
flowTypeSettings {
3236
__typename

src/packages/ce/src/function/components/suggestion/FunctionSuggestionComponent.view.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/packages/ce/src/function/components/suggestion/FunctionSuggestionMenuComponent.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/packages/ce/src/function/components/suggestion/FunctionSuggestionMenuComponent.util.tsx

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/packages/ce/src/function/components/suggestion/FunctionSuggestionMenuFooterComponent.tsx

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/packages/ce/src/function/components/suggestion/FunctionSuggestionSearchBarComponent.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)