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/next/components/statistics/active-projects.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Table } from "antd";
7
8
import { HistoricCounts } from "@cocalc/util/db-schema/stats";
9
import { Paragraph, Title } from "components/misc";
10
import { ZEROS } from "./misc";
11
12
interface Props {
13
active: HistoricCounts;
14
created: HistoricCounts;
15
running: { free: number; member: number };
16
style?: React.CSSProperties;
17
}
18
19
const columns = [
20
{ title: "Projects", dataIndex: "type", key: "type" },
21
{ title: "Now", dataIndex: "5min", key: "5m" },
22
{ title: "Hour", dataIndex: "1h", key: "1h" },
23
{ title: "Day", dataIndex: "1d", key: "1d" },
24
{ title: "Week", dataIndex: "7d", key: "7d" },
25
{ title: "Month", dataIndex: "30d", key: "30d" },
26
];
27
28
export default function ActiveProject({
29
created,
30
active,
31
running,
32
style,
33
}: Props) {
34
const rows = [
35
{ type: "Actively being used", ...ZEROS, ...active },
36
{ type: "Created", ...ZEROS, "5min": "-", ...created },
37
];
38
return (
39
<div style={style}>
40
<Title level={2}>Running Projects: {running.free + running.member}</Title>
41
<Paragraph>
42
There are {running.free + running.member} projects running right now.
43
Track the number of projects that were actively being used and the
44
number that were created below.
45
</Paragraph>
46
<Table
47
dataSource={rows}
48
columns={columns}
49
bordered
50
pagination={false}
51
rowKey={"type"}
52
/>
53
</div>
54
);
55
}
56
57