Rename columns func type

Signed-off-by: Paul Stoker <pstoker@spotify.com>
This commit is contained in:
Paul Stoker
2023-11-17 09:30:16 +01:00
parent 4b4fe7004d
commit edb12882df
4 changed files with 11 additions and 8 deletions
@@ -44,7 +44,7 @@ import React from 'react';
import { createComponentRouteRef } from '../../routes';
import { CatalogTableRow } from '../CatalogTable';
import { DefaultCatalogPage } from './DefaultCatalogPage';
import { ColumnsFunc } from '../CatalogTable/CatalogTable';
import { CatalogTableColumnsFunc } from '../CatalogTable/CatalogTable';
describe('DefaultCatalogPage', () => {
const origReplaceState = window.history.replaceState;
@@ -219,7 +219,7 @@ describe('DefaultCatalogPage', () => {
}, 20_000);
it('should render the custom column function passed as prop', async () => {
const columns: ColumnsFunc = ({ filters, entities }) => {
const columns: CatalogTableColumnsFunc = ({ filters, entities }) => {
return filters.kind?.value === 'component' && entities.length
? [
{ title: 'Foo', field: 'entity.foo' },
@@ -43,7 +43,7 @@ import { createComponentRouteRef } from '../../routes';
import { CatalogTable, CatalogTableRow } from '../CatalogTable';
import { catalogTranslationRef } from '../../translation';
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
import { ColumnsFunc } from '../CatalogTable/CatalogTable';
import { CatalogTableColumnsFunc } from '../CatalogTable/CatalogTable';
/** @internal */
export interface BaseCatalogPageProps {
@@ -87,7 +87,7 @@ export function BaseCatalogPage(props: BaseCatalogPageProps) {
*/
export interface DefaultCatalogPageProps {
initiallySelectedFilter?: UserListFilterKind;
columns?: TableColumn<CatalogTableRow>[] | ColumnsFunc;
columns?: TableColumn<CatalogTableRow>[] | CatalogTableColumnsFunc;
actions?: TableProps<CatalogTableRow>['actions'];
initialKind?: string;
tableOptions?: TableProps<CatalogTableRow>['options'];
@@ -31,7 +31,7 @@ import {
import { renderInTestApp, TestApiRegistry } from '@backstage/test-utils';
import { act, fireEvent, screen } from '@testing-library/react';
import * as React from 'react';
import { CatalogTable, ColumnsFunc } from './CatalogTable';
import { CatalogTable, CatalogTableColumnsFunc } from './CatalogTable';
const entities: Entity[] = [
{
@@ -381,7 +381,10 @@ describe('CatalogTable component', () => {
});
it('should render the label column with customised title and value as specified using function', async () => {
const columns: ColumnsFunc = ({ filters, entities: entities1 }) => {
const columns: CatalogTableColumnsFunc = ({
filters,
entities: entities1,
}) => {
return filters.kind?.value === 'api' && entities1.length
? [
CatalogTable.columns.createNameColumn({ defaultKind: 'API' }),
@@ -53,7 +53,7 @@ import { CatalogTableRow } from './types';
*
* @public
*/
export type ColumnsFunc = (
export type CatalogTableColumnsFunc = (
entityListContext: EntityListContextProps,
) => TableColumn<CatalogTableRow>[];
@@ -63,7 +63,7 @@ export type ColumnsFunc = (
* @public
*/
export interface CatalogTableProps {
columns?: TableColumn<CatalogTableRow>[] | ColumnsFunc;
columns?: TableColumn<CatalogTableRow>[] | CatalogTableColumnsFunc;
actions?: TableProps<CatalogTableRow>['actions'];
tableOptions?: TableProps<CatalogTableRow>['options'];
emptyContent?: ReactNode;