Skip to content

Conversation

@barnabasbusa
Copy link
Contributor

Summary

  • Add new file upload functionality to the WebUI test registration modal
  • Introduce /api/v1/tests/register_upload API endpoint for multipart form uploads
  • Maintain backward compatibility with existing URL-based registration

Changes Made

  • Backend: New API endpoint /api/v1/tests/register_upload that accepts multipart form data
  • Frontend: Enhanced register test modal with radio button toggle between URL and file upload methods
  • UI/UX: Added form guidance text and proper file input validation
  • Validation: Comprehensive YAML parsing and file size limits (10MB max)

Features

  1. Dual Registration Methods: Users can choose between URL-based or file upload registration
  2. Custom Overrides: Support for custom test names and configuration overrides
  3. File Metadata: Uploaded file information is preserved in test configuration
  4. Error Handling: Proper validation and user-friendly error messages
  5. File Type Filtering: Only accepts .yaml and .yml files

UI Changes

The register test modal now includes:

  • Radio button toggle for "From URL" vs "Upload File"
  • File input with .yaml/.yml file type restrictions
  • Enhanced form guidance text
  • Dynamic field visibility based on selected method

API Changes

  • New endpoint: POST /api/v1/tests/register_upload
  • Content-Type: multipart/form-data
  • Parameters:
    • playbook (file): YAML test configuration file
    • name (optional): Custom test name override
    • config (optional): YAML configuration overrides
    • configVars (optional): YAML configuration variables

Test plan

  • Build successfully compiles
  • WebUI loads with new upload interface
  • File upload validation works
  • API endpoint handles multipart form data
  • Test registration via upload functions
  • Backward compatibility with URL method maintained
  • Error handling works correctly

Example

Included cgc-test.yaml demonstrates the new upload functionality for CGC validation testing.

🤖 Generated with Claude Code

This commit adds functionality to upload custom YAML test configuration
files directly through the WebUI, in addition to the existing URL-based
registration method.

Changes:
- Add new `/api/v1/tests/register_upload` API endpoint for file uploads
- Modify WebUI register test modal to support both URL and file upload methods
- Add radio button toggle to switch between "From URL" and "Upload File" modes
- Support multipart form uploads with custom name and config overrides
- Include metadata about uploaded files in test configuration
- Maintain backward compatibility with existing URL-based registration

The new upload functionality allows users to:
1. Select local YAML test configuration files
2. Override test names and add custom configuration
3. Upload files up to 10MB in size
4. View helpful form guidance text

Example usage: Upload cgc-test.yaml for CGC validation testing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@barnabasbusa barnabasbusa marked this pull request as draft June 19, 2025 11:45
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.

2 participants