LuckPermsWeb icon indicating copy to clipboard operation
LuckPermsWeb copied to clipboard

Preview/undoing of web editor changes

Open lucko opened this issue 7 years ago • 7 comments

Taken from

https://github.com/lucko/LuckPerms/issues/655

lucko avatar Jan 08 '18 21:01 lucko

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.

BrainStone avatar Jan 09 '18 18:01 BrainStone

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.

lucko avatar Jan 09 '18 19:01 lucko

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: true to any new nodes (already added in my fork)
  • add changed: true to any updated nodes
    • add previous: {node} to store the unchanged state of the node (to show to the user later)
  • add deleted: true to 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.

Turbotailz avatar Aug 17 '18 12:08 Turbotailz

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

BrainStone avatar Aug 17 '18 12:08 BrainStone

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.

Turbotailz avatar Aug 17 '18 12:08 Turbotailz

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.

BrainStone avatar Aug 17 '18 13:08 BrainStone

Fair enough, if I could understand the algorithm better then I could probably do this myself.

Turbotailz avatar Aug 17 '18 13:08 Turbotailz