mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
feat: show Spinner before agent logs are rendered (#25820)
related to DEVEX-313 https://github.com/user-attachments/assets/5fb074bd-7ee7-4f11-9c0a-30567cd71abc
This commit is contained in:
@@ -305,7 +305,9 @@ export const AgentRow: FC<AgentRowProps> = ({
|
||||
...sortedSourceLogTabs,
|
||||
];
|
||||
const hasAnyLogs = agentLogs.length > 0;
|
||||
const logTabsMeasureEnabled = hasStartupFeatures && hasAnyLogs && showLogs;
|
||||
const shouldExpandLogs = showLogs || (!hasStartupFeatures && hasAgentIssues);
|
||||
const shouldShowLogsTabs = hasStartupFeatures && hasAnyLogs;
|
||||
const logTabsMeasureEnabled = shouldShowLogsTabs && showLogs;
|
||||
const {
|
||||
containerRef: logTabsListContainerRef,
|
||||
visibleTabs: visibleLogTabs,
|
||||
@@ -529,7 +531,7 @@ export const AgentRow: FC<AgentRowProps> = ({
|
||||
<span>{runningScriptsCount}</span>
|
||||
</Badge>
|
||||
)}
|
||||
{healthIssues.length > 0 && (
|
||||
{hasAgentIssues && (
|
||||
<Badge
|
||||
variant={hasWarningIssues ? "warning" : "info"}
|
||||
size="xs"
|
||||
@@ -545,9 +547,16 @@ export const AgentRow: FC<AgentRowProps> = ({
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
<Collapse in={showLogs || (!hasStartupFeatures && hasAgentIssues)}>
|
||||
<Collapse in={shouldExpandLogs}>
|
||||
<div className={cn("px-4", hasStartupFeatures ? "pb-4" : "py-4")}>
|
||||
{healthIssues.length > 0 && (
|
||||
{/*
|
||||
Collapse's `in` condition is needed here,
|
||||
or else the Spinner will also show as Collapse is closing
|
||||
*/}
|
||||
{shouldExpandLogs && !(hasAgentIssues || shouldShowLogsTabs) && (
|
||||
<Spinner size="lg" loading className="block mx-auto" />
|
||||
)}
|
||||
{hasAgentIssues && (
|
||||
<div className="mb-4 flex flex-col gap-3">
|
||||
{healthIssues.map((issue) => (
|
||||
<AgentAlert
|
||||
@@ -558,7 +567,7 @@ export const AgentRow: FC<AgentRowProps> = ({
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{hasStartupFeatures && hasAnyLogs && (
|
||||
{shouldShowLogsTabs && (
|
||||
<div className="border border-solid rounded-md overflow-clip">
|
||||
<Tabs
|
||||
className="-mx-px -mt-px"
|
||||
|
||||
Reference in New Issue
Block a user