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/course/configuration/parallel.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Card, InputNumber } from "antd";6import { useEffect, useState } from "react";7import { useRedux, useActions } from "../../app-framework";8import { Icon } from "../../components";9import { CourseActions } from "../actions";10import { MAX_COPY_PARALLEL } from "../store";1112interface Props {13name: string;14}15export function Parallel({ name }: Props) {16const settings = useRedux([name, "settings"]);17const actions: CourseActions = useActions({ name });1819const parallel =20settings.get("copy_parallel") ?? actions.get_store().get_copy_parallel();21const [value, setValue] = useState<number | null>(parallel);22useEffect(() => {23setValue(parallel);24}, [parallel]);2526function render_parallel() {27return (28<div>29<i>Max number of students</i> to copy and collect files from in30parallel. What is optimal depends on available compute resources31(upgrades) and the size of the content you are copying.32<br />33<div style={{ textAlign: "center", marginTop: "15px" }}>34<InputNumber35style={{ width: "200px" }}36onChange={(n) => setValue(n)}37min={1}38max={MAX_COPY_PARALLEL}39value={value}40onBlur={() => {41if (!value) {42setValue(1);43actions.configuration.set_copy_parallel(1);44return;45}46if (value != parallel) {47actions.configuration.set_copy_parallel(value);48}49}}50/>51</div>52</div>53);54}5556return (57<Card58title={59<>60{" "}61<Icon name="users" /> Parallel Limit: Copy {parallel} assignments at a62time63</>64}65>66{render_parallel()}67</Card>68);69}707172