Bug #5259
closedfirewall_aliases_edit.php: Switch to a URL Table type when you already have multiple rows
100%
Description
Start editing a new alias, click "Add Host" a few times to get multiple rows.
Switch the alias type to "URL Table (IPs)" or "URL Table (Ports)".
Now there are multiple rows still displayed but the "Delete" buttons at the end of each row are gone.
What to do here?
If the user is adding a new alias, then when switching to a "URL Table" type the code could automatically remove any rows after the first. I think that case is easy to see a reasonable thing to do.
If the user is editing an existing alias (e.g. a Network type alias with multiple rows), then what to do? A "URL Table" alias type is quite a different thing. Should we automatically remove all but the first row for the user, and then the user can type over the top of the first network they had and put a URL? But that might be quite annoying if a user "kind of accidentally" selects a "URL Table" type and wants to switch back. They would have to "cancel out" (= use the back button to get back to the firewall_aliases page) and start the alias edit again.
Perhaps the "Delete" button at the end of each row can always be shown as long as there is more than 1 row existing. Obviously that would mean that the code that generates row 1 would have to look ahead to know if row 2 exists in order to decide if a "Delete" button is needed on the end of row 1. But actually if it is done that way then a good side-effect is that when there is only 1 row, then there will be no Delete button displayed, and so no need for the popup message "You may not delete the last row".
Note: In 2.2.* the delete buttons were always shown regardless of the alias type, so users could do more what they liked and it was left to the validation on submit to check if they submitted rubbish.
Updated by Anonymous about 9 years ago
- Subject changed from Firewall Alias Edit switch to a URL Table type when you already have multiple rows to firewall_aliases_edit.php: Switch to a URL Table type when you already have multiple rows
- Status changed from New to Feedback
- Assignee changed from Anonymous to Phillip Davis
Added Javascript to hide and disable rows > 0 on selecting table types. Disabling them is required to ensure they are not included in the POST.
Updated by Anonymous about 9 years ago
- % Done changed from 0 to 100
Applied in changeset pfsense:a955944077507b434f1870ae6002b714c78b7648.
Updated by Phillip Davis about 9 years ago
2.3-ALPHA (amd64)
built on Mon Oct 26 19:32:58 CDT 2015
FreeBSD 10.2-STABLE
I played with various ways to try and trick it, switching alias types back and forth while editing. I could not break it. Fixed for me.
Updated by Anonymous about 9 years ago
jquery/pfSenseHelpers.js has been further amended to hide the "Delete" button when less than two rows exist.
The new function is called on page load, delete row and add row.
Updated by Phillip Davis about 9 years ago
Hide the "Delete" button when less than two rows exist - that is working nicely, thanks.
I think everything here is working and this issue is resolved.
Updated by Renato Botelho about 9 years ago
- Project changed from Bootstrap to pfSense