initModifyStep sets up step-specific state when arriving at a visible step.
()
| 242 | |
| 243 | // initModifyStep sets up step-specific state when arriving at a visible step. |
| 244 | func (m *modifyModel) initModifyStep() { |
| 245 | m.cursor = 0 |
| 246 | switch m.step { |
| 247 | case modifyStepGPU: |
| 248 | m.cursor = m.getCurrentGPUCursorPosition() |
| 249 | case modifyStepCompute: |
| 250 | if m.needsGPUCountPhase() && m.config.NumGPUs == 0 { |
| 251 | m.gpuCountPhase = true |
| 252 | m.cursor = m.getCurrentGPUCountCursorPosition() |
| 253 | } else if !m.needsGPUCountPhase() { |
| 254 | gpuCounts := m.specs.GPUCounts(m.config.GPUType) |
| 255 | if len(gpuCounts) > 0 { |
| 256 | m.config.NumGPUs = gpuCounts[0] |
| 257 | } else { |
| 258 | m.config.NumGPUs = 1 |
| 259 | } |
| 260 | m.gpuCountPhase = false |
| 261 | m.cursor = m.getCurrentComputeCursorPosition() |
| 262 | } else { |
| 263 | m.cursor = m.getCurrentComputeCursorPosition() |
| 264 | } |
| 265 | case modifyStepDiskSize: |
| 266 | m.diskInput.Focus() |
| 267 | m.diskInputTouched = false |
| 268 | default: |
| 269 | m.diskInput.Blur() |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | func (m *modifyModel) resetComputeSelection() { |
| 274 | m.config.NumGPUs = 0 |
no test coverage detected