Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PR review
  • Loading branch information
Kira-Pilot committed Nov 13, 2023
commit e94d7ae2e1ddeafce7915417bb7d2d2dbbf812eb
6 changes: 2 additions & 4 deletions site/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,11 @@ export const stopWorkspace = (

export const deleteWorkspace = (
workspaceId: string,
logLevel?: TypesGen.CreateWorkspaceBuildRequest["log_level"],
orphan?: TypesGen.CreateWorkspaceBuildRequest["orphan"],
options?: Pick<TypesGen.CreateWorkspaceBuildRequest, "log_level" & "orphan">,
) =>
postWorkspaceBuild(workspaceId, {
transition: "delete",
log_level: logLevel,
orphan,
...options,
});

export const cancelWorkspaceBuild = async (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { type ComponentProps } from "react";
import { Meta, StoryObj } from "@storybook/react";
import { WorkspaceDeleteDialog } from "./WorkspaceDeleteDialog";
import { MockWorkspace } from "testHelpers/entities";
Expand All @@ -10,7 +11,7 @@ const meta: Meta<typeof WorkspaceDeleteDialog> = {
export default meta;
type Story = StoryObj<typeof WorkspaceDeleteDialog>;

const args = {
const args: ComponentProps<typeof WorkspaceDeleteDialog> = {
workspace: MockWorkspace,
canUpdateTemplate: false,
isOpen: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ export const WorkspaceDeleteDialog = (props: WorkspaceDeleteDialogProps) => {
description={
<>
<div css={styles.workspaceInfo}>
<div css={{ flexDirection: "column" }}>
<div>
<p className="name">{workspace.name}</p>
<p className="label">workspace</p>
</div>
<div css={{ flexDirection: "column" }}>
<div>
<p className="info">{dayjs(workspace.created_at).fromNow()}</p>
<p className="label">created</p>
</div>
Expand Down Expand Up @@ -150,7 +150,7 @@ export const WorkspaceDeleteDialog = (props: WorkspaceDeleteDialogProps) => {
id="orphan_resources"
size="small"
color="warning"
onChange={async () => {
onChange={() => {
setOrphanWorkspace(!orphanWorkspace);
}}
className="option"
Expand Down
6 changes: 4 additions & 2 deletions site/src/xServices/workspace/workspaceXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,10 @@ export const workspaceMachine = createMachine(
if (context.workspace) {
const deleteWorkspacePromise = await API.deleteWorkspace(
context.workspace.id,
context.createBuildLogLevel,
data.orphan,
{
log_level: context.createBuildLogLevel,
orphan: data.orphan,
},
);
send({ type: "REFRESH_TIMELINE" });
return deleteWorkspacePromise;
Expand Down