Skip to content

Commit e411433

Browse files
committed
feat: add ID column to volume list
Show a short UUID (first 8 chars) in the volume list so users can match volumes to the UUIDs shown in server detail. The column has priority 2 and hides on narrow terminals alongside Device.
1 parent 74af6a6 commit e411433

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/internal/ui/volumelist/volumelist.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type Column struct {
3838
func defaultColumns() []Column {
3939
return []Column{
4040
{Title: "Name", MinWidth: 10, Flex: 3, Priority: 0, Key: "name"},
41+
{Title: "ID", MinWidth: 10, Flex: 0, Priority: 2, Key: "id"},
4142
{Title: "Status", MinWidth: 14, Flex: 0, Priority: 0, Key: "status"},
4243
{Title: "Size", MinWidth: 6, Flex: 0, Priority: 0, Key: "size"},
4344
{Title: "Type", MinWidth: 8, Flex: 1, Priority: 1, Key: "type"},
@@ -327,6 +328,8 @@ func (m *Model) sortVolumes() {
327328
switch colKey {
328329
case "name":
329330
less = strings.ToLower(a.Name) < strings.ToLower(b.Name)
331+
case "id":
332+
less = a.ID < b.ID
330333
case "status":
331334
less = a.Status < b.Status
332335
case "size":
@@ -430,8 +433,14 @@ func (m Model) View() string {
430433
device = v.AttachedDevice
431434
}
432435

436+
shortID := v.ID
437+
if len(shortID) > 8 {
438+
shortID = shortID[:8]
439+
}
440+
433441
values := map[string]string{
434442
"name": name,
443+
"id": shortID,
435444
"status": shared.StatusIcon(v.Status) + v.Status,
436445
"size": fmt.Sprintf("%dGB", v.Size),
437446
"type": v.VolumeType,

0 commit comments

Comments
 (0)