Advances for  #78184 and #78182 and minor fixes

We handle when to enable the delete layer and make persistent context menu entries and delete from the server when the layer is persisted.

Also, other minor fixes.