Open plajjan opened 11 years ago
I recommend to add a checkbox in the confirmation window which says something like "Delete all sub prefixes". The answer is then stored in 'recursive' parameter. This would require changes in the files
I think it's not really necessary to list affected prefixes, maybe in a spoiler. But what would be nice is if you could revert the last delete.
I think we will implement most of the logic in JavaScript for a better user experience.
If a prefix is to be deleted, we query the backend for any subnets to the prefix that is about to be deleted. If the prefix is an assignment and there are hosts inside, it is required that it is deleted recursively as having hosts without a covering assignment is a violation of the database constraints. If on the other hand it is a reservation, we should give the user the option to either just delete the selected prefix or recursively delete all that it contains. This is how the cli behaves and I think we should mimic that behaviour. The cli also displays a list of prefixes that are about to be deleted, if a recursive delete is used. If the list is to long, it is truncated and a message stating how many prefixes are affected is shown.
Rethinking this I realize we probably don't need to query the backend. We have the number of children of the prefix already!
If the prefix is of type assignment and has children >0 then a normal (non recursive) is not allowed and could be greyed out.
If a prefix has zero children then obviously a recursive delete is not possible, or at least doesn't make a difference, and could therefore be greyed out.
But on the other hand, since we want to display a list of affected prefixes (ie, the ones that are about to be removed) we need to query the backend anyway...
The web-ui does not currently support recursively deleting a prefix and all its children. Add support so that when a prefix that has children is being deleted, the user is prompted if the prefix should be deleted recursively or not.
Should also list which prefixes are affected, Ie that will be deleted, if a recursive delete is used.