azimuttapp / azimutt

Explore, document and optimize any database
https://azimutt.app
MIT License
1.33k stars 87 forks source link

Auto layout feature, show all tables by default #194

Open alexkreidler opened 1 year ago

alexkreidler commented 1 year ago

When I start a new Azimutt project for the first time by importing some tables from a SQL file, I'd like to quickly get an overview of the project by seeing all the tables visually, linked by their relationships.

However, the current start page has an "empty content" card with some getting started text saying "Your project has 6 tables. Here are some that could be interesting," with some tags that add a single table to the interface when the user clicks on them. I then learned how to use the table list and toggle each individual table to be visible.

I would have liked to have 1. the table list be already open 2. for it to have a very clear "toggle all" button (I discovered that functionality was in the search bar). And then upon adding some tables to the page, they are all overlaid on top of eachother, so I need to drag them apart separately to get a sense of their relationships.

However, those changes would be unnecessary if we had an auto-layout feature like a force-graph layout or even a simple system that enforces a margin between different tables, and Azimutt showed all the tables on the page by default. Using the auto-layout on all the tables on first load, so the user doesn't have to go through those steps, would make it a much more immediate "aha moment".

Thanks for this project, it is very nice! I hope my first-encounter thoughts are somewhat useful!

loicknuchel commented 1 year ago

Hi @alexkreidler

Thanks for your feedback! Azimutt was thought first for huge projects with a lot of tables (I'm working with a database with 700+ tables ^^). That's why it has this particular behavior (at the opposite of others). But you're right, for small projects it's a bit awkward...

There is already an auto-layout feature (the dashed cube on the bottom right toolbar) using the dagre algorithm (the one powering mermaid graphs), but it's not working so well so I didn't promote it a lot. Maybe a force layout would do better but I'm not so sure because there is often a lot of relations and especially when most tables have a created_by column (or similar) it makes just an ugly big ball ^^ I've seen other algorithms, simple ones like an alphabetical grid or more complex ones with topological sort or other but I'm not really convinced they perform so much better. Do you have an example of tool/algorithm that do this well?

At least, if there is few tables (let's say less than 15), I can add a "Show all" button on the empty card with an auto-layout. What do you think?

Quite happy you like the project! We do our best to make it as useful and friendly as possible, feedback are highly appreciated!