8000 refactor: move required external auth buttons to the submit side by BrunoQuaresma · Pull Request #18586 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

refactor: move required external auth buttons to the submit side #18586

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

Merged
merged 6 commits into from
Jun 27, 2025
Merged
Changes from 1 commit
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
8000
Diff view
Diff view
Prev Previous commit
Next Next commit
Add retry
  • Loading branch information
BrunoQuaresma committed Jun 26, 2025
commit a6ff6850b5dbaf99218ae42419954ec893e97ff0
72 changes: 53 additions & 19 deletions site/src/pages/TasksPage/TasksPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
import { ExternalImage } from "components/ExternalImage/ExternalImage";
import { useAuthenticated } from "hooks";
import { useExternalAuth } from "hooks/useExternalAuth";
import { RotateCcwIcon, SendIcon } from "lucide-react";
import { RedoIcon, RotateCcwIcon, SendIcon } from "lucide-react";
import { AI_PROMPT_PARAMETER_NAME, type Task } from "modules/tasks/tasks";
import { WorkspaceAppStatus } from "modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus";
import { generateWorkspaceName } from "modules/workspaces/generateWorkspaceName";
Expand All @@ -51,6 +51,12 @@ import TextareaAutosize from "react-textarea-autosize";
import { pageTitle } from "utils/page";
import { relativeTime } from "utils/time";
import { type UserOption, UsersCombobox } from "./UsersCombobox";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "components/Tooltip/Tooltip";

type TasksFilter = {
user: UserOption | undefined;
Expand Down Expand Up @@ -325,27 +331,55 @@ const ExternalAuthButtons: FC<ExternalAuthButtonProps> = ({
template,
missedExternalAuth,
}) => {
const { startPollingExternalAuth, isPollingExternalAuth } = useExternalAuth(
template.active_version_id,
);
const {
startPollingExternalAuth,
isPollingExternalAuth,
externalAuthPollingState,
} = useExternalAuth(template.active_version_id);
const shouldRetry = externalAuthPollingState === "abandoned";

return missedExternalAuth.map((auth) => {
return (
<Button
variant="outline"
key={auth.id}
size="sm"
disabled={isPollingExternalAuth || auth.authenticated}
onClick={() => {
window.open(auth.authenticate_url, "_blank", "width=900,height=600");
startPollingExternalAuth();
}}
>
<Spinner loading={isPollingExternalAuth}>
<ExternalImage src={auth.display_icon} />
</Spinner>
Connect to {auth.display_name}
</Button>
<div className="flex items-center gap-2" key={auth.id}>
<Button
variant="outline"
size="sm"
disabled={isPollingExternalAuth || auth.authenticated}
onClick={() => {
window.open(
auth.authenticate_url,
"_blank",
"width=900,height=600",
);
startPollingExternalAuth();
}}
>
<Spinner loading={isPollingExternalAuth}>
<ExternalImage src={auth.display_icon} />
</Spinner>
Connect to {auth.display_name}
</Button>

{shouldRetry && !auth.authenticated && (
<TooltipProvider>
<Tooltip delayDuration={100}>
<TooltipTrigger asChild>
<Button
variant="outline"
size="icon"
onClick={startPollingExternalAuth}
>
<RedoIcon />
<span className="sr-only">Refresh external auth</span>
</Button>
</TooltipTrigger>
<TooltipContent>
Retry connect to {auth.display_name}
Copy link
Member

Choose a reason for hiding this comment

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

I think ~ing sounds more natural: Retry connecting to

</TooltipContent>
</Tooltip>
</TooltipProvider>
)}
</div>
);
});
};
Expand Down
Loading
0