Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/frontend/compute/configuration.tsx
Views: 687
import type {1Configuration as ConfigurationType,2ComputeServerTemplate,3State,4} from "@cocalc/util/db-schema/compute-servers";5import GoogleCloudConfiguration from "./google-cloud-config";6import OnPremConfiguration from "./onprem-config";7import HyperstackConfiguration from "./cloud/hyperstack/config";89interface Props {10configuration: ConfigurationType;11data?;12editable?: boolean;13id?: number;14project_id?: string;15onChange?: (configuration: ConfigurationType) => void;16state?: State;17setCloud?;18template?: ComputeServerTemplate;19}2021export default function Configuration({22configuration,23data,24editable,25id,26project_id,27onChange,28state,29setCloud,30template,31}: Props) {32const disabled =33(state ?? "deprovisioned") != "deprovisioned" && state != "off";34return (35<>36{editable && disabled && (37<div38style={{39fontWeight: 250,40textAlign: "center",41maxWidth: "600px",42margin: "15px auto",43borderBottom: "1px solid #aaa",44marginBottom: "15px",45paddingBottom: "15px",46}}47>48Most configuration can only be changed when the server is off, and49some things can only be changed if you deprevision the server (which50deletes the disk).51{configuration?.cloud == "google-cloud" ? (52<b>53<br />54The disk can be instantly enlarged at any time without a reboot.55</b>56) : (57""58)}59</div>60)}61<Config62editable={editable}63id={id}64project_id={project_id}65configuration={configuration}66data={data}67onChange={onChange}68disabled={disabled}69state={state}70setCloud={setCloud}71template={template}72/>73</>74);75}7677function Config({78configuration,79data,80editable,81id,82project_id,83onChange,84disabled,85state,86setCloud,87template,88}) {89if (configuration?.cloud == "google-cloud") {90return (91<GoogleCloudConfiguration92configuration={configuration}93data={data}94editable={editable}95id={id}96project_id={project_id}97onChange={onChange}98disabled={disabled}99state={state}100setCloud={setCloud}101template={template}102/>103);104} else if (configuration?.cloud == "onprem") {105return (106<OnPremConfiguration107configuration={configuration}108data={data}109editable={editable}110id={id}111project_id={project_id}112onChange={onChange}113disabled={disabled}114state={state}115template={template}116/>117);118} else if (configuration?.cloud == "hyperstack") {119return (120<HyperstackConfiguration121configuration={configuration}122data={data}123editable={editable}124id={id}125project_id={project_id}126onChange={onChange}127disabled={disabled}128state={state}129setCloud={setCloud}130template={template}131/>132);133} else {134return (135<span>136Configuration not implemented: {JSON.stringify(configuration)}137</span>138);139}140}141142143