-
Notifications
You must be signed in to change notification settings - Fork 176
Extract builder types and add tests for update-flow-version #542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f2f08b1
Select duplicated step
alexandrudanpop 05e96cc
extract and add basic types for update-flow-version
alexandrudanpop 3c0a9d9
extract types to prevent circular dependency error
alexandrudanpop d8c4a13
fix duplicate key
alexandrudanpop 5e13abd
Merge remote-tracking branch 'origin/main' into chore/refactor-builder
alexandrudanpop e7919a9
Merge branch 'main' into chore/refactor-builder
alexandrudanpop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,2 +1,18 @@ | ||
| import { TextDecoder, TextEncoder } from 'util'; | ||
| Object.assign(global, { TextDecoder, TextEncoder }); | ||
|
|
||
| jest.mock('react-markdown', () => ({ | ||
| __esModule: true, | ||
| default: jest.fn().mockImplementation(({ children }) => children), | ||
| })); | ||
|
|
||
| jest.mock('@/app/lib/api', () => ({ | ||
| API_BASE_URL: 'http://localhost:3000', | ||
| api: { | ||
| get: jest.fn(), | ||
| post: jest.fn(), | ||
| put: jest.fn(), | ||
| delete: jest.fn(), | ||
| patch: jest.fn(), | ||
| }, | ||
| })); |
This file contains hidden or 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
6 changes: 2 additions & 4 deletions
6
packages/react-ui/src/app/features/builder/builder-header/builder-header.tsx
This file contains hidden or 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 hidden or 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 hidden or 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
106 changes: 106 additions & 0 deletions
106
packages/react-ui/src/app/features/builder/builder-types.ts
This file contains hidden or 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,106 @@ | ||
| import { BlockProperty } from '@openops/blocks-framework'; | ||
| import { AiChatContainerSizeState } from '@openops/components/ui'; | ||
| import { | ||
| Flow, | ||
| FlowOperationRequest, | ||
| FlowRun, | ||
| FlowVersion, | ||
| } from '@openops/shared'; | ||
| import { DataSelectorSizeState } from './data-selector/data-selector-size-togglers'; | ||
|
|
||
| export enum LeftSideBarType { | ||
| RUNS = 'runs', | ||
| VERSIONS = 'versions', | ||
| RUN_DETAILS = 'run-details', | ||
| MENU = 'menu', | ||
| TREE_VIEW = 'tree-view', | ||
| NONE = 'none', | ||
| } | ||
|
|
||
| export enum RightSideBarType { | ||
| NONE = 'none', | ||
| BLOCK_SETTINGS = 'block-settings', | ||
| } | ||
|
|
||
| export type InsertMentionHandler = (propertyPath: string) => void; | ||
|
|
||
| export type MidpanelState = { | ||
| showDataSelector: boolean; | ||
| dataSelectorSize: DataSelectorSizeState; | ||
| showAiChat: boolean; | ||
| aiContainerSize: AiChatContainerSizeState; | ||
| aiChatProperty?: BlockProperty & { | ||
| inputName: `settings.input.${string}`; | ||
| }; | ||
| codeToInject?: string; | ||
| }; | ||
|
|
||
| export type MidpanelAction = | ||
| | { type: 'FOCUS_INPUT_WITH_MENTIONS' } | ||
| | { type: 'DATASELECTOR_MIMIZE_CLICK' } | ||
| | { type: 'DATASELECTOR_DOCK_CLICK' } | ||
| | { type: 'DATASELECTOR_EXPAND_CLICK' } | ||
| | { type: 'AICHAT_CLOSE_CLICK' } | ||
| | { type: 'AICHAT_MIMIZE_CLICK' } | ||
| | { type: 'AICHAT_DOCK_CLICK' } | ||
| | { type: 'AICHAT_EXPAND_CLICK' } | ||
| | { type: 'PANEL_CLICK_AWAY' } | ||
| | { | ||
| type: 'GENERATE_WITH_AI_CLICK'; | ||
| property?: BlockProperty & { inputName: `settings.input.${string}` }; | ||
| } | ||
| | { type: 'ADD_CODE_TO_INJECT'; code: string } | ||
| | { type: 'CLEAN_CODE_TO_INJECT' }; | ||
|
|
||
| export type BuilderState = { | ||
| flow: Flow; | ||
| flowVersion: FlowVersion; | ||
|
|
||
| readonly: boolean; | ||
| loopsIndexes: Record<string, number>; | ||
| run: FlowRun | null; | ||
| leftSidebar: LeftSideBarType; | ||
| rightSidebar: RightSideBarType; | ||
| selectedStep: string | null; | ||
| canExitRun: boolean; | ||
| activeDraggingStep: string | null; | ||
| saving: boolean; | ||
| refreshBlockFormSettings: boolean; | ||
| refreshSettings: () => void; | ||
| exitRun: () => void; | ||
| exitStepSettings: () => void; | ||
| renameFlowClientSide: (newName: string) => void; | ||
| moveToFolderClientSide: (folderId: string) => void; | ||
| setRun: (run: FlowRun, flowVersion: FlowVersion) => void; | ||
| setLeftSidebar: (leftSidebar: LeftSideBarType) => void; | ||
| setRightSidebar: (rightSidebar: RightSideBarType) => void; | ||
| applyOperation: ( | ||
| operation: FlowOperationRequest, | ||
| onError: () => void, | ||
| ) => void; | ||
| removeStepSelection: () => void; | ||
| selectStepByName: (stepName: string, openRightSideBar?: boolean) => void; | ||
| startSaving: () => void; | ||
| setActiveDraggingStep: (stepName: string | null) => void; | ||
| setFlow: (flow: Flow) => void; | ||
| exitBlockSelector: () => void; | ||
| setVersion: (flowVersion: FlowVersion) => void; | ||
| setVersionUpdateTimestamp: (updateTimestamp: string) => void; | ||
| insertMention: InsertMentionHandler | null; | ||
| setReadOnly: (readOnly: boolean) => void; | ||
| setInsertMentionHandler: (handler: InsertMentionHandler | null) => void; | ||
| setLoopIndex: (stepName: string, index: number) => void; | ||
| canUndo: boolean; | ||
| setCanUndo: (canUndo: boolean) => void; | ||
| canRedo: boolean; | ||
| setCanRedo: (canUndo: boolean) => void; | ||
| dynamicPropertiesAuthReconnectCounter: number; | ||
| refreshDynamicPropertiesForAuth: () => void; | ||
| midpanelState: MidpanelState; | ||
| applyMidpanelAction: (midpanelAction: MidpanelAction) => void; | ||
| }; | ||
|
|
||
| export type BuilderInitialState = Pick< | ||
| BuilderState, | ||
| 'flow' | 'flowVersion' | 'readonly' | 'run' | 'canExitRun' | ||
| >; | ||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all types moved from builder-hooks & updated other files to reference this. We get circular dependency issue on build if we don't extract out the types