skanaar / nomnoml

The sassy UML diagram renderer
https://www.nomnoml.com
MIT License
2.7k stars 209 forks source link

[idea] Loading and saving diagrams on server side #73

Closed Semmu closed 5 years ago

Semmu commented 6 years ago

Hi!

I would like to use your awesome tool internally for our project and I am thinking about how we could do that. The easiest way would be to host our own nomnoml instance (on intranet, so no need to integrate authentication into this tool), but it would be really awesome if we could load and save diagrams on the server itself and give them short names (URL) to be able to pass their links around.

Did you think of something like this, or what would you recommend as an alternative solution? I think a feature like this would make nomnoml a more appealing option for teams, as they could host their own instance and keep their data secure, but easy to access and modify.

skanaar commented 6 years ago

I think it is a great idea! I have not implemented any server-side features since it would increase my running costs quite a bit.

But if you can avoid authentication then some simple key-value database would suffice. In nomnoml.app.js there is a buildStorage function that manages the two different modes that nomnoml can be in. Add a third storage-mode that persists to a server.

I would love to see a pull-request with your work so that I can present nomnoml as an attractive Run-Your-Own-Instance application 😄

Semmu commented 6 years ago

Glad you like it!

Yeah, this feature would need some very simple backend, but as you said, a key-value store would be enough. I don't have much experience in JS backend, but I will look into it.

Also the user interface should be updated, some buttons would have to be added, specifically "New", "Save" and "Load". There should be a name input somewhere as well, (or only displayed when clicking on "Save"?), and I think the "Load" button should create a popup with a dropdown to select the desired diagram to load.

And all of this should have a client side configuration variable, which determines which mode the instance is running (in other words: if it has a backend) and should present the buttons only if there is one.

What do you think of this solution? I will (hopefully) try to implement this myself, but I want to hear your opinion!

skanaar commented 6 years ago

I think it sound promising.

There is a #title directive that is used when saving an image of the diagram. If present it could be used for a server-side filename, otherwise, a random string would be generated. With an appropriate warning if the filename is already taken.

Raithybabes commented 6 years ago

Would you consider integrating with a simple storage service, such as 5apps, for the online version of nomnoml?

It might also satisfy for self-hosted instances - although I expect most people would rather control the data too.