LuckPermsWeb
LuckPermsWeb copied to clipboard
Preview/undoing of web editor changes
Taken from
https://github.com/lucko/LuckPerms/issues/655
I suggest that we generate a diff similar to the one in the plugin and either display it when saving or add a button for it.
Yeah, I think doing both could work.
Maybe have it display over the top of the page (like the help menu) so it can be easily dismissed or closed.
In my opinion the best user experience would be to show a confirmation screen when the user clicks the save button and it displays all of their current updates (additions, deletions and changes). They can click a confirm button to send the data back to bytebin or cancel (maybe even remove changes).
I think we can solve this by changing up the JSON node data as follows:
- add
new: trueto any new nodes (already added in my fork) - add
changed: trueto any updated nodes- add
previous: {node}to store the unchanged state of the node (to show to the user later)
- add
- add
deleted: trueto any deleted nodes
This would allow us to loop through all the nodes and show the user which ones are new, changed and deleted. They can then confirm these are the changes they wanted and continue the save process (at this point the data would be sent to bytebin and a token returned).
I assume this change would break things LuckPerms side, as currently the deleted nodes are removed from the tabs.rows array which I guess you have some way of checking for that (my Java sucks so I wasn't able to make any sense of it 😛 ).
This is the only option I can think of, if you think it will work then I'm happy to do what I can on this side.
I dislike the idea of it slowing down the workflow.
I’d prefer to get the option to preview the changes with a button.
So maybe add a quick save button? The save button would behave as you described and the quick save button behaves as before
Or Preview & Save buttons? Preview brings up a screen showing all the changes along with Save and Cancel buttons. Otherwise just click Save to save as normal.
This would still require a change in the object data.
Sounds even better.
Though it should be fairly straight forward to implement the diff algorithm Luck uses in the plugin on the page. So no change in the data is needed, as you still have the original data.
Fair enough, if I could understand the algorithm better then I could probably do this myself.