From 272106fdad56a6a8930349ef84d9aa13e70f2a5d Mon Sep 17 00:00:00 2001 From: Patrick Jungermann Date: Wed, 15 Jun 2022 13:07:14 +0200 Subject: [PATCH] fix: check for `integrations.github` without retrieving `integrations` Support use without `integrations` or only integrations without frontend visible properties (e.g., `bitbucketCloud`) being configured by checking `integrations.github` directly without attempting to load `integrations`. Previously, `integrations` was retrieved first and then the existence of the key `github` was checked. This could fail if there was no config below `integrations` which has `@visibility frontend`. This happened if no integration or only non-Github integrations without frontend visible properties like `integrations.bitbucketCloud` are used. After this change, we will check `integrations.github` directly. Closes: #11700 Signed-off-by: Patrick Jungermann --- .changeset/unlucky-stingrays-juggle.md | 5 +++++ .../src/components/ImportInfoCard/ImportInfoCard.tsx | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .changeset/unlucky-stingrays-juggle.md diff --git a/.changeset/unlucky-stingrays-juggle.md b/.changeset/unlucky-stingrays-juggle.md new file mode 100644 index 0000000000..f2e83f7163 --- /dev/null +++ b/.changeset/unlucky-stingrays-juggle.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-import': patch +--- + +Support use without `integrations` or only integrations without frontend visible properties (e.g., `bitbucketCloud`) being configured by checking `integrations.github` directly without attempting to load `integrations`. diff --git a/plugins/catalog-import/src/components/ImportInfoCard/ImportInfoCard.tsx b/plugins/catalog-import/src/components/ImportInfoCard/ImportInfoCard.tsx index 7fa6b13a82..4779e2d64b 100644 --- a/plugins/catalog-import/src/components/ImportInfoCard/ImportInfoCard.tsx +++ b/plugins/catalog-import/src/components/ImportInfoCard/ImportInfoCard.tsx @@ -46,8 +46,7 @@ export const ImportInfoCard = (props: ImportInfoCardProps) => { const appTitle = configApi.getOptional('app.title') || 'Backstage'; const catalogImportApi = useApi(catalogImportApiRef); - const integrations = configApi.getConfig('integrations'); - const hasGithubIntegration = integrations.has('github'); + const hasGithubIntegration = configApi.has('integrations.github'); const catalogFilename = useCatalogFilename();