@@ -22,7 +22,7 @@ const readGithubUsageReport = async (data: string, cb?: (usageReport: UsageRepor
22
22
continue ;
23
23
}
24
24
const csv = line . split ( ',' ) ;
25
- const [ year , month , day ] = csv [ 0 ] . split ( "-" ) . map ( Number ) ;
25
+ const [ year , month , day ] = csv [ 0 ] . split ( / - | \/ / ) . map ( Number ) ;
26
26
const date = new Date ( year , month - 1 , day ) ;
27
27
const data : UsageReportLine = {
28
28
date,
@@ -77,7 +77,7 @@ export class UsageReportService {
77
77
usageReportData ! : string ;
78
78
usageReport ! : CustomUsageReport ;
79
79
usageReportFiltered : BehaviorSubject < CustomUsageReportLine [ ] > = new BehaviorSubject < CustomUsageReportLine [ ] > ( [ ] ) ;
80
- usageReportFilteredProduct : { [ key : string ] : Observable < CustomUsageReportLine [ ] > } = { } ;
80
+ usageReportFilteredProduct : { [ key : string ] : Observable < CustomUsageReportLine [ ] > } = { } ;
81
81
filters : Filter = {
82
82
startDate : new Date ( ) ,
83
83
endDate : new Date ( ) ,
@@ -92,6 +92,39 @@ export class UsageReportService {
92
92
products : string [ ] = [ ] ;
93
93
usernames : string [ ] = [ ] ;
94
94
valueType : BehaviorSubject < 'minutes' | 'cost' > = new BehaviorSubject < 'minutes' | 'cost' > ( 'cost' )
95
+ skuMapping : { [ key : string ] : string } = {
96
+ "Compute - UBUNTU" : 'Ubuntu 2' ,
97
+ "Compute - UBUNTU_16_CORE" : 'Ubuntu 16' ,
98
+ "Compute - UBUNTU_16_CORE_ARM" : 'Ubuntu 16 (ARM)' ,
99
+ "Compute - UBUNTU_2_CORE_ARM" : 'Ubuntu 2 (ARM)' ,
100
+ "Compute - UBUNTU_32_CORE" : 'Ubuntu 32' ,
101
+ "Compute - UBUNTU_32_CORE_ARM" : 'Ubuntu 32 (ARM)' ,
102
+ "Compute - UBUNTU_4_CORE" : 'Ubuntu 4' ,
103
+ "Compute - UBUNTU_4_CORE_ARM" : 'Ubuntu 4 (ARM)' ,
104
+ "Compute - UBUNTU_4_CORE_GPU" : 'Ubuntu 4 (GPU)' ,
105
+ "Compute - UBUNTU_64_CORE" : 'Ubuntu 64' ,
106
+ "Compute - UBUNTU_64_CORE_ARM" : 'Ubuntu 64 (ARM)' ,
107
+ "Compute - UBUNTU_8_CORE" : 'Ubuntu 8' ,
108
+ "Compute - UBUNTU_8_CORE_ARM" : 'Ubuntu 8 (ARM)' ,
109
+ "Compute - MACOS" : 'MacOS 3' ,
110
+ "Compute - MACOS_12_CORE" : 'MacOS 12' ,
111
+ "Compute - MACOS_8_CORE" : 'MacOS 8' ,
112
+ "Compute - MACOS_LARGE" : 'MacOS 12 (x86)' ,
113
+ "Compute - MACOS_XLARGE" : 'MacOS 6 (M1)' ,
114
+ "Compute - WINDOWS" : 'Windows 2' ,
115
+ "Compute - WINDOWS_16_CORE" : 'Windows 16' ,
116
+ "Compute - WINDOWS_16_CORE_ARM" : 'Windows 16 (ARM)' ,
117
+ "Compute - WINDOWS_2_CORE_ARM" : 'Windows 2 (ARM)' ,
118
+ "Compute - WINDOWS_32_CORE" : 'Windows 32' ,
119
+ "Compute - WINDOWS_32_CORE_ARM" : 'Windows 32 (ARM)' ,
120
+ "Compute - WINDOWS_4_CORE" : 'Windows 4' ,
121
+ "Compute - WINDOWS_4_CORE_ARM" : 'Windows 4 (ARM)' ,
122
+ "Compute - WINDOWS_4_CORE_GPU" : 'Windows 4 (GPU)' ,
123
+ "Compute - WINDOWS_64_CORE" : 'Windows 64' ,
124
+ "Compute - WINDOWS_64_CORE_ARM" : 'Windows 64 (ARM)' ,
125
+ "Compute - WINDOWS_8_CORE" : 'Windows 8' ,
126
+ "Compute - WINDOWS_8_CORE_ARM" : 'Windows 8 (ARM)' ,
127
+ } ;
95
128
skuOrder = [
96
129
'Compute - UBUNTU' ,
97
130
'Compute - UBUNTU_4_CORE' ,
@@ -127,7 +160,7 @@ export class UsageReportService {
127
160
'November' ,
128
161
'December' ,
129
162
] ;
130
-
163
+
131
164
constructor ( ) {
132
165
}
133
166
@@ -241,22 +274,19 @@ export class UsageReportService {
241
274
}
242
275
243
276
formatSku ( sku : string ) {
244
- let formatted ;
277
+ if ( ! sku ) return sku ;
278
+ if ( this . skuMapping [ sku ] ) return this . skuMapping [ sku ] ;
279
+ console . log ( `No mapping for ${ sku } ` )
245
280
const skuParts = sku . split ( 'Compute - ' ) ;
246
281
if ( skuParts . length < 2 ) return sku ;
247
- formatted = skuParts [ 1 ] . replaceAll ( '_' , ' ' ) . replace ( ' CORE' , '' ) ;
282
+ const runtime = skuParts [ 1 ] ;
283
+ let formatted = runtime . replaceAll ( '_' , ' ' ) . replace ( ' CORE' , '' ) ;
248
284
formatted = titlecasePipe . transform ( formatted ) ;
249
285
formatted = formatted . replace ( 'Macos' , 'MacOS' ) ;
250
- switch ( formatted ) {
251
- case 'Ubuntu' :
252
- return 'Ubuntu 2' ;
253
- case 'Windows' :
254
- return 'Windows 2' ;
255
- case 'MacOS' :
256
- return 'MacOS 3' ;
257
- default :
258
- return formatted ;
286
+ if ( formatted . includes ( 'ARM' ) ) {
287
+ return `${ formatted } (ARM)`
259
288
}
289
+ return formatted ;
260
290
}
261
291
}
262
292
0 commit comments