-
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
feat: add generic display of properties #786
Conversation
This creates a generic OSCALProperties component and adds it to back matter, controls, and metadata.
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.
Very early thoughts. There are a few design things not written here that we should talk through. I will try to summarize those and provide more info soon.
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/oscal-utils/OSCALPropUtils.ts
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.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.
Just had a quick look over things as they are. I had a few comments.
I also am not sure I understand why namespaceOf
can't be used instead of isNistNamespace
. I didn't have a ton of time to think it over, so maybe I am missing something.
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
|
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/oscal-utils/OSCALPropUtils.ts
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
I discussed this briefly with @Bronstrom, but I wonder if filtering out non nist namespaces to a separate list to only then put it in more or less the same list is the best approach. To me, this feels more like we need to I honestly am unsure if this cleans up the code a ton, but conceptually it makes more sense to me in terms of what we are actually trying to do. I also think it will make the return statement of the component a lot cleaner. Feel free to ignore me if I am wrong here or this is too big of a change 😆 |
Are you suggesting something like: function compareNamespace(a: Property, b: Property): number {
if (namespaceOf(a) === namespaceOf(b)) {
return 0;
}
if (namespaceOf(a) === NIST_DEFAULT_NAMESPACE) {
return -1;
}
if (namespaceOf(b) === NIST_DEFAULT_NAMESPACE) {
return 1;
}
return namespaceOf(a).localeCompare(namespaceOf(b));
}
const sorted = props
.sort((a, b) => a.name.localeCompare(b.name))
.sort(localeCompare); That feels immensely complicated compared to filtering. And then we're just encoding that information in the sort order... |
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
This fixes mertadata's title, which didn't display the label correctly, as well as removes the fallback in favor of having resources with no title be handled in OSCALBackMatter.
One of the Profile tests continues to fail more, so the wait time has been extended. Also some of the catalog group tests don't expect children underneath the controls (like props), so additional test data was created specifically with props data for tests.
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALBackMatter.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.
Small iconography change and then I think I am good to move forward with merging.
packages/oscal-react-library/src/components/OSCALProperties.tsx
Outdated
Show resolved
Hide resolved
packages/oscal-react-library/src/components/OSCALProperties.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.
Oh! We also need a storybook file for this! At least for the OSCALProperties
dialog itself
); | ||
}; | ||
|
||
interface OSCALPropertiesDialogProps { |
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.
interface OSCALPropertiesDialogProps { | |
export interface OSCALPropertiesDialogProps { |
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.
Good point!
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.
Thanks for your work on this!
This creates a generic OSCALProperties component and adds it to back matter, controls, and metadata. ## Testing Try out the following catalog in the Catalog Viewer/Editor: https://raw.githubusercontent.com/EasyDynamics/oscal-demo-content/brad/test-catalog-generic-properties/catalogs/generic_properties_test_calalog.json Closes #718 --------- Co-authored-by: Kyle Laker <klaker@easydynamics.com>
This creates a generic OSCALProperties component and adds it to back matter, controls, and metadata.
Testing
Try out the following catalog in the Catalog Viewer/Editor: https://raw.githubusercontent.com/EasyDynamics/oscal-demo-content/brad/test-catalog-generic-properties/catalogs/generic_properties_test_calalog.json
Closes #718