diff --git a/migrations/0001_running_status.sql b/migrations/0001_running_status.sql index 55c5143..8dce60c 100644 --- a/migrations/0001_running_status.sql +++ b/migrations/0001_running_status.sql @@ -1 +1 @@ -ALTER TABLE shells ADD `running` text; \ No newline at end of file +ALTER TABLE shells ADD `running` text 1; \ No newline at end of file diff --git a/src/app/actions/create-action.ts b/src/app/actions/create-action.ts index efd11c9..bc92102 100644 --- a/src/app/actions/create-action.ts +++ b/src/app/actions/create-action.ts @@ -37,7 +37,7 @@ export async function create(name: string, distro: string, extraArgs: string) { port: port, password: createRandomPassowrd(), extraArgs: extraArgs, - running: "true", + running: true, }; const { success, error } = await new containerHelpers(data).createContainer(); diff --git a/src/app/actions/start-action.ts b/src/app/actions/start-action.ts index aabbd65..3316900 100644 --- a/src/app/actions/start-action.ts +++ b/src/app/actions/start-action.ts @@ -6,7 +6,7 @@ import { containerHelpers } from "@/utils/container-helpers"; import { revalidatePath } from "next/cache"; export const start = async (shell: containerData) => { - shell.running = "true"; + shell.running = true; const { success, error } = await new containerHelpers(shell).startContainer(); if (success) { diff --git a/src/app/actions/stop-action.ts b/src/app/actions/stop-action.ts index f204b5d..bb028af 100644 --- a/src/app/actions/stop-action.ts +++ b/src/app/actions/stop-action.ts @@ -6,7 +6,7 @@ import { containerHelpers } from "@/utils/container-helpers"; import { revalidatePath } from "next/cache"; export const stop = async (shell: containerData) => { - shell.running = "false"; + shell.running = false; const { success, error } = await new containerHelpers(shell).stopContainer(); if (success) { diff --git a/src/app/components/render-shell/render-shell.tsx b/src/app/components/render-shell/render-shell.tsx index 0f9b690..9c25786 100644 --- a/src/app/components/render-shell/render-shell.tsx +++ b/src/app/components/render-shell/render-shell.tsx @@ -8,8 +8,9 @@ import { stop } from "../../actions/stop-action"; import { start } from "../../actions/start-action"; export const renderShell = (shell: containerData) => { + console.log(shell); const handleStopStart = async () => { - if (shell.running == "true") { + if (shell.running) { toast.info(`Stopping ${shell.name}...`); const { success } = await stop(shell); if (success) { @@ -36,7 +37,7 @@ export const renderShell = (shell: containerData) => { - {shell.running == "true" ? ( + {shell.running ? ( diff --git a/src/server/db/schema.ts b/src/server/db/schema.ts index eba5c68..d73174f 100644 --- a/src/server/db/schema.ts +++ b/src/server/db/schema.ts @@ -7,5 +7,5 @@ export const shells = sqliteTable("shells", { port: integer("port").notNull(), password: text("password").notNull(), extraArgs: text("extraArgs"), - running: text("running"), + running: integer("running", { mode: "boolean" }), }); diff --git a/src/types/types.ts b/src/types/types.ts index 549ef8e..a3a59ee 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -5,5 +5,5 @@ export interface containerData { port: number; password: string; extraArgs: string | null; - running: string | null; + running: boolean | null; }