From 2a3704d75ffd6fc01eceee6e0737464c966d8cbe Mon Sep 17 00:00:00 2001 From: James Brooks <52410024+jabrks@users.noreply.github.com> Date: Fri, 19 Sep 2025 16:06:43 +0100 Subject: [PATCH] Fix translation key for owner column title (#31200) The entity table currently has two columns labelled "Type" as a regression was introduced in #30076 which used the same translation key for the owner column as well as the type column. This PR corrects the key so that both columns now have the correct labels. Signed-off-by: James Brooks --- .changeset/eager-toes-start.md | 5 +++ .../components/EntityTable/columns.test.tsx | 39 +++++++++++++++++++ .../src/components/EntityTable/columns.tsx | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .changeset/eager-toes-start.md create mode 100644 plugins/catalog-react/src/components/EntityTable/columns.test.tsx diff --git a/.changeset/eager-toes-start.md b/.changeset/eager-toes-start.md new file mode 100644 index 0000000000..f36cb1bb0a --- /dev/null +++ b/.changeset/eager-toes-start.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-react': patch +--- + +Correct translation key from "type" to "owner" for owner column in entity table to ensure the right translation is loaded. diff --git a/plugins/catalog-react/src/components/EntityTable/columns.test.tsx b/plugins/catalog-react/src/components/EntityTable/columns.test.tsx new file mode 100644 index 0000000000..05c9c61c26 --- /dev/null +++ b/plugins/catalog-react/src/components/EntityTable/columns.test.tsx @@ -0,0 +1,39 @@ +/* + * Copyright 2025 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { render, screen } from '@testing-library/react'; +import { columnFactories } from './columns'; +import { mockApis, MockErrorApi, TestApiProvider } from '@backstage/test-utils'; +import { errorApiRef } from '@backstage/core-plugin-api'; +import { translationApiRef } from '@backstage/core-plugin-api/alpha'; + +describe('columns', () => { + it('should render owner title', async () => { + const { title } = columnFactories.createOwnerColumn(); + + render( + + {title} + , + ); + + expect(await screen.findByText('Owner')).toBeInTheDocument(); + }); +}); diff --git a/plugins/catalog-react/src/components/EntityTable/columns.tsx b/plugins/catalog-react/src/components/EntityTable/columns.tsx index 94b1141057..1bea56dc27 100644 --- a/plugins/catalog-react/src/components/EntityTable/columns.tsx +++ b/plugins/catalog-react/src/components/EntityTable/columns.tsx @@ -108,7 +108,7 @@ export const columnFactories = Object.freeze({ }, createOwnerColumn(): TableColumn { return this.createEntityRelationColumn({ - title: , + title: , relation: RELATION_OWNED_BY, defaultKind: 'group', });