Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/ocm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
27 changes: 15 additions & 12 deletions pkg/ocm/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@ import (
"fmt"
"os"
"path/filepath"
"time"
)

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"`
}

type fixtureServiceLog struct {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion pkg/ocm/ocm.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package ocm

import "context"
import (
"context"
"time"
)

// ClusterInfo contains enriched cluster data from the OCM API.
type ClusterInfo struct {
Expand All @@ -16,6 +19,7 @@ type ClusterInfo struct {
CCS bool
Organization string
OrganizationID string
CreatedAt time.Time
}

// ServiceLog represents a single service log entry.
Expand Down
1 change: 1 addition & 0 deletions pkg/tui/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
3 changes: 2 additions & 1 deletion testdata/fixtures/clusters.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading