Page MenuHomeSoftware Heritage

assets/diff-utils: Use ejs to generate diff panel from HTML template
ClosedPublic

Authored by anlambert on Aug 13 2020, 6:46 PM.

Details

Summary

This is clearly a better pratice than using Javascript template strings when
the template is large.

Depends on D3789.

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D3790 (id=13308)

Could not rebase; Attempt merge onto 0cb8a77860...

Updating 0cb8a778..65e8f4a9
Fast-forward
 cypress/integration/revision-diff.spec.js          | 318 +++++++++-
 cypress/support/index.js                           |   2 +-
 package.json                                       |   1 +
 .../assets/config/webpack.config.development.js    |  12 +
 swh/web/assets/src/bundles/revision/diff-panel.ejs |  50 ++
 swh/web/assets/src/bundles/revision/diff-utils.js  | 689 ++++++++++++++-------
 swh/web/assets/src/utils/highlightjs.js            |   7 +-
 swh/web/browse/views/revision.py                   |  11 +-
 yarn.lock                                          |  93 ++-
 9 files changed, 935 insertions(+), 248 deletions(-)
 create mode 100644 swh/web/assets/src/bundles/revision/diff-panel.ejs
Changes applied before test
commit 65e8f4a9889c94d5d99ea5fe2995af2a6f94b77a
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Aug 13 18:03:17 2020 +0200

    assets/diff-utils: Use ejs to generate diff panel from HTML template
    
    This is clearly a better pratice than using Javascript template strings when
    the template is large.

commit a52a1309a9205e40b6d9c230e367a8556f035ce3
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Aug 13 17:32:59 2020 +0200

    assets/highlightjs: Add synchronous version of lineNumberBlock
    
    It enables to get a more readable code in diff-utils module by removing some
    setTimeout instructions.

commit 3174b773c3dcb9537d4527d2da0d8b8ae3d4f815
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Wed Aug 5 16:05:39 2020 +0200

    assets/diff-utils: Add diff lines highlighting feature
    
    That new feature enables to highlight code fragments in a diff generated
    from the revision view by selecting a lines range with the mouse (click
    and Shift+click on line numbers).
    
    Both unified and split diff can be highlighted. For the split case,
    only lines from the left or right part can be highlighted but also lines
    spanning both.
    
    When a diff gets highlighted, an URL fragment will be added describing the
    highlighting state. When the revision view gets reloaded with it, the
    diff will be automatically computed, highlighted and displayed.
    
    Closes T2491

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/325/ for more details.

This revision is now accepted and ready to land.Aug 14 2020, 11:05 AM

Build has FAILED

Patch application report for D3790 (id=13397)

Could not rebase; Attempt merge onto 6be09894e3...

Updating 6be09894..9615eaa4
Fast-forward
 package.json                                       |    1 +
 .../assets/config/webpack.config.development.js    |   12 +
 swh/web/assets/src/bundles/revision/diff-panel.ejs |   50 +
 swh/web/assets/src/bundles/revision/diff-utils.js  |  349 +-
 swh/web/assets/src/utils/highlightjs.js            |    7 +-
 yarn.lock                                          | 3371 ++++++--------------
 6 files changed, 1200 insertions(+), 2590 deletions(-)
 create mode 100644 swh/web/assets/src/bundles/revision/diff-panel.ejs
Changes applied before test
commit 9615eaa4fa45632052a5c491cbdcccd1eee868e3
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Aug 13 18:03:17 2020 +0200

    assets/diff-utils: Use ejs to generate diff panel from HTML template
    
    This is clearly a better pratice than using Javascript template strings when
    the template is large.

commit 5ce0cbd3e650fd838e5e9ce08d94e041404fa94a
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Aug 18 15:29:42 2020 +0200

    assets/highlightjs: Add synchronous version of lineNumberBlock
    
    It enables to get a more readable code in diff-utils module by removing some
    setTimeout instructions.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/329/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/329/console

Build has FAILED

Patch application report for D3790 (id=13397)

Could not rebase; Attempt merge onto 6be09894e3...

Updating 6be09894..9615eaa4
Fast-forward
 package.json                                       |    1 +
 .../assets/config/webpack.config.development.js    |   12 +
 swh/web/assets/src/bundles/revision/diff-panel.ejs |   50 +
 swh/web/assets/src/bundles/revision/diff-utils.js  |  349 +-
 swh/web/assets/src/utils/highlightjs.js            |    7 +-
 yarn.lock                                          | 3371 ++++++--------------
 6 files changed, 1200 insertions(+), 2590 deletions(-)
 create mode 100644 swh/web/assets/src/bundles/revision/diff-panel.ejs
Changes applied before test
commit 9615eaa4fa45632052a5c491cbdcccd1eee868e3
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Aug 13 18:03:17 2020 +0200

    assets/diff-utils: Use ejs to generate diff panel from HTML template
    
    This is clearly a better pratice than using Javascript template strings when
    the template is large.

commit 5ce0cbd3e650fd838e5e9ce08d94e041404fa94a
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Aug 18 15:29:42 2020 +0200

    assets/highlightjs: Add synchronous version of lineNumberBlock
    
    It enables to get a more readable code in diff-utils module by removing some
    setTimeout instructions.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/330/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/330/console

Build has FAILED

Patch application report for D3790 (id=13398)

Could not rebase; Attempt merge onto 6be09894e3...

Updating 6be09894..02eb1bd0
Fast-forward
 package.json                                       |    1 +
 .../assets/config/webpack.config.development.js    |   12 +
 swh/web/assets/src/bundles/revision/diff-panel.ejs |   50 +
 swh/web/assets/src/bundles/revision/diff-utils.js  |  349 +-
 swh/web/assets/src/utils/highlightjs.js            |    7 +-
 yarn.lock                                          | 3371 ++++++--------------
 6 files changed, 1200 insertions(+), 2590 deletions(-)
 create mode 100644 swh/web/assets/src/bundles/revision/diff-panel.ejs
Changes applied before test
commit 02eb1bd029c7e10f9a4ea7f82e416e305e316b8b
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Aug 13 18:03:17 2020 +0200

    assets/diff-utils: Use ejs to generate diff panel from HTML template
    
    This is clearly a better pratice than using Javascript template strings when
    the template is large.

commit 5ce0cbd3e650fd838e5e9ce08d94e041404fa94a
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Aug 18 15:29:42 2020 +0200

    assets/highlightjs: Add synchronous version of lineNumberBlock
    
    It enables to get a more readable code in diff-utils module by removing some
    setTimeout instructions.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/331/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/331/console

Build is green

Patch application report for D3790 (id=13399)

Could not rebase; Attempt merge onto 6be09894e3...

Updating 6be09894..652b39bd
Fast-forward
 package.json                                       |    1 +
 .../assets/config/webpack.config.development.js    |   12 +
 swh/web/assets/src/bundles/revision/diff-panel.ejs |   50 +
 swh/web/assets/src/bundles/revision/diff-utils.js  |  353 +-
 swh/web/assets/src/utils/highlightjs.js            |    7 +-
 yarn.lock                                          | 3371 ++++++--------------
 6 files changed, 1202 insertions(+), 2592 deletions(-)
 create mode 100644 swh/web/assets/src/bundles/revision/diff-panel.ejs
Changes applied before test
commit 652b39bd1d36850d88d1f39fdaae6e68cef828ec
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Aug 13 18:03:17 2020 +0200

    assets/diff-utils: Use ejs to generate diff panel from HTML template
    
    This is clearly a better pratice than using Javascript template strings when
    the template is large.

commit 5ce0cbd3e650fd838e5e9ce08d94e041404fa94a
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Aug 18 15:29:42 2020 +0200

    assets/highlightjs: Add synchronous version of lineNumberBlock
    
    It enables to get a more readable code in diff-utils module by removing some
    setTimeout instructions.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/332/ for more details.