From 8dfabd8d51330ec81eb63f39f9f9f17bfac84906 Mon Sep 17 00:00:00 2001 From: Stefan VanBuren Date: Thu, 28 Mar 2024 07:55:00 -0400 Subject: [PATCH 1/3] Tweak digest display Didn't look too closely at these before, but this now trims down the digest column, because it's not terribly helpful for consumers to use anywhere. (May eventually just remove it if there's more to be added in this table.) --- main.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 55f34f3..9313706 100644 --- a/main.go +++ b/main.go @@ -322,16 +322,27 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { // TODO: adjust these dynamically? {Title: "ID", Width: 12}, {Title: "Create Time", Width: 19}, - // TODO: What makes sense? - {Title: "Digest", Width: 19}, + // No need to make this too long - it's not really + // useful to consumers. + // 2 "" + 1 ":" + 6 starting characters + {Title: "Digest", Width: 9}, // TODO: What else is useful here? } rows := make([]table.Row, len(msg)) for i, commit := range msg { + var digestType string + switch commit.Digest.Type { + case modulev1beta1.DigestType_DIGEST_TYPE_B4: + digestType = "b4" + case modulev1beta1.DigestType_DIGEST_TYPE_B5: + digestType = "b5" + default: + digestType = "??" + } rows[i] = table.Row{ commit.Id, commit.CreateTime.AsTime().Format(time.DateTime), - fmt.Sprintf("%s:%s", commit.Digest.Type.String(), commit.Digest.Value), + fmt.Sprintf("%s:%x", digestType, commit.Digest.Value), } } m.commitsTable = table.New( From e3b3acf3ac5d4ce3352f619331bbbbcd359717e2 Mon Sep 17 00:00:00 2001 From: Stefan VanBuren Date: Thu, 28 Mar 2024 08:00:17 -0400 Subject: [PATCH 2/3] Remove prefix and rename column The digests returned from the v1 API will always be b5, so no need to include the prefix. --- main.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/main.go b/main.go index 9313706..8634066 100644 --- a/main.go +++ b/main.go @@ -324,25 +324,15 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { {Title: "Create Time", Width: 19}, // No need to make this too long - it's not really // useful to consumers. - // 2 "" + 1 ":" + 6 starting characters - {Title: "Digest", Width: 9}, + {Title: "B5 Digest", Width: 9}, // TODO: What else is useful here? } rows := make([]table.Row, len(msg)) for i, commit := range msg { - var digestType string - switch commit.Digest.Type { - case modulev1beta1.DigestType_DIGEST_TYPE_B4: - digestType = "b4" - case modulev1beta1.DigestType_DIGEST_TYPE_B5: - digestType = "b5" - default: - digestType = "??" - } rows[i] = table.Row{ commit.Id, commit.CreateTime.AsTime().Format(time.DateTime), - fmt.Sprintf("%s:%x", digestType, commit.Digest.Value), + fmt.Sprintf("%x", commit.Digest.Value), } } m.commitsTable = table.New( From 8fcd13c593494ddd3ff8e0252d58faefb7eeb4e8 Mon Sep 17 00:00:00 2001 From: Stefan VanBuren Date: Thu, 28 Mar 2024 08:01:15 -0400 Subject: [PATCH 3/3] Change b5 casing --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 8634066..aaebf22 100644 --- a/main.go +++ b/main.go @@ -324,7 +324,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { {Title: "Create Time", Width: 19}, // No need to make this too long - it's not really // useful to consumers. - {Title: "B5 Digest", Width: 9}, + {Title: "b5 Digest", Width: 9}, // TODO: What else is useful here? } rows := make([]table.Row, len(msg))