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/cloud-filesystem/mount-button.tsx
Views: 687
1
import { Button, Spin, Popconfirm, Switch } from "antd";
2
import { Icon } from "@cocalc/frontend/components/icon";
3
import { A } from "@cocalc/frontend/components/A";
4
5
interface Props {
6
cloudFilesystem;
7
setShowMount?;
8
}
9
10
export default function MountButton({ cloudFilesystem, setShowMount }: Props) {
11
if (cloudFilesystem.deleting) {
12
return (
13
<Popconfirm
14
title={
15
<div style={{ maxWidth: "400px" }}>
16
The Google Cloud Storage bucket is currently being deleted.
17
Depending on how much data you have, this can take a long time. It
18
is managed entirely on the backend using the{" "}
19
<A href="https://cloud.google.com/storage-transfer-service">
20
Storage Transfer Service
21
</A>
22
, so you do not need to keep your browser open.
23
</div>
24
}
25
>
26
<Button
27
danger
28
style={{
29
fontWeight: 600,
30
fontSize: "16px",
31
}}
32
type="text"
33
>
34
Deleting... <Spin style={{ marginLeft: "15px" }} />
35
</Button>
36
</Popconfirm>
37
);
38
}
39
40
// return (
41
// <Button
42
// style={{
43
// fontWeight: 600,
44
// fontSize: "16px",
45
// color: cloudFilesystem.mount ? "#389E0D" : "#FF4B00",
46
// }}
47
// type="text"
48
// onClick={() => {
49
// setShowMount(true);
50
// }}
51
// >
52
// <Icon
53
// name={cloudFilesystem.mount ? "run" : "stop"}
54
// style={{ marginRight: "5px" }}
55
// />
56
// {cloudFilesystem.mount ? (
57
// <Tooltip
58
// title={`Will attempt to mount at /home/user/${cloudFilesystem.mountpoint} on any running compute server in this project.`}
59
// >
60
// Automount
61
// </Tooltip>
62
// ) : (
63
// "Not Mounted"
64
// )}
65
// </Button>
66
// );
67
return (
68
<Switch
69
disabled={setShowMount == null}
70
onClick={() => {
71
setShowMount?.(true);
72
}}
73
checkedChildren={
74
<>
75
<Icon name="run" /> Automount
76
</>
77
}
78
unCheckedChildren={<>Not Mounted</>}
79
checked={cloudFilesystem.mount}
80
/>
81
);
82
}
83
84