CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/compute/allow-collaborator-control.tsx
Views: 687
1
import { Alert, Checkbox, Switch } from "antd";
2
import { useState } from "react";
3
import { Icon } from "@cocalc/frontend/components/icon";
4
5
export default function AllowCollaboratorControl({
6
setConfig,
7
configuration,
8
loading,
9
}) {
10
const [allowCollaboratorControl, setAllowCollaboratorControl] =
11
useState<boolean>(!!configuration.allowCollaboratorControl);
12
const [help, setHelp] = useState<boolean>(false);
13
return (
14
<div>
15
<div style={{ color: "#666", marginBottom: "5px" }}>
16
<div>
17
<b>
18
<Switch
19
size="small"
20
checkedChildren={"Help"}
21
unCheckedChildren={"Help"}
22
style={{ float: "right" }}
23
checked={help}
24
onChange={(val) => setHelp(val)}
25
/>
26
<Icon name="users" /> Allow Collaborator Control
27
</b>
28
</div>
29
{help && (
30
<Alert
31
showIcon
32
style={{ margin: "15px 0" }}
33
type="info"
34
message={"Allow Collaborators to Control this Compute Server"}
35
description={
36
<div>
37
Any collaborator on this project will be allowed to start, stop,
38
suspend or resume this compute server. You will be charged for
39
usage (not them).
40
</div>
41
}
42
/>
43
)}
44
<Checkbox
45
style={{ marginTop: "5px" }}
46
disabled={loading}
47
checked={allowCollaboratorControl}
48
onChange={() => {
49
setConfig({ allowCollaboratorControl: !allowCollaboratorControl });
50
setAllowCollaboratorControl(!allowCollaboratorControl);
51
}}
52
>
53
Allow Collaborator Control: allow project collaborators to start,
54
stop, suspend and resume this compute server (you pay)
55
</Checkbox>
56
</div>
57
</div>
58
);
59
}
60
61