Page MenuHomeSoftware Heritage

Allow filtering add-forge-now requests in listing view
ClosedPublic

Authored by ardumont on Mar 25 2022, 12:26 PM.

Details

Summary

This introduces a checkbox to allow users to filter their own requests. It's turned on
by default. The checkbox is not shown when connected anonymously.

Either browsing anonymously or unchecking the box (when connected) allows to browse all
requests.

This also unifies the rendering with the save code now view:

  • same datatable layout
  • the spinner logo during computation

screenshots:

user connected (checked by default, list user requests, as they have none, it's empty)

user connected (unchecked, list all requests)

anonymous (list all requests)

Related to T4011
Depends on D7438

Test Plan

cypress

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

ardumont edited the summary of this revision. (Show Details)

Build is green

Patch application report for D7431 (id=26893)

Could not rebase; Attempt merge onto 8d5f258e31...

Updating 8d5f258e..602af514
Fast-forward
 assets/src/bundles/add_forge/create-request.js     | 30 +++++++++++++++++++---
 assets/src/bundles/save/index.js                   | 19 ++++++--------
 assets/src/utils/requests-filter-checkbox.ejs      | 17 ++++++++++++
 .../add-forge-now-request-create.spec.js           | 20 +++++++++++++++
 4 files changed, 72 insertions(+), 14 deletions(-)
 create mode 100644 assets/src/utils/requests-filter-checkbox.ejs
Changes applied before test
commit 602af51488d1d8ebfda8927c5451045f5c0f791a
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 25 11:09:56 2022 +0100

    Allow filtering add-forge-now requests in listing view
    
    This also changes to filter user requests by default.
    
    Related to T4011

commit 1ffff63f70226bd41eb59803b8d47a5d7dcbeb06
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 25 10:34:10 2022 +0100

    save-code-now: Extract the checkbox filtering into a js template
    
    This will allow to reuse that part inside the add-forge-now form as well.
    
    Related to T4011

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

anlambert added inline comments.
assets/src/bundles/add_forge/create-request.js
110–115

Could you update the layout to match other datatables ? Search box should be on the right and number of rows selector on the left.

assets/src/bundles/add_forge/create-request.js
110–115

yes, i'll try.

It's all configured with that 'dom' key entry, right?

assets/src/bundles/add_forge/create-request.js
110–115

Yes, you can inspire from the one of SCN datatables.

ardumont edited the summary of this revision. (Show Details)
ardumont added inline comments.
assets/src/bundles/add_forge/create-request.js
110–115

done, not updated the diff yet (i'm still fighting the last test...)

ardumont marked an inline comment as done.
ardumont edited the summary of this revision. (Show Details)
  • rebase
  • Add last test on filtering scenario
  • Unify datatable layout
ardumont edited the summary of this revision. (Show Details)
cypress/integration/add-forge-now-request-create.spec.js
9–10

In order to avoid flaky tests and weird behavior when using the type command, I advise you to pass these options to it as second parameter: {delay: 0, force: true}.

cypress/integration/add-forge-now-request-create.spec.js
10–15

you mean like this?

cy.get('#swh-input-forge-url').clear().type(url, {delay: 0, force: true});
ardumont edited the summary of this revision. (Show Details)

Apply suggestion

Build has FAILED

Patch application report for D7431 (id=26917)

Rebasing onto 6f1a974c1f...

Current branch diff-target is up to date.
Changes applied before test
commit 2783ff28d63e58237d1b03cda897deceeabdf2ad
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 25 11:09:56 2022 +0100

    Filter user add-forge-now requests when authenticated
    
    This introduces a checkbox to allow users to filter their own requests. It's turned on
    by default. The checkbox is not shown when connected anonymously.
    
    Either browsing anonymously or unchecking the box (when connected) allows to browse all
    requests.
    
    This also unifies the rendering with the save code now view:
    - same datatable layout
    - the spinner logo during computation
    
    Related to T4011

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

Build has FAILED

Patch application report for D7431 (id=26915)

Rebasing onto 6f1a974c1f...

Current branch diff-target is up to date.
Changes applied before test
commit 3777f9e68be0125b97f4ec86790b2930cad44064
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 25 11:09:56 2022 +0100

    Filter user add-forge-now requests when authenticated
    
    This introduces a checkbox to allow users to filter their own requests. It's turned on
    by default. The checkbox is not shown when connected anonymously.
    
    Either browsing anonymously or unchecking the box (when connected) allows to browse all
    requests.
    
    This also unifies the rendering with the save code now view:
    - same datatable layout
    - the spinner logo during computation
    
    Related to T4011

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

Build has FAILED

Patch application report for D7431 (id=26918)

Rebasing onto 6f1a974c1f...

Current branch diff-target is up to date.
Changes applied before test
commit 2783ff28d63e58237d1b03cda897deceeabdf2ad
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 25 11:09:56 2022 +0100

    Filter user add-forge-now requests when authenticated
    
    This introduces a checkbox to allow users to filter their own requests. It's turned on
    by default. The checkbox is not shown when connected anonymously.
    
    Either browsing anonymously or unchecking the box (when connected) allows to browse all
    requests.
    
    This also unifies the rendering with the save code now view:
    - same datatable layout
    - the spinner logo during computation
    
    Related to T4011

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

ardumont edited the summary of this revision. (Show Details)

Rebase on the fixing diff D7438

This revision is now accepted and ready to land.Mar 25 2022, 5:41 PM

Build is green

Patch application report for D7431 (id=26928)

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

Updating 6f1a974c..6b5aa57b
Fast-forward
 assets/src/bundles/add_forge/create-request.js     | 35 ++++++++--
 .../add-forge-now-request-create.spec.js           | 80 ++++++++++++++++++++--
 .../add-forge-now-request-dashboard.spec.js        |  5 ++
 cypress/plugins/index.js                           |  8 +++
 cypress/support/index.js                           |  4 ++
 swh/web/tests/create_test_users.py                 |  3 +-
 6 files changed, 126 insertions(+), 9 deletions(-)
Changes applied before test
commit 6b5aa57b3f33491df10dd5a83f22ed091dc7885f
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 25 11:09:56 2022 +0100

    Filter user add-forge-now requests when authenticated
    
    This introduces a checkbox to allow users to filter their own requests. It's turned on
    by default. The checkbox is not shown when connected anonymously.
    
    Either browsing anonymously or unchecking the box (when connected) allows to browse all
    requests.
    
    This also unifies the rendering with the save code now view:
    - same datatable layout
    - the spinner logo during computation
    
    Related to T4011

commit 930ab5ed5725d1a9254987da8d41a3954b30ea99
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Mar 25 17:34:22 2022 +0100

    Fix flaky test in the request dashboard spec

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