#feat16 : Added command graph (browser based). #45
Merged
gemanor merged 51 commits intopermitio:mainfrom Mar 27, 2025
Merged
Conversation
Contributor
Author
1 Users is now in orange boxes 2 Resource instance in purple 3 Resource instances is in the following naming convention resource_type#resource_id 4. Green lines is presenting the roles and the connection between a user and resource instance (the pill shows the role assigned) 5 Green dashed lines added it show the implicit (derived) assignment of a user to a resource 6 Orange lines now presents relationships between resource instances (the pill describes the relationship)
added more detailed styling Orange lines now presenting relationships between resource instances (the pill is describing the relationship) every user is now displayed in the graph lines now use better styling
added pagination support for better fetching added styles that render graph in configurable format
…istency with our policy graph
added support for layering ensuring every node is appear only once updates styles advance algorithms for rendering and calculating positions solved cross edges problem
introduced a new minimap fixed styling issues
gemanor
requested changes
Mar 22, 2025
Collaborator
gemanor
left a comment
There was a problem hiding this comment.
The code is generally great, but it also needs some refactoring. Left comments.
source/components/HtmlGraphSaver.ts
Outdated
|
|
||
| export const saveHTMLGraph = (graphData: GraphData) => { | ||
| const outputHTMLPath = resolve(process.cwd(), 'permit-graph.html'); | ||
| const htmlTemplate = ` |
Collaborator
There was a problem hiding this comment.
Please extract it to an external HTML file and import it to the component
| @@ -0,0 +1,168 @@ | |||
| // Define types | |||
Collaborator
There was a problem hiding this comment.
The file name should be GraphData.ts or GraphDataGenerator.ts
Contributor
Author
There was a problem hiding this comment.
changed , thank you!
source/components/graphCommand.tsx
Outdated
| @@ -0,0 +1,406 @@ | |||
| import React, { useEffect, useState } from 'react'; | |||
Collaborator
There was a problem hiding this comment.
This file should get refactored with the following comments in mind:
- File name should be
GraphCommands.tsxor justGraph.tsx - No API calls should made from here, but from hooks. See the contributing guide for the right usage of hooks, AuthProvider, and
useClientto do API calls (you'll maybe need to merge from the main for that) - Functions need to be more modular break to smaller, more maintainable functions
Contributor
Author
There was a problem hiding this comment.
named as GraphCommands.tsx and now using useClient for making api calls, thank you!
refactored changes
gemanor
approved these changes
Mar 27, 2025
Collaborator
gemanor
left a comment
There was a problem hiding this comment.
Great Job! Thanks for this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

/claim #16
/closes #16
CLI is now able to read the whole resource instance, relationships, and role assignment from the Permit APIs and display them as a graph with the relationships.
added command graph that runs on
npx tsx ./source/cli.tsx graph
display a permit fga graph that is showing the graph of the Permit permissions in ReBAC.
opened in default browser
