Fix issues in the MI Extension#899
Conversation
WalkthroughAdds legacy MI runtime detection and an RPC for it, conditions try-out UI on runtime/artifact support, tightens error reporting with user notifications, adjusts module filtering and form field defaults/validation, restructures project information fields, and makes async/runtime changes in RPC manager and state machine. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as SetPayloads UI
participant RPC as MiDiagram RPC
participant Core as mi-core (isLegacyProject)
rect rgb(225,240,255)
Note right of UI: User opens Try-Out / Set Payloads
end
UI->>RPC: request isLegacyProject(projectUri)
RPC->>Core: delegate isLegacyProject check
Core-->>RPC: Promise<boolean> (isLegacy)
RPC-->>UI: boolean result
alt isLegacyRuntime == true
UI->>UI: show legacy runtime warning (no try-out)
else isSupportedArtifact == false
UI->>UI: show unsupported artifact warning
else
UI->>UI: render payload form (AutoComplete, ParameterManager, actions)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings, 1 inconclusive)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
workspaces/mi/mi-diagram/src/components/sidePanel/modules/ModulesList.tsx (1)
159-168: Restore version check in connector filtering logic.The git diff confirms the version comparison
(c.version === values.version.tagName)was removed from the filter. This is a functional regression: the updated code hides all versions of an installed connector, preventing users from accessing alternative versions or upgrades.This inconsistency is evident when compared to similar filtering in
workspaces/mi/mi-diagram/src/components/sidePanel/mediators/ModuleSuggestions.tsx:107, which retains the version check:(c.version === module.version.tagName).Restore the condition to match the intended filtering behavior:
.filter(([_, values]: [string, any]) => !localConnectors || !localConnectors.some((c: any) => ((c.displayName ? c.displayName === values.connectorName : c.name.toLowerCase() === values.connectorName.toLowerCase())) && (c.version === values.version.tagName) ) )workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (1)
6149-6153: Strip inline TOML comments before evaluatingexpose.versioned.services
If the admin keeps an inline comment – e.g.expose.versioned.services = true # generated by script–match[1]becomestrue # ..., so the latertoLowerCase() === "true"check fails and we incorrectly report that versioned deployments are disabled. That forces the runtime-services flow to fall back even though the feature is actually on. Please trim any trailing inline comment (and surrounding whitespace) before comparing the value.- if (match) { - let value = match[1].trim(); - value = value.replace(/^["']|["']$/g, ""); + if (match) { + let value = match[1].trim(); + value = value.replace(/^["']|["']$/g, ""); + value = value.split('#')[0].trim(); if (value.toLowerCase() === "true") return true; return false; }
🧹 Nitpick comments (8)
workspaces/mi/mi-visualizer/src/views/Forms/Tests/MockServices/MockServiceForm.tsx (1)
314-315: LGTM! Minor spacing and capitalization improvements.The title capitalization change improves UI consistency, and the spacing adjustment enhances the layout. No functional issues introduced.
Optionally, consider using CSS margin instead of the
<br/>tag for more maintainable spacing:- <ComponentCard id="mockServiceResourceCard" sx={cardStyle} disbaleHoverEffect> - <br/> - <FormGroup title="Mock Service Resources" isCollapsed={false}> + <ComponentCard id="mockServiceResourceCard" sx={{...cardStyle, paddingTop: '30px'}} disbaleHoverEffect> + <FormGroup title="Mock Service Resources" isCollapsed={false}>workspaces/mi/mi-visualizer/src/views/Forms/MessageProcessorForm.tsx (1)
123-124: Validation logic correctly allows -1 as a special value.The updated validation properly allows -1 (likely representing unlimited attempts), undefined, and positive values while rejecting zero and other negative numbers. The logic aligns with the error message.
Consider these optional enhancements:
- Add integer validation to prevent decimal values like 0.5 or 2.7, which don't make semantic sense for attempt counts:
maxRedeliveryAttempts: yup.number().typeError('Max Redelivery Attempts must be a number').notRequired().default(4) - .test('valid-value','Max Redelivery Attempts must be greater than 0 or -1',(value) => value === -1 || value === undefined || value > 0), + .test('valid-value','Max Redelivery Attempts must be greater than 0 or -1',(value) => value === -1 || value === undefined || (value > 0 && Number.isInteger(value))),
- Update the placeholder at line 396 to guide users about the -1 special value:
- placeholder="10" + placeholder="10 (use -1 for unlimited)"workspaces/mi/mi-extension/src/debugger/debugger.ts (1)
635-640: LGTM - Conditional command construction is correct.The logic appropriately constructs different command structures based on context: "variables" command-argument for the "variable" context, and "properties" for all others.
Optionally, you could define a more specific type instead of
anyon line 635:-let propertiesCommand: any; +let propertiesCommand: { command: string; "command-argument": string; context: string };This would provide better type safety, though the current implementation is acceptable given the immediate assignment.
workspaces/mi/mi-visualizer/src/views/Forms/Tests/MockServices/MockResourceForm.tsx (2)
174-175: Consider CSS-based spacing instead of<br/>tags.The added line break achieves the desired spacing, but using CSS (e.g., margin or padding on the
FormGroupor via thesxprop on the parentComponentCard) would be more maintainable and align with modern React best practices. The updated FormGroup title "Expected Request to Resource" is clear and improves the UI.If you'd like to refactor, you could apply this approach:
- <ComponentCard id="mockResourceRequestCard" sx={cardStyle} disbaleHoverEffect> - <br/> - <FormGroup title="Expected Request to Resource" isCollapsed={false}> + <ComponentCard id="mockResourceRequestCard" sx={{ ...cardStyle, paddingTop: '15px' }} disbaleHoverEffect> + <FormGroup title="Expected Request to Resource" isCollapsed={false}>
207-208: Consider CSS-based spacing instead of<br/>tags.Same as the previous FormGroup, using CSS for spacing would be more maintainable. The updated title "Expected Response from Resource" is descriptive and enhances clarity.
Apply the same refactor approach here:
- <ComponentCard id="mockResourceResponseCard" sx={cardStyle} disbaleHoverEffect> - <br/> - <FormGroup title="Expected Response from Resource" isCollapsed={false}> + <ComponentCard id="mockResourceResponseCard" sx={{ ...cardStyle, paddingTop: '15px' }} disbaleHoverEffect> + <FormGroup title="Expected Response from Resource" isCollapsed={false}>workspaces/mi/mi-extension/src/debugger/debugHelper.ts (1)
206-209: Remove redundantshouldCopyTargetcheck.Line 209 checks
if (shouldCopyTarget && code === 0)inside a block already guarded byif (shouldCopyTarget)at line 206. The innershouldCopyTargetcheck is redundant.Apply this diff to simplify:
if (shouldCopyTarget) { buildProcess.on('exit', async (code) => { - if (shouldCopyTarget && code === 0) { + if (code === 0) {workspaces/mi/mi-diagram/src/components/nodes/MediatorNode/MediatorNodeWidget.tsx (1)
102-116: Consider extracting repeated logic into a custom hook.The pattern of fetching
isLegacyProjecton mount is duplicated across Navigator, GroupNodeWidget, MediatorNodeWidget, and List components. This violates the DRY principle and makes maintenance harder.Create a custom hook:
// hooks/useIsLegacyProject.ts export function useIsLegacyProject(rpcClient: any): boolean { const [isLegacyProject, setIsLegacyProject] = React.useState<boolean>(false); useEffect(() => { rpcClient.getMiDiagramRpcClient().isLegacyProject() .then(setIsLegacyProject) .catch((error) => { console.error("Failed to determine legacy project status:", error); setIsLegacyProject(false); }); }, [rpcClient]); return isLegacyProject; }Then use it in components:
- const [isLegacyProject, setIsLegacyProject] = React.useState<boolean>(false); - - useEffect(() => { - rpcClient.getMiDiagramRpcClient().isLegacyProject().then(setIsLegacyProject); - }, []); + const isLegacyProject = useIsLegacyProject(rpcClient);workspaces/mi/mi-diagram/src/components/nodes/CallNode/CallNodeWidget.tsx (1)
134-138: Consider addingrpcClientto the useEffect dependencies.The useEffect references
rpcClientbut doesn't include it in the dependency array. WhilerpcClientis unlikely to change in practice, including it follows React best practices and prevents potential stale closure issues.Apply this diff:
useEffect(() => { rpcClient.getMiDiagramRpcClient().isLegacyProject().then(setIsLegacyProject); - }, []); + }, [rpcClient]);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (31)
workspaces/mi/mi-core/src/rpc-types/mi-diagram/index.ts(1 hunks)workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts(1 hunks)workspaces/mi/mi-diagram/src/components/Navigator/Navigator.tsx(2 hunks)workspaces/mi/mi-diagram/src/components/nodes/CallNode/CallNodeWidget.tsx(3 hunks)workspaces/mi/mi-diagram/src/components/nodes/GroupNode/GroupNodeWidget.tsx(3 hunks)workspaces/mi/mi-diagram/src/components/nodes/MediatorNode/MediatorNodeWidget.tsx(3 hunks)workspaces/mi/mi-diagram/src/components/nodes/ReferenceNode/ReferenceNodeWidget.tsx(2 hunks)workspaces/mi/mi-diagram/src/components/sidePanel/index.tsx(1 hunks)workspaces/mi/mi-diagram/src/components/sidePanel/mediators/List.tsx(3 hunks)workspaces/mi/mi-diagram/src/components/sidePanel/mediators/ModuleSuggestions.tsx(1 hunks)workspaces/mi/mi-diagram/src/components/sidePanel/modules/ModulesList.tsx(1 hunks)workspaces/mi/mi-diagram/src/components/sidePanel/tryout/SetPayloads.tsx(3 hunks)workspaces/mi/mi-diagram/src/resources/icons/mediatorIcons/icons.tsx(2 hunks)workspaces/mi/mi-extension/README.md(0 hunks)workspaces/mi/mi-extension/src/debugger/debugHelper.ts(2 hunks)workspaces/mi/mi-extension/src/debugger/debugger.ts(1 hunks)workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-handler.ts(2 hunks)workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts(2 hunks)workspaces/mi/mi-extension/src/util/index.ts(2 hunks)workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts(2 hunks)workspaces/mi/mi-visualizer/src/views/Forms/AddressEndpointForm.tsx(1 hunks)workspaces/mi/mi-visualizer/src/views/Forms/ConnectionForm/index.tsx(1 hunks)workspaces/mi/mi-visualizer/src/views/Forms/HTTPEndpointForm/Types.ts(1 hunks)workspaces/mi/mi-visualizer/src/views/Forms/InboundEPform/inboundConnectorForm.tsx(1 hunks)workspaces/mi/mi-visualizer/src/views/Forms/InboundEPform/index.tsx(1 hunks)workspaces/mi/mi-visualizer/src/views/Forms/MessageProcessorForm.tsx(1 hunks)workspaces/mi/mi-visualizer/src/views/Forms/Tests/MockServices/MockResourceForm.tsx(2 hunks)workspaces/mi/mi-visualizer/src/views/Forms/Tests/MockServices/MockServiceForm.tsx(1 hunks)workspaces/mi/mi-visualizer/src/views/Forms/WSDLEndpointForm/Types.ts(1 hunks)workspaces/mi/mi-visualizer/src/views/Overview/ProjectInformation/ProjectInformationForm.tsx(4 hunks)workspaces/mi/mi-visualizer/src/views/Overview/ProjectInformation/index.tsx(1 hunks)
💤 Files with no reviewable changes (1)
- workspaces/mi/mi-extension/README.md
🧰 Additional context used
🧬 Code graph analysis (12)
workspaces/mi/mi-diagram/src/components/Navigator/Navigator.tsx (4)
workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts (1)
isLegacyProject(456-456)workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (1)
isLegacyProject(6123-6126)workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts (1)
isLegacyProject(1189-1191)workspaces/mi/mi-diagram/src/resources/icons/mediatorIcons/icons.tsx (1)
getMediatorIconsFromFont(27-326)
workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts (2)
workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (1)
isLegacyProject(6123-6126)workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts (1)
isLegacyProject(1189-1191)
workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-handler.ts (3)
workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts (1)
isLegacyProject(456-456)workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (1)
isLegacyProject(6123-6126)workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts (1)
isLegacyProject(1189-1191)
workspaces/mi/mi-diagram/src/components/sidePanel/mediators/List.tsx (4)
workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts (1)
isLegacyProject(456-456)workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (1)
isLegacyProject(6123-6126)workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts (1)
isLegacyProject(1189-1191)workspaces/mi/mi-diagram/src/resources/icons/mediatorIcons/icons.tsx (1)
getMediatorIconsFromFont(27-326)
workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts (2)
workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts (1)
isLegacyProject(456-456)workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (1)
isLegacyProject(6123-6126)
workspaces/mi/mi-diagram/src/components/sidePanel/index.tsx (1)
workspaces/mi/mi-diagram/src/resources/icons/mediatorIcons/icons.tsx (1)
getMediatorIconsFromFont(27-326)
workspaces/mi/mi-diagram/src/components/sidePanel/tryout/SetPayloads.tsx (1)
workspaces/common-libs/ui-toolkit/src/components/AutoComplete/AutoComplete.tsx (1)
AutoComplete(326-563)
workspaces/mi/mi-diagram/src/components/nodes/MediatorNode/MediatorNodeWidget.tsx (4)
workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts (1)
isLegacyProject(456-456)workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (1)
isLegacyProject(6123-6126)workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts (1)
isLegacyProject(1189-1191)workspaces/mi/mi-diagram/src/resources/icons/mediatorIcons/icons.tsx (1)
getMediatorIconsFromFont(27-326)
workspaces/mi/mi-diagram/src/components/nodes/CallNode/CallNodeWidget.tsx (4)
workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts (1)
isLegacyProject(456-456)workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (1)
isLegacyProject(6123-6126)workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts (1)
isLegacyProject(1189-1191)workspaces/mi/mi-diagram/src/resources/icons/mediatorIcons/icons.tsx (1)
getMediatorIconsFromFont(27-326)
workspaces/mi/mi-diagram/src/components/nodes/GroupNode/GroupNodeWidget.tsx (4)
workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts (1)
isLegacyProject(456-456)workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (1)
isLegacyProject(6123-6126)workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts (1)
isLegacyProject(1189-1191)workspaces/mi/mi-diagram/src/resources/icons/mediatorIcons/icons.tsx (1)
getMediatorIconsFromFont(27-326)
workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (3)
workspaces/mi/mi-extension/src/util/onboardingUtils.ts (2)
getMIVersionFromPom(137-149)compareVersions(976-997)workspaces/mi/mi-extension/src/constants/index.ts (1)
RUNTIME_VERSION_440(200-200)workspaces/mi/mi-extension/src/stateMachine.ts (1)
getStateMachine(686-718)
workspaces/mi/mi-diagram/src/components/nodes/ReferenceNode/ReferenceNodeWidget.tsx (4)
workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts (1)
isLegacyProject(456-456)workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (1)
isLegacyProject(6123-6126)workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts (1)
isLegacyProject(1189-1191)workspaces/mi/mi-diagram/src/resources/icons/mediatorIcons/icons.tsx (1)
getMediatorIconsFromFont(27-326)
🔇 Additional comments (25)
workspaces/mi/mi-extension/src/debugger/debugger.ts (2)
623-623: LGTM - New context type added.The addition of "variable" to the context list enables querying variables alongside other property scopes.
630-631: LGTM - Property mappings extended.The new mappings appropriately transform response keys to user-friendly labels for the Synapse scope and the new Variables feature.
workspaces/mi/mi-visualizer/src/views/Forms/ConnectionForm/index.tsx (1)
235-239: LGTM! Good addition of user feedback.The error notification improves user experience by providing visible feedback when connector fetching fails, while the console.error maintains developer debugging capability.
workspaces/mi/mi-visualizer/src/views/Forms/InboundEPform/index.tsx (1)
109-112: LGTM! Improved error handling with user notification.The addition of user-facing error notification when fetching inbound-connectors fails improves the user experience by making failures visible.
workspaces/mi/mi-diagram/src/components/sidePanel/mediators/ModuleSuggestions.tsx (1)
54-76: LGTM! Improved error handling consistency.The changes improve error handling by:
- Initializing
datato an empty array- Only parsing JSON when
response.okis true- Consistently using empty array
[]instead ofundefinedon errorThis ensures more predictable behavior in error scenarios.
workspaces/mi/mi-visualizer/src/views/Forms/InboundEPform/inboundConnectorForm.tsx (1)
253-286: LGTM! Fixed parameter merging logic.The change from
transformedParameterstofinalParameterscorrectly merges both parameter sources:
- Parameters from the ParamManager UI component
- Parameters from the form fields
This ensures all parameter inputs are included in the inbound connector configuration.
workspaces/mi/mi-extension/src/util/index.ts (1)
179-210: LGTM! Standard .gitignore patterns added.The additions follow common best practices:
.envprevents accidental commit of environment variables/secretsmvnwandmvnw.cmdare Maven wrapper executables that are typically generatedworkspaces/mi/mi-diagram/src/components/nodes/ReferenceNode/ReferenceNodeWidget.tsx (2)
106-110: LGTM! Legacy project detection added.The component now detects legacy projects on mount and passes this flag to icon rendering, enabling legacy-aware UI behavior.
234-234: LGTM! Icon rendering updated for legacy support.The
isLegacyProjectflag is correctly propagated togetMediatorIconsFromFont, enabling appropriate icon rendering based on project type.workspaces/mi/mi-core/src/rpc-types/mi-diagram/index.ts (1)
447-447: LGTM! New API method for legacy project detection.The
isLegacyProjectmethod is correctly added to theMiDiagramAPIinterface, enabling components to query project type.workspaces/mi/mi-visualizer/src/views/Forms/AddressEndpointForm.tsx (1)
236-247: LGTM! Improved form UX with placeholder instead of default value.The change from
defaultValue: "parameter_value"toplaceholder: "parameter_value"withdefaultValue: ""provides better user experience by showing an example without pre-filling the field.workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts (1)
456-456: LGTM! RPC type declaration follows established patterns.The new
isLegacyProjectRPC type is well-defined and consistent with other RPC type declarations in the file.workspaces/mi/mi-visualizer/src/views/Forms/HTTPEndpointForm/Types.ts (1)
161-162: Good UX improvement with placeholder guidance.Changing from a pre-filled
defaultValueto aplaceholderprovides clearer guidance while keeping the field initially empty. This aligns with modern form design patterns.workspaces/mi/mi-diagram/src/components/Navigator/Navigator.tsx (1)
148-148: Verify icon rendering behavior with legacy flag.The legacy flag is now passed to
getMediatorIconsFromFont. Ensure this produces the expected icon colors for legacy vs. non-legacy projects, especially for mediator groups like Call, Clone, and OAuth that have conditional coloring.workspaces/mi/mi-visualizer/src/views/Forms/WSDLEndpointForm/Types.ts (1)
107-108: Consistent UX improvement across endpoint forms.This change mirrors the HTTPEndpointForm update, providing consistent placeholder-based guidance across different endpoint types.
workspaces/mi/mi-visualizer/src/views/Overview/ProjectInformation/index.tsx (1)
240-244: Verify the UI change manually against linked issues.I was unable to access the linked issues in the sandbox environment to verify whether any of them specifically request displaying Group ID and Artifact ID instead of Name and Description. The GitHub CLI is not functioning in this context.
Please manually verify that at least one of the linked issues (668, 1289, 1204, 1314, 1308, 1042, 1022, 970, 1259, 1343, 1306, 1295, 1293, 1098, 695, 715, 643, 645) explicitly requests this UI change. If confirmed, the change is intentional and aligns with requirements. If not, consider whether the project name should remain prominently displayed alongside or instead of the technical Maven coordinates.
workspaces/mi/mi-diagram/src/components/sidePanel/index.tsx (1)
158-159: LGTM!The legacy project check is properly awaited and the result is correctly passed to
getMediatorIconsFromFont. The implementation aligns with the broader PR pattern for legacy-aware icon rendering.workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-handler.ts (2)
321-322: LGTM!The import of
isLegacyProjectis correctly added to the import list from@wso2/mi-core.
510-510: LGTM!The RPC handler registration correctly delegates to the manager's
isLegacyProject()method and follows the established pattern in this file.workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts (2)
452-453: LGTM!The import additions are correctly structured and follow the established pattern.
1189-1191: LGTM!The client-side RPC method implementation correctly follows the established pattern and matches the type definitions from the core module.
workspaces/mi/mi-diagram/src/components/nodes/CallNode/CallNodeWidget.tsx (1)
228-228: LGTM!The
isLegacyProjectflag is correctly passed to bothgetMediatorIconsFromFontcalls for consistent legacy-aware icon rendering across the node and its endpoint.Also applies to: 271-271
workspaces/mi/mi-diagram/src/components/sidePanel/tryout/SetPayloads.tsx (3)
52-53: LGTM!The state initialization and computed value for error conditions are correctly implemented. The optional chaining for
artifactModel?.tagis good defensive programming.
82-84: LGTM!The legacy project check is appropriately placed within the existing data loading effect, ensuring it runs once on mount alongside other initialization logic.
260-299: LGTM!The conditional rendering logic effectively handles unsupported artifacts and legacy runtimes before showing the payload configuration form. The warning messages are clear and provide actionable guidance to users.
workspaces/mi/mi-diagram/src/components/Navigator/Navigator.tsx
Outdated
Show resolved
Hide resolved
workspaces/mi/mi-diagram/src/components/nodes/GroupNode/GroupNodeWidget.tsx
Outdated
Show resolved
Hide resolved
workspaces/mi/mi-diagram/src/components/nodes/MediatorNode/MediatorNodeWidget.tsx
Outdated
Show resolved
Hide resolved
workspaces/mi/mi-diagram/src/components/sidePanel/mediators/List.tsx
Outdated
Show resolved
Hide resolved
workspaces/mi/mi-visualizer/src/views/Overview/ProjectInformation/ProjectInformationForm.tsx
Show resolved
Hide resolved
workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
workspaces/mi/mi-core/src/state-machine-types.ts (1)
252-274:isLegacyRuntimeflag looks fine; consider clarifying semantics vsisOldProjectThe new optional field is backward compatible and fits the existing pattern of boolean flags on
VisualizerLocation. To avoid ambiguity withisOldProject, it might be worth adding a short doc comment (either on the interface or on the field) explaining howisLegacyRuntimediffers fromisOldProjectand in which scenarios each should be set.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
workspaces/mi/mi-extension/src/stateMachine.ts (2)
100-104: Minor: Trailing blank line inside assign block.There's an extra blank line at line 103 before the closing brace. Consider removing it for consistency with the other assign blocks in this file.
isOldProject: (context, event) => event.data.isOldProject, displayOverview: (context, event) => event.data.displayOverview, isLegacyRuntime: (context, event) => event.data.isLegacyRuntime - })
914-916: Consider moving version detection inside the project check block.The runtime version detection logic is correct—defaulting to
true(legacy) when the version is unavailable is a safe fallback. However, this detection runs unconditionally for all calls, including when no MI project is detected.For a minor performance optimization, consider moving this logic inside the
if (isProject || isOldProject)block (around line 905), since the legacy runtime flag is only meaningful for valid projects:if (isProject || isOldProject) { isEnvironmentSetUp = await setupEnvironment(projectUri, isOldProject); if (!isEnvironmentSetUp) { vscode.commands.executeCommand('setContext', 'MI.status', 'notSetUp'); } // console.log project path console.log(`Current workspace path: ${projectUri}`); } - const runtimeVersion = await getMIVersionFromPom(projectUri); - const isLegacyRuntime = runtimeVersion ? compareVersions(runtimeVersion, RUNTIME_VERSION_440) < 0 : true; + let isLegacyRuntime = true; + if (isProject || isOldProject) { + const runtimeVersion = await getMIVersionFromPom(projectUri); + isLegacyRuntime = runtimeVersion ? compareVersions(runtimeVersion, RUNTIME_VERSION_440) < 0 : true; + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
workspaces/mi/mi-extension/src/stateMachine.ts(6 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
workspaces/mi/mi-extension/src/stateMachine.ts (4)
workspaces/mi/mi-core/src/rpc-types/mi-diagram/rpc-type.ts (1)
getMIVersionFromPom(428-428)workspaces/mi/mi-rpc-client/src/rpc-clients/mi-diagram/rpc-client.ts (1)
getMIVersionFromPom(1080-1082)workspaces/mi/mi-extension/src/rpc-managers/mi-diagram/rpc-manager.ts (1)
getMIVersionFromPom(490-495)workspaces/mi/mi-extension/src/constants/index.ts (1)
RUNTIME_VERSION_440(199-199)
🔇 Additional comments (3)
workspaces/mi/mi-extension/src/stateMachine.ts (3)
21-21: LGTM!Import additions for runtime version detection are correctly structured and appropriately sourced from constants and utility modules.
Also applies to: 30-30
40-40: LGTM!The optional
isLegacyRuntimeproperty correctly extendsMachineContextand aligns with the pattern of other optional properties in the interface.
918-928: LGTM!The return object correctly includes
isLegacyRuntime, which is properly consumed by the state machine transition on line 102.
This PR will fix the below mentioned issues.
deployment.tomlconfigs mi-vscode#1306Summary by CodeRabbit
New Features
Bug Fixes
Improvements
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.