Coder Social home page Coder Social logo

stevebuik / graphvizforce-lightning Goto Github PK

View Code? Open in Web Editor NEW
30.0 8.0 3.0 20.52 MB

Automatic Entity-Relationship diagrams and SOQL queries for Salesforce

License: The Unlicense

JavaScript 94.93% CSS 0.06% Apex 4.89% HTML 0.11% Dockerfile 0.02%
lightning sfdx sfdx-cli salesforce apex tooling-api soql erd

graphvizforce-lightning's Introduction

Graphvizforce for Lightning

A Salesforce Entity Relationship diagramming and visual SOQL builder.

Status: BETA Stable. Needs minor features and bug fixes.

Distributed as a managed package but we will convert to an unlocked package as soon as they are available.

Continuous Integration Build Status: CircleCI

Installation

Install into a Production or DE Org using tiny.cc/gvf2p

Install into a Sandbox Org using tiny.cc/gvf2t

Features

Watch the videos

Developers

If you would like to contribute to this project, we welcome any help. Please first look at the issues marked help wanted and contact us to check if anybody else is already working on it.

Then follow these instructions to setup your development environment.

You might also want to clone/setup this project to learn some of the techniques we use. You can also read the posts on this blog, as we will explain the design in more detail there.

Architecture

We document our architectural decisions using a standard Architecture Review Document format.

These documents can be seen in the ADR dir.

Issues

We manage our roadmap and defects as Github issues

Acknowledgements

Thanks Jason Guan for working on v1 and initiating the v2.

Thanks Andrew Fawcett for the UML Canvas project. We used 2 classes from that project to create the Auto-Build feature.

Thank you if you are using this tool. We volunteer our time for the satisfaction of knowing that people use the tools that we make.

Licence

Graphvizforce is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.

graphvizforce-lightning's People

Contributors

austinwang1121 avatar jasong327 avatar stevebuik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphvizforce-lightning's Issues

Google Analytics support

for navigation and other events to that the GVF team can see usage and understand if future features are worth building

later on, add a global config option to disable this if the user doesn't want to be tracked. But track when this is disabled

Persistence

Diagrams are saved to SFDC somewhere. maybe as JSON in the Docs or Files tab

User can see the diagram as a SOQL query

Prototype the idea that this can be used as a query builder to reach a wider audience.

It will need the user to pick the "from" entity from the list of visible entities.

SOQL Query Runner

A natural next step after building a query is to run it and examine the results.

Since join results are basically a list of trees, a Lightning Component could be built to execute the current query (simplest is just send to apex and use Database.query) and display the results graphically.

The UI could use the lightning:treegrid https://developer.salesforce.com/docs/component-library/bundle/lightning:treeGrid/example#lightningComponentDemo:exampleTreeGridBase

Not sure how easy it will be to map nested sobjects into a tree grid but it will need to support:

  1. top level from entity/attributes
  2. ancestor entity/attributes
  3. children entity/attributes
  4. ancestors of children entity/attributes

Results can be displayed in a new tab next to the download tab

Apex autobuild fails/hangs when trying to analyse a class from a managed package

The message is " from a managed package cannot be saved"

Also hangs the console when this occurs (because the console watches the tooling api via a websocket)

Solution: detect the lack of source for classes from managed packages and skip them i.e. use a predicate method for skipping classes.

Also add a try/catch block to better handle generic errors and report to user in progress component

sort available Object list to show related entities first

When adding Objects, it's natural to want to add those that are related to the one you just added. Currently the list of all objects is alphabetic.

If the most recently added entity (from Apex) is stored in an attribute, then the sorted list of Objects can be split into two sets of sorted entities. The top one shows all entities related to the most recently added. The lower section shows all other entities not related.

For extra bonus points, the transitively related entities can also be included in the top section but they are sorted lower in the list.

This would drastically improve the manual creation of diagrams

Back button support

Create a History Manager component which detects the browser back button and syncs changes in the URI to navigation events which the app can respond to

User can download graphviz text

If a user wants to open the diagram in Graphviz on local machine (to support SVG, PDF etc) then we need a button to download the content (was originally a VF page) or a modal with the text displayed so it can be copied.

d3 based diagram UI component

a d3 force directed graph where the nodes are html tables could replace the diagram with a lot more interactive features

  • drag/drop repositioning of the entities. in d3 it's possible to lock a node in place so any node that is dropped can lock in place, the others will adjust automatically.
  • the edges in the chart will be lines but it should be possible to calculate the two right angled lines horizontal/vertical lines to make a better connector with an arrow on the end
  • when groups are added to graphviz diagrams, d3 supports auto-calculated grouping containers so these be be used for groups https://bl.ocks.org/bumbeishvili/f027f1b6664d048e894d19e54feeed42
  • entities can be drag/dropped from one group to another
  • better visualisation/animation of entities that are part of a SOQL query

any of these features needing data persisted can add a section to the JSON schema / persisted document shape

it can be another tab next to download, giving the user choice.

SOQL Renderer

add a fn to static resource:
2 args: persisted JSON and from entity
result = SOQL string

using Jasmine etc to dev/test this

Clean up names

Camel all and name events EventFoo

get rid of ERD prefix

diagram can zoom in/out

when the diagram gets large, it's useful to be able to zoom and maybe even pan around. zoom out (with a reset) at least would be useful.

is this possible with SVG? there are js libs that can zoom and pan svg but not sure if they work under the LockerService and without Lightning renderer conflicts.

SOQL generates parent -> child -> parent fields

In SOQL, it's supported to join from an entity, down to a child and then from there, up to other ancestors of the child entity.

The SOQL generator currently doesn't include those fields in the query or the selected fields data for the diagram.

double comma in SOQL rendered query

when a query has a parent -> child join, copy or view the rendered SOQL and there will be a double comma after the from fields and before the child joins

Add grouping feature (same as in old graphviz VF tool)

the persistence JSON already supports groups. In order to add this feature, you will need to add:

1/ the graphviz.js/diagramAsText fn/template will need to add extra graphviz markup to display the groups.

2/ a lightning UI/component to manage the groups. this could use the Lightning duelling lists component. it should probably replace the entity/fields editor when active so that instant UI feedback is possible. It can include a colour picker for each group.

automatically choose the from entity to maximise reach of SOQL query

when a developer want to maximise the entities that are returned by a SOQL they need to try various from entities to see which includes the most entities.

When extracting the from options from the persisted JSON, the "entities" pure fn could return objects instead of strings. Those objects can contain the "from" entity name and also a label with (n) appended. N would be the count of entities included when that entity is used as the from for a SOQL query.

This makes it easy for the user to know which entity has the greatest reach without needing any new UI components i.e. keeping UI clean

stop using Lightning Data Service

It is not providing much value i.e. more client code than if we just used Apex and harder to test.

Also, it's not supported in Lightning Out.

So delete the DiagramDataService and replace it with apex methods to read/write a diagram

auto-build fails with mutation event handling error

Use auto-build on classes and you will see:

This page has an error. You might just need to refresh it. Action failed: gvf2:ERDContainer$controller$onDiagramMutate [Cannot read property 'RecordTypeId' of undefined] Callback failed: apex://gvf2.AutoBuild/ACTION$pollSource Failing descriptor: {gvf2:ERDContainer$controller$onDiagramMutate}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.