Skip to content

Conversation

@patil-pratik-87
Copy link
Contributor

@patil-pratik-87 patil-pratik-87 commented Sep 4, 2025

Summary by Bito

This PR resolves OS assignment issues in the migration forms by combining: 1) adding osFamily property to the migration model, 2) enhancing VM validation for powered-off VMs, 3) ensuring proper OS assignment in migration forms. The changes include: UI/state management for OS selection, validation for IP/OS assignments, and alert handling to prevent progression with validation errors.

fixes #866

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Sep 4, 2025

Code Review Agent Run #94ebec

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: ba5b1c0..ba5b1c0
    • ui/src/api/migration-templates/model.ts
    • ui/src/features/migration/VmsSelectionStep.tsx
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at mithil@platform9.com.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link
Contributor

@windsurf-bot windsurf-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 To request another review, post a new comment with "/windsurf-review".

};

// OS assignment handler
const handleOSAssignment = async (vmId: string, osFamily: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handleOSAssignment function doesn't handle empty string values properly. When a user selects the "Select OS" option (empty value), the function will still update the state and make an API call with an empty string. This could lead to unexpected behavior in the backend.

Consider adding a check to prevent empty string assignments or handle them as a special case (e.g., removing the assignment).

Comment on lines +390 to +396
value={(() => {
if (!currentOsFamily || currentOsFamily === "Unknown") return "";
const osLower = currentOsFamily.toLowerCase();
if (osLower.includes("windows")) return "windowsGuest";
if (osLower.includes("linux")) return "linuxGuest";
return "";
})()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The self-executing function inside the value prop of the Select component adds unnecessary complexity:

Suggested change
value={(() => {
if (!currentOsFamily || currentOsFamily === "Unknown") return "";
const osLower = currentOsFamily.toLowerCase();
if (osLower.includes("windows")) return "windowsGuest";
if (osLower.includes("linux")) return "linuxGuest";
return "";
})()}
const getOsFamilyValue = () => {
if (!currentOsFamily || currentOsFamily === "Unknown") return "";
const osLower = currentOsFamily.toLowerCase();
if (osLower.includes("windows")) return "windowsGuest";
if (osLower.includes("linux")) return "linuxGuest";
return "";
};
// Then in the Select component:
value={getOsFamilyValue()}

Consider extracting this logic to a separate function for better readability.

Comment on lines +444 to +448
<Tooltip title={powerState === "powered-off" ?
((!currentOsFamily || currentOsFamily === "Unknown") ?
"OS assignment required for powered-off VMs" :
"Click to change OS selection") :
displayValue}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nested ternary operators in the tooltip title make the code difficult to read and maintain:

Suggested change
<Tooltip title={powerState === "powered-off" ?
((!currentOsFamily || currentOsFamily === "Unknown") ?
"OS assignment required for powered-off VMs" :
"Click to change OS selection") :
displayValue}>
const tooltipTitle = powerState === "powered-off" ?
(!currentOsFamily || currentOsFamily === "Unknown") ?
"OS assignment required for powered-off VMs" :
"Click to change OS selection" :
displayValue;
return (
<Tooltip title={tooltipTitle}>

Consider extracting this logic to a separate variable for better readability.

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Sep 4, 2025

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Feature Improvement - Migration Model Enhancement

model.ts - Added the optional osFamily field to the migration model to support enhanced OS assignment.

Bug Fix - OS Assignment Bug Fixes

MigrationForm.tsx - Enhanced VM validation logic to ensure powered-off VMs have proper IP addresses and OS assignments.

VmsSelectionStep.tsx - Improved OS assignment handling with a new dropdown selection and an asynchronous patching mechanism to update OS values.

Other Improvements - Rolling Form Alert Styling Improvement

RollingMigrationForm.tsx - Updated Alert component styling to ensure consistent visual warnings in the rolling migration form.

Copy link
Contributor

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #4e67f8

Actionable Suggestions - 1
  • ui/src/features/migration/MigrationForm.tsx - 1
Review Details
  • Files reviewed - 2 · Commit Range: ba5b1c0..4e626e7
    • ui/src/features/migration/MigrationForm.tsx
    • ui/src/features/migration/RollingMigrationForm.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at mithil@platform9.com.

Documentation & Help

AI Code Review powered by Bito Logo

Comment on lines +660 to +665
// Check for VMs without IP addresses
const vmsWithoutIPs = poweredOffVMs.filter(vm =>
!vm.ipAddress || vm.ipAddress === "—" || vm.ipAddress.trim() === ""
);

// Check for VMs without OS assignment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect character used in IP validation

The IP address check includes a special dash character '—' (em dash) instead of a regular hyphen '-'. This could cause issues with IP validation for powered-off VMs.

Code suggestion
Check the AI-generated fix before applying
Suggested change
// Check for VMs without IP addresses
const vmsWithoutIPs = poweredOffVMs.filter(vm =>
!vm.ipAddress || vm.ipAddress === "" || vm.ipAddress.trim() === ""
);
// Check for VMs without OS assignment
// Check for VMs without IP addresses
const vmsWithoutIPs = poweredOffVMs.filter(vm =>
!vm.ipAddress || vm.ipAddress === "-" || vm.ipAddress.trim() === ""
);
// Check for VMs without OS assignment

Code Review Run #4e67f8


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Copy link
Collaborator

@spai-p9 spai-p9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@patil-pratik-87 patil-pratik-87 merged commit c2134e9 into main Sep 4, 2025
12 checks passed
@patil-pratik-87 patil-pratik-87 deleted the 866-ui-not-able-to-select-os-when-doing-cold-migration branch September 4, 2025 11:56
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Sep 4, 2025

Bito Automatic Review Failed - Technical Failure

Bito encountered technical difficulties while generating code feedback . To retry, type /review in a comment and save. If the issue persists, contact support@bito.ai and provide the following details:

Agent Run ID: b0ddfd5c-2f68-4d05-ab5f-33a3fcc28344

rishabh625 pushed a commit to rishabh625/vjailbreak that referenced this pull request Sep 5, 2025
jessicaralhan pushed a commit to jessicaralhan/vjailbreak-testing that referenced this pull request Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI: Not able to select OS when doing cold migration

4 participants