From b12cd5dc2215e72729b652f75094ecda6b8a05e6 Mon Sep 17 00:00:00 2001 From: Axel Koehler Date: Mon, 8 May 2023 11:13:26 +0200 Subject: [PATCH] feat(plugins/adr): render SupportButton only if config is set Signed-off-by: Axel Koehler --- .changeset/twelve-birds-boil.md | 5 +++++ .../src/components/EntityAdrContent/EntityAdrContent.tsx | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changeset/twelve-birds-boil.md diff --git a/.changeset/twelve-birds-boil.md b/.changeset/twelve-birds-boil.md new file mode 100644 index 0000000000..04317c26cd --- /dev/null +++ b/.changeset/twelve-birds-boil.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-adr': minor +--- + +render SupportButton only if config is set diff --git a/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx b/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx index d136de4717..da575d884f 100644 --- a/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx +++ b/plugins/adr/src/components/EntityAdrContent/EntityAdrContent.tsx @@ -29,7 +29,7 @@ import { SupportButton, WarningPanel, } from '@backstage/core-components'; -import { useApi, useRouteRef } from '@backstage/core-plugin-api'; +import { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api'; import { scmIntegrationsApiRef } from '@backstage/integration-react'; import { AdrFilePathFilterFn, @@ -170,6 +170,9 @@ export const EntityAdrContent = (props: { const adrApi = useApi(adrApiRef); const entityHasAdrs = isAdrAvailable(entity); + const config = useApi(configApiRef); + const appSupportConfigured = config?.getOptionalConfig('app.support'); + const { value, loading, error } = useAsync(async () => { const url = getAdrLocationUrl(entity, scmIntegrations); return adrApi.listAdrs(url); @@ -212,7 +215,7 @@ export const EntityAdrContent = (props: { return ( - + {appSupportConfigured && } {!entityHasAdrs && (