Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dashboard] allow setting ws class for prebuilds #15288

Merged
merged 1 commit into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
42 changes: 41 additions & 1 deletion components/dashboard/src/projects/ProjectSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,53 @@ export default function () {
return value;
}
const before = project.settings?.workspaceClasses?.regular;
updateProjectSettings({ workspaceClasses: { prebuild: value, regular: value } });
updateProjectSettings({ workspaceClasses: { ...project.settings?.workspaceClasses, regular: value } });
return before;
};

const setWorkspaceClassForPrebuild = async (value: string) => {
if (!project) {
return value;
}
const before = project.settings?.workspaceClasses?.prebuild;
updateProjectSettings({ workspaceClasses: { ...project.settings?.workspaceClasses, prebuild: value } });
return before;
};

return (
<ProjectSettingsPage project={project}>
<h3>Prebuilds</h3>
<p className="text-base text-gray-500 dark:text-gray-400">
Choose the workspace machine type for your prebuilds.
</p>
{BillingMode.canSetWorkspaceClass(billingMode) ? (
<SelectWorkspaceClass
workspaceClass={project.settings?.workspaceClasses?.prebuild}
setWorkspaceClass={setWorkspaceClassForPrebuild}
/>
) : (
<Alert type="message" className="mt-4">
<div className="flex flex-col">
<span>
To access{" "}
<a
className="gp-link"
href="https://www.gitpod.io/docs/configure/workspaces/workspace-classes"
>
large workspaces
</a>{" "}
and{" "}
<a className="gp-link" href="https://www.gitpod.io/docs/configure/billing/pay-as-you-go">
pay-as-you-go
</a>
, first cancel your existing plan.
</span>
<Link className="mt-2" to={project.teamId ? "../billing" : "/plans"}>
<button>Go to {project.teamId ? "Team" : "Personal"} Billing</button>
</Link>
</div>
</Alert>
)}
<CheckBox
title={<span>Enable Incremental Prebuilds </span>}
desc={
Expand Down
4 changes: 2 additions & 2 deletions components/gitpod-protocol/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ export type IDESettings = {
};

export interface WorkspaceClasses {
regular: string;
prebuild: string;
regular?: string;
prebuild?: string;
}

export interface UserPlatform {
Expand Down