Implementation of Review Request Infobox to the Dashboard
Review Request #8661 — Created Jan. 22, 2017 and submitted
This change introduces a new infobox to the dashboard upon hover, over a review request. The idea is similar to the infobox for users and bugs - the infobox will display some summary information regarding the review request, including the submitter, the summary and description, issue counts, and a few of the most recent reviews/activity on the request. This will allow users to get a quick overview of the review request without having to actually move to the page - in particular, what should be useful is the ability to see what recent activity has been done to a review request.
Code has been tested by running the development server and adjusting the tester review request for different scenarios.
Jasmine tests have been run - but at this point in time, the Jasmine tests find that the class label for the infobox is being generated on the Diff links, where it should not be.
Python tests have not been run.
Description | From | Last Updated |
---|---|---|
Col: 1 E302 expected 2 blank lines, found 1 |
reviewbot | |
Col: 17 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 17 E128 continuation line under-indented for visual indent |
reviewbot | |
Col: 80 E501 line too long (81 > 79 characters) |
reviewbot | |
Col: 44 W291 trailing whitespace |
reviewbot | |
This is indented too far. |
brennie | |
Comments should have a period. |
brennie | |
undefined name 'format_html_join' |
reviewbot | |
Col: 13 E126 continuation line over-indented for hanging indent |
reviewbot | |
undefined name 'format_html' |
reviewbot | |
We do 4 space indentation. |
brennie | |
undefined name 'format_html' |
reviewbot | |
Col: 13 E128 continuation line under-indented for visual indent |
reviewbot | |
We use one space indentation for html files. |
brennie | |
{% if %} etc should be formatted wiht the { in column 1 and a number of spaces between % … |
brennie | |
If you use a {# django template comment #} it wont get put in the resulting HTML. |
brennie | |
Col: 80 E501 line too long (83 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (83 > 79 characters) |
reviewbot | |
The other infobox views here have an old style of docstring, but because this is new code, we should use … |
david | |
The last item in python dictionaries should also end in a comma (so that it's easier to add new stuff … |
david | |
Can we name all the classes review-request-infobox-* instead of reviewRequest-infobox-*? |
david | |
'format_html' imported but unused |
reviewbot | |
'format_html_join' imported but unused |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
'format_html' imported but unused |
reviewbot | |
'format_html_join' imported but unused |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
'format_html_join' imported but unused |
reviewbot | |
'format_html' imported but unused |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
Col: 80 E501 line too long (80 > 79 characters) |
reviewbot | |
'format_html' imported but unused |
reviewbot | |
'format_html_join' imported but unused |
reviewbot | |
Col: 9 E265 block comment should start with '# ' |
reviewbot | |
Python strings concatenate in the same way that C strings do, so you can just elide the + operator here. … |
david | |
Yep, you do. |
david | |
I think this line can be merged with display_data on line 680 |
AN anni_cao | |
request should be type of HTTP Get request |
AN anni_cao | |
str is not a type, should be String |
AN anni_cao | |
I guess local_site should be name/address of local site, maybe type of String |
AN anni_cao | |
To be consistent with all the other comments, the description for HttpResponse should be on a new line |
AN anni_cao | |
Suggest to move <div class=...> to a new line so that it will be easier to read. The name of … |
AN anni_cao | |
The " is now on the inside of the }, which isn't right. |
david | |
Type should be django.http.HttpRequest. |
david | |
Type should be reviewboard.site.models.LocalSite. The description can be "The review request's local site, if available." |
david | |
django.http.HttpResponse |
david | |
We could refactor this bit into a new method, e.g., reviewboard.accounts.query.attach_visibility_to_queryset(queryset, user.id) or something similar |
brennie | |
Instead of doing a bunch of additions, can we make a list and then do display_data = mark_safe(''.join(display_data_parts)) ? String … |
brennie | |
Blank line between these. Same below. |
brennie | |
If you do the other refactor I suggested, you should be able to refactor this into a utility method. |
brennie | |
Alphabetize. |
brennie | |
Missing period & trailing space. |
brennie | |
Block tags like this (for, if, etc.) should be left-aligned. The indentation is done the tag itself. The same applied … |
brennie | |
This is missing the colon? |
brennie | |
This is missing the colon? |
brennie | |
This is missing the colon? |
brennie | |
The colon should be in the trans templatetag. |
brennie | |
The class name "review_request" is way too generic, and is bound to conflict with other things. I know we do … |
chipx86 | |
I know this was here before your code, but string concatenation is slow in Python. Instead, can you build this … |
chipx86 | |
Since this isn't taking potentially HTML-unsafe values, you don't need format_html. |
chipx86 | |
Better not to have the extra spaces there. Just one. |
chipx86 | |
No parens here. |
chipx86 | |
The function isn't embedded. The returned HTML is. |
chipx86 | |
Missing periods. |
chipx86 | |
This should be one statement. |
chipx86 | |
Too long for a line. This should wrap. |
chipx86 | |
This line is too long. |
chipx86 | |
This line is too long. Same with all others in this file. |
chipx86 | |
It should be fine to just use the value directly without checking for it. If it's blank, it's blank. |
chipx86 | |
There's some alignment problems with the HTML and with the Django tags. HTML and Django templating have their own indentation … |
chipx86 |
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/reviews/review_request_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/reviews/review_request_infobox.html
-
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/reviews/review_request_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/reviews/review_request_infobox.html
-
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/reviews/review_request_infobox.html Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py Ignored Files: reviewboard/templates/reviews/review_request_infobox.html
-
It looks like you're making good progress so far. Don't forget to close issues on old reviews as you address them. A couple small comments to keep the code clean as you go:
-
The other infobox views here have an old style of docstring, but because this is new code, we should use our more modern style (which we're moving to). This means a few things:
- The voice of the summary line should be the imperative mood rather than passive ("Display ..." rather than "Displays ...")
- We should include "Args" and "Returns" sections.
See https://www.notion.so/reviewboard/Writing-Codebase-Documentation-e16312b5f061437cb73cbfa369ac3cb5 for info on Args/Returns.
-
The last item in python dictionaries should also end in a comma (so that it's easier to add new stuff at the end)
-
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py reviewboard/reviews/urls.py Ignored Files: reviewboard/templates/reviews/review_request_infobox.html reviewboard/static/rb/js/common.es6.js Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/reviews/urls.py Ignored Files: reviewboard/templates/reviews/review_request_infobox.html reviewboard/static/rb/js/common.es6.js
-
-
-
-
Tool: Pyflakes Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/reviews/urls.py Ignored Files: reviewboard/static/rb/js/utils/linkifyUtils.es6.js reviewboard/templates/reviews/review_request_infobox.html reviewboard/static/rb/js/common.es6.js Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/reviews/urls.py Ignored Files: reviewboard/static/rb/js/utils/linkifyUtils.es6.js reviewboard/templates/reviews/review_request_infobox.html reviewboard/static/rb/js/common.es6.js
-
-
-
-
- Commit:
-
57d7e46a554be149d0350b1c3f407ef0084265c0eda9b4d675cc7fd4cb3b28c33580ba68a9a0c5e0
- Diff:
-
Revision 7 (+170 -8)
-
Tool: Pyflakes Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/datagrids/columns.py reviewboard/reviews/urls.py Ignored Files: reviewboard/static/rb/js/pages/views/datagridPageView.js reviewboard/static/rb/js/utils/linkifyUtils.es6.js reviewboard/static/rb/css/common.less reviewboard/templates/reviews/review_request_infobox.html reviewboard/static/rb/js/common.es6.js Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/datagrids/columns.py reviewboard/reviews/urls.py Ignored Files: reviewboard/static/rb/js/pages/views/datagridPageView.js reviewboard/static/rb/js/utils/linkifyUtils.es6.js reviewboard/static/rb/css/common.less reviewboard/templates/reviews/review_request_infobox.html reviewboard/static/rb/js/common.es6.js
-
-
-
-
-
- Commit:
-
eda9b4d675cc7fd4cb3b28c33580ba68a9a0c5e021add9ba7896b876e2e123a7446ef50244b2522a
- Diff:
-
Revision 8 (+232 -8)
-
Tool: Pyflakes Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/datagrids/columns.py reviewboard/reviews/urls.py Ignored Files: reviewboard/static/rb/js/pages/views/datagridPageView.js reviewboard/static/rb/js/utils/linkifyUtils.es6.js reviewboard/static/rb/css/common.less reviewboard/templates/reviews/review_request_infobox.html reviewboard/static/rb/js/common.es6.js Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/datagrids/columns.py reviewboard/reviews/urls.py Ignored Files: reviewboard/static/rb/js/pages/views/datagridPageView.js reviewboard/static/rb/js/utils/linkifyUtils.es6.js reviewboard/static/rb/css/common.less reviewboard/templates/reviews/review_request_infobox.html reviewboard/static/rb/js/common.es6.js
-
-
-
-
-
- Commit:
-
21add9ba7896b876e2e123a7446ef50244b2522a06365e6970ee2c45e6b63af7ff36ecb2e592443e
- Diff:
-
Revision 9 (+224 -7)
-
Tool: Pyflakes Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/datagrids/columns.py reviewboard/reviews/urls.py Ignored Files: reviewboard/static/rb/js/pages/views/datagridPageView.js reviewboard/static/rb/js/utils/linkifyUtils.es6.js reviewboard/static/rb/css/common.less reviewboard/templates/reviews/review_request_infobox.html reviewboard/static/rb/js/common.es6.js Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/builtin_fields.py reviewboard/reviews/views.py reviewboard/datagrids/columns.py reviewboard/reviews/urls.py Ignored Files: reviewboard/static/rb/js/pages/views/datagridPageView.js reviewboard/static/rb/js/utils/linkifyUtils.es6.js reviewboard/static/rb/css/common.less reviewboard/templates/reviews/review_request_infobox.html reviewboard/static/rb/js/common.es6.js
-
Now that you've started actually working on the CSS, can you start including a screenshot of what things look like whenever you do your code updates?
-
Python strings concatenate in the same way that C strings do, so you can just elide the
+
operator here. That said, the way things concatenate now, there won't be any space betweentitle="..."
andclass="review_request"
. This probably parses OK on the browser side but it's not totally correct. Let's add some spaces at the beginning of the second line, which also helps make it more readable:rendered_item = format_html( '<a href="{url}" title="{summary"}' ' class="review_request">{id}</a>', ...
-
- Commit:
-
06365e6970ee2c45e6b63af7ff36ecb2e592443ece464827f7332b73719829ad76c5d780d08cc272
- Diff:
-
Revision 10 (+273 -44)
- Added Files:
Checks run (2 succeeded, 1 failed with error)
- Commit:
-
ce464827f7332b73719829ad76c5d780d08cc272353cd3782e0649e78597ea9500d2bfe09b83c7f7
- Diff:
-
Revision 11 (+284 -51)
Checks run (2 succeeded, 1 failed with error)
-
Oh: it would be very nice to have some details of the testing you've been doing (obviously you've done some since you were able to make a screenshot).
- Commit:
-
353cd3782e0649e78597ea9500d2bfe09b83c7f75bfd2f1e17db07b6dd06772a1ec6dfe7f2e4bbac
- Diff:
-
Revision 12 (+340 -52)
Checks run (2 succeeded, 1 failed with error)
- Testing Done:
-
~ Code isn't ready to be run or tested at this point in time.
~ Code has been tested by running the development server and adjusting the tester review request for different scenarios.
+ Jasmine tests have been run - but at this point in time, the Jasmine tests find that the class label for the infobox is being generated on the Diff links, where it should not be. + Python tests have not been run.
-
-
We could refactor this bit into a new method, e.g.,
reviewboard.accounts.query.attach_visibility_to_queryset(queryset, user.id)
or something similar -
Instead of doing a bunch of additions, can we make a list and then do
display_data = mark_safe(''.join(display_data_parts))
? String addition is quite slow bceause it has to do N allocations instead of just 1 forstr.join
. -
-
If you do the other refactor I suggested, you should be able to refactor this into a utility method.
-
-
-
Block tags like this (for, if, etc.) should be left-aligned. The indentation is done the tag itself.
The same applied throughout the rest of the file.
-
-
-
-
- Commit:
-
5bfd2f1e17db07b6dd06772a1ec6dfe7f2e4bbaca04f9e4a12e93a8e0d15e2bf63cf474415dd6d0c
- Diff:
-
Revision 13 (+341 -52)
Checks run (2 succeeded, 1 failed with error)
-
-
The class name "review_request" is way too generic, and is bound to conflict with other things. I know we do this with "user," but frankly that was a mistake too.
Can we call this "review-request-link" instead?
(Also note that we should use
-
and not_
in class names).Same with other parts of the codebase.
-
I know this was here before your code, but string concatenation is slow in Python. Instead, can you build this as a list like:
result = [ format_html(...), format_html(...) ] if summary: result.append(format_html(...)) ... return ''.join(result)
This is actually faster.
-
-
-
-
-
-
-
-
-
-
It should be fine to just use the value directly without checking for it. If it's blank, it's blank.
-
There's some alignment problems with the HTML and with the Django tags.
HTML and Django templating have their own indentation context. HTML should always be indented 1 space relative to parent HTML tags. The content within
{% ... %}
should be indented 1 relative to their parents.
- Commit:
-
a04f9e4a12e93a8e0d15e2bf63cf474415dd6d0c7b14813bb96b77c017fb0df620d6a6e8c1a5dc1a
- Diff:
-
Revision 14 (+352 -58)