Skip to content

Commit

Permalink
🐛 Count custom rules imported from yaml file (#1748)
Browse files Browse the repository at this point in the history
  • Loading branch information
rszwajko authored Mar 6, 2024
1 parent ddcbccf commit 8ec8083
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 8ec8083

Please sign in to comment.