laravel-schematics icon indicating copy to clipboard operation
laravel-schematics copied to clipboard

[Feature] Make layout persistent

Open robsontenorio opened this issue 4 years ago • 7 comments

Thanks for your time! Nice work!

Would be nice to have a persistent layout (diagram).

  • Open http://localhost:8080/schematics
  • Move around some objects
  • Open a icognito browser http://localhost:8080/schematics
  • Diagram layout has lost.

robsontenorio avatar Mar 06 '20 21:03 robsontenorio

Hi again @robsontenorio! :)

Thanks!

The diagram saving relies on the localStorage which gets lost when you open a incognito screen. You could use the export / import to restore it though.

Maybe in the future I could save the diagrams somewhere else so they'll go along with incognito or browser switching. I'll have to think of a implementation.

mtolhuys avatar Mar 06 '20 21:03 mtolhuys

I think you could use a database, or Redis to save the layout.

ArtNous avatar Mar 06 '20 22:03 ArtNous

@ArtNous Yeah, could definitely be an option. I went for localStorage to make it the least "intrusive" as it could be.

Thinking about it I'm actually leaning towards using backend caching.

Will be a heavy change since pretty much everything you do gets stored in it (dragging positions etc.)

mtolhuys avatar Mar 06 '20 22:03 mtolhuys

You could keep all current logic using localStorage. But just send back to backend and save all changes on dedicated table.

In fact would be necessary to have a persitent mechanism, like a table.

EDIT: or maybe a simple file on proper location.

Captura de tela de 2020-03-06 19 36 07

robsontenorio avatar Mar 06 '20 22:03 robsontenorio

That's right, It would be a big change, but I think it is necessary, we're here to support and help.

ArtNous avatar Mar 06 '20 22:03 ArtNous

Thanks guys! All contributions will be fully credited of course. Just have to make a nice section for it in the README as I didn't thought this would happen so fast. :)

I'll take the suggestions with me.

mtolhuys avatar Mar 06 '20 23:03 mtolhuys

At the moment I'm working on a "hybrid" solution for this. I'm thinking of a save button in the right upper corner which will cache the localStorage. With that, if the localStorage is empty, it could fill it with it. This way we'll prevent a request bombardment. :)

mtolhuys avatar Mar 09 '20 15:03 mtolhuys