Skip to content

Conversation

doughty247
Copy link

Description

This PR adds quality-of-life improvements to the VM resource configuration experience by providing real-time feedback when users allocate system resources that may impact host performance.

Motivation

Currently, WinBoat validates resource allocation with basic minimum checks (4GB RAM, 2 CPU cores) but doesn't warn users when they're allocating a large percentage of their available system resources. Users can inadvertently allocate too much RAM or CPU without realizing the impact on their host system until performance degradation occurs.

Changes

1. Yellow Warning System

  • Added percentage-based warnings for RAM and CPU allocation in the Configuration view
  • RAM Warning: Displays when allocation exceeds 40% of total system RAM
  • CPU Warning: Displays when allocation exceeds 50% of total physical CPU cores
  • Warnings appear as yellow text (text-yellow-400) directly below the respective input fields
  • Example: "⚠️ Using 65% of total RAM - high allocation may impact host performance"

2. Enhanced System Detection

  • Leverages existing getMemoryInfo() function in specs.ts that reads /proc/meminfo to extract both total and available system memory
  • Returns MemoryInfo type with totalGB and availableGB properties
  • Used by getSpecs() to provide accurate memory detection
  • Enables real-time validation during both setup and configuration

3. Improved UI Components

  • Replaced <x-input> components with native <input type="number"> elements for RAM/CPU allocation
  • Added custom styling to match WinBoat's design language:
    class="w-24 text-right text-[1.1rem] bg-neutral-800 border border-neutral-600 rounded px-3 py-1.5"
  • Changed card layout from flex-row to flex-col to accommodate inline warning messages

Technical Implementation

File: src/renderer/views/Config.vue

  • Added computed properties ramWarning and cpuWarning
  • Calculate percentage of system resources being allocated
  • Return warning strings when thresholds exceeded, otherwise return null
  • Warning messages displayed conditionally with v-if="ramWarning" / v-if="cpuWarning"

File: src/renderer/lib/specs.ts

  • Already implements getMemoryInfo() function
  • Reads /proc/meminfo, extracts MemTotal and MemAvailable lines
  • Converts kilobytes to gigabytes with rounding: Math.round(parseInt(...) / 1024 / 1024 * 100) / 100
  • Exports MemoryInfo type for type safety

Benefits

  1. Proactive User Guidance: Users receive immediate feedback about allocation impact before applying changes
  2. Prevents System Instability: Warnings help users avoid over-allocating resources that could freeze their host system
  3. Better UX: Native number inputs provide more familiar controls compared to custom components
  4. Consistent Validation: Same detection logic used during initial setup and ongoing configuration

Testing Notes

  • Tested on systems with varying RAM amounts (16GB, 32GB)
  • Warning thresholds trigger correctly at 40% RAM and 50% CPU
  • Native number inputs respect min/max boundaries
  • Warning messages display inline without breaking card layout
  • Color scheme (text-yellow-400) provides appropriate visual hierarchy

Screenshots

Screenshot_20251010_180636

Notes

  • All changes are backwards-compatible with existing WinBoat installations
  • Warning system is non-blocking - users can still save their configuration choices

Modified Files

  • src/renderer/views/Config.vue (71 additions, 42 deletions)

Total Changes: ~113 lines modified


Build Verification

Test Build Completed Successfully

  • Built clean AppImage
  • No build errors or warnings
  • Branch: qol-warnings-and-detection

@Levev Levev added the enhancement New feature or request label Oct 11, 2025
@Levev
Copy link
Collaborator

Levev commented Oct 11, 2025

Thank you for taking your time to improve WinBoat's UX! I really like how the warning looks!

That being said, I'm not sure how I feel about removing x-card. Relying on xel-toolkit's components could seem like a limiting factor when designing the UI but in my opinion it is what makes WinBoat's look consistent.
Also make sure you parse ramGB correctly, iirc we used a bit of RegEx for that.

@doughty247
Copy link
Author

Yeah... My idea there was that I wanted easy increase/decrease for users, but I do totally agree that it breaks the UI look. Thanks for the feedback! I will make the changes immediately.

@doughty247 doughty247 force-pushed the qol-warnings-and-detection branch from a1b7361 to abc8e42 Compare October 11, 2025 00:48
@doughty247
Copy link
Author

Updated! I've switched back to x-input components with RegEx parsing as requested.

Changes made:

  • Replaced native input elements with x-input components
  • Added RegEx parsing: @input="(e: any) => ramGB = Number(/^\d+$/.exec(e.target.value)![0] || 4)"
  • Kept the flex-col layout and all warning functionality
  • Tested locally - everything works great!

Thanks for the feedback! @Levev

@doughty247 doughty247 marked this pull request as ready for review October 11, 2025 11:46
Your Name added 2 commits October 11, 2025 08:07
- Add percentage-based warnings for RAM (>40%) and CPU (>50%) allocation
- Replace x-input components with native HTML5 number inputs
- Add yellow warning messages below resource inputs when thresholds exceeded
- Change card layout from flex-row to flex-col to accommodate inline warnings
- Uses existing getMemoryInfo() for accurate RAM detection from /proc/meminfo

This provides proactive user guidance to prevent over-allocation that could
impact host system performance.
- Replaced native input elements with x-input components
- Added RegEx parsing: @input with /^\d+$/.exec() pattern
- Kept flex-col layout for warning display
- Kept all warning functionality (40% RAM, 50% CPU thresholds)
- Changed gap-3 to gap-2, removed font-medium from labels
@doughty247 doughty247 force-pushed the qol-warnings-and-detection branch from abc8e42 to 5d3b04e Compare October 11, 2025 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants