From f7777a6ec889e50f24e1966b3207835276bc7a0a Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 17 Mar 2026 15:52:42 +0100 Subject: [PATCH] revert: keep scaffolder on the old layout Back out the scaffolder NFS header migration for now so the create and related pages stay on the existing layout until the follow-up scaffolder-specific work is ready. Signed-off-by: Patrik Oldsberg Made-with: Cursor --- .changeset/nfs-header-page-migrations.md | 1 - plugins/scaffolder/package.json | 1 - plugins/scaffolder/report-alpha.api.md | 2 - plugins/scaffolder/report.api.md | 10 +- .../TemplateEditorPage/CustomFieldsPage.tsx | 24 +-- .../TemplateEditorPage/TemplateEditorPage.tsx | 31 ++- .../TemplateEditorPage/TemplateFormPage.tsx | 35 ++-- .../TemplateEditorPage/TemplateIntroPage.tsx | 25 +-- .../TemplateListPage/TemplateListPage.tsx | 102 +++++----- .../TemplateWizardPage/TemplateWizardPage.tsx | 39 ++-- plugins/scaffolder/src/alpha/extensions.tsx | 2 +- .../components/ActionsPage/ActionsPage.tsx | 27 +-- .../ListTasksPage/ListTasksPage.tsx | 27 +-- .../components/OngoingTask/OngoingTask.tsx | 192 +++++++++--------- .../src/components/Router/Router.tsx | 43 +--- .../components/ScaffolderPageLayout.test.tsx | 50 ----- .../src/components/ScaffolderPageLayout.tsx | 115 ----------- .../TemplatingExtensionsPage.tsx | 27 +-- 18 files changed, 267 insertions(+), 486 deletions(-) delete mode 100644 plugins/scaffolder/src/components/ScaffolderPageLayout.test.tsx delete mode 100644 plugins/scaffolder/src/components/ScaffolderPageLayout.tsx diff --git a/.changeset/nfs-header-page-migrations.md b/.changeset/nfs-header-page-migrations.md index f7ebfdf1b0..135a77c015 100644 --- a/.changeset/nfs-header-page-migrations.md +++ b/.changeset/nfs-header-page-migrations.md @@ -7,7 +7,6 @@ '@backstage/plugin-catalog-unprocessed-entities': patch '@backstage/plugin-devtools': patch '@backstage/plugin-notifications': patch -'@backstage/plugin-scaffolder': patch '@backstage/plugin-search': patch '@backstage/plugin-techdocs': patch '@backstage/plugin-user-settings': patch diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 77d35445b0..b2ee8a47d4 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -74,7 +74,6 @@ "@backstage/plugin-techdocs-common": "workspace:^", "@backstage/plugin-techdocs-react": "workspace:^", "@backstage/types": "workspace:^", - "@backstage/ui": "workspace:^", "@codemirror/language": "^6.0.0", "@codemirror/legacy-modes": "^6.1.0", "@codemirror/view": "^6.0.0", diff --git a/plugins/scaffolder/report-alpha.api.md b/plugins/scaffolder/report-alpha.api.md index 7ce069e2ec..b2cd1bbcbe 100644 --- a/plugins/scaffolder/report-alpha.api.md +++ b/plugins/scaffolder/report-alpha.api.md @@ -727,7 +727,6 @@ export type TemplateListPageProps = { title?: string; subtitle?: string; }; - headerVariant?: 'legacy' | 'bui'; }; // @alpha (undocumented) @@ -743,7 +742,6 @@ export type TemplateWizardPageProps = { title?: string; subtitle?: string; }; - headerVariant?: 'legacy' | 'bui'; }; // (No @packageDocumentation comment for this package) diff --git a/plugins/scaffolder/report.api.md b/plugins/scaffolder/report.api.md index 0f5c617acc..17fd25e646 100644 --- a/plugins/scaffolder/report.api.md +++ b/plugins/scaffolder/report.api.md @@ -499,14 +499,7 @@ export type RouterProps = { TemplateCardComponent?: ComponentType<{ template: TemplateEntityV1beta3; }>; - TaskPageComponent?: ComponentType< - PropsWithChildren<{ - TemplateOutputsComponent?: ComponentType<{ - output?: ScaffolderTaskOutput_2; - }>; - headerVariant?: 'legacy' | 'bui'; - }> - >; + TaskPageComponent?: ComponentType>; EXPERIMENTAL_TemplateOutputsComponent?: ComponentType<{ output?: ScaffolderTaskOutput_2; }>; @@ -629,7 +622,6 @@ export const TaskPage: (props: { TemplateOutputsComponent?: ComponentType<{ output?: ScaffolderTaskOutput_2; }>; - headerVariant?: 'legacy' | 'bui'; }) => JSX_2.Element; // @public @deprecated diff --git a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/CustomFieldsPage.tsx b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/CustomFieldsPage.tsx index a188aca2ad..d7f6525f47 100644 --- a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/CustomFieldsPage.tsx +++ b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/CustomFieldsPage.tsx @@ -14,6 +14,7 @@ * limitations under the License. */ +import { Page, Header, Content } from '@backstage/core-components'; import { useRouteRef } from '@backstage/core-plugin-api'; import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; import { FieldExtensionOptions } from '@backstage/plugin-scaffolder-react'; @@ -22,11 +23,9 @@ import { editRouteRef } from '../../../routes'; import { scaffolderTranslationRef } from '../../../translation'; import { CustomFieldExplorer } from './CustomFieldExplorer'; -import { ScaffolderPageLayout } from '../../../components/ScaffolderPageLayout'; interface CustomFieldsPageProps { fieldExtensions?: FieldExtensionOptions[]; - headerVariant?: 'legacy' | 'bui'; } export function CustomFieldsPage(props: CustomFieldsPageProps) { @@ -34,15 +33,16 @@ export function CustomFieldsPage(props: CustomFieldsPageProps) { const { t } = useTranslationRef(scaffolderTranslationRef); return ( - - - + +
+ + + + ); } diff --git a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateEditorPage.tsx b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateEditorPage.tsx index b94d831ba4..13439c666f 100644 --- a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateEditorPage.tsx +++ b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateEditorPage.tsx @@ -14,6 +14,7 @@ * limitations under the License. */ import { makeStyles } from '@material-ui/core/styles'; +import { Content, Header, Page } from '@backstage/core-components'; import { useRouteRef } from '@backstage/core-plugin-api'; import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; import { @@ -24,7 +25,6 @@ import { import { scaffolderTranslationRef } from '../../../translation'; import { editRouteRef } from '../../../routes'; import { TemplateEditor } from './TemplateEditor'; -import { ScaffolderPageLayout } from '../../../components/ScaffolderPageLayout'; const useStyles = makeStyles( { @@ -40,7 +40,6 @@ interface TemplatePageProps { fieldExtensions?: FieldExtensionOptions[]; layouts?: LayoutOptions[]; formProps?: FormProps; - headerVariant?: 'legacy' | 'bui'; } export function TemplateEditorPage(props: TemplatePageProps) { @@ -49,20 +48,20 @@ export function TemplateEditorPage(props: TemplatePageProps) { const { t } = useTranslationRef(scaffolderTranslationRef); return ( - - +
- + + + + ); } diff --git a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateFormPage.tsx b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateFormPage.tsx index adf4027e29..4e726fec96 100644 --- a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateFormPage.tsx +++ b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateFormPage.tsx @@ -19,6 +19,7 @@ import { useNavigate } from 'react-router-dom'; import { makeStyles } from '@material-ui/core/styles'; +import { Page, Header, Content } from '@backstage/core-components'; import { useRouteRef } from '@backstage/core-plugin-api'; import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; import { @@ -31,7 +32,6 @@ import { editRouteRef } from '../../../routes'; import { scaffolderTranslationRef } from '../../../translation'; import { TemplateFormPreviewer } from './TemplateFormPreviewer'; -import { ScaffolderPageLayout } from '../../../components/ScaffolderPageLayout'; const useStyles = makeStyles({ root: { @@ -44,7 +44,6 @@ interface TemplateFormPageProps { formProps?: FormProps; fieldExtensions?: FieldExtensionOptions[]; defaultPreviewTemplate?: string; - headerVariant?: 'legacy' | 'bui'; } export function TemplateFormPage(props: TemplateFormPageProps) { @@ -58,22 +57,22 @@ export function TemplateFormPage(props: TemplateFormPageProps) { }, [navigate, editLink]); return ( - - +
- + + + + ); } diff --git a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateIntroPage.tsx b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateIntroPage.tsx index 6140e6849f..04dcf9e481 100644 --- a/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateIntroPage.tsx +++ b/plugins/scaffolder/src/alpha/components/TemplateEditorPage/TemplateIntroPage.tsx @@ -14,6 +14,7 @@ * limitations under the License. */ import { useCallback } from 'react'; +import { Content, Header, Page } from '@backstage/core-components'; import { TemplateEditorIntro } from './TemplateEditorIntro'; import { useNavigate } from 'react-router-dom'; @@ -27,9 +28,8 @@ import { import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; import { scaffolderTranslationRef } from '../../../translation'; import { useTemplateDirectory } from './useTemplateDirectory'; -import { ScaffolderPageLayout } from '../../../components/ScaffolderPageLayout'; -export function TemplateIntroPage(props: { headerVariant?: 'legacy' | 'bui' }) { +export function TemplateIntroPage() { const navigate = useNavigate(); const createLink = useRouteRef(rootRouteRef); const editorLink = useRouteRef(editorRouteRef); @@ -65,15 +65,16 @@ export function TemplateIntroPage(props: { headerVariant?: 'legacy' | 'bui' }) { ); return ( - - - + +
+ + + + ); } diff --git a/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx b/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx index 4fa884a534..37a50ed904 100644 --- a/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx +++ b/plugins/scaffolder/src/alpha/components/TemplateListPage/TemplateListPage.tsx @@ -20,8 +20,11 @@ import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common'; import { useApp, useRouteRef } from '@backstage/core-plugin-api'; import { + Content, ContentHeader, DocsIcon, + Header, + Page, SupportButton, } from '@backstage/core-components'; import { @@ -56,7 +59,6 @@ import { useTranslationRef, } from '@backstage/core-plugin-api/alpha'; import { scaffolderTranslationRef } from '../../../translation'; -import { ScaffolderPageLayout } from '../../../components/ScaffolderPageLayout'; import { buildTechDocsURL } from '@backstage/plugin-techdocs-react'; import { TECHDOCS_ANNOTATION, @@ -83,7 +85,6 @@ export type TemplateListPageProps = { title?: string; subtitle?: string; }; - headerVariant?: 'legacy' | 'bui'; }; const createGroupsWithOther = ( @@ -182,62 +183,55 @@ export const TemplateListPage = (props: TemplateListPageProps) => { }, [navigate, templateRoute], ); - const pageActions = ( - <> - - - {t('templateListPage.contentHeader.supportButtonTitle')} - - - ); return ( - - {props.headerVariant === 'bui' ? pageActions : undefined} - - - } - > - {props.headerVariant !== 'bui' ? ( - {pageActions} - ) : null} + +
+ +
+ + + + + {t('templateListPage.contentHeader.supportButtonTitle')} + + - - - - - - - - -
+ + + + + + + + + +
); }; diff --git a/plugins/scaffolder/src/alpha/components/TemplateWizardPage/TemplateWizardPage.tsx b/plugins/scaffolder/src/alpha/components/TemplateWizardPage/TemplateWizardPage.tsx index bee0b7d2f0..5f0176e439 100644 --- a/plugins/scaffolder/src/alpha/components/TemplateWizardPage/TemplateWizardPage.tsx +++ b/plugins/scaffolder/src/alpha/components/TemplateWizardPage/TemplateWizardPage.tsx @@ -41,7 +41,7 @@ import { useTemplateParameterSchema, } from '@backstage/plugin-scaffolder-react/alpha'; import { JsonValue } from '@backstage/types'; -import { Progress } from '@backstage/core-components'; +import { Header, Page, Progress } from '@backstage/core-components'; import { rootRouteRef, @@ -53,7 +53,6 @@ import { scaffolderTranslationRef } from '../../../translation'; import { TemplateWizardPageContextMenu } from './TemplateWizardPageContextMenu'; import { useFormDecorators } from '../../hooks'; -import { ScaffolderPageLayout } from '../../../components/ScaffolderPageLayout'; /** * @alpha @@ -70,7 +69,6 @@ export type TemplateWizardPageProps = { title?: string; subtitle?: string; }; - headerVariant?: 'legacy' | 'bui'; }; export const TemplateWizardPage = (props: TemplateWizardPageProps) => { @@ -138,24 +136,21 @@ export const TemplateWizardPage = (props: TemplateWizardPageProps) => { return ( - } - > + +
+ +
{isCreating && } { formProps={props.formProps} layouts={props.layouts} /> -
+
); }; diff --git a/plugins/scaffolder/src/alpha/extensions.tsx b/plugins/scaffolder/src/alpha/extensions.tsx index 08a8551ba9..91306bf5fd 100644 --- a/plugins/scaffolder/src/alpha/extensions.tsx +++ b/plugins/scaffolder/src/alpha/extensions.tsx @@ -59,7 +59,7 @@ export const scaffolderPage = PageBlueprint.makeWithOverrides({ const formFields = [...apiFormFields, ...loadedFormFields]; return import('../components/Router/Router').then(m => ( - + )); }, }); diff --git a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx index 0d32e05e65..6be502659a 100644 --- a/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx +++ b/plugins/scaffolder/src/components/ActionsPage/ActionsPage.tsx @@ -31,10 +31,13 @@ import SearchIcon from '@material-ui/icons/Search'; import { useApi, useRouteRef } from '@backstage/core-plugin-api'; import { + Content, EmptyState, ErrorPanel, + Header, Link, MarkdownContent, + Page, Progress, } from '@backstage/core-components'; import { ScaffolderPageContextMenu } from '@backstage/plugin-scaffolder-react/alpha'; @@ -49,7 +52,6 @@ import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; import { scaffolderTranslationRef } from '../../translation'; import { Expanded, RenderSchema, SchemaRenderContext } from '../RenderSchema'; import { ScaffolderUsageExamplesTable } from '../ScaffolderUsageExamplesTable'; -import { ScaffolderPageLayout } from '../ScaffolderPageLayout'; const useStyles = makeStyles(theme => ({ code: { @@ -240,7 +242,6 @@ export type ActionsPageProps = { create?: boolean; templatingExtensions?: boolean; }; - headerVariant?: 'legacy' | 'bui'; }; export const ActionsPage = (props: ActionsPageProps) => { @@ -272,17 +273,17 @@ export const ActionsPage = (props: ActionsPageProps) => { }; return ( - +
- } - > - - +
+ + + + ); }; diff --git a/plugins/scaffolder/src/components/ListTasksPage/ListTasksPage.tsx b/plugins/scaffolder/src/components/ListTasksPage/ListTasksPage.tsx index 58c89d7cc1..6cce6c3727 100644 --- a/plugins/scaffolder/src/components/ListTasksPage/ListTasksPage.tsx +++ b/plugins/scaffolder/src/components/ListTasksPage/ListTasksPage.tsx @@ -14,9 +14,12 @@ * limitations under the License. */ import { + Content, EmptyState, ErrorPanel, + Header, Link, + Page, Progress, Table, } from '@backstage/core-components'; @@ -45,7 +48,6 @@ import { ScaffolderPageContextMenu } from '@backstage/plugin-scaffolder-react/al import { useNavigate } from 'react-router-dom'; import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; import { scaffolderTranslationRef } from '../../translation'; -import { ScaffolderPageLayout } from '../ScaffolderPageLayout'; export interface MyTaskPageProps { initiallySelectedFilter?: 'owned' | 'all'; @@ -55,7 +57,6 @@ export interface MyTaskPageProps { create?: boolean; templatingExtensions?: boolean; }; - headerVariant?: 'legacy' | 'bui'; } const ListTaskPageContent = (props: MyTaskPageProps) => { @@ -199,17 +200,17 @@ export const ListTasksPage = (props: MyTaskPageProps) => { : undefined, }; return ( - +
- } - > - - +
+ + + + ); }; diff --git a/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx b/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx index 901ab1a0d0..bc0d5fe1aa 100644 --- a/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx +++ b/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx @@ -20,7 +20,7 @@ import { useMemo, useState, } from 'react'; -import { ErrorPanel } from '@backstage/core-components'; +import { Content, ErrorPanel, Header, Page } from '@backstage/core-components'; import { useNavigate, useParams } from 'react-router-dom'; import Box from '@material-ui/core/Box'; import Button from '@material-ui/core/Button'; @@ -57,7 +57,6 @@ import { scaffolderTranslationRef } from '../../translation'; import { entityPresentationApiRef } from '@backstage/plugin-catalog-react'; import { default as reactUseAsync } from 'react-use/esm/useAsync'; import { stringifyEntityRef } from '@backstage/catalog-model'; -import { ScaffolderPageLayout } from '../ScaffolderPageLayout'; const useStyles = makeStyles(theme => ({ contentWrapper: { @@ -87,7 +86,6 @@ export const OngoingTask = (props: { TemplateOutputsComponent?: ComponentType<{ output?: ScaffolderTaskOutput; }>; - headerVariant?: 'legacy' | 'bui'; }) => { // todo(blam): check that task Id actually exists, and that it's valid. otherwise redirect to something more useful. const { taskId } = useParams(); @@ -108,7 +106,9 @@ export const OngoingTask = (props: { taskId, }} > - + + + ); }; @@ -117,7 +117,6 @@ function OngoingTaskContent(props: { TemplateOutputsComponent?: ComponentType<{ output?: ScaffolderTaskOutput; }>; - headerVariant?: 'legacy' | 'bui'; }) { const { taskId } = useParams(); const templateRouteRef = useRouteRef(selectedTemplateRouteRef); @@ -244,24 +243,23 @@ function OngoingTaskContent(props: { !cancelEnabled || cancelStatus !== 'not-executed' || !canCancelTask; return ( - - {t('ongoingTask.title')}{' '} - {presentation ? presentation.primaryTitle : ''} - - } - subtitle={t('ongoingTask.subtitle', { taskId: taskId as string })} - headerActions={ + <> +
+ {t('ongoingTask.title')}{' '} + {presentation ? presentation.primaryTitle : ''} + + } + subtitle={t('ongoingTask.subtitle', { taskId: taskId as string })} + > - } - contentClassName={classes.contentWrapper} - > - {taskStream.error ? ( +
+ + {taskStream.error ? ( + + + + ) : null} + - - ) : null} - - - + - - - {buttonBarVisible ? ( - - - -
- - {isRetryableTask && ( + {buttonBarVisible ? ( + + + +
- )} - - -
+ {isRetryableTask && ( + + )} + + +
+
+
+
+ ) : null} + + {logsVisible ? ( + + + - - ) : null} - - {logsVisible ? ( - - - - - - ) : null} -
+ ) : null} + + ); } diff --git a/plugins/scaffolder/src/components/Router/Router.tsx b/plugins/scaffolder/src/components/Router/Router.tsx index 81c20c96ba..0fa43901bf 100644 --- a/plugins/scaffolder/src/components/Router/Router.tsx +++ b/plugins/scaffolder/src/components/Router/Router.tsx @@ -77,14 +77,7 @@ export type RouterProps = { TemplateCardComponent?: ComponentType<{ template: TemplateEntityV1beta3; }>; - TaskPageComponent?: ComponentType< - PropsWithChildren<{ - TemplateOutputsComponent?: ComponentType<{ - output?: ScaffolderTaskOutput; - }>; - headerVariant?: 'legacy' | 'bui'; - }> - >; + TaskPageComponent?: ComponentType>; EXPERIMENTAL_TemplateOutputsComponent?: ComponentType<{ output?: ScaffolderTaskOutput; }>; @@ -124,7 +117,6 @@ export const InternalRouter = ( props: PropsWithChildren< RouterProps & { formFields?: Array; - headerVariant?: 'legacy' | 'bui'; } >, ) => { @@ -170,7 +162,6 @@ export const InternalRouter = ( groups={props.groups} templateFilter={props.templateFilter} headerOptions={props.headerOptions} - headerVariant={props.headerVariant} /> } /> @@ -184,7 +175,6 @@ export const InternalRouter = ( layouts={customLayouts} components={{ ReviewStepComponent }} formProps={props.formProps} - headerVariant={props.headerVariant} /> } @@ -194,7 +184,6 @@ export const InternalRouter = ( element={ } /> @@ -203,7 +192,7 @@ export const InternalRouter = ( element={ - + } @@ -213,10 +202,7 @@ export const InternalRouter = ( element={ - + } @@ -230,7 +216,6 @@ export const InternalRouter = ( layouts={customLayouts} formProps={props.formProps} fieldExtensions={fieldExtensions} - headerVariant={props.headerVariant} /> @@ -239,21 +224,11 @@ export const InternalRouter = ( - } + element={} /> - } + element={} /> @@ -272,12 +246,7 @@ export const InternalRouter = ( /> - } + element={} /> } /> diff --git a/plugins/scaffolder/src/components/ScaffolderPageLayout.test.tsx b/plugins/scaffolder/src/components/ScaffolderPageLayout.test.tsx deleted file mode 100644 index 510d69d748..0000000000 --- a/plugins/scaffolder/src/components/ScaffolderPageLayout.test.tsx +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2026 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { renderInTestApp } from '@backstage/test-utils'; -import { screen } from '@testing-library/react'; -import { ScaffolderPageLayout } from './ScaffolderPageLayout'; - -describe('ScaffolderPageLayout', () => { - it('preserves BUI titles, subtitles, and breadcrumb links', async () => { - await renderInTestApp( - - Task My template - - } - subtitle="Task ID: 123" - type="Scaffolder" - typeLink="/create" - > -
Body content
-
, - ); - - expect( - screen.getByRole('heading', { name: 'Task page' }), - ).toBeInTheDocument(); - expect(screen.getByText('My template')).toBeInTheDocument(); - expect(screen.getByText('Task ID: 123')).toBeInTheDocument(); - expect(screen.getByRole('link', { name: 'Scaffolder' })).toHaveAttribute( - 'href', - '/create', - ); - }); -}); diff --git a/plugins/scaffolder/src/components/ScaffolderPageLayout.tsx b/plugins/scaffolder/src/components/ScaffolderPageLayout.tsx deleted file mode 100644 index 31d7233435..0000000000 --- a/plugins/scaffolder/src/components/ScaffolderPageLayout.tsx +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2026 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import Box from '@material-ui/core/Box'; -import { Content, Header, Page } from '@backstage/core-components'; -import { HeaderPage } from '@backstage/ui'; -import type { ReactNode } from 'react'; -import { useEffect } from 'react'; - -type HeaderVariant = 'legacy' | 'bui'; - -type ScaffolderPageLayoutProps = { - headerVariant?: HeaderVariant; - themeId?: string; - title?: ReactNode; - subtitle?: ReactNode; - pageTitleOverride?: string; - type?: string; - typeLink?: string; - headerActions?: ReactNode; - contentClassName?: string; - withContent?: boolean; - children?: ReactNode; -}; - -export const ScaffolderPageLayout = (props: ScaffolderPageLayoutProps) => { - const { - headerVariant = 'legacy', - themeId = 'home', - title, - subtitle, - pageTitleOverride, - type, - typeLink, - headerActions, - contentClassName, - withContent = true, - children, - } = props; - - const pageContent = withContent ? ( - {children} - ) : ( - children - ); - - useEffect(() => { - if (!pageTitleOverride) { - return; - } - - document.title = pageTitleOverride; - }, [pageTitleOverride]); - - if (headerVariant === 'bui') { - let buiTitle: string | undefined; - if (typeof title === 'string') { - buiTitle = title; - } else if (pageTitleOverride) { - buiTitle = pageTitleOverride; - } else if (typeof subtitle === 'string') { - buiTitle = subtitle; - } - - const breadcrumbs = - type && typeLink ? [{ label: type, href: typeLink }] : undefined; - const customTitle = typeof title === 'string' ? undefined : title; - const hasHeaderDetails = Boolean(customTitle) || Boolean(subtitle); - - return ( - - - {hasHeaderDetails && ( - - {customTitle} - {subtitle && {subtitle}} - - )} - {pageContent} - - ); - } - - return ( - -
- {headerActions} -
- {pageContent} -
- ); -}; diff --git a/plugins/scaffolder/src/components/TemplatingExtensionsPage/TemplatingExtensionsPage.tsx b/plugins/scaffolder/src/components/TemplatingExtensionsPage/TemplatingExtensionsPage.tsx index 184c54471e..fc2b180596 100644 --- a/plugins/scaffolder/src/components/TemplatingExtensionsPage/TemplatingExtensionsPage.tsx +++ b/plugins/scaffolder/src/components/TemplatingExtensionsPage/TemplatingExtensionsPage.tsx @@ -29,9 +29,12 @@ import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; import { scaffolderTranslationRef } from '../../translation'; import { + Content, EmptyState, ErrorPanel, + Header, Link, + Page, Progress, } from '@backstage/core-components'; import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react'; @@ -65,7 +68,6 @@ import { TemplateGlobalFunctions, TemplateGlobalValues, } from './TemplateGlobals'; -import { ScaffolderPageLayout } from '../ScaffolderPageLayout'; const useStyles = makeStyles(theme => ({ code: { @@ -301,7 +303,6 @@ export type TemplatingExtensionsPageProps = { tasks?: boolean; create?: boolean; }; - headerVariant?: 'legacy' | 'bui'; }; export const TemplatingExtensionsPage = ( @@ -336,17 +337,17 @@ export const TemplatingExtensionsPage = ( const { t } = useTranslationRef(scaffolderTranslationRef); return ( - +
- } - > - - +
+ + + + ); };