diff --git a/CHANGELOG.md b/CHANGELOG.md index b28e588b3..b472f274c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan - [#292](https://github.com/kobsio/kobs/pull/292): [resources] Fix shown conditions in details view. - [#297](https://github.com/kobsio/kobs/pull/297): [prometheus] Fix metrics, when Prometheus returns `Inf` value. - [#303](https://github.com/kobsio/kobs/pull/303): [core] Fix missing borders for select elements. +- [#304](https://github.com/kobsio/kobs/pull/304): [resources] Fix formatting of cells for Custom Resource Definition. ### Changed diff --git a/plugins/core/src/utils/resources.tsx b/plugins/core/src/utils/resources.tsx index c210c78a3..abbfe924d 100644 --- a/plugins/core/src/utils/resources.tsx +++ b/plugins/core/src/utils/resources.tsx @@ -1678,11 +1678,16 @@ export const customResourceDefinition = (crds: ICRD[]): IResources => { const crdCells = crd.columns && crd.columns.length > 0 ? crd.columns.map((column) => { - const value = JSONPath({ json: cr, path: `$.${column.jsonPath}` })[0]; - if (!value) return ''; - if (column.type === 'date') + const value = JSONPath({ json: cr, path: `$.${column.jsonPath}` })[0]; + if (!value) { + return ''; + } else if (column.type === 'date') { return timeDifference(new Date().getTime(), new Date(value).getTime()); - return value; + } else if (Array.isArray(value)) { + return value.join(', '); + } else { + return value; + } }) : [timeDifference(new Date().getTime(), new Date(cr.metadata?.creationTimestamp).getTime())];