Skip to content

Commit

Permalink
🐛 Count custom rules imported from yaml file
Browse files Browse the repository at this point in the history
Reference-Url: https://issues.redhat.com/browse/MTA-2003
Signed-off-by: Radoslaw Szwajkowski <rszwajko@redhat.com>
  • Loading branch information
rszwajko committed Mar 6, 2024
1 parent ddcbccf commit 080d1ad
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 080d1ad

Please sign in to comment.