Flip boolean config

Signed-off-by: Gabriel Dugny <gabriel.dugny@believe.com>
This commit is contained in:
Gabriel Dugny
2026-02-10 23:59:40 +01:00
parent 7291529eb5
commit c47f3d8a73
5 changed files with 14 additions and 20 deletions
+3 -3
View File
@@ -2,7 +2,7 @@
'@backstage/plugin-techdocs': minor
---
Add two config values to the `page:techdocs/reader` extension that configure default layout, `withSearch` and `withHeader`. Default are unchanged to `true`.
Add two config values to the `page:techdocs/reader` extension that configure default layout, `withoutSearch` and `withoutHeader`. Default are unchanged to `false`.
E.g. to disable the search and header on the Techdocs Reader Page:
@@ -11,6 +11,6 @@ app:
extensions:
- page:techdocs/reader:
config:
withSearch: false
withHeader: false
withoutSearch: true
withoutHeader: true
```
@@ -5,7 +5,7 @@ app:
- sign-in-page:app: false
- page:techdocs/reader:
config:
withSearch: false
withoutSearch: true
backend:
baseUrl: http://localhost:3000
@@ -30,7 +30,7 @@ jest.mock('./config', () => ({
{
'page:techdocs/reader': {
config: {
withSearch: false,
withoutSearch: true,
},
},
},
+4 -4
View File
@@ -308,13 +308,13 @@ const _default: OverridableFrontendPlugin<
}>;
'page:techdocs/reader': OverridableExtensionDefinition<{
config: {
withSearch: boolean;
withHeader: boolean;
withoutSearch: boolean;
withoutHeader: boolean;
path: string | undefined;
};
configInput: {
withSearch?: boolean | undefined;
withHeader?: boolean | undefined;
withoutSearch?: boolean | undefined;
withoutHeader?: boolean | undefined;
path?: string | undefined;
};
output:
+5 -11
View File
@@ -158,18 +158,12 @@ const techDocsReaderPage = PageBlueprint.makeWithOverrides({
},
config: {
schema: {
withSearch: z => z.boolean().default(true),
withHeader: z => z.boolean().default(true),
withoutSearch: z => z.boolean().default(false),
withoutHeader: z => z.boolean().default(false),
},
},
factory(originalFactory, { inputs, config }) {
factory(originalFactory, { apis, inputs, config }) {
const addonsApi = apis.get(techdocsAddonsApiRef);
const addons = inputs.addons.map(output => {
const options = output.get(AddonBlueprint.dataRefs.addon);
const Addon = options.component;
attachTechDocsAddonComponentData(Addon, options);
return <Addon key={options.name} />;
});
return originalFactory({
path: '/docs/:namespace/:kind/:name',
@@ -195,8 +189,8 @@ const techDocsReaderPage = PageBlueprint.makeWithOverrides({
return import('../Router').then(({ TechDocsReaderRouter }) => (
<TechDocsReaderRouter>
<TechDocsReaderLayout
withSearch={config.withSearch}
withHeader={config.withHeader}
withSearch={!config.withoutSearch}
withHeader={!config.withoutHeader}
/>
<TechDocsAddons>{addons}</TechDocsAddons>
</TechDocsReaderRouter>