Skip to content

Commit a7a09c5

Browse files
committed
Merge remote-tracking branch 'origin/master' into delete-project-data
2 parents f0b6d4c + baae3c6 commit a7a09c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1107
-670
lines changed

src/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ There are two types of file system build caching. These greatly improve the time
192192
It is handy to have a user with admin rights in your dev cocalc server. With the database running you can make a `[email protected]` an admin as follows:
193193

194194
```sh
195-
~/cocalc/src$ pnpm run c
195+
~/cocalc/src$ pnpm install -D express && pnpm run c
196196
...
197197
> db.make_user_admin({email_address:'[email protected]', cb:console.log})
198198
...
Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,68 @@
11
import { Button } from "antd";
22
import { Icon } from "./icon";
3-
import { CSSProperties } from "react";
3+
import { CSSProperties, useState } from "react";
4+
import ShowError from "@cocalc/frontend/components/error";
45

56
interface Props {
6-
refresh: () => void;
7+
refresh: Function;
78
style?: CSSProperties;
9+
refreshing?;
10+
setRefreshing?;
811
}
912

10-
export default function Refresh({ refresh, style }: Props) {
13+
export default function Refresh({
14+
refresh,
15+
style,
16+
refreshing,
17+
setRefreshing,
18+
}: Props) {
19+
if (refreshing == null) {
20+
return <UnControlled refresh={refresh} style={style} />;
21+
} else {
22+
return (
23+
<Controlled
24+
refresh={refresh}
25+
style={style}
26+
refreshing={refreshing}
27+
setRefreshing={setRefreshing}
28+
/>
29+
);
30+
}
31+
}
32+
33+
function UnControlled({ refresh, style }) {
34+
const [refreshing, setRefreshing] = useState<boolean>(false);
35+
return (
36+
<Controlled
37+
refresh={refresh}
38+
style={style}
39+
refreshing={refreshing}
40+
setRefreshing={setRefreshing}
41+
/>
42+
);
43+
}
44+
45+
function Controlled({ refresh, style, refreshing, setRefreshing }) {
46+
const [error, setError] = useState<string>("");
1147
return (
12-
<Button onClick={refresh} style={style}>
13-
<Icon name="refresh" /> Refresh
14-
</Button>
48+
<>
49+
<Button
50+
onClick={async () => {
51+
try {
52+
setError("");
53+
setRefreshing?.(true);
54+
await refresh();
55+
} catch (err) {
56+
setError(`${err}`);
57+
} finally {
58+
setRefreshing?.(false);
59+
}
60+
}}
61+
style={style}
62+
>
63+
<Icon name="refresh" spin={refreshing} /> Refresh
64+
</Button>
65+
<ShowError error={error} setError={setError} />
66+
</>
1567
);
1668
}

src/packages/frontend/compute/cloud-filesystem/cloud-filesystems.tsx

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { Button, Spin } from "antd";
1414
import CreateCloudFilesystem from "./create";
1515
import CloudFilesystem from "./cloud-filesystem";
1616
import { Icon } from "@cocalc/frontend/components/icon";
17+
import { A } from "@cocalc/frontend/components/A";
18+
import RefreshButton from "@cocalc/frontend/components/refresh";
1719
import { cmp } from "@cocalc/util/misc";
1820
import {
1921
SortableList,
@@ -148,11 +150,11 @@ export default function CloudFilesystems({ project_id }: Props) {
148150

149151
return (
150152
<div>
151-
<Button style={{ position: "absolute", right: 0 }} onClick={refresh}>
152-
<Icon name="refresh" />
153-
Refresh{" "}
154-
{refreshing ? <Spin style={{ marginLeft: "15px" }} /> : undefined}
155-
</Button>
153+
<RefreshButton
154+
refresh={refresh}
155+
style={{ position: "absolute", right: 0 }}
156+
refreshing={refreshing}
157+
/>
156158
<h2 style={{ textAlign: "center" }}>Cloud File Systems</h2>
157159
<div style={{ textAlign: "center" }}>
158160
<Button
@@ -163,9 +165,20 @@ export default function CloudFilesystems({ project_id }: Props) {
163165
<Icon name="youtube" style={{ color: "red" }} />
164166
Short Demo
165167
</Button>
166-
<Button href="https://youtu.be/uk5eA5piQEo" target="_new">
168+
<Button
169+
href="https://youtu.be/uk5eA5piQEo"
170+
target="_new"
171+
style={{ marginRight: "15px" }}
172+
>
167173
<Icon name="youtube" style={{ color: "red" }} />
168-
Longer Demo
174+
Long Demo
175+
</Button>
176+
<Button
177+
href="https://doc.cocalc.com/cloud_file_system.html"
178+
target="_new"
179+
>
180+
<Icon name="external-link" />
181+
Docs
169182
</Button>
170183
</div>
171184
<p
@@ -176,12 +189,15 @@ export default function CloudFilesystems({ project_id }: Props) {
176189
color: "#666",
177190
}}
178191
>
179-
CoCalc Cloud File Systems are scalable distributed POSIX shared
180-
file systems with fast local caching. Use them simultaneously from all
181-
compute servers in this project. There are no limits on how much data
182-
you can store. You do not specify the size of a cloud file system in
183-
advance. The cost per GB is typically much less than a compute server
184-
disk, but you pay network usage and operations.
192+
<A href="https://doc.cocalc.com/cloud_file_system.html">
193+
CoCalc Cloud File Systems{" "}
194+
</A>
195+
are scalable distributed POSIX shared file systems with fast local
196+
caching. Use them simultaneously from all compute servers in this
197+
project. There are no limits on how much data you can store. You do not
198+
specify the size of a cloud file system in advance. The cost per GB is
199+
typically much less than a compute server disk, but you pay network
200+
usage and operations.
185201
</p>
186202

187203
<div style={{ margin: "5px 0" }}>

src/packages/frontend/compute/compute-server-log.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ More precisely this is a little button that you click on, and
55
it shows the log in a modal.
66
*/
77

8-
import { Modal, Button, Spin, Table } from "antd";
8+
import { Modal, Button, Spin, Table, Tooltip } from "antd";
99
import { useEffect, useState } from "react";
1010
import LogEntry from "./log-entry";
1111
import type { ComputeServerEvent } from "@cocalc/util/compute/log";
@@ -25,7 +25,7 @@ export default function ComputeServerLog({
2525
const [open, setOpen] = useState<boolean>(false);
2626

2727
return (
28-
<>
28+
<Tooltip title={"Show configuration and control log"}>
2929
<Button
3030
size={"small"}
3131
type="text"
@@ -37,7 +37,7 @@ export default function ComputeServerLog({
3737
<Icon name="history" /> Log
3838
</Button>
3939
{open && <LogModal id={id} close={() => setOpen(false)} />}
40-
</>
40+
</Tooltip>
4141
);
4242
}
4343

src/packages/frontend/compute/compute-server.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -373,20 +373,20 @@ export default function ComputeServer({
373373
{id != null && (
374374
<div style={{ color: "#888" }}>Id: {project_specific_id}</div>
375375
)}
376-
{id != null && (
377-
<ComputeServerLog id={id} style={{ marginLeft: "-15px" }} />
378-
)}
379-
{id != null &&
380-
configuration.cloud == "google-cloud" &&
381-
(state == "starting" ||
382-
state == "stopping" ||
383-
state == "running") && (
384-
<SerialPortOutput
385-
id={id}
386-
style={{ marginLeft: "-15px" }}
387-
title={title}
388-
/>
389-
)}
376+
<div style={{ display: "flex", marginLeft: "-20px" }}>
377+
{id != null && <ComputeServerLog id={id} />}
378+
{id != null &&
379+
configuration.cloud == "google-cloud" &&
380+
(state == "starting" ||
381+
state == "stopping" ||
382+
state == "running") && (
383+
<SerialPortOutput
384+
id={id}
385+
title={title}
386+
style={{ marginLeft: "-5px" }}
387+
/>
388+
)}
389+
</div>
390390
{id != null && (
391391
<div style={{ marginLeft: "-15px" }}>
392392
<CurrentCost state={state} cost_per_hour={cost_per_hour} />

src/packages/frontend/compute/google-cloud-config.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,9 +1411,11 @@ function ensureConsistentImage(configuration, changes, IMAGES) {
14111411
if (gpu && !gpuSelected) {
14121412
// GPU image but non-GPU machine -- change image to non-GPU
14131413
configuration["image"] = changes["image"] = "python";
1414+
configuration["tag"] = changes["tag"] = null;
14141415
} else if (!gpu && gpuSelected) {
14151416
// GPU machine but not image -- change image to pytorch
14161417
configuration["image"] = changes["image"] = "pytorch";
1418+
configuration["tag"] = changes["tag"] = null;
14171419
}
14181420
}
14191421

src/packages/frontend/compute/inline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default function ComputeServer({
5959
}
6060
if (!id) {
6161
setServer({
62-
title: "Default Shared Resources",
62+
title: "Home Base",
6363
color: PROJECT_COLOR,
6464
project_specific_id: 0,
6565
});

0 commit comments

Comments
 (0)