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/admin/page.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 { Collapse, CollapseProps } from "antd";
7
import { useState } from "react";
8
9
import { Icon, Title } from "@cocalc/frontend/components";
10
import { SiteLicenses } from "../site-licenses/admin/component";
11
import { RegistrationToken } from "./registration-token";
12
import SiteSettings from "./site-settings";
13
import { UsageStatistics } from "./stats/page";
14
import { SystemNotifications } from "./system-notifications";
15
import { UserSearch } from "./users/user-search";
16
import AIAvatar from "@cocalc/frontend/components/ai-avatar";
17
import { TestLLMAdmin } from "./llm";
18
19
const headerStyle = { fontSize: "12pt" } as const;
20
21
export function AdminPage() {
22
const [activeKey, setActiveKey] = useState<string[]>([]);
23
24
const items: CollapseProps["items"] = [
25
{
26
key: "user-search",
27
label: (
28
<div style={headerStyle}>
29
<Icon name="users" style={{ marginRight: "8px" }} /> User Search
30
</div>
31
),
32
children: <UserSearch />,
33
},
34
{
35
key: "site-licenses",
36
label: (
37
<div style={headerStyle}>
38
<Icon name="key" style={{ marginRight: "8px" }} /> Licenses
39
</div>
40
),
41
children: <SiteLicenses />,
42
},
43
{
44
key: "site-settings",
45
label: (
46
<div style={headerStyle}>
47
<Icon name="gears" style={{ marginRight: "8px" }} /> Site Settings
48
</div>
49
),
50
children: (
51
<SiteSettings
52
close={() => {
53
setActiveKey(activeKey.filter((key) => key != "site-settings"));
54
}}
55
/>
56
),
57
},
58
{
59
key: "registration-tokens",
60
label: (
61
<div style={headerStyle}>
62
<Icon name="sign-in" style={{ marginRight: "8px" }} /> Registration
63
Tokens
64
</div>
65
),
66
children: <RegistrationToken />,
67
},
68
{
69
key: "system-notifications",
70
label: (
71
<div style={headerStyle}>
72
<Icon name="comment" style={{ marginRight: "8px" }} /> System
73
Notifications
74
</div>
75
),
76
children: <SystemNotifications />,
77
},
78
{
79
key: "usage-stats",
80
label: (
81
<div style={headerStyle}>
82
<Icon name="line-chart" style={{ marginRight: "8px" }} /> Usage
83
Statistics
84
</div>
85
),
86
children: <UsageStatistics />,
87
},
88
{
89
key: "llm-testing",
90
label: (
91
<div style={headerStyle}>
92
<AIAvatar size={16} style={{ marginRight: "8px" }} /> Test LLM
93
Integration
94
</div>
95
),
96
children: <TestLLMAdmin />,
97
},
98
];
99
100
return (
101
<div
102
className="smc-vfill"
103
style={{
104
overflowY: "auto",
105
overflowX: "hidden",
106
padding: "30px 45px",
107
}}
108
>
109
<Title level={3}>Administration</Title>
110
<Collapse
111
destroyInactivePanel /* so that data is refreshed when they are shown */
112
activeKey={activeKey}
113
onChange={(activeKey) => {
114
setActiveKey(activeKey as string[]);
115
}}
116
items={items}
117
/>
118
</div>
119
);
120
}
121
122