From 03c9e3aea6c8821254a732b8c1f70602598e22ba Mon Sep 17 00:00:00 2001 From: Josh Maxwell Date: Sat, 22 Oct 2022 17:38:10 -0600 Subject: [PATCH 1/5] Removing forced capitalization for Entity types in the sidebar. Signed-off-by: Josh Maxwell --- .../src/components/EntityTypePicker/EntityTypePicker.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx b/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx index a0770ef30a..b90349949e 100644 --- a/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx +++ b/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx @@ -54,10 +54,10 @@ export const EntityTypePicker = (props: EntityTypePickerProps) => { if (availableTypes.length === 0 || error) return null; const items = [ - { value: 'all', label: 'All' }, + { value: 'all', label: 'all' }, ...availableTypes.map((type: string) => ({ value: type, - label: capitalize(type), + label: type, })), ]; From 83d7dacc4caa4032968dd234d55bde37faa8ebbd Mon Sep 17 00:00:00 2001 From: Josh Maxwell Date: Sat, 22 Oct 2022 19:19:38 -0600 Subject: [PATCH 2/5] Removing unused capitalization import Signed-off-by: Josh Maxwell --- .../src/components/EntityTypePicker/EntityTypePicker.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx b/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx index b90349949e..3e641e8e37 100644 --- a/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx +++ b/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.tsx @@ -15,7 +15,6 @@ */ import React, { useEffect } from 'react'; -import capitalize from 'lodash/capitalize'; import { Box } from '@material-ui/core'; import { useEntityTypeFilter } from '../../hooks/useEntityTypeFilter'; From 3c072cae169fd4c2c29b4adf777dcea1929b0998 Mon Sep 17 00:00:00 2001 From: Josh Maxwell Date: Sat, 22 Oct 2022 19:43:21 -0600 Subject: [PATCH 3/5] Updating tests to check for lowercase type names Signed-off-by: Josh Maxwell --- .../EntityTypePicker/EntityTypePicker.test.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.test.tsx b/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.test.tsx index 4623cf5d9e..9992322f61 100644 --- a/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.test.tsx +++ b/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.test.tsx @@ -16,7 +16,6 @@ import React from 'react'; import { fireEvent, waitFor } from '@testing-library/react'; -import { capitalize } from 'lodash'; import { Entity } from '@backstage/catalog-model'; import { EntityTypePicker } from './EntityTypePicker'; import { MockEntityListContextProvider } from '../../testUtils/providers'; @@ -99,11 +98,11 @@ describe('', () => { const input = rendered.getByTestId('select'); fireEvent.click(input); - await waitFor(() => rendered.getByText('Service')); + await waitFor(() => rendered.getByText('service')); entities.forEach(entity => { expect( - rendered.getByText(capitalize(entity.spec!.type as string)), + rendered.getByText(entity.spec!.type as string), ).toBeInTheDocument(); }); }); @@ -125,8 +124,8 @@ describe('', () => { const input = rendered.getByTestId('select'); fireEvent.click(input); - await waitFor(() => rendered.getByText('Service')); - fireEvent.click(rendered.getByText('Service')); + await waitFor(() => rendered.getByText('service')); + fireEvent.click(rendered.getByText('service')); expect(updateFilters).toHaveBeenLastCalledWith({ type: new EntityTypeFilter(['service']), From 395c13c6ae851858ac8333ca2afae5d1d4342095 Mon Sep 17 00:00:00 2001 From: Josh Maxwell Date: Sat, 22 Oct 2022 20:36:29 -0600 Subject: [PATCH 4/5] Updating tests to check for lowercase all type Signed-off-by: Josh Maxwell --- .../src/components/EntityTypePicker/EntityTypePicker.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.test.tsx b/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.test.tsx index 9992322f61..525c757dea 100644 --- a/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.test.tsx +++ b/plugins/catalog-react/src/components/EntityTypePicker/EntityTypePicker.test.tsx @@ -132,7 +132,7 @@ describe('', () => { }); fireEvent.click(input); - fireEvent.click(rendered.getByText('All')); + fireEvent.click(rendered.getByText('all')); expect(updateFilters).toHaveBeenLastCalledWith({ type: undefined }); }); From e47f466f8090d69691126feaf596bcd3e5a81f04 Mon Sep 17 00:00:00 2001 From: Josh Maxwell Date: Sat, 22 Oct 2022 20:59:18 -0600 Subject: [PATCH 5/5] Adding changeset summary Signed-off-by: Josh Maxwell --- .changeset/happy-avocados-tan.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/happy-avocados-tan.md diff --git a/.changeset/happy-avocados-tan.md b/.changeset/happy-avocados-tan.md new file mode 100644 index 0000000000..9f087930d5 --- /dev/null +++ b/.changeset/happy-avocados-tan.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-react': patch +--- + +Removed forced capitalization for Entity types in the catalog sidebar.