diff --git a/src/renderer/components/+catalog/catalog-entity.store.ts b/src/renderer/components/+catalog/catalog-entity.store.ts index c11374ede2..7c63bcb0f0 100644 --- a/src/renderer/components/+catalog/catalog-entity.store.ts +++ b/src/renderer/components/+catalog/catalog-entity.store.ts @@ -28,6 +28,10 @@ import { autoBind } from "../../../common/utils"; export class CatalogEntityItem implements ItemObject { constructor(public entity: CatalogEntity) {} + get kind() { + return this.entity.kind; + } + get name() { return this.entity.metadata.name; } diff --git a/src/renderer/components/+catalog/catalog.scss b/src/renderer/components/+catalog/catalog.scss index e76606567b..a0afd8c08c 100644 --- a/src/renderer/components/+catalog/catalog.scss +++ b/src/renderer/components/+catalog/catalog.scss @@ -75,6 +75,10 @@ align-items: center; } + .TableCell.kind { + max-width: 150px; + } + .TableCell.source { max-width: 100px; } diff --git a/src/renderer/components/+catalog/catalog.tsx b/src/renderer/components/+catalog/catalog.tsx index cd04892745..066295b864 100644 --- a/src/renderer/components/+catalog/catalog.tsx +++ b/src/renderer/components/+catalog/catalog.tsx @@ -43,6 +43,7 @@ import { Avatar } from "../avatar/avatar"; enum sortBy { name = "name", + kind = "kind", source = "source", status = "status" } @@ -197,6 +198,83 @@ export class Catalog extends React.Component { ); } + renderSingleCategoryList() { + return ( + item.name, + [sortBy.source]: (item: CatalogEntityItem) => item.source, + [sortBy.status]: (item: CatalogEntityItem) => item.phase, + }} + searchFilters={[ + (entity: CatalogEntityItem) => entity.searchFields, + ]} + renderTableHeader={[ + { title: "", className: "icon" }, + { title: "Name", className: "name", sortBy: sortBy.name }, + { title: "Source", className: "source", sortBy: sortBy.source }, + { title: "Labels", className: "labels" }, + { title: "Status", className: "status", sortBy: sortBy.status }, + ]} + renderTableContents={(item: CatalogEntityItem) => [ + this.renderIcon(item), + item.name, + item.source, + item.labels.map((label) => ), + { title: item.phase, className: kebabCase(item.phase) } + ]} + onDetails={(item: CatalogEntityItem) => this.onDetails(item) } + renderItemMenu={this.renderItemMenu} + /> + ); + } + + renderAllCategoriesList() { + return ( + item.name, + [sortBy.kind]: (item: CatalogEntityItem) => item.kind, + [sortBy.source]: (item: CatalogEntityItem) => item.source, + [sortBy.status]: (item: CatalogEntityItem) => item.phase, + }} + searchFilters={[ + (entity: CatalogEntityItem) => entity.searchFields, + ]} + renderTableHeader={[ + { title: "", className: "icon" }, + { title: "Name", className: "name", sortBy: sortBy.name }, + { title: "Kind", className: "kind", sortBy: sortBy.kind }, + { title: "Source", className: "source", sortBy: sortBy.source }, + { title: "Labels", className: "labels" }, + { title: "Status", className: "status", sortBy: sortBy.status }, + ]} + renderTableContents={(item: CatalogEntityItem) => [ + this.renderIcon(item), + item.name, + item.kind, + item.source, + item.labels.map((label) => ), + { title: item.phase, className: kebabCase(item.phase) } + ]} + onDetails={(item: CatalogEntityItem) => this.onDetails(item) } + renderItemMenu={this.renderItemMenu} + /> + ); + } + render() { if (!this.catalogEntityStore) { return null; @@ -208,39 +286,7 @@ export class Catalog extends React.Component { navigation={this.renderNavigation()} provideBackButtonNavigation={false} contentGaps={false}> - item.name, - [sortBy.source]: (item: CatalogEntityItem) => item.source, - [sortBy.status]: (item: CatalogEntityItem) => item.phase, - }} - searchFilters={[ - (entity: CatalogEntityItem) => entity.searchFields, - ]} - renderTableHeader={[ - { title: "", className: "icon" }, - { title: "Name", className: "name", sortBy: sortBy.name }, - { title: "Source", className: "source", sortBy: sortBy.source }, - { title: "Labels", className: "labels" }, - { title: "Status", className: "status", sortBy: sortBy.status }, - ]} - renderTableContents={(item: CatalogEntityItem) => [ - this.renderIcon(item), - item.name, - item.source, - item.labels.map((label) => ), - { title: item.phase, className: kebabCase(item.phase) } - ]} - onDetails={(item: CatalogEntityItem) => this.onDetails(item) } - renderItemMenu={this.renderItemMenu} - /> + { this.catalogEntityStore.activeCategory ? this.renderSingleCategoryList() : this.renderAllCategoriesList() } );