Merge pull request #16178 from Team-P0110/#16138/Inconsistent-display-of-list-of-entities
Inconsistent display of list of entities
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog': patch
|
||||
---
|
||||
|
||||
The list of entities takes into account the title when its different from the name to sort the entities.
|
||||
@@ -16,6 +16,7 @@
|
||||
import {
|
||||
ANNOTATION_EDIT_URL,
|
||||
ANNOTATION_VIEW_URL,
|
||||
Entity,
|
||||
RELATION_OWNED_BY,
|
||||
RELATION_PART_OF,
|
||||
} from '@backstage/catalog-model';
|
||||
@@ -62,6 +63,16 @@ const YellowStar = withStyles({
|
||||
},
|
||||
})(Star);
|
||||
|
||||
const refCompare = (a: Entity, b: Entity) => {
|
||||
const toRef = (entity: Entity) =>
|
||||
entity.metadata.title ||
|
||||
humanizeEntityRef(entity, {
|
||||
defaultKind: 'Component',
|
||||
});
|
||||
|
||||
return toRef(a).localeCompare(toRef(b));
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export const CatalogTable = (props: CatalogTableProps) => {
|
||||
const { columns, actions, tableOptions, subtitle, emptyContent } = props;
|
||||
@@ -177,7 +188,7 @@ export const CatalogTable = (props: CatalogTableProps) => {
|
||||
},
|
||||
];
|
||||
|
||||
const rows = entities.map(entity => {
|
||||
const rows = entities.sort(refCompare).map(entity => {
|
||||
const partOfSystemRelations = getEntityRelations(entity, RELATION_PART_OF, {
|
||||
kind: 'system',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user