@@ -60,18 +60,18 @@ class Dashboard extends React.Component {
60
60
healthcheck : {
61
61
db_read : { } ,
62
62
db_sync : { } ,
63
- time_sync : { }
63
+ time_sync : { } ,
64
64
} ,
65
- tr : true
65
+ tr : true ,
66
66
} ;
67
67
68
68
convert_tags_to_releases ( tags ) {
69
- tags . forEach ( r => {
70
- Object . keys ( r . commit ) . forEach ( function ( key ) {
69
+ tags . forEach ( ( r ) => {
70
+ Object . keys ( r . commit ) . forEach ( function ( key ) {
71
71
r [ key ] = r . commit [ key ] ;
72
72
} ) ;
73
73
74
- Object . keys ( r . release ) . forEach ( function ( key ) {
74
+ Object . keys ( r . release ) . forEach ( function ( key ) {
75
75
r [ key ] = r . release [ key ] ;
76
76
} ) ;
77
77
r . created_at = moment ( r . created_at ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ;
@@ -97,65 +97,65 @@ class Dashboard extends React.Component {
97
97
if ( this . props . state . server . type === 'CE' ) {
98
98
api_static
99
99
. get ( '/gitlab.com/psono/psono-server/changelog.json' )
100
- . then ( response => {
100
+ . then ( ( response ) => {
101
101
this . convert_tags_to_releases ( response . data ) ;
102
102
this . setState ( {
103
103
server_tags : response . data ,
104
- server_latest_version : response . data [ 0 ] . name
104
+ server_latest_version : response . data [ 0 ] . name ,
105
105
} ) ;
106
106
} ) ;
107
107
} else {
108
108
api_static
109
109
. get ( '/gitlab.com/psono-enterprise/psono-server/changelog.json' )
110
- . then ( response => {
110
+ . then ( ( response ) => {
111
111
this . convert_tags_to_releases ( response . data ) ;
112
112
this . setState ( {
113
113
server_tags : response . data ,
114
- server_latest_version : response . data [ 0 ] . name
114
+ server_latest_version : response . data [ 0 ] . name ,
115
115
} ) ;
116
116
} ) ;
117
117
}
118
118
api_static
119
119
. get ( '/gitlab.com/psono/psono-client/changelog.json' )
120
- . then ( response => {
120
+ . then ( ( response ) => {
121
121
this . convert_tags_to_releases ( response . data ) ;
122
122
this . setState ( {
123
123
client_tags : response . data ,
124
- client_latest_version : response . data [ 0 ] . name
124
+ client_latest_version : response . data [ 0 ] . name ,
125
125
} ) ;
126
126
} ) ;
127
127
api_static
128
128
. get ( '/gitlab.com/psono/psono-admin-client/changelog.json' )
129
- . then ( response => {
129
+ . then ( ( response ) => {
130
130
this . convert_tags_to_releases ( response . data ) ;
131
131
this . setState ( {
132
132
admin_client_tags : response . data ,
133
- admin_client_latest_version : response . data [ 0 ] . name
133
+ admin_client_latest_version : response . data [ 0 ] . name ,
134
134
} ) ;
135
135
} ) ;
136
136
api_static
137
137
. get ( '/gitlab.com/psono/psono-fileserver/changelog.json' )
138
- . then ( response => {
138
+ . then ( ( response ) => {
139
139
this . convert_tags_to_releases ( response . data ) ;
140
140
this . setState ( {
141
141
fileserver_tags : response . data ,
142
- fileserver_latest_version : response . data [ 0 ] . name
142
+ fileserver_latest_version : response . data [ 0 ] . name ,
143
143
} ) ;
144
144
} ) ;
145
145
146
146
psono_server . healthcheck ( ) . then (
147
- response => {
147
+ ( response ) => {
148
148
//healthy is reported as 200
149
149
this . setState ( {
150
- healthcheck : response . data
150
+ healthcheck : response . data ,
151
151
} ) ;
152
152
} ,
153
- response => {
153
+ ( response ) => {
154
154
//error occured, could mean unhealthy...
155
155
if ( response . status === 400 ) {
156
156
//unhealthy is reported as 400
157
157
this . setState ( {
158
- healthcheck : response . data
158
+ healthcheck : response . data ,
159
159
} ) ;
160
160
}
161
161
}
@@ -165,7 +165,7 @@ class Dashboard extends React.Component {
165
165
this . props . state . user . token ,
166
166
this . props . state . user . session_secret_key
167
167
)
168
- . then ( response => {
168
+ . then ( ( response ) => {
169
169
response . data . info = JSON . parse ( response . data . info ) ;
170
170
171
171
let label_day = [ ] ;
@@ -176,7 +176,7 @@ class Dashboard extends React.Component {
176
176
177
177
let count_registrations_first_week = 0 ;
178
178
let count_registrations_second_week = 0 ;
179
- response . data . registrations_over_day . forEach ( function ( r ) {
179
+ response . data . registrations_over_day . forEach ( function ( r ) {
180
180
count = count - 1 ;
181
181
if ( count > 13 ) {
182
182
return ;
@@ -196,18 +196,18 @@ class Dashboard extends React.Component {
196
196
let label_month = [ ] ;
197
197
let data_month_new = [ ] ;
198
198
let data_month_total = [ ] ;
199
- response . data . registrations_over_month . forEach ( function ( r ) {
199
+ response . data . registrations_over_month . forEach ( function ( r ) {
200
200
label_month . push ( r . month ) ;
201
201
data_month_new . push ( r . count_new ) ;
202
202
data_month_total . push ( r . count_total ) ;
203
203
} ) ;
204
204
205
205
let registrations = [ ] ;
206
- response . data . registrations . forEach ( function ( r ) {
206
+ response . data . registrations . forEach ( function ( r ) {
207
207
registrations . push ( {
208
208
date : moment ( r . date ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ,
209
209
username : r . username ,
210
- active : r . active ? t ( 'YES' ) : t ( 'NO' )
210
+ active : r . active ? t ( 'YES' ) : t ( 'NO' ) ,
211
211
} ) ;
212
212
} ) ;
213
213
@@ -234,35 +234,38 @@ class Dashboard extends React.Component {
234
234
label_month,
235
235
data_month_new,
236
236
data_month_total,
237
- registrations
237
+ registrations,
238
238
} ) ;
239
239
psono_client . set_url ( response . data . info . web_client ) ;
240
- return psono_client . get_version ( ) . then ( response => {
240
+ return psono_client . get_version ( ) . then ( ( response ) => {
241
241
this . setState ( {
242
- client_used_version : 'v' + response . data . split ( ' ' ) [ 0 ]
242
+ client_used_version : 'v' + response . data . split ( ' ' ) [ 0 ] ,
243
243
} ) ;
244
244
} ) ;
245
245
} ) ;
246
246
247
- axios . get ( '/portal/VERSION.txt' ) . then ( response => {
248
- this . setState ( {
249
- admin_client_used_version : 'v' + response . data . split ( ' ' ) [ 0 ]
247
+ axios
248
+ . get ( '/portal/VERSION.txt?t=' + new Date ( ) . getTime ( ) )
249
+ . then ( ( response ) => {
250
+ this . setState ( {
251
+ admin_client_used_version :
252
+ 'v' + response . data . split ( ' ' ) [ 0 ] ,
253
+ } ) ;
250
254
} ) ;
251
- } ) ;
252
255
}
253
256
254
257
render ( ) {
255
258
const { t } = this . props ;
256
259
const {
257
260
count_registrations_second_week,
258
- count_registrations_first_week
261
+ count_registrations_first_week,
259
262
} = this . state ;
260
263
const { files } = this . props . state . server ;
261
264
let registration_text ;
262
265
if ( this . state . count_registrations_second_week ) {
263
266
let percentage = Math . round (
264
- this . state . count_registrations_second_week /
265
- this . state . count_registrations_first_week *
267
+ ( this . state . count_registrations_second_week /
268
+ this . state . count_registrations_first_week ) *
266
269
100 -
267
270
100
268
271
) ;
@@ -354,16 +357,17 @@ class Dashboard extends React.Component {
354
357
labels : this . state . label_day ,
355
358
series : [
356
359
this . state . data_day_total ,
357
- this . state . data_day_new
358
- ]
360
+ this . state . data_day_new ,
361
+ ] ,
359
362
} }
360
363
type = "Line"
361
364
options = { {
362
- lineSmooth : Chartist . Interpolation . cardinal (
363
- {
364
- tension : 0
365
- }
366
- ) ,
365
+ lineSmooth :
366
+ Chartist . Interpolation . cardinal (
367
+ {
368
+ tension : 0 ,
369
+ }
370
+ ) ,
367
371
low : 0 ,
368
372
high :
369
373
Math . max (
@@ -375,7 +379,7 @@ class Dashboard extends React.Component {
375
379
top : 0 ,
376
380
right : 0 ,
377
381
bottom : 10 ,
378
- left : 10
382
+ left : 10 ,
379
383
} ,
380
384
plugins : [
381
385
Chartist . plugins . ctAxisTitle ( {
@@ -386,21 +390,21 @@ class Dashboard extends React.Component {
386
390
axisClass : 'ct-label' ,
387
391
offset : {
388
392
x : 0 ,
389
- y : 35
393
+ y : 35 ,
390
394
} ,
391
- textAnchor : 'middle'
395
+ textAnchor : 'middle' ,
392
396
} ,
393
397
axisY : {
394
398
axisTitle : t ( 'USERS' ) ,
395
399
axisClass : 'ct-label' ,
396
400
offset : {
397
401
x : 10 ,
398
- y : - 10
402
+ y : - 10 ,
399
403
} ,
400
- flipTitle : false
401
- }
402
- } )
403
- ]
404
+ flipTitle : false ,
405
+ } ,
406
+ } ) ,
407
+ ] ,
404
408
} }
405
409
listener = { dailySalesChart . animation }
406
410
/>
@@ -439,16 +443,17 @@ class Dashboard extends React.Component {
439
443
labels : this . state . label_month ,
440
444
series : [
441
445
this . state . data_month_total ,
442
- this . state . data_month_new
443
- ]
446
+ this . state . data_month_new ,
447
+ ] ,
444
448
} }
445
449
type = "Line"
446
450
options = { {
447
- lineSmooth : Chartist . Interpolation . cardinal (
448
- {
449
- tension : 0
450
- }
451
- ) ,
451
+ lineSmooth :
452
+ Chartist . Interpolation . cardinal (
453
+ {
454
+ tension : 0 ,
455
+ }
456
+ ) ,
452
457
low : 0 ,
453
458
high :
454
459
Math . max (
@@ -460,7 +465,7 @@ class Dashboard extends React.Component {
460
465
top : 0 ,
461
466
right : 0 ,
462
467
bottom : 10 ,
463
- left : 10
468
+ left : 10 ,
464
469
} ,
465
470
plugins : [
466
471
Chartist . plugins . ctAxisTitle ( {
@@ -471,21 +476,21 @@ class Dashboard extends React.Component {
471
476
axisClass : 'ct-label' ,
472
477
offset : {
473
478
x : 0 ,
474
- y : 35
479
+ y : 35 ,
475
480
} ,
476
- textAnchor : 'middle'
481
+ textAnchor : 'middle' ,
477
482
} ,
478
483
axisY : {
479
484
axisTitle : t ( 'USERS' ) ,
480
485
axisClass : 'ct-label' ,
481
486
offset : {
482
487
x : 10 ,
483
- y : - 10
488
+ y : - 10 ,
484
489
} ,
485
- flipTitle : false
486
- }
487
- } )
488
- ]
490
+ flipTitle : false ,
491
+ } ,
492
+ } ) ,
493
+ ] ,
489
494
} }
490
495
listener = { dailySalesChart . animation }
491
496
/>
@@ -582,12 +587,12 @@ class Dashboard extends React.Component {
582
587
{ field : 'date' , title : t ( 'DATE' ) } ,
583
588
{
584
589
field : 'username' ,
585
- title : t ( 'USERNAME' )
590
+ title : t ( 'USERNAME' ) ,
586
591
} ,
587
592
{
588
593
field : 'active' ,
589
- title : t ( 'ACTIVE' )
590
- }
594
+ title : t ( 'ACTIVE' ) ,
595
+ } ,
591
596
] }
592
597
data = { this . state . registrations }
593
598
title = { '' }
@@ -603,9 +608,10 @@ class Dashboard extends React.Component {
603
608
}
604
609
605
610
Dashboard . propTypes = {
606
- classes : PropTypes . object . isRequired
611
+ classes : PropTypes . object . isRequired ,
607
612
} ;
608
613
609
- export default compose ( withTranslation ( ) , withStyles ( dashboardStyle ) ) (
610
- Dashboard
611
- ) ;
614
+ export default compose (
615
+ withTranslation ( ) ,
616
+ withStyles ( dashboardStyle )
617
+ ) ( Dashboard ) ;
0 commit comments