Skip to content
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

[frontend] Update demographic stixCoreRelationships from entity overview #9637

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

marieflorescontact
Copy link
Member

@marieflorescontact marieflorescontact commented Jan 17, 2025

Proposed changes

  • Update of Citizenship / Nationality / Country of residence can be done directly from the overview tab. (alignment with others StixCoreRelationships)
  • Apply review remarks on AddPersonaThreatActorIndividual and AddIndividualsThreatActorIndividual and childs components :
    • use usePreloadedQuery instead of useLazyLoadQuery,
    • use useFragment instead of useRefetchableFragment + remove useEffect()

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case (coverage and e2e)
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

othe

@github-actions github-actions bot added the filigran team use to identify PR from the Filigran team label Jan 17, 2025
@marieflorescontact marieflorescontact self-assigned this Jan 17, 2025
@marieflorescontact marieflorescontact marked this pull request as ready for review January 17, 2025 16:50
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.50%. Comparing base (1fba256) to head (94ac8c4).
Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9637      +/-   ##
==========================================
+ Coverage   65.25%   65.50%   +0.25%     
==========================================
  Files         630      630              
  Lines       60311    60475     +164     
  Branches     6776     7183     +407     
==========================================
+ Hits        39356    39617     +261     
+ Misses      20955    20858      -97     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marieflorescontact marieflorescontact marked this pull request as draft January 20, 2025 08:09
@marieflorescontact marieflorescontact marked this pull request as ready for review January 20, 2025 08:22
@marieflorescontact marieflorescontact changed the title [frontend] Update demographic stixCoreRelationships from entity [frontend] Update demographic stixCoreRelationships from entity overview Jan 20, 2025
@lndrtrbn lndrtrbn self-requested a review January 20, 2025 09:16
Copy link
Member

@lndrtrbn lndrtrbn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally seems good

Comment on lines 147 to 156
const [currentTargets, setCurrentTargets] = useState<string[]>(initialTargets);

const updateDelete = (store: RecordSourceSelectorProxy, path: string, rootId: string, deleteId: string) => {
const node = store.get(rootId);
const records = node?.getLinkedRecord(path);
const edges = records?.getLinkedRecords('edges');
if (!records || !edges) { return; }
const newEdges = edges.filter((n) => n.getLinkedRecord('node')?.getValue('toId') !== deleteId);
records.setLinkedRecords(newEdges, 'edges');
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is a duplicate and seems pretty generic.
In fact it seems to be the same as deleteNodeFromEdge from store.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it and use the function from store.js

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleteNodeFromEdge uses "id" while updateDelete uses "toId"

For now, I have moved the updateDelete method to store.js since it is used three times.
Later, we can see if deleteNodeFromEdge and updateDelete can be combined into a single method.

@marieflorescontact
Copy link
Member Author

PR status: all comments have been taken into account, ready for a second round of reviews

@marieflorescontact marieflorescontact marked this pull request as ready for review January 29, 2025 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filigran team use to identify PR from the Filigran team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent behavior on overview of demographics
2 participants