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:
parent
b8cc62cc96
commit
918e792af6
@ -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} />
|
||||
|
@ -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',
|
||||
|
@ -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,
|
||||
|
@ -6,6 +6,7 @@ export type ProjectForUi = {
|
||||
name: string;
|
||||
description?: string;
|
||||
health: number;
|
||||
technicalDebt: number;
|
||||
createdAt: Date;
|
||||
mode: ProjectMode;
|
||||
memberCount: number;
|
||||
|
@ -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,
|
||||
|
@ -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