diff --git a/.changeset/pink-knives-obey.md b/.changeset/pink-knives-obey.md new file mode 100644 index 0000000000..258e974300 --- /dev/null +++ b/.changeset/pink-knives-obey.md @@ -0,0 +1,22 @@ +--- +'example-app': patch +'@backstage/core': patch +'@backstage/create-app': patch +'@backstage/plugin-api-docs': patch +'@backstage/plugin-bitrise': patch +'@backstage/plugin-catalog': patch +'@backstage/plugin-catalog-import': patch +'@backstage/plugin-catalog-react': patch +'@backstage/plugin-circleci': patch +'@backstage/plugin-cloudbuild': patch +'@backstage/plugin-explore': patch +'@backstage/plugin-github-actions': patch +'@backstage/plugin-jenkins': patch +'@backstage/plugin-kubernetes': patch +'@backstage/plugin-lighthouse': patch +'@backstage/plugin-org': patch +'@backstage/plugin-scaffolder': patch +'@backstage/plugin-search': patch +--- + +use local version of lowerCase and upperCase methods diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx index fb56b40e68..b06cc042b3 100644 --- a/packages/app/src/components/catalog/EntityPage.tsx +++ b/packages/app/src/components/catalog/EntityPage.tsx @@ -484,7 +484,7 @@ const DomainEntityPage = ({ entity }: { entity: Entity }) => ( export const EntityPage = () => { const { entity } = useEntity(); - switch (entity?.kind?.toLowerCase()) { + switch (entity?.kind?.toLocaleLowerCase('en-US')) { case 'component': return ; case 'api': diff --git a/packages/core/src/api-wrappers/createApp.tsx b/packages/core/src/api-wrappers/createApp.tsx index 9a8f7a36df..db8d0d0636 100644 --- a/packages/core/src/api-wrappers/createApp.tsx +++ b/packages/core/src/api-wrappers/createApp.tsx @@ -58,7 +58,10 @@ export const defaultConfigLoader: AppConfigLoader = async ( const configs = (appConfig.slice() as unknown) as AppConfig[]; // Avoiding this string also being replaced at runtime - if (runtimeConfigJson !== '__app_injected_runtime_config__'.toUpperCase()) { + if ( + runtimeConfigJson !== + '__app_injected_runtime_config__'.toLocaleUpperCase('en-US') + ) { try { const data = JSON.parse(runtimeConfigJson) as JsonObject; if (Array.isArray(data)) { diff --git a/packages/core/src/components/Table/Table.stories.tsx b/packages/core/src/components/Table/Table.stories.tsx index 64ceb761f8..3e2f73b7cb 100644 --- a/packages/core/src/components/Table/Table.stories.tsx +++ b/packages/core/src/components/Table/Table.stories.tsx @@ -213,8 +213,8 @@ export const SubvalueTable = () => { row: any, // Only needed if you want subvalue searchable ) => `${row.col1} ${row.subvalue}` - .toUpperCase() - .includes(query.toUpperCase()), + .toLocaleUpperCase('en-US') + .includes(query.toLocaleUpperCase('en-US')), field: 'col1', highlight: true, render: (row: any): React.ReactNode => ( diff --git a/packages/core/src/components/WarningPanel/WarningPanel.tsx b/packages/core/src/components/WarningPanel/WarningPanel.tsx index e82c49c49a..1faf3bb142 100644 --- a/packages/core/src/components/WarningPanel/WarningPanel.tsx +++ b/packages/core/src/components/WarningPanel/WarningPanel.tsx @@ -81,7 +81,7 @@ type Props = { }; const capitalize = (s: string) => { - return s.charAt(0).toUpperCase() + s.slice(1); + return s.charAt(0).toLocaleUpperCase('en-US') + s.slice(1); }; /** diff --git a/packages/create-app/templates/default-app/packages/app/src/components/catalog/EntityPage.tsx b/packages/create-app/templates/default-app/packages/app/src/components/catalog/EntityPage.tsx index de6ab2b6b5..b1884ac1c6 100644 --- a/packages/create-app/templates/default-app/packages/app/src/components/catalog/EntityPage.tsx +++ b/packages/create-app/templates/default-app/packages/app/src/components/catalog/EntityPage.tsx @@ -184,7 +184,7 @@ const ApiEntityPage = ({ entity }: { entity: Entity }) => ( export const EntityPage = () => { const { entity } = useEntity(); - switch (entity?.kind?.toLowerCase()) { + switch (entity?.kind?.toLocaleLowerCase('en-US')) { case 'component': return ; case 'api': diff --git a/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx b/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx index 9c3203d532..7cc0257e85 100644 --- a/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx +++ b/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx @@ -74,7 +74,8 @@ export const ConsumedApisCard = ({ variant = 'gridItem' }: Props) => { emptyContent={
- This {entity.kind.toLowerCase()} does not consume any APIs. + This {entity.kind.toLocaleLowerCase('en-US')} does not consume any + APIs. diff --git a/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx b/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx index beeb4d051e..e6da61fcd9 100644 --- a/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx +++ b/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx @@ -78,7 +78,8 @@ export const HasApisCard = ({ variant = 'gridItem' }: Props) => { emptyContent={
- This {entity.kind.toLowerCase()} does not contain any APIs. + This {entity.kind.toLocaleLowerCase('en-US')} does not contain any + APIs. diff --git a/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx b/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx index 2447054b89..6659d7d85e 100644 --- a/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx +++ b/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx @@ -74,7 +74,8 @@ export const ProvidedApisCard = ({ variant = 'gridItem' }: Props) => { emptyContent={
- This {entity.kind.toLowerCase()} does not provide any APIs. + This {entity.kind.toLocaleLowerCase('en-US')} does not provide any + APIs. diff --git a/plugins/bitrise/src/components/BitriseBuildsTableComponent/BitriseBuildsTableComponent.tsx b/plugins/bitrise/src/components/BitriseBuildsTableComponent/BitriseBuildsTableComponent.tsx index 86722436ed..06a9ddd9f8 100644 --- a/plugins/bitrise/src/components/BitriseBuildsTableComponent/BitriseBuildsTableComponent.tsx +++ b/plugins/bitrise/src/components/BitriseBuildsTableComponent/BitriseBuildsTableComponent.tsx @@ -162,8 +162,8 @@ export const BitriseBuildsTable = ({ title: 'Branch', customFilterAndSearch: (query, row: any) => `${row.message} ${row.workflow}` - .toUpperCase() - .includes(query.toUpperCase()), + .toLocaleUpperCase('en-US') + .includes(query.toLocaleUpperCase('en-US')), field: 'message', width: 'auto', highlight: true, diff --git a/plugins/catalog-import/src/components/EntityListComponent/EntityListComponent.tsx b/plugins/catalog-import/src/components/EntityListComponent/EntityListComponent.tsx index d94a1cad19..bdeb483df4 100644 --- a/plugins/catalog-import/src/components/EntityListComponent/EntityListComponent.tsx +++ b/plugins/catalog-import/src/components/EntityListComponent/EntityListComponent.tsx @@ -54,7 +54,7 @@ function sortEntities(entities: Array) { } function getEntityIcon(entity: { kind: string }): React.ReactElement { - switch (entity.kind.toLowerCase()) { + switch (entity.kind.toLocaleLowerCase('en-US')) { case 'api': return ; diff --git a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx index 73e3824d98..c19c9c1703 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx +++ b/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx @@ -48,11 +48,12 @@ export const EntityRefLink = forwardRef( name = entityRef.name; } - kind = kind.toLowerCase(); + kind = kind.toLocaleLowerCase('en-US'); const routeParams = { kind, - namespace: namespace?.toLowerCase() ?? ENTITY_DEFAULT_NAMESPACE, + namespace: + namespace?.toLocaleLowerCase('en-US') ?? ENTITY_DEFAULT_NAMESPACE, name, }; diff --git a/plugins/catalog/src/components/AboutCard/AboutContent.tsx b/plugins/catalog/src/components/AboutCard/AboutContent.tsx index 57ea894570..695595285b 100644 --- a/plugins/catalog/src/components/AboutCard/AboutContent.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutContent.tsx @@ -39,10 +39,10 @@ type Props = { export const AboutContent = ({ entity }: Props) => { const classes = useStyles(); - const isSystem = entity.kind.toLowerCase() === 'system'; - const isDomain = entity.kind.toLowerCase() === 'domain'; - const isResource = entity.kind.toLowerCase() === 'resource'; - const isComponent = entity.kind.toLowerCase() === 'component'; + const isSystem = entity.kind.toLocaleLowerCase('en-US') === 'system'; + const isDomain = entity.kind.toLocaleLowerCase('en-US') === 'domain'; + const isResource = entity.kind.toLocaleLowerCase('en-US') === 'resource'; + const isComponent = entity.kind.toLocaleLowerCase('en-US') === 'component'; const partOfSystemRelations = getEntityRelations(entity, RELATION_PART_OF, { kind: 'system', }); diff --git a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx index c4cd4c5c71..cf7976e7ee 100644 --- a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx +++ b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx @@ -69,10 +69,10 @@ const headerProps = ( : '' }`, headerType: (() => { - let t = kind.toLowerCase(); + let t = kind.toLocaleLowerCase('en-US'); if (entity && entity.spec && 'type' in entity.spec) { t += ' — '; - t += (entity.spec as { type: string }).type.toLowerCase(); + t += (entity.spec as { type: string }).type.toLocaleLowerCase('en-US'); } return t; })(), diff --git a/plugins/catalog/src/components/EntityPageLayout/EntityPageLayout.tsx b/plugins/catalog/src/components/EntityPageLayout/EntityPageLayout.tsx index 51c8f85116..5cd66fca51 100644 --- a/plugins/catalog/src/components/EntityPageLayout/EntityPageLayout.tsx +++ b/plugins/catalog/src/components/EntityPageLayout/EntityPageLayout.tsx @@ -88,10 +88,10 @@ const headerProps = ( : '' }`, headerType: (() => { - let t = kind.toLowerCase(); + let t = kind.toLocaleLowerCase('en-US'); if (entity && entity.spec && 'type' in entity.spec) { t += ' — '; - t += (entity.spec as { type: string }).type.toLowerCase(); + t += (entity.spec as { type: string }).type.toLocaleLowerCase('en-US'); } return t; })(), diff --git a/plugins/catalog/src/components/Router.tsx b/plugins/catalog/src/components/Router.tsx index 3e51b74dc2..f86f5959cb 100644 --- a/plugins/catalog/src/components/Router.tsx +++ b/plugins/catalog/src/components/Router.tsx @@ -63,7 +63,8 @@ const EntityPageSwitch = ({ EntityPage }: { EntityPage: ComponentType }) => { const OldEntityRouteRedirect = () => { const { optionalNamespaceAndName, '*': rest } = useParams() as any; const [name, namespace] = optionalNamespaceAndName.split(':').reverse(); - const namespaceLower = namespace?.toLowerCase() ?? ENTITY_DEFAULT_NAMESPACE; + const namespaceLower = + namespace?.toLocaleLowerCase('en-US') ?? ENTITY_DEFAULT_NAMESPACE; const restWithSlash = rest ? `/${rest}` : ''; return ( { - switch (status.toLowerCase()) { + switch (status.toLocaleLowerCase('en-US')) { case 'queued': case 'scheduled': return ; diff --git a/plugins/cloudbuild/src/components/WorkflowRunStatus/WorkflowRunStatus.tsx b/plugins/cloudbuild/src/components/WorkflowRunStatus/WorkflowRunStatus.tsx index 45a8fc662c..931bcd7b2d 100644 --- a/plugins/cloudbuild/src/components/WorkflowRunStatus/WorkflowRunStatus.tsx +++ b/plugins/cloudbuild/src/components/WorkflowRunStatus/WorkflowRunStatus.tsx @@ -29,7 +29,7 @@ export const WorkflowRunStatus = ({ status: string | undefined; }) => { if (status === undefined) return null; - switch (status.toLowerCase()) { + switch (status.toLocaleLowerCase('en-US')) { case 'queued': return ( <> diff --git a/plugins/explore/src/components/ToolCard/ToolCard.tsx b/plugins/explore/src/components/ToolCard/ToolCard.tsx index 60f467ca80..b4a30b3e51 100644 --- a/plugins/explore/src/components/ToolCard/ToolCard.tsx +++ b/plugins/explore/src/components/ToolCard/ToolCard.tsx @@ -76,13 +76,13 @@ export const ToolCard = ({ card, objectFit }: Props) => { {title}{' '} - {lifecycle && lifecycle.toLowerCase() !== 'ga' && ( + {lifecycle && lifecycle.toLocaleLowerCase('en-US') !== 'ga' && ( )} diff --git a/plugins/github-actions/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx b/plugins/github-actions/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx index b5915f400c..38d84a4b6d 100644 --- a/plugins/github-actions/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx +++ b/plugins/github-actions/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx @@ -88,8 +88,8 @@ const StepView = ({ step }: { step: Step }) => { diff --git a/plugins/github-actions/src/components/WorkflowRunStatus/WorkflowRunStatus.tsx b/plugins/github-actions/src/components/WorkflowRunStatus/WorkflowRunStatus.tsx index b1a71ea3ed..c6beff00cd 100644 --- a/plugins/github-actions/src/components/WorkflowRunStatus/WorkflowRunStatus.tsx +++ b/plugins/github-actions/src/components/WorkflowRunStatus/WorkflowRunStatus.tsx @@ -32,7 +32,7 @@ export const WorkflowRunStatus = ({ conclusion: string | undefined; }) => { if (status === undefined) return null; - switch (status.toLowerCase()) { + switch (status.toLocaleLowerCase('en-US')) { case 'queued': return ( <> @@ -46,7 +46,7 @@ export const WorkflowRunStatus = ({ ); case 'completed': - switch (conclusion?.toLowerCase()) { + switch (conclusion?.toLocaleLowerCase('en-US')) { case 'skipped' || 'canceled': return ( <> diff --git a/plugins/jenkins/src/components/BuildsPage/lib/Status/JenkinsRunStatus.tsx b/plugins/jenkins/src/components/BuildsPage/lib/Status/JenkinsRunStatus.tsx index 66a58abe76..1b22015a59 100644 --- a/plugins/jenkins/src/components/BuildsPage/lib/Status/JenkinsRunStatus.tsx +++ b/plugins/jenkins/src/components/BuildsPage/lib/Status/JenkinsRunStatus.tsx @@ -30,7 +30,7 @@ export const JenkinsRunStatus = ({ status: string | undefined; }) => { if (status === undefined) return null; - switch (status.toLowerCase()) { + switch (status.toLocaleLowerCase('en-US')) { case 'queued': case 'scheduled': return ( diff --git a/plugins/kubernetes/src/components/CustomResources/DefaultCustomResourceDrawer.tsx b/plugins/kubernetes/src/components/CustomResources/DefaultCustomResourceDrawer.tsx index db109ad096..57836ac673 100644 --- a/plugins/kubernetes/src/components/CustomResources/DefaultCustomResourceDrawer.tsx +++ b/plugins/kubernetes/src/components/CustomResources/DefaultCustomResourceDrawer.tsx @@ -18,7 +18,8 @@ import React from 'react'; import { KubernetesDrawer } from '../KubernetesDrawer/KubernetesDrawer'; import { Typography, Grid } from '@material-ui/core'; -const capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1); +const capitalize = (str: string) => + str.charAt(0).toLocaleUpperCase('en-US') + str.slice(1); export const DefaultCustomResourceDrawer = ({ customResource, diff --git a/plugins/lighthouse/src/components/AuditList/AuditListTable.tsx b/plugins/lighthouse/src/components/AuditList/AuditListTable.tsx index 8a59869266..a85a5bfa0b 100644 --- a/plugins/lighthouse/src/components/AuditList/AuditListTable.tsx +++ b/plugins/lighthouse/src/components/AuditList/AuditListTable.tsx @@ -106,7 +106,7 @@ export const AuditListTable = ({ items }: { items: Website[] }) => { lastReport: ( <> {' '} - {website.lastAudit.status.toUpperCase()} + {website.lastAudit.status.toLocaleUpperCase('en-US')} ), lastAuditTriggered: formatTime(website.lastAudit.timeCreated), diff --git a/plugins/lighthouse/src/components/Cards/LastLighthouseAuditCard.tsx b/plugins/lighthouse/src/components/Cards/LastLighthouseAuditCard.tsx index 693a8b6ec6..8940bb3773 100644 --- a/plugins/lighthouse/src/components/Cards/LastLighthouseAuditCard.tsx +++ b/plugins/lighthouse/src/components/Cards/LastLighthouseAuditCard.tsx @@ -59,7 +59,7 @@ const LighthouseCategoryScoreStatus = ({ score }: { score: number }) => { const LighthouseAuditStatus = ({ audit }: { audit: Audit }) => ( <> - {audit.status.toUpperCase()} + {audit.status.toLocaleUpperCase('en-US')} ); diff --git a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx index a73216b23b..7a0e05dc4b 100644 --- a/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx +++ b/plugins/org/src/components/Cards/Group/MembersList/MembersListCard.tsx @@ -125,13 +125,15 @@ export const MembersListCard = (_props: { kind: 'User', }, }); - const groupMembersList = ((membersList.items as unknown) as Array).filter( - member => - member?.relations?.some( - r => - r.type === RELATION_MEMBER_OF && - r.target.name.toLowerCase() === groupName.toLowerCase(), - ), + const groupMembersList = ((membersList.items as unknown) as Array< + UserEntity + >).filter(member => + member?.relations?.some( + r => + r.type === RELATION_MEMBER_OF && + r.target.name.toLocaleLowerCase('en-US') === + groupName.toLocaleLowerCase('en-US'), + ), ); return groupMembersList; }, [catalogApi]); diff --git a/plugins/scaffolder/src/components/ResultsFilter/ResultsFilter.test.tsx b/plugins/scaffolder/src/components/ResultsFilter/ResultsFilter.test.tsx index 22de59b6ef..406515985c 100644 --- a/plugins/scaffolder/src/components/ResultsFilter/ResultsFilter.test.tsx +++ b/plugins/scaffolder/src/components/ResultsFilter/ResultsFilter.test.tsx @@ -100,7 +100,9 @@ describe('Results Filter', () => { ); for (const category of categories) { expect( - await findByText(category.charAt(0).toUpperCase() + category.slice(1)), + await findByText( + category.charAt(0).toLocaleUpperCase('en-US') + category.slice(1), + ), ).toBeInTheDocument(); } }); diff --git a/plugins/scaffolder/src/components/ResultsFilter/ResultsFilter.tsx b/plugins/scaffolder/src/components/ResultsFilter/ResultsFilter.tsx index 301c6b01d8..4325d2d0d4 100644 --- a/plugins/scaffolder/src/components/ResultsFilter/ResultsFilter.tsx +++ b/plugins/scaffolder/src/components/ResultsFilter/ResultsFilter.tsx @@ -107,7 +107,10 @@ export const ResultsFilter = ({ availableCategories }: Props) => { /> ); diff --git a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx index 8e8ba15ddc..0353dff798 100644 --- a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx +++ b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx @@ -105,8 +105,8 @@ export const ScaffolderPageContents = () => { ); const matchesQuery = (metadata: EntityMeta, query: string) => - `${metadata.title}`.toUpperCase().includes(query) || - metadata.tags?.join('').toUpperCase().indexOf(query) !== -1; + `${metadata.title}`.toLocaleUpperCase('en-US').includes(query) || + metadata.tags?.join('').toLocaleUpperCase('en-US').indexOf(query) !== -1; useEffect(() => { if (search.length === 0) { @@ -114,7 +114,7 @@ export const ScaffolderPageContents = () => { } return setMatchingEntities( filteredEntities.filter(template => - matchesQuery(template.metadata, search.toUpperCase()), + matchesQuery(template.metadata, search.toLocaleUpperCase('en-US')), ), ); }, [search, filteredEntities]); diff --git a/plugins/search/src/components/SearchPage/SearchPage.tsx b/plugins/search/src/components/SearchPage/SearchPage.tsx index 33e89e90dc..7c216fc908 100644 --- a/plugins/search/src/components/SearchPage/SearchPage.tsx +++ b/plugins/search/src/components/SearchPage/SearchPage.tsx @@ -56,7 +56,9 @@ export const SearchPage = () => { /> - + diff --git a/plugins/search/src/components/SearchResult/SearchResult.tsx b/plugins/search/src/components/SearchResult/SearchResult.tsx index c4d8809732..7f4d31a6df 100644 --- a/plugins/search/src/components/SearchResult/SearchResult.tsx +++ b/plugins/search/src/components/SearchResult/SearchResult.tsx @@ -158,11 +158,13 @@ export const SearchResult = ({ searchQuery }: SearchResultProps) => { if (searchQuery) { withFilters = withFilters.filter( (result: Result) => - result.name?.toLowerCase().includes(searchQuery) || + result.name?.toLocaleLowerCase('en-US').includes(searchQuery) || result.name - ?.toLowerCase() + ?.toLocaleLowerCase('en-US') .includes(searchQuery.split(' ').join('-')) || - result.description?.toLowerCase().includes(searchQuery), + result.description + ?.toLocaleLowerCase('en-US') + .includes(searchQuery), ); }