Added a filter on the users page for viewing inactive/removed users
Review Request #8650 — Created Jan. 21, 2017 and submitted
There's been a request to add a filter to the Users page that allows for showing those who are no longer part of the team. This was done by updating class 'UsersDataGrid' to introduce show/hide inactive users functionality. I also created templates/datagrids/user_listview.html to display the show/hide inactive toggle.
This was tested by changing a user from active to inactive via admin page. Then, I checked on the users page if an inactive user disappears after clicking 'Hide inactive', and whether an inactive user also appears after clicking 'Show inactive'.
Description | From | Last Updated |
---|---|---|
Col: 1 E302 expected 2 blank lines, found 1 |
reviewbot | |
Because there's only one UsersDataGrid, we don't really need a mixin class. We can just put this implementation into UsersDataGrid.load_extra_state |
david | |
Col: 1 E101 indentation contains mixed spaces and tabs |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Col: 1 E101 indentation contains mixed spaces and tabs |
reviewbot | |
Col: 17 E122 continuation line missing indentation or outdented |
reviewbot | |
Col: 1 E101 indentation contains mixed spaces and tabs |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Col: 14 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Col: 16 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Col: 1 W191 indentation contains tabs |
reviewbot | |
Do we need the reviewtags library here? |
david | |
Space between datagrid_filters and %} |
brennie | |
Col: 28 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
Col: 26 E251 unexpected spaces around keyword / parameter equals |
reviewbot | |
The load_extra_state method takes a non-optional profile argument. |
david | |
The other code in this file is old and doesn't match up with our new docstring guidelines. This should include … |
david | |
Can you make this "Do nothing."? |
david | |
allow_hide_inactive is always going to be True so we could just get rid of it. |
david | |
This can all go on one line. |
david | |
Col: 51 W291 trailing whitespace |
reviewbot | |
Col: 1 W293 blank line contains whitespace |
reviewbot | |
Col: 58 W291 trailing whitespace |
reviewbot | |
Col: 37 W291 trailing whitespace |
reviewbot | |
Col: 51 W291 trailing whitespace |
reviewbot | |
The summary should be a single line, followed by a blank line, followed by more stuff. The following stuff should … |
david | |
Blank line between these. |
david | |
Should be "bool" instead of "Boolean" |
david | |
"The user profile..." |
brennie | |
So a few things here: self.show_inactive is initially False and int(False) will raise ValueError. Instead of self.show_inactive, lets use 0. … |
brennie | |
Not necessary. |
brennie | |
Col: 62 E241 multiple spaces after ',' |
reviewbot | |
Blank line between these. |
brennie | |
I just noticed that there's an extra </li> added on each of these lines (in addition to the one after … |
david |
- Description:
-
~ - Included a class 'ShowInactiveUsersMixin' to show/hide inactive users (datagrids/grids.py).
~ There's been a request to add a filter to the Users page that allows for showing those who are no longer part of the team. This was done by updating class 'UsersDataGrid' to introduce show/hide inactive users functionality. I also created templates/datagrids/user_listview.html to display the show/hide inactive toggle.
- - Updated class 'UsersDataGrid' to introduce show/hide inactive users functionality.
- - Created templates/datagrids/user_listview.html to display show or hide inactive toggle.
- Testing Done:
-
~ - Changed a user from active to inactive via admin page.
~ This was tested by changing a user from active to inactive via admin page. Then, I checked on the users page if an inactive user disappears after clicking 'Hide inactive', and whether an inactive user also appears after clicking 'Show inactive'.
- - Checked on users page if inactive user disappears after clicking 'Hide inactive'.
- - Checked on users page if inactive user appears after clicking 'Show inactive'.
- Commit:
-
f9b83bf91dc0ac7cf918a0f28d54bca6041156b34c4b58762feda868003c1086047ac3dfbd14a00e
-
Tool: Pyflakes Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html Tool: PEP8 Style Checker Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html
-
-
-
Tool: Pyflakes Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html Tool: PEP8 Style Checker Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html
-
Tool: Pyflakes Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html Tool: PEP8 Style Checker Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html
-
-
-
-
-
Tool: Pyflakes Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html Tool: PEP8 Style Checker Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html
-
-
Tool: PEP8 Style Checker Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html Tool: Pyflakes Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html
-
-
The summary should be a single line, followed by a blank line, followed by more stuff. The following stuff should be aligned to the starting column of the """. Something like this:
def load_extra_state(self, profile): """Load extra state for the datagrid. This handles hiding or showing inactive users. Args: profile (reviewboard.accounts.models.Profile): User profile which contains some basic configurable settings. Returns: bool: Always returns False. """
-
-
-
Tool: Pyflakes Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html Tool: PEP8 Style Checker Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html
-
-
-
So a few things here:
-
self.show_inactive
is initiallyFalse
andint(False)
will raiseValueError
. Instead ofself.show_inactive
, lets use0
. -
If you pull the
request.GET.get(...)
code into a separate variable, it will look slightly cleaner, i.e. less indents:
show_inactive = self.request.GET.get('show-inactive', 0) try: self.show_inactive = int(show_inactive) except ValueError: pass
-
-
-
Tool: Pyflakes Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html Tool: PEP8 Style Checker Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html
-
-
Tool: Pyflakes Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html Tool: PEP8 Style Checker Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html
-
Tool: Pyflakes Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html Tool: PEP8 Style Checker Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/user_listview.html
-
-
I just noticed that there's an extra
</li>
added on each of these lines (in addition to the one after the{% endif %}
). This is also a bug in the code you modeled this on, so it's totally not your fault.We should at least fix it here, and if you wanted to fix up the one in review_request_listview.html as well, that would be awesome.
-
Tool: Pyflakes Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/review_request_listview.html reviewboard/templates/datagrids/user_listview.html Tool: PEP8 Style Checker Processed Files: reviewboard/datagrids/grids.py Ignored Files: reviewboard/templates/datagrids/review_request_listview.html reviewboard/templates/datagrids/user_listview.html