MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / View

Method View

tui/create.go:793–1083  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

791}
792
793func (m createModel) View() string {
794 if m.err != nil {
795 return ""
796 }
797
798 if m.quitting {
799 return ""
800 }
801
802 if m.step == stepComplete {
803 return ""
804 }
805
806 var s strings.Builder
807 s.WriteString("\n")
808 s.WriteString(m.styles.Title.Render("⚡ Create Thunder Compute Instance"))
809 s.WriteString("\n")
810
811 type progressEntry struct {
812 name string
813 steps []createStep
814 }
815 progressSteps := []progressEntry{
816 {"GPU", []createStep{stepGPU}},
817 {"Size", []createStep{stepCompute}},
818 {"Template", []createStep{stepTemplate}},
819 {"Disk", []createStep{stepDiskSize}},
820 {"Confirm", []createStep{stepConfirmation}},
821 }
822 for i, entry := range progressSteps {
823 isCurrent := false
824 isDone := true
825 for _, st := range entry.steps {
826 if st == m.step {
827 isCurrent = true
828 }
829 if st <= m.step || m.skippedSteps[st] {
830 // step is done
831 } else {
832 isDone = false
833 }
834 }
835 if isCurrent {
836 s.WriteString(m.styles.Selected.Render(fmt.Sprintf("[%s]", entry.name)))
837 } else if isDone {
838 s.WriteString(fmt.Sprintf("[✓ %s]", entry.name))
839 } else {
840 s.WriteString(fmt.Sprintf("[%s]", entry.name))
841 }
842 if i < len(progressSteps)-1 {
843 s.WriteString(" → ")
844 }
845 }
846 s.WriteString("\n\n")
847
848 switch m.step {
849 case stepGPU:
850 if !m.specsLoaded {

Callers

nothing calls this directly

Calls 10

getGPUOptionsMethod · 0.95
computePreviewPriceMethod · 0.95
FormatGPUTypeFunction · 0.92
CapitalizeFunction · 0.92
FormatPriceFunction · 0.92
IsGPUTypeAvailableMethod · 0.80
GPUCountsMethod · 0.80
IsSpecAvailableMethod · 0.80
RamPerVCPUMethod · 0.80
VCPUOptionsMethod · 0.80

Tested by

no test coverage detected