Merge pull request #12935 from kielosz/add-names-to-groups
Add names to Group in Cost Insights
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-cost-insights': patch
|
||||
'@backstage/plugin-cost-insights-common': patch
|
||||
---
|
||||
|
||||
Add name property to Group
|
||||
@@ -44,6 +44,7 @@ export interface Entity {
|
||||
// @public (undocumented)
|
||||
export type Group = {
|
||||
id: string;
|
||||
name?: string;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
|
||||
@@ -19,4 +19,5 @@
|
||||
*/
|
||||
export type Group = {
|
||||
id: string;
|
||||
name?: string;
|
||||
};
|
||||
|
||||
@@ -32,6 +32,7 @@ const mockGroups: Group[] = [
|
||||
},
|
||||
{
|
||||
id: 'test-group-3',
|
||||
name: 'Test Group 3',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -76,7 +77,7 @@ describe('<CostInsightsTabs />', () => {
|
||||
);
|
||||
await userEvent.click(rendered.getByTestId('cost-insights-groups-tab'));
|
||||
mockGroups.forEach(group =>
|
||||
expect(rendered.getByText(group.id)).toBeInTheDocument(),
|
||||
expect(rendered.getByText(group.name ?? group.id)).toBeInTheDocument(),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -100,7 +100,7 @@ export const CostInsightsTabs = ({ groups }: CostInsightsTabsProps) => {
|
||||
data-testid={g.id}
|
||||
onClick={updateGroupFilterAndCloseMenu(g)}
|
||||
>
|
||||
{g.id}
|
||||
{g.name ?? g.id}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Menu>
|
||||
|
||||
@@ -52,7 +52,8 @@ export class ExampleCostInsightsClient implements CostInsightsApi {
|
||||
|
||||
async getUserGroups(userId: string): Promise<Group[]> {
|
||||
const groups: Group[] = await this.request({ userId }, [
|
||||
{ id: 'pied-piper' },
|
||||
{ id: 'group-a', name: 'Group A' },
|
||||
{ id: 'group-b', name: 'Group B' },
|
||||
]);
|
||||
|
||||
return groups;
|
||||
|
||||
Reference in New Issue
Block a user