don't format custom names

Signed-off-by: ambulgm <mukul.ambulgekar@autodesk.com>
This commit is contained in:
ambulgm
2025-11-23 00:01:19 -08:00
committed by Ben Lambert
parent fea7302000
commit 275a57d772
2 changed files with 21 additions and 7 deletions
@@ -466,6 +466,7 @@ describe('ReviewState', () => {
it('should allow custom review name', async () => {
const formState = {
foo: 'test',
providedAPIs: 'api1,api2',
};
const schemas: ParsedTemplateSchema[] = [
@@ -477,7 +478,15 @@ describe('ReviewState', () => {
type: 'string',
'ui:backstage': {
review: {
name: 'bar',
name: 'Bar',
},
},
},
providedAPIs: {
type: 'string',
'ui:backstage': {
review: {
name: 'Provided APIs',
},
},
},
@@ -495,6 +504,9 @@ describe('ReviewState', () => {
expect(queryByRole('row', { name: 'Bar test' })).toBeInTheDocument();
expect(queryByRole('row', { name: 'Foo test' })).not.toBeInTheDocument();
expect(
queryByRole('row', { name: 'Provided APIs api1,api2' }),
).toBeInTheDocument();
});
it('should handle options in multiple schemas', async () => {
@@ -43,7 +43,7 @@ function processSchema(
const name =
definitionInSchema?.['ui:backstage']?.review?.name ??
definitionInSchema?.title ??
key;
formatKey(key);
if (definitionInSchema) {
const backstageReviewOptions = definitionInSchema['ui:backstage']?.review;
@@ -96,12 +96,14 @@ export const ReviewState = (props: ReviewStateProps) => {
const schema = findSchemaForKey(key, props.schemas, props.formState);
return schema
? processSchema(key, value, schema, props.formState)
: [[key, value]];
: [[formatKey(key), value]];
})
.filter(prop => prop.length > 0),
);
const options = {
titleFormat: formatKey,
};
return <StructuredMetadataTable metadata={reviewData} options={options} />;
return (
<StructuredMetadataTable
metadata={reviewData}
options={{ titleFormat: key => key }}
/>
);
};