Merge pull request #17693 from axdotl/adrs-plugin

feat(plugins/adr): render SupportButton only if config is set
This commit is contained in:
Phil Kuang
2023-05-15 09:29:47 -04:00
committed by GitHub
2 changed files with 10 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-adr': minor
---
render SupportButton only if config is set
@@ -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 (
<Content>
<ContentHeader title="Architecture Decision Records">
<SupportButton />
{appSupportConfigured && <SupportButton />}
</ContentHeader>
{!entityHasAdrs && (