-
Notifications
You must be signed in to change notification settings - Fork 980
chore: simplify workspace routing #17981
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
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,17 +3,32 @@ import { deploymentStats } from "api/queries/deployment"; | |
import { useAuthenticated } from "hooks"; | ||
import type { FC } from "react"; | ||
import { useQuery } from "react-query"; | ||
import { useLocation } from "react-router-dom"; | ||
import { DeploymentBannerView } from "./DeploymentBannerView"; | ||
|
||
const HIDE_DEPLOYMENT_BANNER_PATHS = [ | ||
// Workspace page. | ||
// Hide the banner on workspace page because it already has a lot of information. | ||
/^\/@[^\/]+\/[^\/]+$/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What types of paths are we trying to catch with this? My gut feeling is that the current regex might be a little too loose in some ways, and a little too strict in others Like, right now, we're exclusively matching patterns that go like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this wasn't what you wanted, you can let me know what you were going for, and I can try to whip up a regex for it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is exactly what we want. It is to catch the workspace page route, but I'm open in case you have a better regex idea or a way to match the path. Since the route path def is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, try
I just checked what characters we allow for usernames and workspace names, and those seemed to be the only characters we support right now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good one 👍 |
||
]; | ||
|
||
export const DeploymentBanner: FC = () => { | ||
const { permissions } = useAuthenticated(); | ||
const deploymentStatsQuery = useQuery(deploymentStats()); | ||
const healthQuery = useQuery({ | ||
...health(), | ||
enabled: permissions.viewDeploymentConfig, | ||
}); | ||
const location = useLocation(); | ||
const isHidden = HIDE_DEPLOYMENT_BANNER_PATHS.some((regex) => | ||
regex.test(location.pathname), | ||
); | ||
|
||
if (!permissions.viewDeploymentConfig || !deploymentStatsQuery.data) { | ||
if ( | ||
isHidden || | ||
!permissions.viewDeploymentConfig || | ||
!deploymentStatsQuery.data | ||
) { | ||
return null; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ import { useAgentLogs } from "./useAgentLogs"; | |
* Issue: https://github.com/romgain/jest-websocket-mock/issues/172 | ||
*/ | ||
|
||
describe("useAgentLogs", () => { | ||
describe.skip("useAgentLogs", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just got the go-ahead to work on fixing this flake today! |
||
afterEach(() => { | ||
WS.clean(); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried that we missed something in the conversion here:
Was that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeap. I did some storybook reviews and QA around and I didn't find anything broken. Maybe it was a leftover? I would appreciate you helping me with some QA 🙏