Dioxus Bootstrap migration #29
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_mahmoud"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The workspace uses axum 0.7.9 for the UI crate, which uses :path for path parameters. The {path} syntax is axum 0.8 only and was treated as a literal string, causing all /css/*, /js/*, and /fonts/* routes to return 404.Inline <script> tags inside {% block content %} ran before app.js was loaded, causing ReferenceError for rpc(), escapeHtml(), loadOpenRpcSpec() etc. Moving all page-specific JS to {% block scripts %} ensures it executes after the base template's script includes.vm_log() calls domain.vm_get() which triggers vm_trigger_get_post, scrubbing the secret field. When vm_log() then writes back via vm_set(), the secret was being destroyed, and subsequent reads would return empty logs because the VM record was corrupted. Wrap all vm_get() calls in vm_log/vm_log_start with with_secret("") (internal access) to bypass the CRUD hooks. Also fix get_deployment_logs and list_deployments to use with_secret so they return the full VM data including logs.Every domain.vm_get() without a secret context triggers vm_trigger_get_post which scrubs vm.secret=None. When the result is written back via vm_set(), the secret is destroyed and logs can be lost due to race conditions with corrupted VM records. Added INTERNAL_SECRET sentinel ("__internal__") that bypasses the scrub hook. All internal vm_get calls (background tasks, monitors, vm_log helpers, job_id saves, reconciliation) now use with_secret(INTERNAL_SECRET, || ...) to preserve all VM fields.Three bugs fixed: 1. ZINIT MONITOR INFINITE LOOP: If zinit.job_status() always fails (due to zinit SDK deserialization bugs), the monitor looped forever, keeping VMs stuck in "provisioning" permanently. Now gives up after 15 consecutive failures (~30s) and marks VM as error with a clear log message explaining what happened. 2. FALSE "COMPLETED" STATUS: get_deployment_logs defaulted log_status to "completed" when None, even for VMs still in provisioning. This caused the UI to show "Deployment completed" toast while the VM was still stuck. Now infers status from VM state: provisioning/starting → "running", error → "failed", stopped/running → "completed". 3. MONITOR WRITES LOGS: Each failed poll attempt now writes a log line to the VM record ("Waiting for zinit job N...") so the user can see the monitor is trying and what errors it encounters.- Start/Stop: action buttons replaced with spinner + label ("starting...", "stopping...") while RPC is in flight - Delete: spinner shown after confirm dialog, buttons restored on error - Deploy modal: spinner shown while submitting deploy request - All spinners use Bootstrap spinner-border-sm for consistencyBackend: - Added MigrateSecretResult type to schema (migrated_count, failed_count) - Added migrate_secret(old_secret, new_secret) RPC method - Implementation reads all VMs with INTERNAL_SECRET context, filters by old_secret match, updates each VM's secret field - Returns count of migrated/failed VMs - Validates: new_secret not empty, old != new, returns NotFound if no VMs match (never reveals "wrong secret") Frontend: - Two-step secret modal replacing the simple single-field form - Step 1 (Set mode): single field for first-time secret setup - Step 1 (Change mode): current/new/confirm password fields with client-side validation (match, different, non-empty) - On Update: calls list_vms to check for owned VMs - Step 2 (if VMs exist): shows VM list with state badges, offers three choices: - [Migrate VMs + Update]: calls migrate_secret RPC, updates all VMs to new secret, then updates localStorage - [Update Secret Only]: just updates localStorage, warns that previous VMs become inaccessible - [Cancel]: go back - Loading spinners on buttons during RPC calls - Error messages shown inline in the modal - Activity feed logging for all secret operationsa-ma-zing.