Skip to content

Commit 35e7f60

Browse files
committed
feat: review-comment: fix color for files without classifications
Signed-off-by: Dominikus Hellgartner <dominikus.hellgartner@tngtech.com>
1 parent 6bf552d commit 35e7f60

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

src/Frontend/Components/ProgressBar/ProgressBar.util.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import MuiBox from '@mui/material/Box';
66
import { sum } from 'lodash';
77

88
import { Criticality } from '../../../shared/shared-types';
9-
import { criticalityColor, OpossumColors } from '../../shared-styles';
9+
import {
10+
classificationUnknownColor,
11+
criticalityColor,
12+
OpossumColors,
13+
} from '../../shared-styles';
1014
import { navigateToSelectedPathOrOpenUnsavedPopup } from '../../state/actions/popup-actions/popup-actions';
1115
import { useAppDispatch, useAppSelector } from '../../state/hooks';
1216
import {
@@ -254,7 +258,7 @@ function calculateProgressBarSteps(
254258
);
255259
progressBarSteps.push({
256260
widthInPercent: 100 - totalPercentage,
257-
color: OpossumColors.lightestBlue,
261+
color: classificationUnknownColor,
258262
});
259263

260264
return roundPercentagesToAtLeastOnePercentAndNormalize(progressBarSteps);

src/Frontend/Components/ProgressBar/__tests__/ProgressBar.util.test.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
// SPDX-License-Identifier: Apache-2.0
55
import { Criticality } from '../../../../shared/shared-types';
66
import { faker } from '../../../../testing/Faker';
7-
import { criticalityColor, OpossumColors } from '../../../shared-styles';
7+
import {
8+
classificationUnknownColor,
9+
criticalityColor,
10+
OpossumColors,
11+
} from '../../../shared-styles';
812
import {
913
ClassificationStatistics,
1014
ProgressBarData,
@@ -98,7 +102,7 @@ describe('ProgressBar helpers', () => {
98102

99103
const background = getClassificationBarBackground(testProgressBarData);
100104

101-
const expectedBackground = `linear-gradient(to right, ${classificationStatistics[3].color} 0% 5% , ${classificationStatistics[2].color} 5% 25% , ${classificationStatistics[1].color} 25% 40% , ${classificationStatistics[0].color} 40% 65% , hsl(220, 41%, 92%) 65% 100% )`;
105+
const expectedBackground = `linear-gradient(to right, ${classificationStatistics[3].color} 0% 5% , ${classificationStatistics[2].color} 5% 25% , ${classificationStatistics[1].color} 25% 40% , ${classificationStatistics[0].color} 40% 65% , ${classificationUnknownColor} 65% 100% )`;
102106
expect(background).toEqual(expectedBackground);
103107
});
104108

@@ -125,7 +129,7 @@ describe('ProgressBar helpers', () => {
125129

126130
const background = getClassificationBarBackground(testProgressBarData);
127131

128-
const expectedBackground = `linear-gradient(to right, ${classificationStatistics[11].color} 0% 5% , ${classificationStatistics[2].color} 5% 25% , ${classificationStatistics[1].color} 25% 40% , ${classificationStatistics[0].color} 40% 65% , hsl(220, 41%, 92%) 65% 100% )`;
132+
const expectedBackground = `linear-gradient(to right, ${classificationStatistics[11].color} 0% 5% , ${classificationStatistics[2].color} 5% 25% , ${classificationStatistics[1].color} 25% 40% , ${classificationStatistics[0].color} 40% 65% , ${classificationUnknownColor} 65% 100% )`;
129133
expect(background).toEqual(expectedBackground);
130134
});
131135

@@ -168,7 +172,7 @@ describe('ProgressBar helpers', () => {
168172

169173
const background = getClassificationBarBackground(testProgressBarData);
170174

171-
const expectedBackground = `linear-gradient(to right, ${classificationStatisticsEntry.color} 0% 25% , hsl(220, 41%, 92%) 25% 100% )`;
175+
const expectedBackground = `linear-gradient(to right, ${classificationStatisticsEntry.color} 0% 25% , ${classificationUnknownColor} 25% 100% )`;
172176
expect(background).toBe(expectedBackground);
173177
});
174178
});

src/Frontend/Components/ProjectStatisticsPopup/ProjectStatisticsPopup.util.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
PackageInfo,
1414
} from '../../../shared/shared-types';
1515
import { text } from '../../../shared/text';
16-
import { OpossumColors } from '../../shared-styles';
16+
import { classificationUnknownColor } from '../../shared-styles';
1717
import {
1818
AttributionCountPerSourcePerLicense,
1919
ChartDataItem,
@@ -378,7 +378,7 @@ export function getSignalCountByClassification(
378378
name: text.projectStatisticsPopup.charts
379379
.signalCountByClassificationPieChart.noClassification,
380380
count: classificationCounts[NO_CLASSIFICATION],
381-
color: OpossumColors.lightestBlue,
381+
color: classificationUnknownColor,
382382
});
383383
}
384384

src/Frontend/shared-styles.ts

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export const OpossumColors = {
4040
brown: 'hsl(33, 55%, 44%)',
4141
};
4242

43+
export const classificationUnknownColor = OpossumColors.lightOrange;
44+
4345
export const criticalityColor = {
4446
[Criticality.High]: OpossumColors.orange,
4547
[Criticality.Medium]: OpossumColors.mediumOrange,

0 commit comments

Comments
 (0)