Skip to content

Commit

Permalink
fix(desktop):invite & modify role (labring#4005)
Browse files Browse the repository at this point in the history
  • Loading branch information
xudaotutou authored and bxy4543 committed Oct 13, 2023
1 parent a595d21 commit 0931d20
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion frontend/desktop/src/components/team/DissolveTeam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function DissolveTeam({
const session = useSessionStore((s) => s.session);
const { t } = useTranslation();
const submit = () => {
if (teamName !== nsid)
if (teamName.trim() !== nsid)
return toast({
title: t('Invaild Name of Team')
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/desktop/src/components/team/InviteMember.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function InviteMember({
const session = useSessionStore((s) => s.session);
const { k8s_username } = session.user;
const [userId, setUserId] = useState('');
const [role, setRole] = useState(1);
const [role, setRole] = useState(UserRole.Developer);
const toast = useToast();
const queryClient = useQueryClient();
const mutation = useMutation({
Expand Down
7 changes: 4 additions & 3 deletions frontend/desktop/src/components/team/ModifyRole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
MenuItem,
Text,
Flex,
Spinner
Spinner,
ButtonProps
} from '@chakra-ui/react';
import { useState } from 'react';
import { ROLE_LIST, UserRole } from '@/types/team';
Expand All @@ -30,7 +31,7 @@ export default function ModifyRole({
userId,
roles,
...props
}: Parameters<typeof Button>[0] & {
}: ButtonProps & {
ns_uid: string;
userId: string;
currentRole: UserRole;
Expand Down Expand Up @@ -68,7 +69,7 @@ export default function ModifyRole({
fontSize={'12px'}
fontWeight={'500'}
variant={'unstyled'}
{...(props as Parameters<typeof Button>[0])}
{...props}
>
{ROLE_LIST[currentRole]}
</Button>
Expand Down
4 changes: 2 additions & 2 deletions frontend/desktop/src/components/team/userTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ export default function UserTable({
k8s_username={user.k8s_username}
isDisabled={
user.status === InvitedStatus.Inviting ||
!canManage(user.role, userId) ||
user.uid === userId
user.uid === userId ||
UserRole.Owner !== userSelf.role
}
/>
</Td>
Expand Down

0 comments on commit 0931d20

Please sign in to comment.