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,
|
...sortedSourceLogTabs,
|
||||||
];
|
];
|
||||||
const hasAnyLogs = agentLogs.length > 0;
|
const hasAnyLogs = agentLogs.length > 0;
|
||||||
const logTabsMeasureEnabled = hasStartupFeatures && hasAnyLogs && showLogs;
|
const shouldExpandLogs = showLogs || (!hasStartupFeatures && hasAgentIssues);
|
||||||
|
const shouldShowLogsTabs = hasStartupFeatures && hasAnyLogs;
|
||||||
|
const logTabsMeasureEnabled = shouldShowLogsTabs && showLogs;
|
||||||
const {
|
const {
|
||||||
containerRef: logTabsListContainerRef,
|
containerRef: logTabsListContainerRef,
|
||||||
visibleTabs: visibleLogTabs,
|
visibleTabs: visibleLogTabs,
|
||||||
@@ -529,7 +531,7 @@ export const AgentRow: FC<AgentRowProps> = ({
|
|||||||
<span>{runningScriptsCount}</span>
|
<span>{runningScriptsCount}</span>
|
||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
{healthIssues.length > 0 && (
|
{hasAgentIssues && (
|
||||||
<Badge
|
<Badge
|
||||||
variant={hasWarningIssues ? "warning" : "info"}
|
variant={hasWarningIssues ? "warning" : "info"}
|
||||||
size="xs"
|
size="xs"
|
||||||
@@ -545,9 +547,16 @@ export const AgentRow: FC<AgentRowProps> = ({
|
|||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<Collapse in={showLogs || (!hasStartupFeatures && hasAgentIssues)}>
|
<Collapse in={shouldExpandLogs}>
|
||||||
<div className={cn("px-4", hasStartupFeatures ? "pb-4" : "py-4")}>
|
<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">
|
<div className="mb-4 flex flex-col gap-3">
|
||||||
{healthIssues.map((issue) => (
|
{healthIssues.map((issue) => (
|
||||||
<AgentAlert
|
<AgentAlert
|
||||||
@@ -558,7 +567,7 @@ export const AgentRow: FC<AgentRowProps> = ({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{hasStartupFeatures && hasAnyLogs && (
|
{shouldShowLogsTabs && (
|
||||||
<div className="border border-solid rounded-md overflow-clip">
|
<div className="border border-solid rounded-md overflow-clip">
|
||||||
<Tabs
|
<Tabs
|
||||||
className="-mx-px -mt-px"
|
className="-mx-px -mt-px"
|
||||||
|
|||||||
Reference in New Issue
Block a user