-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix(catalog): catalog viewer only shows controls if they are under a group #792
Conversation
2c897ec
to
c29c738
Compare
Note: I still need to add interface documentation |
packages/oscal-react-library/src/components/OSCALCatalogGroup.tsx
Outdated
Show resolved
Hide resolved
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.
Looking good so far and thanks for adjusting this to typescript.
packages/oscal-react-library/src/components/OSCALCatalogGroup.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALCatalogGroup.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALCatalogGroup.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALCatalogGroups.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALCatalogGroup.tsx
Outdated
Show resolved
Hide resolved
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.
If the catalog specifies only controls
and not groups
, how is it displayed?
const subControl: Control | undefined = upperLayer?.controls?.find( | ||
(control) => control.id === controlLayers[i] | ||
); | ||
const subGroup: ControlGroup | undefined = upperLayer?.groups?.find( |
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 am confused about why this needs a specific type -- what part of this causes tsc
to lose the ability to infer types?
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.
'subControl' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. [7022]
'subGroup' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. [7022]
73b30fc
to
552a819
Compare
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.
Why does this use a different way to display the list of controls than a Profile does? It seems like when we're listing just controls, those two should use the same code to display the controls?
Profile has always displayed lists of controls differently than the catalog does. That may be something to look into at some point. I figured we would not want to remove the accordion like feature the controls in the catalog currently have. I can just have them displayed as we do in Profile. |
I am not sure why we'd go from having three ways of displaying controls (the way CDef/SSP does it, the way profile does it, and the way catalog does it) to four ways (CDef/SSP, Profile, Catalog w/ Groups, Catalog w/out Groups). If it's something to look into later, we should open the ticket for that fix now. |
#816 was created to track that. We may want to refactor it a bit / create a few tasks from it. |
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.
Previously OSCALCatalog ignored the
Controls
prop it was passed.This creates an OSCALControls component to display controls outside
a group.
closes #741
closes #742
Testing
No controls
https://raw.githubusercontent.com/EasyDynamics/oscal-demo-content/main/catalogs/NIST_SP-800-53_rev4_catalog.json
Controls + Groups
https://raw.githubusercontent.com/EasyDynamics/oscal-demo-content/tuckerzp/group-prose/catalogs/basic-test-catalog.json
Just Controls
https://raw.githubusercontent.com/EasyDynamics/oscal-demo-content/tuckerzp/group-prose/catalogs/basic-test-catalog-no-groups.json
Groups without controls is displayed the same
Top Controls
is now shown as a groupTop level control groups with
prose
is displayedChildren groups with
prose
is displayedNo groups listed