mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: display build timings when all timings are loaded (#15728)
- [Refetch timings until script timings are present](https://github.com/coder/coder/commit/2181bec72b5334e5e15dc575d2234860be02920b) - [Stay on loading state when agent script timings are empty](https://github.com/coder/coder/commit/b16fad165c8733c60150b0dfce5df73ab2669e36) Fix https://github.com/coder/coder/issues/15273
This commit is contained in:
@@ -118,3 +118,11 @@ export const DuplicatedScriptTiming: Story = {
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
// Loading when agent script timings are empty
|
||||
// Test case for https://github.com/coder/coder/issues/15273
|
||||
export const LoadingWhenAgentScriptTimingsAreEmpty: Story = {
|
||||
args: {
|
||||
agentScriptTimings: undefined,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -58,15 +58,25 @@ export const WorkspaceTimings: FC<WorkspaceTimingsProps> = ({
|
||||
].sort((a, b) => {
|
||||
return new Date(a.started_at).getTime() - new Date(b.started_at).getTime();
|
||||
});
|
||||
const [isOpen, setIsOpen] = useState(defaultIsOpen);
|
||||
const isLoading = timings.length === 0;
|
||||
|
||||
// All stages
|
||||
const [isOpen, setIsOpen] = useState(defaultIsOpen);
|
||||
|
||||
// If any of the timings are empty, we are still loading the data. They can be
|
||||
// filled in different moments.
|
||||
const isLoading = [
|
||||
provisionerTimings,
|
||||
agentScriptTimings,
|
||||
agentConnectionTimings,
|
||||
].some((t) => t.length === 0);
|
||||
|
||||
// Each agent connection timing is a stage in the timeline to make it easier
|
||||
// to users to see the timing for connection and the other scripts.
|
||||
const agentStageLabels = Array.from(
|
||||
new Set(
|
||||
agentConnectionTimings.map((t) => `agent (${t.workspace_agent_name})`),
|
||||
),
|
||||
);
|
||||
|
||||
const stages = [
|
||||
...provisioningStages,
|
||||
...agentStageLabels.flatMap((a) => agentStages(a)),
|
||||
@@ -120,7 +130,8 @@ export const WorkspaceTimings: FC<WorkspaceTimingsProps> = ({
|
||||
: mergeTimeRanges(stageTimings.map(toTimeRange));
|
||||
|
||||
// Prevent users from inspecting internal coder resources in
|
||||
// provisioner timings.
|
||||
// provisioner timings because they were not useful to the
|
||||
// user and would add noise.
|
||||
const visibleResources = stageTimings.filter((t) => {
|
||||
const isProvisionerTiming = "resource" in t;
|
||||
return isProvisionerTiming
|
||||
|
||||
Reference in New Issue
Block a user