1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-01 13:47:27 +02:00

fix: health to technical debt on projects list (#10485)

This commit is contained in:
Tymoteusz Czech 2025-08-11 11:45:27 +02:00 committed by GitHub
parent b8cc62cc96
commit 918e792af6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 21 additions and 4 deletions

View File

@ -29,6 +29,7 @@ export const ProjectCard = ({
name,
featureCount,
health,
technicalDebt,
memberCount = 0,
id,
mode,
@ -71,7 +72,7 @@ export const ProjectCard = ({
</StyledProjectCardContent>
<StyledProjectCardContent>
<div data-loading>
<strong>{health}%</strong> health
<strong>{technicalDebt}%</strong> technical debt
</div>
<div data-loading>
<ProjectLastSeen date={lastReportedFlagUsage} />

View File

@ -80,12 +80,12 @@ export const ProjectsListTable = ({ projects }: ProjectsListTableProps) => {
width: 90,
},
{
Header: 'Health',
accessor: 'health',
Header: 'Technical debt',
accessor: 'technicalDebt',
Cell: ({ value }: { value: number }) => (
<TextCell>{value}%</TextCell>
),
width: 70,
width: 130,
},
{
Header: 'Last seen',

View File

@ -14,6 +14,7 @@ const mockProjectData = (name: string): ProjectForUi => ({
memberCount: 0,
mode: 'open' as const,
health: 100,
technicalDebt: 0,
createdAt: new Date(),
favorite: false,
lastReportedFlagUsage: null,

View File

@ -6,6 +6,7 @@ export type ProjectForUi = {
name: string;
description?: string;
health: number;
technicalDebt: number;
createdAt: Date;
mode: ProjectMode;
memberCount: number;

View File

@ -21,6 +21,7 @@ const mapProjectForUi = (row): ProjectForUi => {
id: row.id,
description: row.description,
health: row.health,
technicalDebt: 100 - (row.health || 0),
favorite: row.favorite,
featureCount: Number(row.number_of_features) || 0,
memberCount: Number(row.number_of_users) || 0,

View File

@ -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);
});