-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dashboard): Tab menu visible for urls trailing '/' #10698
fix(dashboard): Tab menu visible for urls trailing '/' #10698
Conversation
annotations in the pull request changed, but user is not allowed to start a job |
2 similar comments
annotations in the pull request changed, but user is not allowed to start a job |
annotations in the pull request changed, but user is not allowed to start a job |
/werft run 👍 started the job as gitpod-build-fix-dashboard-path-fork.0 |
/werft run 👍 started the job as gitpod-build-fix-dashboard-path-fork.1 |
started the job as gitpod-build-fix-dashboard-path.0 because the annotations in the pull request description changed |
Added werft with-preview in the description |
Hi @CuriousCorrelation, sorry for the delay in reviewing. The build failed, and to make sure that we have everything up to date, would you mind rebasing to the latest in main? 🙏🏽 |
@laushinka No worries at all! Branch should be updated now |
@laushinka I believe this PR should also resolve #10499 Would it be possible to test this via deployment? |
/werft run 👍 started the job as gitpod-build-fix-dashboard-path-fork.2 |
Thank you for this contribution, @CuriousCorrelation! Before doing that, would you mind writing a simple test for Thanks again 🙏🏽 |
Writing tests would be no trouble at all. I'll try to get it done as soon as possible. |
@laushinka Great idea for adding tests! Not only did it help me fix a couple of edge issues, I believe it also fixed #10499 The problem was the trim function's application on first argument and not on second; the list of resources, because both of them can have a trailing or leading '/'. A couple of changes from the last commit:
Let me know if these changes are fine, or if there's something I need to change. |
That's awesome, @CuriousCorrelation! I'm on vacation right now, so let me tag my team @gitpod-io/engineering-webapp so someone could take over :) |
/werft run 👍 started the job as gitpod-build-fix-dashboard-path-fork.3 |
Hi @CuriousCorrelation, I'm back from vacation now - sorry that it's taking a long time. The build is failing because we're missing a license header for
|
@laushinka No worries at all, I totally understand how difficult it can get managing large projects. We should be good to go now, but please feel free to let me know if there are any other changes I should look into! |
/werft run 👍 started the job as gitpod-build-fix-dashboard-path-fork.4 |
Connection got closed - running this again /werft run 👍 started the job as gitpod-build-fix-dashboard-path-fork.5 |
Not sure why builds are failing. Trying again.. /werft run 👍 started the job as gitpod-build-fix-dashboard-path-fork.6 |
@CuriousCorrelation This looks good! I'm happy to approve this (finally). #10499 is not yet fixed, which I believe is due to this line. All that needs to be done I believe is replacing that check with your new logic 😉 I don't want to block this from being merged any further though because you've done a lot of work. You're very welcome to work on #10499 with the hint above. Thanks for your contribution 🔥 |
(Oops I should've asked you to squash. Note for next time!) |
Ah makes sense, thanks for the heads up! |
Description
This bug #10666 was due to this
gitpod/components/dashboard/src/Menu.tsx
Line 109 in 402894b
failing if
url
contained trailing'/'
.Here's a test
So if that was true, it should also happen to
gitpod/components/dashboard/src/Menu.tsx
Line 108 in 402894b
which was indeed the case, see https://gitpod.io/new/ (notice trailing '/').
A simple solution would have been to include another element (
"workspaces/")
in the array or discard trailing '/' and check withincludes
. Adding a new element can potentially cause similar problem if we were to forget duplicating for some new path. For the second option, I first thought of regex but it got really unreadable, so instead I chosesplit
andfilter
This would work but what if we are on a resource but not exactly on base? For example
(Browser console)
Tab menu shouldn't be displayed in path
workspace/testing
because it isisWorkspacesUI
(a subdirectory)A better way would be to test "subpath" against "rootpath"
(Browser console)
Now if we were to test against
we would get an array
on which we can do an exhaustive search like
This would also work for
isAdminUI
checkgitpod/components/dashboard/src/Menu.tsx
Line 110 in 402894b
(Browser console)
If this subpath check behaviour isn't exactly what we need, we can swap positions and get exact results
Related Issue(s)
Fixes #10666
How to test
Described above
Release Notes
Documentation
Does this PR require updates to the documentation at www.gitpod.io/docs?