-
Notifications
You must be signed in to change notification settings - Fork 70
HTML Reports based on filter data #5595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
0355520
ee70c3e
11933bf
15fcf8c
1716018
4f3d77f
ebb6630
ee2d83c
fb5cae2
ad7e902
6fcd9f7
6d0d602
c9da6b9
16debd8
c685143
2eb1c5f
27d54f7
ef73c42
942b798
9876542
22455aa
a490685
bccfbbc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,4 +75,4 @@ | |
| "^.+\\.ts$": "ts-jest" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,12 +29,14 @@ type InputData = { | |
| data: ContextualizedEvaluation | string; | ||
| fileName: string; | ||
| fileID: string; | ||
| filteredControls: string[]; | ||
|
||
| }; | ||
|
|
||
| type ProcessedData = { | ||
| data: ContextualizedEvaluation; | ||
| fileName: string; | ||
| fileID: string; | ||
| filteredControls: string[]; | ||
| }; | ||
|
|
||
| // All selectable export types for an HTML export | ||
|
|
@@ -174,7 +176,12 @@ export class FromHDFToHTMLMapper { | |
| } | ||
|
|
||
| this.addFiledata( | ||
| {data: file.data, fileName: file.fileName, fileID: file.fileID}, | ||
| { | ||
| data: file.data, | ||
| fileName: file.fileName, | ||
| fileID: file.fileID, | ||
| filteredControls: file.filteredControls | ||
| }, | ||
| exportType | ||
| ); | ||
| } | ||
|
|
@@ -201,7 +208,11 @@ export class FromHDFToHTMLMapper { | |
| const allResultLevels: ContextualizedControl[] = []; | ||
| file.data.contains.map((profile) => { | ||
| profile.contains.map((result) => { | ||
| allResultLevels.push(result); | ||
| file.filteredControls.forEach((element) => { | ||
georgedias marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (element === result.data.id) { | ||
| allResultLevels.push(result); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
|
|
@@ -310,7 +321,7 @@ export class FromHDFToHTMLMapper { | |
| }; | ||
|
|
||
| // Calculate & set compliance level and color from result statuses | ||
| // Set default complaince level and color | ||
| // Set default compliance level and color | ||
| this.outputData.compliance.level = '0.00%'; | ||
| this.outputData.compliance.color = 'low'; | ||
|
|
||
|
|
@@ -324,7 +335,9 @@ export class FromHDFToHTMLMapper { | |
| 100 | ||
| ); | ||
| // Set compliance level | ||
| this.outputData.compliance.level = complianceLevel; | ||
| this.outputData.compliance.level = complianceLevel.includes('NaN') | ||
georgedias marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ? '0.00%' | ||
| : complianceLevel; | ||
| // Determine color of compliance level | ||
| // High compliance is green, medium is yellow, low is red | ||
| this.outputData.compliance.color = translateCompliance(complianceLevel); | ||
|
|
@@ -495,7 +508,7 @@ export class FromHDFToHTMLMapper { | |
| return text; | ||
| } | ||
|
|
||
| // Prompt HTML generation from data pulled from file during constructor intialization | ||
| // Prompt HTML generation from data pulled from file during constructor initialization | ||
| // Requires path to prompt location of needed files relative to function call location | ||
| async toHTML(path: string): Promise<string> { | ||
| // Pull export template + styles and create outputData object containing data to fill template with | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the way that this is implemented will not satisfy the issue where it was stated that we should be able to handle any of the filters that the user specifies. this will only filter on pass/fail/whatever.
heimdall2/apps/frontend/src/components/global/ExportCaat.vue
Line 43 in dc5cddd
use this example for how to get all the filter-passing controls. it should also mean that we don't need basically all of what're currently lines 122-123 and 150-164 since it'll just be a simple assignment directly onto 'filteredControls' (which can also then be made const).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely unequivocally disagree that the implementations does not satisfy the requirements. It works on all possible filtered permutations, did you even tried, apparently not if you're making this statement.
"the way that this is implemented will not satisfy the issue where it was stated that we should be able to handle any of the filters that the user specifies. this will only filter on pass/fail/whatever."
Regarding the second opinion, the code that is being referenced (from the ExportCaat.vue) will not work. If you take a look at the reverse-html-mapper.ts it uses the file.data, which is the file.evaluation being set in ExportHTMLModule.vue and you are comparing to this code in the ExportCaat,vue
const data = file?.evaluation ?? '';now how does that filters the proper evaluations? it doesn't. The code on both are accomplishing different tasks.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I've filtered it down to a single control using the nist filters. The html export does not only include that single control. Consequently, it does not meet the requirement of the original ticket according to my reading of it. Like I said elsewhere, we should get @em-c-rod or @ejaronne's opinions on which of our interpretations is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
w/r to your second paragraph, I'm only talking about extracting out the set of controls that pass the filtering. You can use the store to get that set I'm hoping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be a use case, but the ask for this is just to be able to show only the failed controls (aka filter on status). If this becomes an additional ask, we can make another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think it is relevant to consider severity filters here. Looking at severity filters as well was not explicitly the ask, but seems like it is paired in the same use case.