Merge pull request #30526 from backstage/blam/catalog-pagination
catalog: pagination on by default in nfs
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog': patch
|
||||
---
|
||||
|
||||
Turn on `pagination` by default in new frontend system, and also make configurable
|
||||
@@ -1012,9 +1012,26 @@ const _default: FrontendPlugin<
|
||||
}>;
|
||||
'page:catalog': ExtensionDefinition<{
|
||||
config: {
|
||||
pagination:
|
||||
| boolean
|
||||
| {
|
||||
mode: 'offset' | 'cursor';
|
||||
offset?: number | undefined;
|
||||
limit?: number | undefined;
|
||||
};
|
||||
} & {
|
||||
path: string | undefined;
|
||||
};
|
||||
configInput: {
|
||||
pagination?:
|
||||
| boolean
|
||||
| {
|
||||
mode: 'offset' | 'cursor';
|
||||
offset?: number | undefined;
|
||||
limit?: number | undefined;
|
||||
}
|
||||
| undefined;
|
||||
} & {
|
||||
path?: string | undefined;
|
||||
};
|
||||
output:
|
||||
|
||||
@@ -41,7 +41,22 @@ export const catalogPage = PageBlueprint.makeWithOverrides({
|
||||
inputs: {
|
||||
filters: createExtensionInput([coreExtensionData.reactElement]),
|
||||
},
|
||||
factory(originalFactory, { inputs }) {
|
||||
config: {
|
||||
schema: {
|
||||
pagination: z =>
|
||||
z
|
||||
.union([
|
||||
z.boolean(),
|
||||
z.object({
|
||||
mode: z.enum(['cursor', 'offset']),
|
||||
limit: z.number().optional(),
|
||||
offset: z.number().optional(),
|
||||
}),
|
||||
])
|
||||
.default(true),
|
||||
},
|
||||
},
|
||||
factory(originalFactory, { inputs, config }) {
|
||||
return originalFactory({
|
||||
defaultPath: '/catalog',
|
||||
routeRef: convertLegacyRouteRef(rootRouteRef),
|
||||
@@ -50,7 +65,12 @@ export const catalogPage = PageBlueprint.makeWithOverrides({
|
||||
const filters = inputs.filters.map(filter =>
|
||||
filter.get(coreExtensionData.reactElement),
|
||||
);
|
||||
return compatWrapper(<BaseCatalogPage filters={<>{filters}</>} />);
|
||||
return compatWrapper(
|
||||
<BaseCatalogPage
|
||||
filters={<>{filters}</>}
|
||||
pagination={config.pagination}
|
||||
/>,
|
||||
);
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user