Rename entityPresentation parameter to entityPresentationApi for consistency
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Fredrik Adelöw <freben@spotify.com>
This commit is contained in:
@@ -500,7 +500,7 @@ export const entityDataTableColumns: Readonly<{
|
||||
createEntityRefColumn(options: {
|
||||
defaultKind?: string;
|
||||
isRowHeader?: boolean;
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): EntityColumnConfig;
|
||||
createEntityRelationColumn(options: {
|
||||
id: string;
|
||||
@@ -510,7 +510,7 @@ export const entityDataTableColumns: Readonly<{
|
||||
filter?: {
|
||||
kind: string;
|
||||
};
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): EntityColumnConfig;
|
||||
createOwnerColumn(): EntityColumnConfig;
|
||||
createSystemColumn(): EntityColumnConfig;
|
||||
|
||||
@@ -266,7 +266,7 @@ export type CatalogReactUserListPickerClassKey =
|
||||
export const columnFactories: Readonly<{
|
||||
createEntityRefColumn<T extends Entity>(options: {
|
||||
defaultKind?: string;
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): TableColumn<T>;
|
||||
createEntityRelationColumn<T extends Entity>(options: {
|
||||
title: string | JSX.Element;
|
||||
@@ -275,7 +275,7 @@ export const columnFactories: Readonly<{
|
||||
filter?: {
|
||||
kind: string;
|
||||
};
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): TableColumn<T>;
|
||||
createOwnerColumn<T extends Entity>(): TableColumn<T>;
|
||||
createDomainColumn<T extends Entity>(): TableColumn<T>;
|
||||
@@ -689,7 +689,7 @@ export const EntityTable: {
|
||||
columns: Readonly<{
|
||||
createEntityRefColumn<T extends Entity>(options: {
|
||||
defaultKind?: string;
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): TableColumn<T>;
|
||||
createEntityRelationColumn<T extends Entity>(options: {
|
||||
title: string | JSX.Element;
|
||||
@@ -698,7 +698,7 @@ export const EntityTable: {
|
||||
filter?: {
|
||||
kind: string;
|
||||
};
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): TableColumn<T>;
|
||||
createOwnerColumn<T extends Entity>(): TableColumn<T>;
|
||||
createDomainColumn<T extends Entity>(): TableColumn<T>;
|
||||
|
||||
@@ -36,11 +36,11 @@ export interface EntityColumnConfig extends ColumnConfig<EntityRow> {
|
||||
function getEntityTitle(
|
||||
entityOrRef: Entity | { kind: string; namespace?: string; name: string },
|
||||
context: { defaultKind?: string },
|
||||
entityPresentation?: EntityPresentationApi,
|
||||
entityPresentationApi?: EntityPresentationApi,
|
||||
): string {
|
||||
if (entityPresentation) {
|
||||
return entityPresentation.forEntity(entityOrRef as Entity, context).snapshot
|
||||
.primaryTitle;
|
||||
if (entityPresentationApi) {
|
||||
return entityPresentationApi.forEntity(entityOrRef as Entity, context)
|
||||
.snapshot.primaryTitle;
|
||||
}
|
||||
return defaultEntityPresentation(entityOrRef as Entity, context).primaryTitle;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ export const columnFactories = Object.freeze({
|
||||
createEntityRefColumn(options: {
|
||||
defaultKind?: string;
|
||||
isRowHeader?: boolean;
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): EntityColumnConfig {
|
||||
const isRowHeader = options.isRowHeader ?? true;
|
||||
return {
|
||||
@@ -76,7 +76,7 @@ export const columnFactories = Object.freeze({
|
||||
getEntityTitle(
|
||||
entity,
|
||||
{ defaultKind: options.defaultKind },
|
||||
options.entityPresentation,
|
||||
options.entityPresentationApi,
|
||||
),
|
||||
};
|
||||
},
|
||||
@@ -87,7 +87,7 @@ export const columnFactories = Object.freeze({
|
||||
relation: string;
|
||||
defaultKind?: string;
|
||||
filter?: { kind: string };
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): EntityColumnConfig {
|
||||
return {
|
||||
id: options.id,
|
||||
@@ -116,7 +116,7 @@ export const columnFactories = Object.freeze({
|
||||
getEntityTitle(
|
||||
r,
|
||||
{ defaultKind: options.defaultKind },
|
||||
options.entityPresentation,
|
||||
options.entityPresentationApi,
|
||||
),
|
||||
)
|
||||
.join(', '),
|
||||
|
||||
@@ -29,11 +29,11 @@ import { EntityTableColumnTitle } from './TitleColumn';
|
||||
function getEntityTitle(
|
||||
entityOrRef: Entity | CompoundEntityRef,
|
||||
context: { defaultKind?: string },
|
||||
entityPresentation?: EntityPresentationApi,
|
||||
entityPresentationApi?: EntityPresentationApi,
|
||||
): string {
|
||||
if (entityPresentation) {
|
||||
return entityPresentation.forEntity(entityOrRef as Entity, context).snapshot
|
||||
.primaryTitle;
|
||||
if (entityPresentationApi) {
|
||||
return entityPresentationApi.forEntity(entityOrRef as Entity, context)
|
||||
.snapshot.primaryTitle;
|
||||
}
|
||||
return defaultEntityPresentation(entityOrRef, context).primaryTitle;
|
||||
}
|
||||
@@ -42,11 +42,11 @@ function getEntityTitle(
|
||||
export const columnFactories = Object.freeze({
|
||||
createEntityRefColumn<T extends Entity>(options: {
|
||||
defaultKind?: string;
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): TableColumn<T> {
|
||||
const { defaultKind, entityPresentation } = options;
|
||||
const { defaultKind, entityPresentationApi } = options;
|
||||
function formatContent(entity: T): string {
|
||||
return getEntityTitle(entity, { defaultKind }, entityPresentation);
|
||||
return getEntityTitle(entity, { defaultKind }, entityPresentationApi);
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -80,14 +80,14 @@ export const columnFactories = Object.freeze({
|
||||
relation: string;
|
||||
defaultKind?: string;
|
||||
filter?: { kind: string };
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): TableColumn<T> {
|
||||
const {
|
||||
title,
|
||||
relation,
|
||||
defaultKind,
|
||||
filter: entityFilter,
|
||||
entityPresentation,
|
||||
entityPresentationApi,
|
||||
} = options;
|
||||
|
||||
function getRelations(entity: T): CompoundEntityRef[] {
|
||||
@@ -96,7 +96,7 @@ export const columnFactories = Object.freeze({
|
||||
|
||||
function formatContent(entity: T): string {
|
||||
return getRelations(entity)
|
||||
.map(r => getEntityTitle(r, { defaultKind }, entityPresentation))
|
||||
.map(r => getEntityTitle(r, { defaultKind }, entityPresentationApi))
|
||||
.join(', ');
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ export const CatalogTable: {
|
||||
columns: Readonly<{
|
||||
createNameColumn(options?: {
|
||||
defaultKind?: string;
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): TableColumn<CatalogTableRow>;
|
||||
createSystemColumn(): TableColumn<CatalogTableRow>;
|
||||
createOwnerColumn(): TableColumn<CatalogTableRow>;
|
||||
|
||||
@@ -32,11 +32,11 @@ import { EntityTableColumnTitle } from '@backstage/plugin-catalog-react/alpha';
|
||||
export const columnFactories = Object.freeze({
|
||||
createNameColumn(options?: {
|
||||
defaultKind?: string;
|
||||
entityPresentation?: EntityPresentationApi;
|
||||
entityPresentationApi?: EntityPresentationApi;
|
||||
}): TableColumn<CatalogTableRow> {
|
||||
function formatContent(entity: Entity): string {
|
||||
if (options?.entityPresentation) {
|
||||
return options.entityPresentation.forEntity(entity, {
|
||||
if (options?.entityPresentationApi) {
|
||||
return options.entityPresentationApi.forEntity(entity, {
|
||||
defaultKind: options?.defaultKind,
|
||||
}).snapshot.primaryTitle;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export function entitiesToDocsMapper(
|
||||
entities: Entity[],
|
||||
getRouteToReaderPageFor: getRouteFunc,
|
||||
config: ConfigApi,
|
||||
entityPresentation?: EntityPresentationApi,
|
||||
entityPresentationApi?: EntityPresentationApi,
|
||||
) {
|
||||
return entities.map(entity => {
|
||||
const ownedByRelations = getEntityRelations(entity, RELATION_OWNED_BY);
|
||||
@@ -55,8 +55,8 @@ export function entitiesToDocsMapper(
|
||||
ownedByRelations,
|
||||
ownedByRelationsTitle: ownedByRelations
|
||||
.map(r => {
|
||||
if (entityPresentation) {
|
||||
return entityPresentation.forEntity(stringifyEntityRef(r), {
|
||||
if (entityPresentationApi) {
|
||||
return entityPresentationApi.forEntity(stringifyEntityRef(r), {
|
||||
defaultKind: 'group',
|
||||
}).snapshot.primaryTitle;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user