Skip to content
Merged
Changes from all commits
Commits
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 @@ -23,6 +23,7 @@ import {
isOwnRequest,
} from 'teleport/Console/DocumentSsh/useFileTransfer';
import { useConsoleContext } from 'teleport/Console/consoleContextProvider';
import { UserContext } from 'teleport/services/user';

type FileTransferRequestsProps = {
requests: FileTransferRequest[];
Expand Down Expand Up @@ -59,6 +60,7 @@ export const FileTransferRequests = ({
request={request}
onApprove={onApprove}
onDeny={onDeny}
currentUser={currentUser}
/>
)
)}
Expand Down Expand Up @@ -106,9 +108,15 @@ type RequestFormProps = {
request: FileTransferRequest;
onApprove: (requestId: string, approved: boolean) => void;
onDeny: (requestId: string, approved: boolean) => void;
currentUser: UserContext;
};

const ResponseForm = ({ request, onApprove, onDeny }: RequestFormProps) => {
const ResponseForm = ({
request,
onApprove,
onDeny,
currentUser,
}: RequestFormProps) => {
return (
<Box mt={3} key={request.requestID}>
<Text
Expand All @@ -120,7 +128,11 @@ const ResponseForm = ({ request, onApprove, onDeny }: RequestFormProps) => {
{getPendingText(request)}
</Text>
<Flex gap={2}>
<ButtonBorder block onClick={() => onApprove(request.requestID, true)}>
<ButtonBorder
disabled={request.approvers.includes(currentUser.username)}
Copy link
Copy Markdown
Contributor

@rudream rudream May 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too familiar with the UX of this, is there any indication elsewhere that the user has already approved the request? If not, let's add a title attr if disabled that explains why it's disabled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you get output in the terminal. like

Teleport > avatus approved file transfer request 8f60b903-2927-4375-aa1c-a7e97cb4b422

I'm working on another PR right now that will show the individual approvers as well + a list of what else is needed for the policy to be fulfilled that I can throw the title attr in.

block
onClick={() => onApprove(request.requestID, true)}
>
<Icons.Check fontSize="16px" mr={2} />
Approve
</ButtonBorder>
Expand Down