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/account/ssh-keys/global-ssh-keys.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { FormattedMessage } from "react-intl";
7
8
import { Col, Row } from "@cocalc/frontend/antd-bootstrap";
9
import { redux, useRedux } from "@cocalc/frontend/app-framework";
10
import { A, Paragraph, Text } from "@cocalc/frontend/components";
11
import { Footer } from "@cocalc/frontend/customize";
12
import { COLORS } from "@cocalc/util/theme";
13
14
import { SSHKeyAdder } from "./ssh-key-adder";
15
import { SSHKeyList } from "./ssh-key-list";
16
17
export const SSHKeysPage: React.FC = () => {
18
const ssh_keys = useRedux("account", "ssh_keys");
19
20
function render_pre_list_message() {
21
return (
22
<Paragraph style={{ color: COLORS.GRAY_M }}>
23
<FormattedMessage
24
id="account.global-ssh-keys.info"
25
defaultMessage={`The global SSH keys listed here allow you to connect from your computer via SSH
26
to <strong><i>all projects</i> and <i>compute servers</i></strong>
27
on which you are an owner or collaborator.
28
Alternatively, set SSH keys that grant access only to a project in the settings for that project.
29
See <A>the docs</A>
30
or the SSH part of the settings page in a project for further instructions.`}
31
values={{
32
strong: (c) => <Text strong>{c}</Text>,
33
i: (c) => <i>{c}</i>,
34
A: (c) => <A href="https://doc.cocalc.com/account/ssh.html">{c}</A>,
35
}}
36
/>
37
</Paragraph>
38
);
39
}
40
41
function help() {
42
return (
43
<Paragraph>
44
<FormattedMessage
45
id="account.global-ssh-keys.help"
46
defaultMessage={`To SSH into a project, use the following
47
<code>username@host: [project-id-without-dashes]@ssh.cocalc.com</code>
48
The project id without dashes can be found in the part of project settings about SSH keys.
49
To SSH between projects, use <code>[project-id-without-dashes]@ssh</code>`}
50
values={{ code: (c) => <Paragraph code>{c}</Paragraph> }}
51
/>
52
</Paragraph>
53
);
54
}
55
56
return (
57
<div style={{ marginTop: "1em" }}>
58
<Row>
59
<Col md={10}>{render_pre_list_message()}</Col>
60
<Col md={2}>
61
<div style={{ marginTop: "10px", fontSize: "12pt" }}>
62
<A href="https://doc.cocalc.com/account/ssh.html">Docs...</A>
63
</div>
64
</Col>
65
<Col md={12}>
66
<SSHKeyList help={help()} ssh_keys={ssh_keys} />
67
<SSHKeyAdder
68
add_ssh_key={(opts) =>
69
redux.getActions("account").add_ssh_key(opts)
70
}
71
style={{ marginBottom: "0px" }}
72
/>
73
</Col>
74
</Row>
75
<Footer />
76
</div>
77
);
78
};
79
80