Page MenuHomeSoftware Heritage

Maintain tab selection on refresh
ClosedPublic

Authored by jayeshv on Mar 24 2022, 6:23 PM.

Details

Summary

Selected tab is maintained in add-forge-now create view.

Related to T4050

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 D7426 (id=26875)

Rebasing onto 7c86b0e45c...

Current branch diff-target is up to date.
Changes applied before test
commit 7c292a0a20ee282fd0c9800b376c3f4513229312
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Mar 24 18:16:41 2022 +0100

    Maintain tab selection on refresh
    
    Selected tab is maintained in add-forge-now create view.
    
    Related to T4050

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

Build is green

Patch application report for D7426 (id=26876)

Rebasing onto 7c86b0e45c...

Current branch diff-target is up to date.
Changes applied before test
commit d25a0cc69b81104cc6eeb759494b1df4fc78c278
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Mar 24 18:29:55 2022 +0100

    Maintain tab selection on refresh
    
    Maintain selected in add-forge-now create view.
    Add URL hash for the help tab.
    
    Related to T4050

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

anlambert added a subscriber: anlambert.

Could you add a cypress test for this ? You can inspire from the one I wrote for save code now.

assets/src/bundles/add_forge/create-request.js
57–58

Why triggering the same event again ? This should not be needed.

This revision now requires changes to proceed.Mar 24 2022, 7:08 PM
assets/src/bundles/add_forge/create-request.js
57–58

It is not working on page refresh otherwise.

Build is green

Patch application report for D7426 (id=26881)

Rebasing onto d5e3f98417...

Current branch diff-target is up to date.
Changes applied before test
commit 0e103975733b908b92fed170a75a378a682d99a6
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Fri Mar 25 10:23:10 2022 +0100

    Maintain tab selection on refresh
    
    Maintain selected tab in add-forge-now create view.
    Add URL hash for the help tab.
    Improve cypress tests for the tab change.
    
    Related to T4050

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

anlambert added inline comments.
assets/src/bundles/add_forge/create-request.js
57–58

I would rather put the the code inside the hashchange event handler in a function and call it at the end of the onCreateRequestPageLoad function instead.
The current code gives me the impression that this will loop forever when the hash changes.

This revision now requires changes to proceed.Mar 25 2022, 11:07 AM

You still need to keep the hashchange event handler or the tabs will not be switched when playing with browser history:

$(window).on('hashchange', () => {
  onPageHashChage();
});
This revision now requires changes to proceed.Mar 25 2022, 11:35 AM

review comment; Bug fix for browser history

Build is green

Patch application report for D7426 (id=26889)

Rebasing onto 349c7e5f4e...

Current branch diff-target is up to date.
Changes applied before test
commit b81477d5fc0ae91b1cfd6656d734c7ce086bcb60
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Fri Mar 25 11:29:13 2022 +0100

    Maintain tab selection on refresh
    
    Maintain selected tab in add-forge-now create view.
    Add URL hash for the help tab.
    Improve cypress tests for the tab change.
    
    Related to T4050

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

Build is green

Patch application report for D7426 (id=26890)

Rebasing onto 8d5f258e31...

First, rewinding head to replay your work on top of it...
Applying: Maintain tab selection on refresh
Changes applied before test
commit 5348f121624b8617c0923c7de38286e7fae83bdc
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Fri Mar 25 11:42:11 2022 +0100

    Maintain tab selection on refresh
    
    Maintain selected tab in add-forge-now create view.
    Add URL hash for the help tab.
    Improve cypress tests for the tab change.
    
    Related to T4050

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

This revision is now accepted and ready to land.Mar 25 2022, 3:27 PM
This revision was landed with ongoing or failed builds.Mar 25 2022, 3:32 PM
This revision was automatically updated to reflect the committed changes.

Build was aborted

Patch application report for D7426 (id=26909)

Rebasing onto cdda03c3aa...

Current branch diff-target is up to date.
Changes applied before test
commit 6f1a974c1f4c4fe78ca14ed5f1766bbd510a8cea
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Fri Mar 25 11:42:11 2022 +0100

    Maintain tab selection on refresh
    
    Maintain selected tab in add-forge-now create view.
    Add URL hash for the help tab.
    Improve cypress tests for the tab change.
    
    Related to T4050

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