MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / showUpdateDialog

Function showUpdateDialog

vmm/ui/src/composables/useVmManager.ts:859–893  ·  view source on GitHub ↗
(vm: VmListItem)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

ensureVmDetailsFunction · 0.85
autoMemoryDisplayFunction · 0.85
bytesToMBFunction · 0.85
deriveGpuSelectionFunction · 0.85
clonePortMappingsFunction · 0.85

Tested by

no test coverage detected