(vm: VmListItem)
| 857 | } |
| 858 | |
| 859 | async function showUpdateDialog(vm: VmListItem) { |
| 860 | const detailedVm = await ensureVmDetails(vm); |
| 861 | if (!detailedVm?.configuration?.compose_file || !detailedVm.appCompose) { |
| 862 | alert('Compose file not available for this VM. Please expand its details first.'); |
| 863 | return; |
| 864 | } |
| 865 | const config = detailedVm.configuration; |
| 866 | const memoryDisplay = autoMemoryDisplay(config.memory || 0); |
| 867 | const swapDisplay = autoMemoryDisplay(bytesToMB(detailedVm.appCompose?.swap_size || 0)); |
| 868 | const gpuSelection = deriveGpuSelection(config.gpus); |
| 869 | updateDialog.value = { |
| 870 | show: true, |
| 871 | vm: detailedVm, |
| 872 | updateCompose: false, |
| 873 | dockerComposeFile: detailedVm.appCompose.docker_compose_file || '', |
| 874 | initScript: detailedVm.appCompose.init_script || '', |
| 875 | preLaunchScript: detailedVm.appCompose.pre_launch_script || '', |
| 876 | encryptedEnvs: [], |
| 877 | resetSecrets: false, |
| 878 | vcpu: config.vcpu || 0, |
| 879 | memory: config.memory || 0, |
| 880 | memoryValue: memoryDisplay.memoryValue, |
| 881 | memoryUnit: memoryDisplay.memoryUnit, |
| 882 | swap_size: detailedVm.appCompose?.swap_size || 0, |
| 883 | swapValue: swapDisplay.memoryValue, |
| 884 | swapUnit: swapDisplay.memoryUnit, |
| 885 | disk_size: config.disk_size || 0, |
| 886 | image: config.image || '', |
| 887 | ports: clonePortMappings(config.ports || []), |
| 888 | attachAllGpus: gpuSelection.attachAll, |
| 889 | selectedGpus: gpuSelection.selected, |
| 890 | updateGpuConfig: false, |
| 891 | user_config: config.user_config || '', |
| 892 | }; |
| 893 | } |
| 894 | |
| 895 | function parseEnvFile(content: string) { |
| 896 | const lines = content |
nothing calls this directly
no test coverage detected