-
Notifications
You must be signed in to change notification settings - Fork 946
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
[backend/frontend] enable custom overview layout for most entities (#6724) #8010
Conversation
overviewLayoutCustomization: [ | ||
{ key: 'details', width: 6, label: 'Entity details' }, | ||
{ key: 'basicInformation', width: 6, label: 'Basic information' }, | ||
{ key: 'task', width: 6, label: 'Tasks' }, | ||
{ key: 'originOfTheCase', width: 6, label: 'Origin of the case' }, | ||
{ key: 'observables', width: 6, label: 'Observables' }, | ||
{ key: 'otherEntities', width: 6, label: 'Other entities' }, | ||
{ key: 'externalReferences', width: 6, label: 'External references' }, | ||
{ key: 'mostRecentHistory', width: 6, label: 'Most recent history' }, | ||
{ key: 'notes', width: 12, label: 'Notes about this entity' }, | ||
], |
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 is how you declare the default layout when there is a module backend side.
/** | ||
* Placeholder for a report Module Definition | ||
*/ | ||
|
||
import type { OverviewLayoutCustomization } from '../entitySetting/entitySetting-types'; | ||
import { registerEntityOverviewLayoutCustomization } from '../../schema/overviewLayoutCustomization-register'; | ||
import { ENTITY_TYPE_CONTAINER_REPORT } from '../../schema/stixDomainObject'; | ||
|
||
const reportDefaultOverviewLayout: OverviewLayoutCustomization[] = [ | ||
{ key: 'details', width: 6, label: 'Entity details' }, | ||
{ key: 'basicInformation', width: 6, label: 'Basic information' }, | ||
{ key: 'externalReferences', width: 6, label: 'External references' }, | ||
{ key: 'mostRecentHistory', width: 6, label: 'Most recent history' }, | ||
{ key: 'notes', width: 12, label: 'Notes about this entity' }, | ||
]; | ||
|
||
// Register only the default layout | ||
registerEntityOverviewLayoutCustomization( | ||
ENTITY_TYPE_CONTAINER_REPORT, | ||
reportDefaultOverviewLayout, | ||
); |
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.
For reports, no backend module is coded yet ; still old architecture.
I chose to bootstrap a module file, only declaring the default layout.
We can start from there if/when we move reports to the module architecture.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8010 +/- ##
==========================================
+ Coverage 65.84% 66.03% +0.18%
==========================================
Files 584 597 +13
Lines 59315 59628 +313
Branches 6068 6072 +4
==========================================
+ Hits 39056 39373 +317
+ Misses 20259 20255 -4 ☔ View full report in Codecov by Sentry. |
33c1ea3
to
59fe183
Compare
8421b3f
to
6282e30
Compare
6282e30
to
6a65012
Compare
Proposed changes
Replicate what was done in #7969 to most entities, namely:
Code changes are simple:
useOverviewLayoutCustomization(entityType)
overview_layout_customization
for all types of entities, enabling customization in settingsNote if there was no backend module defined for a specific entity type, I created a module folder + bootstrapped a module file that just handles the default overview layout registration.
There is also some code refactoring frontend side (JSX to TSX, class to functional component) so I can use the hook.
Related issues
Checklist