fix: hide support button in catalog, scaffolder, & techdocs if not configured
Signed-off-by: vabf59 <thomas.triplett.vabf59@statefarm.com>
This commit is contained in:
@@ -58,6 +58,7 @@ export function BaseCatalogPage(props: BaseCatalogPageProps) {
|
||||
const { allowed } = usePermission({
|
||||
permission: catalogEntityCreatePermission,
|
||||
});
|
||||
const supportConfig = useApi(configApiRef).getOptionalConfig('app.support');
|
||||
|
||||
return (
|
||||
<PageWithHeader title={t('indexPage.title', { orgName })} themeId="home">
|
||||
@@ -69,7 +70,9 @@ export function BaseCatalogPage(props: BaseCatalogPageProps) {
|
||||
to={createComponentLink && createComponentLink()}
|
||||
/>
|
||||
)}
|
||||
<SupportButton>{t('indexPage.supportButtonContent')}</SupportButton>
|
||||
{supportConfig && (
|
||||
<SupportButton>{t('indexPage.supportButtonContent')}</SupportButton>
|
||||
)}
|
||||
</ContentHeader>
|
||||
<EntityListProvider pagination={pagination}>
|
||||
<CatalogFilterLayout>
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { useApp, useRouteRef } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
configApiRef,
|
||||
useApi,
|
||||
useApp,
|
||||
useRouteRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
import {
|
||||
Content,
|
||||
@@ -110,6 +115,7 @@ export const TemplateListPage = (props: TemplateListPageProps) => {
|
||||
const templateRoute = useRouteRef(selectedTemplateRouteRef);
|
||||
const app = useApp();
|
||||
const { t } = useTranslationRef(scaffolderTranslationRef);
|
||||
const supportConfig = useApi(configApiRef).getOptionalConfig('app.support');
|
||||
|
||||
const groups = givenGroups.length
|
||||
? createGroupsWithOther(givenGroups, t)
|
||||
@@ -184,9 +190,11 @@ export const TemplateListPage = (props: TemplateListPageProps) => {
|
||||
)}
|
||||
to={registerComponentLink && registerComponentLink()}
|
||||
/>
|
||||
<SupportButton>
|
||||
{t('templateListPage.contentHeader.supportButtonTitle')}
|
||||
</SupportButton>
|
||||
{supportConfig && (
|
||||
<SupportButton>
|
||||
{t('templateListPage.contentHeader.supportButtonTitle')}
|
||||
</SupportButton>
|
||||
)}
|
||||
</ContentHeader>
|
||||
|
||||
<CatalogFilterLayout>
|
||||
|
||||
@@ -31,6 +31,7 @@ import { TechDocsPageWrapper } from './TechDocsPageWrapper';
|
||||
import { TechDocsPicker } from './TechDocsPicker';
|
||||
import { EntityListDocsTable } from './Tables';
|
||||
import { TechDocsIndexPageProps } from './TechDocsIndexPage';
|
||||
import { configApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
|
||||
/**
|
||||
* Props for {@link DefaultTechDocsHome}
|
||||
@@ -47,13 +48,16 @@ export type DefaultTechDocsHomeProps = TechDocsIndexPageProps;
|
||||
*/
|
||||
export const DefaultTechDocsHome = (props: TechDocsIndexPageProps) => {
|
||||
const { initialFilter = 'owned', columns, actions, ownerPickerMode } = props;
|
||||
const supportConfig = useApi(configApiRef).getOptionalConfig('app.support');
|
||||
return (
|
||||
<TechDocsPageWrapper>
|
||||
<Content>
|
||||
<ContentHeader title="">
|
||||
<SupportButton>
|
||||
Discover documentation in your ecosystem.
|
||||
</SupportButton>
|
||||
{supportConfig && (
|
||||
<SupportButton>
|
||||
Discover documentation in your ecosystem.
|
||||
</SupportButton>
|
||||
)}
|
||||
</ContentHeader>
|
||||
<EntityListProvider>
|
||||
<CatalogFilterLayout>
|
||||
|
||||
Reference in New Issue
Block a user