Conversation
johnnyblasta
left a comment
There was a problem hiding this comment.
Tested and seems to work fine. Could be good if someone else also tests before approving.
|
Thanks for the feedback @Grammostola I have fixed so that attributes are undone even for new features. Problem was that new features without default values don't have the properties in the "before" state, and the undo operation was not capable of removing added properties. Some of those annoying special cases could probably have been eliminated if the editor re-read features from the server when saved. As it is now Origo assumes that the feature looks like in the client, which very well may be wrong if the database uses default values or triggers. It also means that newly created features only have the properties that have defined default values in Origo. Regarding the Another confusing thing is that there is no check if the attribute editor actually changes any attributes, it always creates an undoable action if the dialog is closed with "OK". But that goes for autoSave as well, so I didn't want to mess with that. |

Fixes #2223 by introducing two new amazing features:
Also lays the foundation for implementing #2018 by implementing the UndoStack class which can be used to build undo functionality for Draw tool.
No new configuration is needed to use these new features, they are on by default. The abort edits and undo stack is implemented completely independent of each other, meaning that the abort function does not rely on the undo stack, so disabling undo will still have abort working. The undo stack will default to 100 last operations (why 100? No idea, just pulled a number from the hat). But there are a few new options available:
maxUndoLevels: Number. set on editor to limit the number of undo levels. Defaults to 100. Setting it to 0 will disable undo altogether and hide the undo/redo buttons.reuseIds: boolean. Defaults to false. Can be set on editor or WFS layers. Layer level will override editor. When set to true, the WFS transaction will use the id of the deleted feature when undoing a delete that has been saved to the server by recreating the feature. Only works for WFS 1.1.0. Also requires that the server implements the "idgen"-attribute in an insert transaction. Geoserver does this, not sure about others. Also for reuseIds to work, the database must allow id insertion. For postgres and identity columns as Private key, the identity must be created withGENERATED BY DEFAULT AS IDENTITYinstead of the more commonGENERATED ALWAYS AS IDENTITY. If not resudeIds are used the re-created feature will get a new id, which probably only matters if the id is used in a relation.Only tested for WFS, but it should work for AGS as well as nothing has changed in the actual transmission to the server except the reuseIds code that is not possible to implement in AGS anyway.