• 
      

    Don't reload the diff viewer when changing revisions.

    Review Request #4630 — Created Sept. 22, 2013 and submitted

    Information

    Review Board
    master

    Reviewers

    Don't reload the diff viewer when changing revisions.

    This change adds a new API resource called "diff-context" which can take the
    same revision/interdiff parameters as the diffviewer view, but will return only
    the JSON data needed to replace the page.

    This is wired up to some AJAX on the client side which will take the new
    revision and change out all the data on the models. A backbone router will make
    sure that the URL and browser history get appropriately updated.

    At the moment this can be a little annoying because our UI jumps around when
    things like the current-revision label get replaced. I'll be reworking some of
    these UI elements to make sure that they use up the same amount of vertical
    space for different diff revisions.

    The next major steps, in addition to preventing things from jumping around, are
    a redesign of the revision selector widget, and a redesign of how we do
    pagination.

    Loaded a bunch of different diff and interdiff revisions. Verified that all of
    the appropriate UI elements (file index, files, revision label, revision
    selector, comments hint) were updated in-place. Checked that pagination still
    worked.

    Description From Last Updated

    'WebAPIResponse' imported but unused

    reviewbotreviewbot

    'webapi_response_errors' imported but unused

    reviewbotreviewbot

    Col: 80 E501 line too long (80 > 79 characters)

    reviewbotreviewbot

    Col: 80 E501 line too long (84 > 79 characters)

    reviewbotreviewbot

    undefined name 'Http404'

    reviewbotreviewbot

    Trailing comma.

    chipx86chipx86

    var parts

    mike_conleymike_conley

    Trailing comma.

    chipx86chipx86

    Can you go into more detail here, for the docs? I know it's meant for internal use, but we should …

    chipx86chipx86

    Missing a period.

    chipx86chipx86

    Needs to be revision, or it'll make Sphinx sad. (foo the beginning of a reference.)

    chipx86chipx86

    Can you add a docstring here as well, that goes into how this is used?

    chipx86chipx86

    Let's just pull this out so it doesn't have to be redefined every time.

    chipx86chipx86

    Can you format this like the other resources? Also, this should have the same key as the resource: return 200, …

    chipx86chipx86

    Col: 80 E501 line too long (82 > 79 characters)

    reviewbotreviewbot

    Col: 17 E126 continuation line over-indented for hanging indent

    reviewbotreviewbot

    Col: 80 E501 line too long (82 > 79 characters)

    reviewbotreviewbot

    Col: 17 E126 continuation line over-indented for hanging indent

    reviewbotreviewbot

    Not sure we want to mention the JavaScript class in this comment. It doesn't really make sense in the API …

    chipx86chipx86

    """ on the next line.

    chipx86chipx86

    Col: 80 E501 line too long (82 > 79 characters)

    reviewbotreviewbot

    """ on the next line.

    chipx86chipx86

    Col: 80 E501 line too long (82 > 79 characters)

    reviewbotreviewbot

    This should still probably go in the main resource doc description.

    chipx86chipx86

    """ on the next line.

    chipx86chipx86

    Col: 80 E501 line too long (82 > 79 characters)

    reviewbotreviewbot
    reviewbot
    1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. Show all issues

      Col: 80
      E501 line too long (80 > 79 characters)

    3. Show all issues

      Col: 80
      E501 line too long (84 > 79 characters)

    4. 
        
    reviewbot
    1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. Show all issues

      'WebAPIResponse' imported but unused

    3. Show all issues

      'webapi_response_errors' imported but unused

    4. Show all issues

      undefined name 'Http404'

    5. 
        
    david
    reviewbot
    1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. 
        
    reviewbot
    1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. 
        
    mike_conley
    1. 
        
    2. Show all issues

      var parts

    3. reviewboard/webapi/resources/diff_context.py (Diff revision 2)
       
       
       
       
       
       
       

      Out of curiosity, is there an advantage to hiding this class in here, beyond making it impossible to import?

    4. 
        
    chipx86
    1. This also needs a doc file and an entry in resource-tree.txt.

    2. Show all issues

      Trailing comma.

    3. Totally optional, but just a thought. If you don't want to use _.bind later (which is safe enough -- that'll just do the native bind() on a function on modern browsers anyway), you could pull out this.model instead of this and just reference that below.

    4. Show all issues

      Trailing comma.

    5. Show all issues

      Can you go into more detail here, for the docs? I know it's meant for internal use, but we should really flesh these out so it's clear if you don't have the source file in front of you.

    6. Show all issues

      Missing a period.

    7. Show all issues

      Needs to be revision, or it'll make Sphinx sad. (foo the beginning of a reference.)

    8. Show all issues

      Can you add a docstring here as well, that goes into how this is used?

    9. reviewboard/webapi/resources/diff_context.py (Diff revision 2)
       
       
       
       
      Show all issues

      Let's just pull this out so it doesn't have to be redefined every time.

    10. Show all issues

      Can you format this like the other resources? Also, this should have the same key as the resource:

      return 200, {
          self.item_result_key: context['diff_context'],
      }
      
    11. 
        
    david
    reviewbot
    1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      docs/manual/webapi/2.0/resources/index.txt
      docs/manual/webapi/2.0/resources/diff-context.txt
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. Show all issues

      Col: 80
      E501 line too long (82 > 79 characters)

    3. Show all issues

      Col: 17
      E126 continuation line over-indented for hanging indent

    4. 
        
    reviewbot
    1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      docs/manual/webapi/2.0/resources/index.txt
      docs/manual/webapi/2.0/resources/diff-context.txt
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. 
        
    david
    reviewbot
    1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      docs/manual/webapi/2.0/resources/index.txt
      docs/manual/webapi/2.0/resources/diff-context.txt
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. Show all issues

      Col: 80
      E501 line too long (82 > 79 characters)

    3. Show all issues

      Col: 17
      E126 continuation line over-indented for hanging indent

    4. 
        
    reviewbot
    1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      docs/manual/webapi/2.0/resources/index.txt
      docs/manual/webapi/2.0/resources/diff-context.txt
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. 
        
    david
    reviewbot
    1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      docs/manual/webapi/2.0/resources/index.txt
      docs/manual/webapi/2.0/resources/diff-context.txt
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. Show all issues

      Col: 80
      E501 line too long (82 > 79 characters)

    3. 
        
    reviewbot
    1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      docs/manual/webapi/2.0/resources/index.txt
      docs/manual/webapi/2.0/resources/diff-context.txt
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. 
        
    chipx86
    1. 
        
    2. Show all issues

      Not sure we want to mention the JavaScript class in this comment. It doesn't really make sense in the API docs. It's more of an implementation detail on our end (even if this is considered more of an internally used API).

      Given that this is the main description for the resource, I think we should move the bit about how this is internal into here.

    3. Show all issues

      """ on the next line.

    4. 
        
    david
    reviewbot
    1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      docs/manual/webapi/2.0/resources/index.txt
      docs/manual/webapi/2.0/resources/diff-context.txt
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. Show all issues

      Col: 80
      E501 line too long (82 > 79 characters)

    3. 
        
    reviewbot
    1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      docs/manual/webapi/2.0/resources/index.txt
      docs/manual/webapi/2.0/resources/diff-context.txt
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. 
        
    chipx86
    1. 
        
    2. Show all issues

      """ on the next line.

    3. Show all issues

      This should still probably go in the main resource doc description.

    4. Show all issues

      """ on the next line.

    5. 
        
    david
    reviewbot
    1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      docs/manual/webapi/2.0/resources/index.txt
      docs/manual/webapi/2.0/resources/diff-context.txt
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. Show all issues

      Col: 80
      E501 line too long (82 > 79 characters)

    3. 
        
    reviewbot
    1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
      reviewboard/webapi/resources/diff_context.py
      reviewboard/webapi/resources/review_request.py
      Ignored Files:
      docs/manual/webapi/2.0/resources/index.txt
      docs/manual/webapi/2.0/resources/diff-context.txt
      reviewboard/static/rb/js/pages/views/diffViewerPageView.js

    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:

    Pushed to master (ea37d8f).