Skip to content

Commit

Permalink
[FIX] close #175
Browse files Browse the repository at this point in the history
  • Loading branch information
gmeghnag committed Aug 13, 2024
1 parent 63cfc53 commit bc3056c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/tablegenerator/tablegenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,15 @@ func GenerateCustomResourceTable(unstruct unstructured.Unstructured) (*metav1.Ta
if len(vars.CRD.Spec.Versions[i].AdditionalPrinterColumns) > 0 {
for _, column := range vars.CRD.Spec.Versions[i].AdditionalPrinterColumns {
table.ColumnDefinitions = append(table.ColumnDefinitions, metav1.TableColumnDefinition{Name: column.Name, Format: "string"})
if column.Name == "Age" || column.Type == "date" {
if column.Name == "Age" {
cells = append(cells, helpers.TranslateTimestamp(unstruct.GetCreationTimestamp()))
}
if column.Name == "Since" {
v := helpers.GetFromJsonPath(unstruct.Object, fmt.Sprintf("%s%s%s", "{", column.JSONPath, "}"))
parsedTime, _ := time.Parse(time.RFC3339, v)
metav1Time := metav1.Time{Time: parsedTime}
v = helpers.TranslateTimestamp(metav1Time)
cells = append(cells, v)
} else {
v := helpers.GetFromJsonPath(unstruct.Object, fmt.Sprintf("%s%s%s", "{", column.JSONPath, "}"))
cells = append(cells, v)
Expand Down

0 comments on commit bc3056c

Please sign in to comment.