- Notifications
You must be signed in to change notification settings - Fork1k
feat: add task page#18076
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
feat: add task page#18076
Changes fromall commits
Commits
Show all changes
4 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { WorkspaceAppStatus } from "api/typesGenerated"; | ||
import { Spinner } from "components/Spinner/Spinner"; | ||
import { | ||
CircleAlertIcon, | ||
CircleCheckIcon, | ||
HourglassIcon, | ||
TriangleAlertIcon, | ||
} from "lucide-react"; | ||
import type { FC } from "react"; | ||
import { cn } from "utils/cn"; | ||
type AppStatusIconProps = { | ||
status: WorkspaceAppStatus; | ||
latest: boolean; | ||
className?: string; | ||
}; | ||
export const AppStatusIcon: FC<AppStatusIconProps> = ({ | ||
status, | ||
latest, | ||
className: customClassName, | ||
}) => { | ||
const className = cn(["size-4 shrink-0", customClassName]); | ||
switch (status.state) { | ||
case "complete": | ||
return ( | ||
<CircleCheckIcon className={cn([className, "text-content-success"])} /> | ||
); | ||
case "failure": | ||
return ( | ||
<CircleAlertIcon className={cn([className, "text-content-warning"])} /> | ||
); | ||
case "working": | ||
return latest ? ( | ||
<Spinner size="sm" className="shrink-0" loading /> | ||
) : ( | ||
<HourglassIcon className={cn([className, "text-highlight-sky"])} /> | ||
); | ||
default: | ||
return ( | ||
<TriangleAlertIcon | ||
className={cn([className, "text-content-secondary"])} | ||
/> | ||
); | ||
} | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { Workspace } from "api/typesGenerated"; | ||
export const AI_PROMPT_PARAMETER_NAME = "AI Prompt"; | ||
export type Task = { | ||
workspace: Workspace; | ||
prompt: string; | ||
}; |
6 changes: 4 additions & 2 deletionssite/src/modules/workspaces/WorkspaceAppStatus/WorkspaceAppStatus.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { spyOn } from "@storybook/test"; | ||
import { | ||
MockFailedWorkspace, | ||
MockStartingWorkspace, | ||
MockStoppedWorkspace, | ||
MockWorkspace, | ||
MockWorkspaceAgent, | ||
MockWorkspaceApp, | ||
MockWorkspaceAppStatus, | ||
MockWorkspaceResource, | ||
mockApiError, | ||
} from "testHelpers/entities"; | ||
import { withProxyProvider } from "testHelpers/storybook"; | ||
import TaskPage, { data } from "./TaskPage"; | ||
const meta: Meta<typeof TaskPage> = { | ||
title: "pages/TaskPage", | ||
component: TaskPage, | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
}; | ||
export default meta; | ||
type Story = StoryObj<typeof TaskPage>; | ||
export const Loading: Story = { | ||
beforeEach: () => { | ||
spyOn(data, "fetchTask").mockImplementation( | ||
() => new Promise((res) => 1000 * 60 * 60), | ||
); | ||
}, | ||
}; | ||
export const LoadingError: Story = { | ||
beforeEach: () => { | ||
spyOn(data, "fetchTask").mockRejectedValue( | ||
mockApiError({ | ||
message: "Failed to load task", | ||
detail: "You don't have permission to access this resource.", | ||
}), | ||
); | ||
}, | ||
}; | ||
export const WaitingOnBuild: Story = { | ||
beforeEach: () => { | ||
spyOn(data, "fetchTask").mockResolvedValue({ | ||
prompt: "Create competitors page", | ||
workspace: MockStartingWorkspace, | ||
}); | ||
}, | ||
}; | ||
export const WaitingOnStatus: Story = { | ||
beforeEach: () => { | ||
spyOn(data, "fetchTask").mockResolvedValue({ | ||
prompt: "Create competitors page", | ||
workspace: { | ||
...MockWorkspace, | ||
latest_app_status: null, | ||
}, | ||
}); | ||
}, | ||
}; | ||
export const FailedBuild: Story = { | ||
beforeEach: () => { | ||
spyOn(data, "fetchTask").mockResolvedValue({ | ||
prompt: "Create competitors page", | ||
workspace: MockFailedWorkspace, | ||
}); | ||
}, | ||
}; | ||
export const TerminatedBuild: Story = { | ||
beforeEach: () => { | ||
spyOn(data, "fetchTask").mockResolvedValue({ | ||
prompt: "Create competitors page", | ||
workspace: MockStoppedWorkspace, | ||
}); | ||
}, | ||
}; | ||
export const TerminatedBuildWithStatus: Story = { | ||
beforeEach: () => { | ||
spyOn(data, "fetchTask").mockResolvedValue({ | ||
prompt: "Create competitors page", | ||
workspace: { | ||
...MockStoppedWorkspace, | ||
latest_app_status: MockWorkspaceAppStatus, | ||
}, | ||
}); | ||
}, | ||
}; | ||
export const Active: Story = { | ||
decorators: [withProxyProvider()], | ||
beforeEach: () => { | ||
spyOn(data, "fetchTask").mockResolvedValue({ | ||
prompt: "Create competitors page", | ||
workspace: { | ||
...MockWorkspace, | ||
latest_build: { | ||
...MockWorkspace.latest_build, | ||
resources: [ | ||
{ | ||
...MockWorkspaceResource, | ||
agents: [ | ||
{ | ||
...MockWorkspaceAgent, | ||
apps: [ | ||
{ | ||
...MockWorkspaceApp, | ||
id: "claude-code", | ||
display_name: "Claude Code", | ||
icon: "/icon/claude.svg", | ||
url: `${window.location.protocol}/iframe.html?viewMode=story&id=pages-terminal--ready&args=&globals=`, | ||
external: true, | ||
statuses: [ | ||
MockWorkspaceAppStatus, | ||
{ | ||
...MockWorkspaceAppStatus, | ||
id: "2", | ||
message: "Planning changes", | ||
state: "working", | ||
}, | ||
], | ||
}, | ||
{ | ||
...MockWorkspaceApp, | ||
id: "vscode", | ||
display_name: "VSCode", | ||
icon: "/icon/code.svg", | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
latest_app_status: { | ||
...MockWorkspaceAppStatus, | ||
app_id: "claude-code", | ||
}, | ||
}, | ||
}); | ||
}, | ||
}; |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.