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

Function showCloneConfig

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

Source from the content-addressed store, hash-verified

1092 }
1093
1094 async function showCloneConfig(vm: VmListItem) {
1095 const theVm = await ensureVmDetails(vm);
1096 if (!theVm?.configuration?.compose_file) {
1097 alert('Compose file not available for this VM. Please open its details first.');
1098 return;
1099 }
1100 const config = theVm.configuration;
1101
1102 // Populate vmForm with current VM data, but clear envs and ports
1103 vmForm.value = {
1104 name: `${config.name || vm.name}`,
1105 image: config.image || '',
1106 dockerComposeFile: theVm.appCompose?.docker_compose_file || '',
1107 initScript: theVm.appCompose?.init_script || '',
1108 preLaunchScript: theVm.appCompose?.pre_launch_script || '',
1109 vcpu: config.vcpu || 1,
1110 memory: config.memory || 0,
1111 memoryValue: autoMemoryDisplay(config.memory || 0).memoryValue,
1112 memoryUnit: autoMemoryDisplay(config.memory || 0).memoryUnit,
1113 swap_size: theVm.appCompose?.swap_size || 0,
1114 swapValue: autoMemoryDisplay(bytesToMB(theVm.appCompose?.swap_size || 0)).memoryValue,
1115 swapUnit: autoMemoryDisplay(bytesToMB(theVm.appCompose?.swap_size || 0)).memoryUnit,
1116 disk_size: config.disk_size || 0,
1117 selectedGpus: [],
1118 attachAllGpus: false,
1119 encryptedEnvs: [], // Clear environment variables
1120 ports: [], // Clear port mappings
1121 storage_fs: theVm.appCompose?.storage_fs || 'zfs',
1122 app_id: config.app_id || '',
1123 kms_urls: config.kms_urls || [],
1124 key_provider: getKeyProvider(theVm),
1125 key_provider_id: theVm.appCompose?.key_provider_id || '',
1126 gateway_enabled: !!theVm.appCompose?.gateway_enabled,
1127 gateway_urls: config.gateway_urls || [],
1128 public_logs: !!theVm.appCompose?.public_logs,
1129 public_sysinfo: !!theVm.appCompose?.public_sysinfo,
1130 public_tcbinfo: !!theVm.appCompose?.public_tcbinfo,
1131 pin_numa: !!config.pin_numa,
1132 hugepages: !!config.hugepages,
1133 no_tee: !!config.no_tee,
1134 net_mode: config.networking?.mode || '',
1135 user_config: config.user_config || '',
1136 stopped: !!config.stopped,
1137 };
1138
1139 // Show Create VM dialog instead of Clone Config dialog
1140 showCreateDialog.value = true;
1141 }
1142
1143 async function cloneConfig() {
1144 try {

Callers

nothing calls this directly

Calls 4

ensureVmDetailsFunction · 0.85
autoMemoryDisplayFunction · 0.85
bytesToMBFunction · 0.85
getKeyProviderFunction · 0.85

Tested by

no test coverage detected