Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/components/statistics/active-projects.tsx
5796 views
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
export const PROJECTS_HEADING_WIDTH = 300;
13
14
interface Props {
15
active: HistoricCounts;
16
created: HistoricCounts;
17
running: { free: number; member: number };
18
style?: React.CSSProperties;
19
}
20
21
const columns = [
22
{
23
title: "Projects",
24
dataIndex: "type",
25
key: "type",
26
width: PROJECTS_HEADING_WIDTH,
27
},
28
{ title: "Hour", dataIndex: "1h", key: "1h" },
29
{ title: "Day", dataIndex: "1d", key: "1d" },
30
{ title: "Week", dataIndex: "7d", key: "7d" },
31
{ title: "Month", dataIndex: "30d", key: "30d" },
32
];
33
34
export default function ActiveProject({
35
created,
36
active,
37
running,
38
style,
39
}: Props) {
40
const rows = [
41
{ type: "Actively being used", ...ZEROS, ...active },
42
{ type: "Created", ...ZEROS, "5min": "-", ...created },
43
];
44
return (
45
<div style={style}>
46
<Title level={2}>Running Projects: {running.free + running.member}</Title>
47
<Paragraph>
48
There are {running.free + running.member} projects running right now.
49
Track the number of projects that were actively being used and the
50
number that were created below.
51
</Paragraph>
52
<Table
53
dataSource={rows}
54
columns={columns}
55
bordered
56
pagination={false}
57
rowKey={"type"}
58
/>
59
</div>
60
);
61
}
62
63