- Notifications
You must be signed in to change notification settings - Fork927
feat(site): add basic organization management ui#13288
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
f36f106
325148c
c304463
2cb6c5d
25a8ee7
b297d3d
5f84937
0f9de62
17a890d
050d553
bed1bd4
3bab8cb
353ef76
b071231
f8ccd96
98b66a2
0a2bfea
ed57254
d07a319
c2263f1
1c397bc
551191d
ab91af8
e5bddc6
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import type { QueryClient } from "react-query"; | ||
import { API } from "api/api"; | ||
import type { | ||
CreateOrganizationRequest, | ||
UpdateOrganizationRequest, | ||
} from "api/typesGenerated"; | ||
import { meKey, myOrganizationsKey } from "./users"; | ||
export const createOrganization = (queryClient: QueryClient) => { | ||
return { | ||
mutationFn: (params: CreateOrganizationRequest) => | ||
API.createOrganization(params), | ||
onSuccess: async () => { | ||
await queryClient.invalidateQueries(meKey); | ||
await queryClient.invalidateQueries(myOrganizationsKey); | ||
aslilac marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
}, | ||
}; | ||
}; | ||
interface UpdateOrganizationVariables { | ||
orgId: string; | ||
req: UpdateOrganizationRequest; | ||
} | ||
export const updateOrganization = (queryClient: QueryClient) => { | ||
return { | ||
mutationFn: (variables: UpdateOrganizationVariables) => | ||
API.updateOrganization(variables.orgId, variables.req), | ||
onSuccess: async () => { | ||
await queryClient.invalidateQueries(myOrganizationsKey); | ||
aslilac marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
}, | ||
}; | ||
}; | ||
export const deleteOrganization = (queryClient: QueryClient) => { | ||
return { | ||
mutationFn: (orgId: string) => API.deleteOrganization(orgId), | ||
onSuccess: async () => { | ||
await queryClient.invalidateQueries(meKey); | ||
await queryClient.invalidateQueries(myOrganizationsKey); | ||
}, | ||
}; | ||
}; |
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -13,20 +13,29 @@ const widthBySize: Record<Size, number> = { | ||
small: containerWidth / 3, | ||
}; | ||
type MarginsProps = JSX.IntrinsicElements["div"] & { | ||
size?: Size; | ||
}; | ||
export const Margins: FC<MarginsProps> = ({ | ||
size = "regular", | ||
children, | ||
aslilac marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
...divProps | ||
}) => { | ||
const maxWidth = widthBySize[size]; | ||
return ( | ||
<div | ||
{...divProps} | ||
css={{ | ||
marginLeft: "auto", | ||
marginRight: "auto", | ||
maxWidth: maxWidth, | ||
paddingLeft: sidePadding, | ||
paddingRight: sidePadding, | ||
width: "100%", | ||
}} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -13,22 +13,25 @@ import { | ||
import { USERS_LINK } from "modules/navigation"; | ||
interface DeploymentDropdownProps { | ||
canViewDeployment: boolean; | ||
canViewOrganizations: boolean; | ||
canViewAllUsers: boolean; | ||
canViewAuditLog: boolean; | ||
canViewHealth: boolean; | ||
aslilac marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
} | ||
export const DeploymentDropdown: FC<DeploymentDropdownProps> = ({ | ||
canViewDeployment, | ||
canViewOrganizations, | ||
canViewAllUsers, | ||
canViewAuditLog, | ||
canViewHealth, | ||
}) => { | ||
const theme = useTheme(); | ||
if ( | ||
!canViewAuditLog && | ||
!canViewOrganizations && | ||
!canViewDeployment && | ||
!canViewAllUsers && | ||
!canViewHealth | ||
@@ -64,9 +67,10 @@ export const DeploymentDropdown: FC<DeploymentDropdownProps> = ({ | ||
}} | ||
> | ||
<DeploymentDropdownContent | ||
canViewDeployment={canViewDeployment} | ||
canViewOrganizations={canViewOrganizations} | ||
canViewAllUsers={canViewAllUsers} | ||
canViewAuditLog={canViewAuditLog} | ||
canViewHealth={canViewHealth} | ||
/> | ||
</PopoverContent> | ||
@@ -75,9 +79,10 @@ export const DeploymentDropdown: FC<DeploymentDropdownProps> = ({ | ||
}; | ||
const DeploymentDropdownContent: FC<DeploymentDropdownProps> = ({ | ||
canViewDeployment, | ||
canViewOrganizations, | ||
canViewAllUsers, | ||
canViewAuditLog, | ||
canViewHealth, | ||
}) => { | ||
const popover = usePopover(); | ||
@@ -96,6 +101,16 @@ const DeploymentDropdownContent: FC<DeploymentDropdownProps> = ({ | ||
Settings | ||
</MenuItem> | ||
)} | ||
{canViewOrganizations && ( | ||
<MenuItem | ||
component={NavLink} | ||
to="/organizations" | ||
css={styles.menuItem} | ||
onClick={onPopoverClose} | ||
> | ||
Organizations | ||
</MenuItem> | ||
)} | ||
{canViewAllUsers && ( | ||
<MenuItem | ||
component={NavLink} | ||
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.