Skip to content

Commit

Permalink
feat(tiles): Mark tiles as deprecated
Browse files Browse the repository at this point in the history
Currently, we're ignoring the deprecated property from camel components.

This commit replaces the header tags with `Deprecated` when applicable

fixes: #287
  • Loading branch information
lordrip committed Nov 3, 2023
1 parent 9d0a747 commit a279812
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions packages/ui/src/camel-utils/camel-to-tile.adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ describe('camelComponentToTile', () => {

expect(tile.tags).toEqual(['consumerOnly', 'producerOnly']);
});

it('should replace the supportLevel header tag if the component is deprecated', () => {
const componentDef = {
component: {
supportLevel: 'Stable',
deprecated: true,
},
} as ICamelComponentDefinition;

const tile = camelComponentToTile(componentDef);

expect(tile.headerTags).toEqual(['Deprecated']);
});
});

describe('camelProcessorToTile', () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/ui/src/camel-utils/camel-to-tile.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ export const camelComponentToTile = (componentDef: ICamelComponentDefinition): I
const headerTags: string[] = [];
const tags: string[] = [];

if (supportLevel) {
if (supportLevel && !componentDef.component.deprecated) {
headerTags.push(supportLevel);
} else {
headerTags.push('Deprecated');
}
if (label) {
tags.push(...label.split(','));
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/components/Catalog/Tags/tag-color-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const getTagColor = (tag: string): COLOR => {
return 'green';
case 'preview':
return 'orange';
case 'deprecated':
return 'red';
default:
return 'grey';
}
Expand Down

0 comments on commit a279812

Please sign in to comment.