mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-05 17:53:12 +02:00
fix: health to technical debt on projects list (#10485)
This commit is contained in:
parent
b8cc62cc96
commit
918e792af6
@ -29,6 +29,7 @@ export const ProjectCard = ({
|
|||||||
name,
|
name,
|
||||||
featureCount,
|
featureCount,
|
||||||
health,
|
health,
|
||||||
|
technicalDebt,
|
||||||
memberCount = 0,
|
memberCount = 0,
|
||||||
id,
|
id,
|
||||||
mode,
|
mode,
|
||||||
@ -71,7 +72,7 @@ export const ProjectCard = ({
|
|||||||
</StyledProjectCardContent>
|
</StyledProjectCardContent>
|
||||||
<StyledProjectCardContent>
|
<StyledProjectCardContent>
|
||||||
<div data-loading>
|
<div data-loading>
|
||||||
<strong>{health}%</strong> health
|
<strong>{technicalDebt}%</strong> technical debt
|
||||||
</div>
|
</div>
|
||||||
<div data-loading>
|
<div data-loading>
|
||||||
<ProjectLastSeen date={lastReportedFlagUsage} />
|
<ProjectLastSeen date={lastReportedFlagUsage} />
|
||||||
|
@ -80,12 +80,12 @@ export const ProjectsListTable = ({ projects }: ProjectsListTableProps) => {
|
|||||||
width: 90,
|
width: 90,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: 'Health',
|
Header: 'Technical debt',
|
||||||
accessor: 'health',
|
accessor: 'technicalDebt',
|
||||||
Cell: ({ value }: { value: number }) => (
|
Cell: ({ value }: { value: number }) => (
|
||||||
<TextCell>{value}%</TextCell>
|
<TextCell>{value}%</TextCell>
|
||||||
),
|
),
|
||||||
width: 70,
|
width: 130,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Header: 'Last seen',
|
Header: 'Last seen',
|
||||||
|
@ -14,6 +14,7 @@ const mockProjectData = (name: string): ProjectForUi => ({
|
|||||||
memberCount: 0,
|
memberCount: 0,
|
||||||
mode: 'open' as const,
|
mode: 'open' as const,
|
||||||
health: 100,
|
health: 100,
|
||||||
|
technicalDebt: 0,
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
favorite: false,
|
favorite: false,
|
||||||
lastReportedFlagUsage: null,
|
lastReportedFlagUsage: null,
|
||||||
|
@ -6,6 +6,7 @@ export type ProjectForUi = {
|
|||||||
name: string;
|
name: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
health: number;
|
health: number;
|
||||||
|
technicalDebt: number;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
mode: ProjectMode;
|
mode: ProjectMode;
|
||||||
memberCount: number;
|
memberCount: number;
|
||||||
|
@ -21,6 +21,7 @@ const mapProjectForUi = (row): ProjectForUi => {
|
|||||||
id: row.id,
|
id: row.id,
|
||||||
description: row.description,
|
description: row.description,
|
||||||
health: row.health,
|
health: row.health,
|
||||||
|
technicalDebt: 100 - (row.health || 0),
|
||||||
favorite: row.favorite,
|
favorite: row.favorite,
|
||||||
featureCount: Number(row.number_of_features) || 0,
|
featureCount: Number(row.number_of_features) || 0,
|
||||||
memberCount: Number(row.number_of_users) || 0,
|
memberCount: Number(row.number_of_users) || 0,
|
||||||
|
@ -91,3 +91,16 @@ test('response for project overview should include feature type counts', async (
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('response should include technical debt field', async () => {
|
||||||
|
const { body } = await app.request
|
||||||
|
.get('/api/admin/projects')
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
|
.expect(200);
|
||||||
|
|
||||||
|
expect(body.projects).toHaveLength(1);
|
||||||
|
expect(body.projects[0]).toHaveProperty('technicalDebt');
|
||||||
|
expect(typeof body.projects[0].technicalDebt).toBe('number');
|
||||||
|
expect(body.projects[0].technicalDebt).toBeGreaterThanOrEqual(0);
|
||||||
|
expect(body.projects[0].technicalDebt).toBeLessThanOrEqual(100);
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user