Skip to content
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

feat(orgAdmin): org admins can archive teams #10022

Merged
merged 25 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
80d9835
Add a delete icon
tianrunhe Jul 23, 2024
d9cbb59
Make team name more visible as a clickable link
tianrunhe Jul 23, 2024
28b9d03
Improve styles for OrgTeamsRow
tianrunhe Jul 23, 2024
de3403a
feat(orgAdmin): org admin can archive teams
tianrunhe Jul 23, 2024
bec8dfe
Only show delete button if the viewer is either team lead or org admin
tianrunhe Jul 23, 2024
0eac79f
feat(orgAdmin): only team lead or org admin can archive teams
tianrunhe Jul 23, 2024
c8750e8
feat(orgAdmin): distinguish between lead team
tianrunhe Jul 23, 2024
5667276
feat(orgAdmin): adjust warning message based on team membership
tianrunhe Jul 23, 2024
08d5bc1
feat(orgAdmin): fix orgName bug in the OrgNav
tianrunhe Jul 24, 2024
3c7c47d
Merge branch 'master' into feat/10011/orgAdminArchiveTeams
tianrunhe Jul 25, 2024
d4d4e69
Make delete team format consistent
tianrunhe Jul 25, 2024
2968cc7
Merge branch 'master' into feat/10011/orgAdminArchiveTeams
tianrunhe Jul 30, 2024
00ffbc5
Fix yarn.lock
tianrunhe Jul 30, 2024
507b924
Append '>' to team name in OrgTeamsRow to hint that it can be clicked…
tianrunhe Jul 30, 2024
cba96b5
Add action menu for deleteing team within the orgTeamMember view
tianrunhe Jul 31, 2024
8124f4a
Revert OrgTeamsRow changes
tianrunhe Jul 31, 2024
466c615
Only team lead, billing leader & org admin can delete teams
tianrunhe Jul 31, 2024
2c53d89
Reformat OrgTeamMembers header row
tianrunhe Jul 31, 2024
ce01184
Optimize permission based info display
tianrunhe Jul 31, 2024
20ecd89
Reuse DeleteTeamDialog
tianrunhe Jul 31, 2024
5311b2c
Fall back to Other's Team
tianrunhe Jul 31, 2024
fd810a9
Remove packages/client/modules/userDashboard/components/OrgTeams/Arch…
tianrunhe Jul 31, 2024
9156570
Merge branch 'master' into feat/10011/orgAdminArchiveTeams
tianrunhe Jul 31, 2024
b52d027
Sneak in a label change
Dschoordsch Aug 1, 2024
6998fa4
Cleanup
Dschoordsch Aug 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Props = {
closeModal: () => void
}

