@@ -14,7 +14,6 @@ import {
14
14
Tooltip ,
15
15
defaults ,
16
16
} from "chart.js" ;
17
- import annotationPlugin from "chartjs-plugin-annotation" ;
18
17
import {
19
18
HelpTooltip ,
20
19
HelpTooltipContent ,
@@ -36,21 +35,16 @@ ChartJS.register(
36
35
Title ,
37
36
Tooltip ,
38
37
Legend ,
39
- annotationPlugin ,
40
38
) ;
41
39
42
- const USER_LIMIT_DISPLAY_THRESHOLD = 60 ;
43
-
44
40
export interface ActiveUserChartProps {
45
41
data : readonly { date : string ; amount : number } [ ] ;
46
42
interval : "day" | "week" ;
47
- userLimit : number | undefined ;
48
43
}
49
44
50
45
export const ActiveUserChart : FC < ActiveUserChartProps > = ( {
51
46
data,
52
47
interval,
53
- userLimit,
54
48
} ) => {
55
49
const theme = useTheme ( ) ;
56
50
@@ -64,24 +58,6 @@ export const ActiveUserChart: FC<ActiveUserChartProps> = ({
64
58
responsive : true ,
65
59
animation : false ,
66
60
plugins : {
67
- annotation : {
68
- annotations : [
69
- {
70
- type : "line" ,
71
- scaleID : "y" ,
72
- display : shouldDisplayUserLimit ( userLimit , chartData ) ,
73
- value : userLimit ,
74
- borderColor : theme . palette . secondary . contrastText ,
75
- borderWidth : 5 ,
76
- label : {
77
- content : "User limit" ,
78
- color : theme . palette . primary . contrastText ,
79
- display : true ,
80
- font : { weight : "normal" } ,
81
- } ,
82
- } ,
83
- ] ,
84
- } ,
85
61
legend : {
86
62
display : false ,
87
63
} ,
@@ -103,7 +79,6 @@ export const ActiveUserChart: FC<ActiveUserChartProps> = ({
103
79
precision : 0 ,
104
80
} ,
105
81
} ,
106
-
107
82
x : {
108
83
grid : { color : theme . palette . divider } ,
109
84
ticks : {
@@ -138,32 +113,26 @@ export const ActiveUserChart: FC<ActiveUserChartProps> = ({
138
113
) ;
139
114
} ;
140
115
141
- export const ActiveUsersTitle : FC = ( ) => {
116
+ type ActiveUsersTitleProps = {
117
+ interval : "day" | "week" ;
118
+ } ;
119
+
120
+ export const ActiveUsersTitle : FC < ActiveUsersTitleProps > = ( { interval } ) => {
142
121
return (
143
122
< div css = { { display : "flex" , alignItems : "center" , gap : 8 } } >
144
- Active Users
123
+ { interval === "day" ? "Daily" : "Weekly" } Active Users
145
124
< HelpTooltip >
146
125
< HelpTooltipTrigger size = "small" />
147
126
< HelpTooltipContent >
148
127
< HelpTooltipTitle > How do we calculate active users?</ HelpTooltipTitle >
149
128
< HelpTooltipText >
150
129
When a connection is initiated to a user's workspace they are
151
- considered an active user. e.g. apps, web terminal, SSH
130
+ considered an active user. e.g. apps, web terminal, SSH. This is for
131
+ measuring user activity and has no connection to license
132
+ consumption.
152
133
</ HelpTooltipText >
153
134
</ HelpTooltipContent >
154
135
</ HelpTooltip >
155
136
</ div >
156
137
) ;
157
138
} ;
158
-
159
- function shouldDisplayUserLimit (
160
- userLimit : number | undefined ,
161
- activeUsers : number [ ] ,
162
- ) : boolean {
163
- if ( ! userLimit || activeUsers . length === 0 ) {
164
- return false ;
165
- }
166
- return (
167
- Math . max ( ...activeUsers ) >= ( userLimit * USER_LIMIT_DISPLAY_THRESHOLD ) / 100
168
- ) ;
169
- }
0 commit comments