From 3b1b6461f71c5f233687f3a36e6aa5d7206291bc Mon Sep 17 00:00:00 2001 From: Patrick Evans Date: Mon, 10 Aug 2026 08:23:08 -0500 Subject: [PATCH 1/2] feat: show cluster creation timestamp in cluster context view --- pkg/ocm/client.go | 1 + pkg/ocm/fixtures.go | 3 +++ pkg/ocm/ocm.go | 6 +++++- pkg/tui/views.go | 1 + testdata/fixtures/clusters.json | 3 ++- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pkg/ocm/client.go b/pkg/ocm/client.go index fafb535a..233e26e6 100644 --- a/pkg/ocm/client.go +++ b/pkg/ocm/client.go @@ -272,6 +272,7 @@ func clusterFromResponse(cluster *cmv1.Cluster) *ClusterInfo { State: string(cluster.State()), CloudProvider: cluster.CloudProvider().ID(), Version: cluster.OpenshiftVersion(), + CreatedAt: cluster.CreationTimestamp(), } if cluster.Region() != nil { diff --git a/pkg/ocm/fixtures.go b/pkg/ocm/fixtures.go index df34bfc2..2ffe3fb8 100644 --- a/pkg/ocm/fixtures.go +++ b/pkg/ocm/fixtures.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "time" ) type fixtureCluster struct { @@ -20,6 +21,7 @@ type fixtureCluster struct { CCS bool `json:"ccs"` Organization string `json:"organization"` OrganizationID string `json:"organization_id"` + CreatedAt time.Time `json:"created_at"` } type fixtureServiceLog struct { @@ -84,6 +86,7 @@ func loadClusterFixtures(path string, mock *MockClient) error { CCS: fc.CCS, Organization: fc.Organization, OrganizationID: fc.OrganizationID, + CreatedAt: fc.CreatedAt, } } return nil diff --git a/pkg/ocm/ocm.go b/pkg/ocm/ocm.go index a075c521..50d5ea00 100644 --- a/pkg/ocm/ocm.go +++ b/pkg/ocm/ocm.go @@ -1,6 +1,9 @@ package ocm -import "context" +import ( + "context" + "time" +) // ClusterInfo contains enriched cluster data from the OCM API. type ClusterInfo struct { @@ -16,6 +19,7 @@ type ClusterInfo struct { CCS bool Organization string OrganizationID string + CreatedAt time.Time } // ServiceLog represents a single service log entry. diff --git a/pkg/tui/views.go b/pkg/tui/views.go index f8637820..fa87d1dc 100644 --- a/pkg/tui/views.go +++ b/pkg/tui/views.go @@ -589,6 +589,7 @@ func (m model) renderClusterTab() (string, error) { fmt.Fprintf(&content, "* CCS: %v\n", info.CCS) fmt.Fprintf(&content, "* Organization: %s\n", info.Organization) fmt.Fprintf(&content, "* Organization ID: %s\n", info.OrganizationID) + fmt.Fprintf(&content, "* Created: %s\n", info.CreatedAt.Format("2006-01-02 15:04:05 UTC")) if i < len(clusters)-1 { content.WriteString("\n---\n") } diff --git a/testdata/fixtures/clusters.json b/testdata/fixtures/clusters.json index d64f5230..a6146f38 100644 --- a/testdata/fixtures/clusters.json +++ b/testdata/fixtures/clusters.json @@ -11,7 +11,8 @@ "hypershift": false, "ccs": true, "organization": "Fake Aeronautical Ltd", - "organization_id": "1a2b3c4d5e6f7g8h9i0j" + "organization_id": "1a2b3c4d5e6f7g8h9i0j", + "created_at": "2024-03-15T10:30:00Z" }, "b2d4e6f8-fake-uuid-test-def012345678": { "id": "cluster-osd-002", From 04e91b4b4bd1e76007649bd2a3b91d7817d6a47a Mon Sep 17 00:00:00 2001 From: Christopher Collins Date: Mon, 10 Aug 2026 12:31:34 -1000 Subject: [PATCH 2/2] fix: gofmt struct tag alignment in fixtureCluster MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align struct tags after adding time.Time CreatedAt field, which widened the type column and required re-alignment of all tags. Created with assistance from Claude 🤖 Signed-off-by: Christopher Collins --- pkg/ocm/fixtures.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/ocm/fixtures.go b/pkg/ocm/fixtures.go index 2ffe3fb8..62e8e5a7 100644 --- a/pkg/ocm/fixtures.go +++ b/pkg/ocm/fixtures.go @@ -9,18 +9,18 @@ import ( ) type fixtureCluster struct { - ID string `json:"id"` - ExternalID string `json:"external_id"` - Name string `json:"name"` - DisplayName string `json:"display_name"` - State string `json:"state"` - Region string `json:"region"` - CloudProvider string `json:"cloud_provider"` - Version string `json:"version"` - Hypershift bool `json:"hypershift"` - CCS bool `json:"ccs"` - Organization string `json:"organization"` - OrganizationID string `json:"organization_id"` + ID string `json:"id"` + ExternalID string `json:"external_id"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + State string `json:"state"` + Region string `json:"region"` + CloudProvider string `json:"cloud_provider"` + Version string `json:"version"` + Hypershift bool `json:"hypershift"` + CCS bool `json:"ccs"` + Organization string `json:"organization"` + OrganizationID string `json:"organization_id"` CreatedAt time.Time `json:"created_at"` }