Repository navigation
feat(vms): a Virtual Machines card where the module answers - #25
Conversation
The dashboard side of the opt-in virtual machine module (CasaOS-VirtManagement, ReCasaOS/CasaOS#18), kept apart from the page so it can be reviewed on its own: - entry.js asks /v2/virt_management/host once per page load; the card joins Files and the App Store only when the module answers through the gateway (a 404 means not installed and is not asked again) - the card opens the page in a modal, or on #/vms when App launching sends it to a new tab; the launcher list offers it only where the module is - the page is a lazy chunk; here it is only its frame (title and close), the list and details of the machines come in the next PR A box without the module downloads nothing beyond this file and the icon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
inkly
left a comment
There was a problem hiding this comment.
Thanks, this is what I hoped for: small, the page stays a lazy chunk, and a box without the module downloads only entry.js and the icon. I read the whole diff and ran nothing yet. Two things before I merge it:
- The probe is on the path that draws the app grid.
AppSection.vuedoesawait hasVirtualMachines()before it builds the list, and the probe has no timeout. On a box whose gateway answers slowly, or where/v2/virt_management/hosthangs instead of failing, the grid (Files, the App Store, every app) waits for it. Could the list be built without waiting, and the card added when the probe answers? (hasVirtualMachines().then(...)pushingvmApplication()into the list; the saved order already keeps its place by name.) Failing that, a short timeout on the probe (a couple of seconds) that counts as "not there, ask again next time". - French.
fr_FR.jsonhas noVirtual Machineskey, so a French dashboard shows it in English. "Machines virtuelles" is the usual wording; I can push it to your branch or you can add it, whichever you prefer. (The lists of machines come in your next PR with their strings: same for French, I will send it when it is up.)
Smaller, no change needed: the 404-means-not-installed rule and asking again after any other failure are the right way round, and the three tests pin them.
The grid is drawn as soon as the apps are read; the Virtual Machines card joins it when the probe answers, at the place the saved order has for it. A grid read again keeps the card it already shows, so it does not blink. A saved order that has the card is saved again only once the probe has answered: saving it while the probe is out would drop the card's name and send the card to the end. Also "Machines virtuelles" in French. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks! Both are in 4789c3e. The probe no longer holds up the grid. One catch with "the saved order already keeps its place by name": One thing that changes: on a box with no saved order yet, the card goes at the end of the grid instead of right after Files, because the order is saved before the probe answers. If you'd rather keep it next to Files there too, I can do that. Three tests in French: I added "Machines virtuelles". |
|
Thanks, both are what I asked for. I read the second commit: the grid draws without waiting, the card joins at its place, once however many reads wait on the probe, and a saved order that has the card is not saved without it while the probe is out. The three tests pin that, and "Machines virtuelles" is right. On a box with no saved order yet, the card at the end of the grid is fine: the owner can move it, and it is not worth a special case. One thing, small, and it can go in your next PR if you prefer: |
The small dashboard PR from ReCasaOS/CasaOS#18: the card, the launcher entry and the route for the opt-in virtual machine module (Vinz2168/CasaOS-VirtManagement), kept apart from the page itself.
What it does
VirtualMachines/entry.jsasksGET /v2/virt_management/hostonce per page load. The card joins Files and the App Store only when the module answers through the gateway; a 404 means it is not installed and is not asked again, any other failure is asked again next time.#/vmswhen App launching sends it to a new tab. The App launching exception list offers "Virtual Machines" only where the module is.en_US.jsonstrings.A box without the module downloads nothing beyond
entry.jsand the icon; the HTTP client is loaded only when the probe runs.Files outside
src/components/VirtualMachines/:AppSection.vue(the card),AppCard.vue(open it),appLaunchPreference.js(casaos:virtual-machines),AppLaunchModal.vue,route.js(#/vms), one string inen_US.json/it_IT.json.Checks: lint 0 errors, build OK, new
entry.spec.js(3 tests on the probe); the rest of the suite fails on exactly the same tests asmain.When the core reads
/etc/casaos/modules/virt.json, the probe can ask the core instead of the module; I kept it to the gateway for now, as agreed in #18.