Skip to content

Commit 62f1996

Browse files
committed
Move workspace specs customization to server
1 parent 751b002 commit 62f1996

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

web/components/modals/workspace-settings-model.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,16 @@ export default function WorkspaceSettingsModal({
125125

126126
// Create workspace
127127
try {
128-
const vCPU = selectedSpec.vCPU.toString();
129-
const ram = getUnitFromUnitString(selectedSpec.ram.toString(), "Gi");
128+
const specs = selectedSpec.key;
130129
const volumeSize = getUnitFromUnitString(storage.toString(), "Gi");
131130

132131
addToast({
133132
title: "Creating workspace",
134-
description: `Creating workspace ${workspaceName}. Specifications: ${vCPU} vCPU, ${ram} RAM, ${volumeSize} storage.`,
133+
description: `Creating workspace ${workspaceName}. Specifications: ${
134+
selectedSpec.vCPU
135+
} vCPU, ${selectedSpec.ram} RAM, ${volumeSize} storage.`,
135136
});
136-
await createWorkspace(workspaceName, vCPU.toString(), ram, volumeSize);
137+
await createWorkspace(workspaceName, specs, volumeSize);
137138
addToast({
138139
title: "Workspace created",
139140
description: `Workspace ${workspaceName} has been created successfully.`,

web/lib/hooks/use-workspace.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ export function useWorkspace() {
4343

4444
async function createWorkspace(
4545
name: string,
46-
cpuLimit: string,
47-
memoryLimit: string,
46+
specs: string,
4847
volumeSize: string,
4948
) {
5049
if (!editorContext) {
@@ -66,7 +65,7 @@ export function useWorkspace() {
6665
headers: {
6766
"Content-Type": "application/json",
6867
},
69-
body: JSON.stringify({ name, cpuLimit, memoryLimit, volumeSize }),
68+
body: JSON.stringify({ name, specs, volumeSize }),
7069
});
7170

7271
if (!response.ok) {

0 commit comments

Comments
 (0)