-
Notifications
You must be signed in to change notification settings - Fork 899
fix: ensure user admins can always see users table #15226
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 1 commit
1ad09fa
620bd3a
7ee3cf0
e889621
36e0376
032a75c
eea8bbd
e6d4201
14fc68e
a8fd9e6
0a36cd1
e6d772b
3752af5
2068a4c
2fe3d53
3c41de0
162642e
64c6f29
e12a4aa
b9b33c0
f7df5ff
6925294
9fc0afa
498e7ba
234c606
4496a75
9fcf3e7
19fb6e5
804255e
d341175
f3e6659
ce67a66
7e946a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,9 @@ import { Loader } from "components/Loader/Loader"; | |
import { Sidebar as BaseSidebar } from "components/Sidebar/Sidebar"; | ||
import { Stack } from "components/Stack/Stack"; | ||
import { UserAvatar } from "components/UserAvatar/UserAvatar"; | ||
import type { Permissions } from "contexts/auth/permissions"; | ||
import { type ClassName, useClassName } from "hooks/useClassName"; | ||
import { useDashboard } from "modules/dashboard/useDashboard"; | ||
import { linkToUsers } from "modules/navigation"; | ||
import type { FC, ReactNode } from "react"; | ||
import { Link, NavLink } from "react-router-dom"; | ||
|
||
|
@@ -30,7 +30,7 @@ interface SidebarProps { | |
/** Organizations and their permissions or undefined if still fetching. */ | ||
organizations: OrganizationWithPermissions[] | undefined; | ||
/** Site-wide permissions. */ | ||
permissions: AuthorizationResponse; | ||
permissions: Permissions; | ||
} | ||
|
||
/** | ||
|
@@ -72,7 +72,7 @@ interface DeploymentSettingsNavigationProps { | |
/** Whether a deployment setting page is being viewed. */ | ||
active: boolean; | ||
/** Site-wide permissions. */ | ||
permissions: AuthorizationResponse; | ||
permissions: Permissions; | ||
} | ||
|
||
/** | ||
|
@@ -130,10 +130,11 @@ const DeploymentSettingsNavigation: FC<DeploymentSettingsNavigationProps> = ({ | |
{permissions.viewDeploymentValues && ( | ||
<SidebarNavSubItem href="network">Network</SidebarNavSubItem> | ||
)} | ||
{/* All users can view workspace regions. */} | ||
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 actually wasn't true, so Steven and I had to put this behind a condition |
||
<SidebarNavSubItem href="workspace-proxies"> | ||
Workspace Proxies | ||
</SidebarNavSubItem> | ||
{permissions.readWorkspaceProxies && ( | ||
<SidebarNavSubItem href="workspace-proxies"> | ||
Workspace Proxies | ||
</SidebarNavSubItem> | ||
)} | ||
{permissions.viewDeploymentValues && ( | ||
<SidebarNavSubItem href="security">Security</SidebarNavSubItem> | ||
)} | ||
|
@@ -145,12 +146,14 @@ const DeploymentSettingsNavigation: FC<DeploymentSettingsNavigationProps> = ({ | |
{permissions.viewAllUsers && ( | ||
<SidebarNavSubItem href="users">Users</SidebarNavSubItem> | ||
)} | ||
<SidebarNavSubItem href="notifications"> | ||
<Stack direction="row" alignItems="center" spacing={1}> | ||
<span>Notifications</span> | ||
<FeatureStageBadge contentType="beta" size="sm" /> | ||
</Stack> | ||
</SidebarNavSubItem> | ||
{permissions.viewNotificationTemplate && ( | ||
<SidebarNavSubItem href="notifications"> | ||
<Stack direction="row" alignItems="center" spacing={1}> | ||
<span>Notifications</span> | ||
<FeatureStageBadge contentType="beta" size="sm" /> | ||
</Stack> | ||
</SidebarNavSubItem> | ||
)} | ||
</Stack> | ||
)} | ||
</div> | ||
|
@@ -167,7 +170,7 @@ interface OrganizationsSettingsNavigationProps { | |
/** Organizations and their permissions or undefined if still fetching. */ | ||
organizations: OrganizationWithPermissions[] | undefined; | ||
/** Site-wide permissions. */ | ||
permissions: AuthorizationResponse; | ||
permissions: Permissions; | ||
} | ||
|
||
/** | ||
|
@@ -241,8 +244,6 @@ interface OrganizationSettingsNavigationProps { | |
const OrganizationSettingsNavigation: FC< | ||
OrganizationSettingsNavigationProps | ||
> = ({ active, organization }) => { | ||
const { experiments } = useDashboard(); | ||
|
||
return ( | ||
<> | ||
<SidebarNavItem | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,15 +11,14 @@ import { Section } from "pages/UserSettingsPage/Section"; | |
import type { FC } from "react"; | ||
import { Helmet } from "react-helmet-async"; | ||
import { useQueries } from "react-query"; | ||
import { useSearchParams } from "react-router-dom"; | ||
import { deploymentGroupHasParent } from "utils/deployOptions"; | ||
import { pageTitle } from "utils/page"; | ||
import OptionsTable from "../OptionsTable"; | ||
import { NotificationEvents } from "./NotificationEvents"; | ||
import { useDeploymentSettings } from "modules/management/DeploymentSettingsProvider"; | ||
import { useSearchParamsKey } from "hooks/useSearchParamsKey"; | ||
|
||
export const NotificationsPage: FC = () => { | ||
const [searchParams] = useSearchParams(); | ||
const { deploymentConfig } = useDeploymentSettings(); | ||
const [templatesByGroup, dispatchMethods] = useQueries({ | ||
queries: [ | ||
|
@@ -30,10 +29,12 @@ export const NotificationsPage: FC = () => { | |
notificationDispatchMethods(), | ||
], | ||
}); | ||
const ready = | ||
templatesByGroup.data && dispatchMethods.data && deploymentConfig; | ||
const tab = searchParams.get("tab") || "events"; | ||
const tabState = useSearchParamsKey({ | ||
key: "tab", | ||
defaultValue: "events", | ||
}); | ||
|
||
const ready = !!(templatesByGroup.data && dispatchMethods.data); | ||
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. nit: prefer 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. So do I, but for some reason, when I tried to change things, it wasn't doing anything with type narrowing |
||
return ( | ||
<> | ||
<Helmet> | ||
|
@@ -45,7 +46,7 @@ export const NotificationsPage: FC = () => { | |
layout="fluid" | ||
featureStage={"beta"} | ||
> | ||
<Tabs active={tab}> | ||
<Tabs active={tabState.value}> | ||
<TabsList> | ||
<TabLink to="?tab=events" value="events"> | ||
Events | ||
|
@@ -58,7 +59,7 @@ export const NotificationsPage: FC = () => { | |
|
||
<div css={styles.content}> | ||
{ready ? ( | ||
tab === "events" ? ( | ||
tabState.value === "events" ? ( | ||
<NotificationEvents | ||
templatesByGroup={templatesByGroup.data} | ||
deploymentConfig={deploymentConfig.config} | ||
|
@@ -71,7 +72,7 @@ export const NotificationsPage: FC = () => { | |
/> | ||
) : ( | ||
<OptionsTable | ||
options={deploymentConfig?.options.filter((o) => | ||
options={deploymentConfig.options.filter((o) => | ||
deploymentGroupHasParent(o.group, "Notifications"), | ||
)} | ||
/> | ||
|
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.
Ended up deleting this because the property wasn't compatible. It also didn't seem to be used anywhere
@Emyrk Not sure if we should update the types so that this can be added back
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.
Can you delete this unused check then?
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.
Oh, sorry – I meant that the
org_id
property specifically didn't seem to be used anywhere