const UserAvatarInput = (props: Props) => {
const ArchiveAllDoneTasksModal = (props: Props) => {
const {closeModal, taskIds} = props
const {onCompleted, onError, submitMutation, submitting} = useMutationProps()
const atmosphere = useAtmosphere()
Expand Down Expand Up @@ -54,4 +54,4 @@ const UserAvatarInput = (props: Props) => {
)
}

export default UserAvatarInput
export default ArchiveAllDoneTasksModal
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ArrowBack} from '@mui/icons-material'
import {ArrowBack, MoreVert} from '@mui/icons-material'
import graphql from 'babel-plugin-relay/macro'
import React from 'react'
import {PreloadedQuery, usePreloadedQuery} from 'react-relay'
Expand All @@ -21,13 +21,15 @@ const query = graphql`
query OrgTeamMembersQuery($teamId: ID!) {
viewer {
team(teamId: $teamId) {
...ArchiveTeam_team
id
billingTier
isOrgAdmin
isViewerLead
name
orgId
organization {
isBillingLeader
}
teamMembers(sortBy: "preferredName") {
id
isNotRemoved
Expand All @@ -45,7 +47,7 @@ export const OrgTeamMembers = (props: Props) => {
const data = usePreloadedQuery<OrgTeamMembersQuery>(query, queryRef)
const {viewer} = data
const {team} = viewer
const {menuPortal, menuProps} = useMenu(MenuPosition.UPPER_RIGHT)
const {togglePortal, menuPortal, menuProps, originRef} = useMenu(MenuPosition.UPPER_RIGHT)

const {
open: openDeleteTeamDialog,
Expand All @@ -54,18 +56,31 @@ export const OrgTeamMembers = (props: Props) => {
} = useDialogState()

if (!team) return null
const {isViewerLead, isOrgAdmin: isViewerOrgAdmin, teamMembers} = team
const {isViewerLead, isOrgAdmin: isViewerOrgAdmin, teamMembers, organization} = team
const {isBillingLeader} = organization
const showMenuButton = isViewerLead || isBillingLeader || isViewerOrgAdmin

return (
<div className='max-w-4xl pb-4'>
<div className='flex items-center justify-center py-1'>
<div className='flex items-center'>
<Button size='md' shape='circle' variant='ghost' asChild>
<Link to={`/me/${ORGANIZATIONS}/${team.orgId}/teams`}>
<ArrowBack />
</Link>
</Button>
<h1 className='flex-1 text-2xl font-semibold leading-7'>{team.name}</h1>
<Button size='md' shape='circle' variant='ghost' asChild>
<Link to={`/me/${ORGANIZATIONS}/${team.orgId}/teams`}>
<ArrowBack />
</Link>
</Button>
<h1 className='flex-1 text-2xl font-semibold leading-7'>{team.name}</h1>
<div className='ml-auto'>
{showMenuButton && (
<Button
shape='circle'
variant='ghost'
onClick={togglePortal}
ref={originRef}
className='bg-slate-400'
>
<MoreVert />
</Button>
)}
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {MenuItem} from '@mui/material'
import React from 'react'
import IconLabel from '../../../../components/IconLabel'
import LinkButton from '../../../../components/LinkButton'
import Menu from '../../../../components/Menu'
import MenuItem from '../../../../components/MenuItem'
import {MenuProps} from '../../../../hooks/useMenu'

interface OrgTeamMembersMenuProps {
Expand All @@ -14,13 +16,18 @@ export const OrgTeamMembersMenu = (props: OrgTeamMembersMenuProps) => {

return (
<Menu ariaLabel={'Select your action'} {...menuProps}>
<MenuItem
label='Delete team'
onClick={() => {
closePortal()
openDeleteTeamModal()
}}
/>
<MenuItem>
<LinkButton
aria-label='Click to permanently delete this team.'
palette='red'
onClick={() => {
closePortal()
openDeleteTeamModal()
}}
>
<IconLabel icon='remove_circle' label='Delete Team' />
</LinkButton>
</MenuItem>
</Menu>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ const OrgTeams = (props: Props) => {
<div className='flex items-center justify-center py-1'>
<div>
<h1 className='text-2xl font-semibold leading-7'>Teams</h1>
{!showAllTeams && (
<p className='text-gray-600 mb-2'>Only showing teams you're a member of</p>
)}
<p className='text-gray-600 mb-2'>
{!showAllTeams
? "Only showing teams you're a member of"
: 'Showing all teams in the organization'}
</p>
</div>
<div className='ml-auto'>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@ const OrgTeamsRow = (props: Props) => {
id
name
teamMembers {
id
isLead
isOrgAdmin
isSelf
email
preferredName
}
}
`,
teamRef
)
const {id: teamId, teamMembers, name} = team
const teamMembersCount = teamMembers.length
const viewerTeamMember = teamMembers.find((m) => m.isSelf)

return (
<Link
Expand All @@ -39,7 +37,14 @@ const OrgTeamsRow = (props: Props) => {
>
<div className='flex items-center p-4'>
<div className='flex flex-1 flex-col py-1'>
<div className='text-gray-700 text-lg font-bold'>{name}</div>
<div className='text-gray-700 flex items-center text-lg font-bold'>
{name}
{!viewerTeamMember && (
<span className='ml-2 rounded-full bg-tomato-700 px-2 py-0.5 text-xs text-white'>
Other's Team
</span>
)}
</div>
<div className='flex items-center justify-between'>
<div className='text-gray-600'>
{`${teamMembersCount} ${plural(teamMembersCount, 'member')}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const OrgNav = (props: Props) => {
`,
organizationRef
)
const {name} = organization
const {name: orgName} = organization

return (
<Wrapper>
Expand All @@ -66,7 +66,7 @@ const OrgNav = (props: Props) => {
<StyledIcon>
<NavigateNextIcon />
</StyledIcon>
<OrgLabel isCurrent>{`${name}'s Org`}</OrgLabel>
<OrgLabel isCurrent>{orgName}</OrgLabel>
tianrunhe marked this conversation as resolved.
Show resolved Hide resolved
</Wrapper>
)
}
Expand Down
Loading