mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: show build timeline regardless of agent scripts count (#20470)
This commit is contained in:
@@ -277,3 +277,47 @@ export const InvalidTimeRange: Story = {
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
// A template with no agent scripts.
|
||||
export const NoAgentScripts: Story = {
|
||||
args: {
|
||||
provisionerTimings: [
|
||||
{
|
||||
...WorkspaceTimingsResponse.provisioner_timings[0],
|
||||
stage: "init",
|
||||
started_at: "2025-01-01T00:00:00Z",
|
||||
ended_at: "2025-01-01T00:01:00Z",
|
||||
},
|
||||
{
|
||||
...WorkspaceTimingsResponse.provisioner_timings[0],
|
||||
stage: "plan",
|
||||
started_at: "2025-01-01T00:01:00Z",
|
||||
ended_at: "0001-01-01T00:00:00Z",
|
||||
},
|
||||
{
|
||||
...WorkspaceTimingsResponse.provisioner_timings[0],
|
||||
stage: "graph",
|
||||
started_at: "0001-01-01T00:00:00Z",
|
||||
ended_at: "2025-01-01T00:03:00Z",
|
||||
},
|
||||
{
|
||||
...WorkspaceTimingsResponse.provisioner_timings[0],
|
||||
stage: "apply",
|
||||
started_at: "2025-01-01T00:03:00Z",
|
||||
ended_at: "2025-01-01T00:04:00Z",
|
||||
},
|
||||
],
|
||||
agentConnectionTimings: [
|
||||
{
|
||||
started_at: "2025-01-01T00:05:00Z",
|
||||
ended_at: "2025-01-01T00:06:00Z",
|
||||
stage: "connect",
|
||||
workspace_agent_id: "67e37a9d-ccac-497e-8f48-4093bcc4f3e7",
|
||||
workspace_agent_name: "main",
|
||||
},
|
||||
],
|
||||
agentScriptTimings: [
|
||||
// No agent scripts in the template
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -69,8 +69,10 @@ export const WorkspaceTimings: FC<WorkspaceTimingsProps> = ({
|
||||
// filled in different moments.
|
||||
const isLoading = [
|
||||
provisionerTimings,
|
||||
agentScriptTimings,
|
||||
agentConnectionTimings,
|
||||
// agentScriptTimings might be an empty array if there are no scripts to run.
|
||||
// Only provisionerTimings and agentConnectionTimings are guaranteed to have
|
||||
// at least one entry.
|
||||
].some((t) => t.length === 0);
|
||||
|
||||
// Each agent connection timing is a stage in the timeline to make it easier
|
||||
|
||||
Reference in New Issue
Block a user