ui: fixed rules views selection and refreshing issues#1614
Open
redsies wants to merge 5 commits into
Open
Conversation
- Fixed selecting rows with the keyboard. The selection was applied to the previous row instead of the current one, so actions from the contextual menu (edit, delete, etc) operated on the wrong rule. - Fixed exception pressing the Down key. - Keep the current row focused after refreshing the views. - Discard the selection when clicking on an empty area of a view. Previously the rows were no longer highlighted, but the actions kept operating on them. - Don't display the rules contextual menu when there's no selection, and don't swallow exceptions of the menu actions silently. - Added tests for the rows selection behaviour. - Misc: right click no longer activates the mouse-dragging selection logic, and fixed highlighting rows when selecting ranges from the db. ref: evilsocket#1291
- When the rules editor was opened from a contextual menu, the contextual-menu-active flag was kept set during the whole editor session, discarding every table refresh. Saving a rule updated the daemon and the db, but the views kept displaying the old values until the editor was closed.
- When the query of a view changed (filtering the view by a word, paginating, etc) while the scrollbar was not at the top or bottom of the view, the viewport kept displaying the rows of the previous query. Selections and menu actions operated on the new result set, so they didn't match the rows displayed. - Added a regression test for the above. ref: evilsocket#1291
- Notify the views whenever rules are added, deleted or disabled in the db. Rules created from pop-ups, temporary rules expiration and rules received when a node connects were not displayed until interacting with the views, because the periodic refresh is skipped while there're rows selected. - Emit the notification once per batch when adding several rules, to avoid a refresh storm when a node connects. - Misc: moved the views update of the rules editor to the central rules class, and added tests for these notifications.
- When the action of an auto-named rule was changed (e.g. reject to allow), the rule was renamed (reject-xxx -> allow-xxx), but the editor kept tracking the old name. Saving the rule again then wrongly reported "There's already a rule with this name", as it compared the renamed rule against itself. - Track the saved rule name instead of the one typed in the field, and stop mutating the rule object while deleting the old name. - Added a regression test. ref: evilsocket#1291
ad937ca to
5045ccf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Selecting rules with the keyboard applied the selection to the previous row instead of the current one, so Edit/Delete from the contextual menu operated on the wrong rule. While debugging it I found a few more problems in the same area:
Fixed all of the above and added tests for the selection behaviour (ui/tests/customwidgets).
While I was in the same area I also fixed a few related issues with the rules views not refreshing correctly:
Added regression tests for these as well. ref #1291