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/cloud/hyperstack/disk.tsx
Views: 687
import DiskGeneric from "@cocalc/frontend/compute/cloud/common/disk";1import { getMinDiskSizeGb } from "@cocalc/util/db-schema/compute-servers";2import { commas, currency, plural } from "@cocalc/util/misc";3import { computeDiskCost } from "@cocalc/util/compute/cloud/hyperstack/compute-cost";4import {5markup,6optionKey,7} from "@cocalc/util/compute/cloud/hyperstack/pricing";8import { Alert } from "antd";910export default function Disk(props) {11if (props.priceData == null || props.IMAGES == null) {12return null;13}14const cost_per_hour_data = markup({15cost: computeDiskCost(props),16priceData: props.priceData,17});18// this data can be null -- I saw this when a bunch of machine types ("flavors") disappeared...19const data = props.priceData.options[optionKey(props.configuration)];20const numTimes =21props.data?.disks == null ? 0 : Math.max(props.data?.disks.length, 1) - 1;22return (23<div>24<DiskGeneric25{...props}26disabled={numTimes >= 25}27noType28minSizeGb={getMinDiskSizeGb(props)}29maxSizeGb={1048576}30computeDiskCost={computeDiskCost}31extraHelp={32<>33<p>34This persistent disk is used to create a ZFS pool, with lz435compression enabled, which stores your data and any Docker images.36Hyperstack does not support enlarging volumes, so when you enlarge37this disk later, we instead add a new volume to this ZFS pool (up38to a total of 26).39</p>40{(data?.ephemeral ?? 0) > 0 && (41<p>42Moreover, some of your{" "}43{data.ephemeral ? `${data.ephemeral} GB` : ""} local SSD will be44used for ZFS caching to make the persistent disk much faster.45This dramatically increases iops and makes reading data46repeatedly much more efficient.47</p>48)}49</>50}51rate={52<>{currency(props.priceData.ssd_cost_per_hour * 730)}/GB per month</>53}54beforeBody={55numTimes >= 1 && props.state != "deprovisioned" ? (56<Alert57showIcon58type="warning"59style={{ float: "right", width: "400px" }}60description={61<>62You can enlarge your disk <b>at most 25 times</b>. You have63enlarged this disk {numTimes} {plural(numTimes, "time")}.64</>65}66/>67) : undefined68}69/>70{cost_per_hour_data != null && (71<div>72<b>73Cost for{" "}74{commas(props.configuration.diskSizeGb ?? getMinDiskSizeGb(props))}75GB:76</b>{" "}77{currency(cost_per_hour_data)}/hour or{" "}78{currency(cost_per_hour_data * 730)}79/month when the server is provisioned.80</div>81)}82{(data?.ephemeral ?? 0) > 0 && (83<div>84<b>Caching:</b> Some of your {data?.ephemeral} GB local SSD is used for85caching to make the data disk much faster.86</div>87)}88</div>89);90}919293