()
| 939 | } |
| 940 | |
| 941 | func (m modifyInstanceSelectorModel) View() string { |
| 942 | if m.quitting { |
| 943 | return "" |
| 944 | } |
| 945 | |
| 946 | var s strings.Builder |
| 947 | |
| 948 | s.WriteString(m.styles.Title.Render("⚙ Modify Thunder Compute Instance")) |
| 949 | s.WriteString("\n") |
| 950 | s.WriteString("Select an instance to modify:\n\n") |
| 951 | |
| 952 | for i, instance := range m.instances { |
| 953 | cursor := " " |
| 954 | if m.cursor == i { |
| 955 | cursor = m.styles.Cursor.Render("▶ ") |
| 956 | } |
| 957 | |
| 958 | // Determine status style |
| 959 | var statusStyle lipgloss.Style |
| 960 | statusSuffix := "" |
| 961 | switch instance.Status { |
| 962 | case "RUNNING": |
| 963 | statusStyle = SuccessStyle() |
| 964 | case "STARTING": |
| 965 | statusStyle = WarningStyle() |
| 966 | case "DELETING": |
| 967 | statusStyle = ErrorStyle() |
| 968 | statusSuffix = " (deleting)" |
| 969 | default: |
| 970 | statusStyle = lipgloss.NewStyle() |
| 971 | } |
| 972 | |
| 973 | idAndName := fmt.Sprintf("(%s) %s", instance.ID, instance.Name) |
| 974 | if m.cursor == i { |
| 975 | idAndName = m.styles.Selected.Render(idAndName) |
| 976 | } |
| 977 | |
| 978 | statusText := statusStyle.Render(fmt.Sprintf("(%s)", instance.Status)) |
| 979 | rest := fmt.Sprintf(" %s%s - %sx%s", |
| 980 | statusText, |
| 981 | statusSuffix, |
| 982 | instance.NumGPUs, |
| 983 | instance.GPUType, |
| 984 | ) |
| 985 | |
| 986 | s.WriteString(fmt.Sprintf("%s%s%s\n", cursor, idAndName, rest)) |
| 987 | } |
| 988 | |
| 989 | s.WriteString("\n") |
| 990 | s.WriteString(m.styles.Help.Render("↑/↓: Navigate Enter: Select Esc/Q: Quit\n")) |
| 991 | |
| 992 | return s.String() |
| 993 | } |
nothing calls this directly
no test coverage detected