File tree 14 files changed +177
-134
lines changed
14 files changed +177
-134
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ import {
12
12
import EntityCreate from 'src/components/shared/Entity/Create' ;
13
13
import EntityToolbar from 'src/components/shared/Entity/Header' ;
14
14
import { MutateDraftSpecProvider } from 'src/components/shared/Entity/MutateDraftSpecContext' ;
15
+ import WorkflowInitializer from 'src/components/shared/Entity/WorkflowInitializer' ;
15
16
import useValidConnectorsExist from 'src/hooks/connectors/useHasConnectors' ;
16
17
import useDraftSpecs from 'src/hooks/useDraftSpecs' ;
17
18
import usePageTitle from 'src/hooks/usePageTitle' ;
18
19
import { CustomEvents } from 'src/services/types' ;
19
20
import { useDetailsFormStore } from 'src/stores/DetailsForm/Store' ;
20
- import WorkflowHydrator from 'src/stores/Workflow/Hydrator' ;
21
21
import { MAX_DISCOVER_TIME } from 'src/utils/misc-utils' ;
22
22
23
23
function CaptureCreate ( ) {
@@ -75,7 +75,7 @@ function CaptureCreate() {
75
75
} , [ entityNameChanged ] ) ;
76
76
77
77
return (
78
- < WorkflowHydrator >
78
+ < WorkflowInitializer >
79
79
< MutateDraftSpecProvider value = { updateDraftSpecs } >
80
80
< EntityCreate
81
81
entityType = { entityType }
@@ -113,7 +113,7 @@ function CaptureCreate() {
113
113
}
114
114
/>
115
115
</ MutateDraftSpecProvider >
116
- </ WorkflowHydrator >
116
+ </ WorkflowInitializer >
117
117
) ;
118
118
}
119
119
Original file line number Diff line number Diff line change @@ -11,12 +11,12 @@ import {
11
11
import EntityCreateExpress from 'src/components/shared/Entity/Create/Express' ;
12
12
import EntityToolbar from 'src/components/shared/Entity/Header' ;
13
13
import { MutateDraftSpecProvider } from 'src/components/shared/Entity/MutateDraftSpecContext' ;
14
+ import WorkflowInitializer from 'src/components/shared/Entity/WorkflowInitializer' ;
14
15
import useValidConnectorsExist from 'src/hooks/connectors/useHasConnectors' ;
15
16
import useDraftSpecs from 'src/hooks/useDraftSpecs' ;
16
17
import usePageTitle from 'src/hooks/usePageTitle' ;
17
18
import { CustomEvents } from 'src/services/types' ;
18
19
import { useDetailsFormStore } from 'src/stores/DetailsForm/Store' ;
19
- import WorkflowHydrator from 'src/stores/Workflow/Hydrator' ;
20
20
import { MAX_DISCOVER_TIME } from 'src/utils/misc-utils' ;
21
21
22
22
export default function CaptureExpressCreate ( ) {
@@ -73,7 +73,7 @@ export default function CaptureExpressCreate() {
73
73
} , [ entityNameChanged ] ) ;
74
74
75
75
return (
76
- < WorkflowHydrator expressWorkflow >
76
+ < WorkflowInitializer expressWorkflow >
77
77
< MutateDraftSpecProvider value = { updateDraftSpecs } >
78
78
< EntityCreateExpress
79
79
entityType = { entityType }
@@ -104,6 +104,6 @@ export default function CaptureExpressCreate() {
104
104
}
105
105
/>
106
106
</ MutateDraftSpecProvider >
107
- </ WorkflowHydrator >
107
+ </ WorkflowInitializer >
108
108
) ;
109
109
}
Original file line number Diff line number Diff line change @@ -11,14 +11,14 @@ import {
11
11
import EntityEdit from 'src/components/shared/Entity/Edit' ;
12
12
import EntityToolbar from 'src/components/shared/Entity/Header' ;
13
13
import { MutateDraftSpecProvider } from 'src/components/shared/Entity/MutateDraftSpecContext' ;
14
+ import WorkflowInitializer from 'src/components/shared/Entity/WorkflowInitializer' ;
14
15
import useValidConnectorsExist from 'src/hooks/connectors/useHasConnectors' ;
15
16
import useGlobalSearchParams , {
16
17
GlobalSearchParams ,
17
18
} from 'src/hooks/searchParams/useGlobalSearchParams' ;
18
19
import { useDraftSpecs_editWorkflow } from 'src/hooks/useDraftSpecs' ;
19
20
import usePageTitle from 'src/hooks/usePageTitle' ;
20
21
import { CustomEvents } from 'src/services/types' ;
21
- import WorkflowHydrator from 'src/stores/Workflow/Hydrator' ;
22
22
import { MAX_DISCOVER_TIME } from 'src/utils/misc-utils' ;
23
23
24
24
const entityType = 'capture' ;
@@ -49,7 +49,7 @@ function CaptureEdit() {
49
49
} , [ mutateDraftSpecs , mutate_advancedEditor ] ) ;
50
50
51
51
return (
52
- < WorkflowHydrator >
52
+ < WorkflowInitializer >
53
53
< MutateDraftSpecProvider value = { updateDraftSpecs } >
54
54
< EntityEdit
55
55
title = "routeTitle.captureEdit"
@@ -85,7 +85,7 @@ function CaptureEdit() {
85
85
}
86
86
/>
87
87
</ MutateDraftSpecProvider >
88
- </ WorkflowHydrator >
88
+ </ WorkflowInitializer >
89
89
) ;
90
90
}
91
91
Original file line number Diff line number Diff line change 1
1
import { Box , Grid , Skeleton } from '@mui/material' ;
2
2
3
- import Tile from '. /Tile' ;
3
+ import Tile from 'src/components/connectors/Grid /Tile' ;
4
4
5
5
const tileCount = 6 ;
6
6
Original file line number Diff line number Diff line change @@ -11,12 +11,12 @@ import MaterializeGenerateButton from 'src/components/materialization/GenerateBu
11
11
import EntityCreate from 'src/components/shared/Entity/Create' ;
12
12
import EntityToolbar from 'src/components/shared/Entity/Header' ;
13
13
import { MutateDraftSpecProvider } from 'src/components/shared/Entity/MutateDraftSpecContext' ;
14
+ import WorkflowInitializer from 'src/components/shared/Entity/WorkflowInitializer' ;
14
15
import useValidConnectorsExist from 'src/hooks/connectors/useHasConnectors' ;
15
16
import useDraftSpecs from 'src/hooks/useDraftSpecs' ;
16
17
import usePageTitle from 'src/hooks/usePageTitle' ;
17
18
import { CustomEvents } from 'src/services/types' ;
18
19
import { useDetailsFormStore } from 'src/stores/DetailsForm/Store' ;
19
- import WorkflowHydrator from 'src/stores/Workflow/Hydrator' ;
20
20
21
21
function MaterializationCreate ( ) {
22
22
usePageTitle ( {
@@ -57,7 +57,7 @@ function MaterializationCreate() {
57
57
} , [ imageTag , setDraftId ] ) ;
58
58
59
59
return (
60
- < WorkflowHydrator >
60
+ < WorkflowInitializer >
61
61
< MutateDraftSpecProvider value = { updateDraftSpecs } >
62
62
< EntityCreate
63
63
entityType = { entityType }
@@ -81,7 +81,7 @@ function MaterializationCreate() {
81
81
}
82
82
/>
83
83
</ MutateDraftSpecProvider >
84
- </ WorkflowHydrator >
84
+ </ WorkflowInitializer >
85
85
) ;
86
86
}
87
87
Original file line number Diff line number Diff line change @@ -10,14 +10,14 @@ import MaterializeGenerateButton from 'src/components/materialization/GenerateBu
10
10
import EntityEdit from 'src/components/shared/Entity/Edit' ;
11
11
import EntityToolbar from 'src/components/shared/Entity/Header' ;
12
12
import { MutateDraftSpecProvider } from 'src/components/shared/Entity/MutateDraftSpecContext' ;
13
+ import WorkflowInitializer from 'src/components/shared/Entity/WorkflowInitializer' ;
13
14
import useValidConnectorsExist from 'src/hooks/connectors/useHasConnectors' ;
14
15
import useGlobalSearchParams , {
15
16
GlobalSearchParams ,
16
17
} from 'src/hooks/searchParams/useGlobalSearchParams' ;
17
18
import { useDraftSpecs_editWorkflow } from 'src/hooks/useDraftSpecs' ;
18
19
import usePageTitle from 'src/hooks/usePageTitle' ;
19
20
import { CustomEvents } from 'src/services/types' ;
20
- import WorkflowHydrator from 'src/stores/Workflow/Hydrator' ;
21
21
22
22
function MaterializationEdit ( ) {
23
23
usePageTitle ( {
@@ -47,7 +47,7 @@ function MaterializationEdit() {
47
47
} , [ mutateDraftSpecs , mutate_advancedEditor ] ) ;
48
48
49
49
return (
50
- < WorkflowHydrator >
50
+ < WorkflowInitializer >
51
51
< MutateDraftSpecProvider value = { updateDraftSpecs } >
52
52
< EntityEdit
53
53
title = "routeTitle.materializationEdit"
@@ -73,7 +73,7 @@ function MaterializationEdit() {
73
73
}
74
74
/>
75
75
</ MutateDraftSpecProvider >
76
- </ WorkflowHydrator >
76
+ </ WorkflowInitializer >
77
77
) ;
78
78
}
79
79
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import { useFormStateStore_status } from 'src/stores/FormState/hooks';
14
14
import { FormStatus } from 'src/stores/FormState/types' ;
15
15
16
16
function DraftInitializer ( { children } : BaseComponentProps ) {
17
- const initializeTaskDraft = useInitializeTaskDraft ( ) ;
17
+ const { initializeTaskDraft } = useInitializeTaskDraft ( ) ;
18
18
19
19
// Draft Editor Store
20
20
const draftInitializationError = useEditorStore_draftInitializationError ( ) ;
Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ function useInitializeTaskDraft() {
203
203
[ taskSpecType ]
204
204
) ;
205
205
206
- return useCallback (
206
+ const initializeTaskDraft = useCallback (
207
207
async (
208
208
setLoading : Dispatch < SetStateAction < boolean > >
209
209
) : Promise < void > => {
@@ -289,6 +289,8 @@ function useInitializeTaskDraft() {
289
289
taskSpecType ,
290
290
]
291
291
) ;
292
+
293
+ return { initializeTaskDraft } ;
292
294
}
293
295
294
296
export default useInitializeTaskDraft ;
Original file line number Diff line number Diff line change
1
+ import type { WorkflowInitializerProps } from './types' ;
2
+
3
+ import { Fragment } from 'react' ;
4
+
5
+ import DraftInitializer from './Edit/DraftInitializer' ;
6
+
7
+ import { useEntityWorkflow_Editing } from 'src/context/Workflow' ;
8
+ import WorkflowHydrator from 'src/stores/Workflow/Hydrator' ;
9
+
10
+ const WorkflowInitializer = ( {
11
+ children,
12
+ expressWorkflow,
13
+ } : WorkflowInitializerProps ) => {
14
+ const isEdit = useEntityWorkflow_Editing ( ) ;
15
+ const InitializerComponent = isEdit ? DraftInitializer : Fragment ;
16
+
17
+ return (
18
+ < InitializerComponent >
19
+ < WorkflowHydrator expressWorkflow = { expressWorkflow } >
20
+ { children }
21
+ </ WorkflowHydrator >
22
+ </ InitializerComponent >
23
+ ) ;
24
+ } ;
25
+
26
+ export default WorkflowInitializer ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import type {
4
4
EntityTestButtonProps ,
5
5
} from 'src/components/shared/Entity/Actions/types' ;
6
6
import type { DataPlaneOption } from 'src/stores/DetailsForm/types' ;
7
- import type { Entity } from 'src/types' ;
7
+ import type { BaseComponentProps , Entity } from 'src/types' ;
8
8
9
9
export interface AddCollectionDialogCTAProps {
10
10
entity ?: Entity ;
@@ -61,3 +61,7 @@ export interface TableHydratorProps {
61
61
entity ?: Entity ;
62
62
selectedCollections : string [ ] ;
63
63
}
64
+
65
+ export interface WorkflowInitializerProps extends BaseComponentProps {
66
+ expressWorkflow ?: boolean ;
67
+ }
You can’t perform that action at this time.
0 commit comments