-
Notifications
You must be signed in to change notification settings - Fork 1k
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] use representatives in distrib graphs, including 'restricted' case (#6319) #6323
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6323 +/- ##
==========================================
+ Coverage 67.69% 67.80% +0.10%
==========================================
Files 532 532
Lines 65010 65101 +91
Branches 5445 5491 +46
==========================================
+ Hits 44008 44139 +131
+ Misses 21002 20962 -40 ☔ View full report in Codecov by Sentry. |
If you ask for the 10 first element matching a relationship distribution on target/source, you get the first 10. If you see only 3 it means 7 of them are not accessible to you (due to markings for instance). Showing the first 10 that YOU can see is not suitable : it means a dashboard is not presenting the same information to different users and that's not the point (dashboard are meant to be shared, etc.). The solution we have in mind will require more work:
This is a breaking change to the API but will allow us to simplify the query handling frontend side, where today we must make |
84a7fec
to
5dff342
Compare
This initial idea implies we update the API at a high level, namely the |
In fact, no need to get around this problem... we need to use the representative even if it's a big refactoring. It's why it has been designed in the first place. I'll use the representative in all queries and refactor to make it work. And use representative 'restricted' when needed. |
Proposed changes
representative
in all distribution queries, removing a lot of lengthy duplicated query code.Related issues
Closes #6319
Further comments
A lot of changes but all the same.
In essence, I'm now using the
representative
field defined for every StixObject and StixRelationShip (and more, seeopencti.graphql
) in the frontend queries for Distribution widgets.Backend side, distribution data will now send a dummy entity info, with "restricted" as representative, and no longer filter out these items (this is solving #6319).
Refactoring:
defaultValue
and other related utility functions, used everywhere in the app, have been moved to a specific filedefaultRepresentatives
out ofGraph.js
defaultValue
anddefaultSecondaryValue
have been renamed togetMainRepresentative
andgetSecondaryRepresentative
to avoid confusion with the settings default value concept.getMainRepresentative
andgetSecondaryRepresentative
first try to use therepresentative
of the input object, then fallback to the previous possibilitiesuseDistributionGraphData
to factorize common code in distribution graphs (utilities to turn query data into chart props)A lot of other places in the code still use lengthy queries with repeated
... on XXX
instead of usingrepresentative { main }
. I'm not addressing all of them here.Ultimately, we shall be able to simplify
getMainRepresentative
andgetSecondaryRepresentative
to only use representative when possible, and other fields for the objects that do not define it (and a side question is... shall we define a representative for every object in the platform? that would make things lot easier).