Skip to content

Commit

Permalink
🐛 Count custom rules imported from yaml file (konveyor#1748) (konveyo…
Browse files Browse the repository at this point in the history
…r#1749)

Reference-Url: https://issues.redhat.com/browse/MTA-2003

### Before
![Screenshot from 2024-03-06

13-39-40](https://github.com/konveyor/tackle2-ui/assets/64194103/915742f9-94da-4ab9-8229-e22e974e72e7)

### After

![Screenshot from 2024-03-06

15-17-17](https://github.com/konveyor/tackle2-ui/assets/64194103/e74f76ee-0a86-489a-a0fc-753c4cd96035)

Signed-off-by: Radoslaw Szwajkowski <rszwajko@redhat.com>
Signed-off-by: Cherry Picker <noreply@github.com>

Signed-off-by: Radoslaw Szwajkowski <rszwajko@redhat.com>
Signed-off-by: Cherry Picker <noreply@github.com>
Co-authored-by: Radoslaw Szwajkowski <64194103+rszwajko@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and rszwajko authored Mar 6, 2024
1 parent 6fd0c67 commit 4e2d7af
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client/src/app/utils/rules-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export const parseRules = (file: IReadFile): ParsedRule => {
const yamlList = Array.isArray(yamlDoc) ? yamlDoc : [yamlDoc];
const yamlLabels = Array.from(
new Set(
yamlList?.flatMap((parsedLine) => {
return parsedLine?.labels ? parsedLine?.labels : [];
yamlList?.flatMap((parsedRule) => {
return parsedRule?.labels ? parsedRule?.labels : [];
}) || []
)
);
Expand All @@ -32,7 +32,8 @@ export const parseRules = (file: IReadFile): ParsedRule => {
target: allLabels?.targetLabel,
otherLabels: allLabels?.otherLabels,
allLabels: allLabels?.allLabels,
total: 0,
total:
yamlList?.filter((parsedRule) => parsedRule?.ruleID)?.length ?? 0,
...(file.responseID && {
fileID: file.responseID,
}),
Expand Down

0 comments on commit 4e2d7af

Please sign in to comment.