-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathmain.js
More file actions
714 lines (698 loc) · 21.5 KB
/
Copy pathmain.js
File metadata and controls
714 lines (698 loc) · 21.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
/*
* Copyright 2022-2024 Nils Knieling. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* FILTERS
*/
const filterParamsNumber = {
filterOptions: ['equals', 'greaterThan', 'greaterThanOrEqual', 'lessThan', 'lessThanOrEqual'],
defaultOption: 'greaterThanOrEqual',
debounceMs: 100,
};
const filterLowerParamsNumber = {
filterOptions: ['equals', 'greaterThan', 'greaterThanOrEqual', 'lessThan', 'lessThanOrEqual'],
defaultOption: 'lessThanOrEqual',
debounceMs: 100,
};
const filterParamsText = {
filterOptions: ['equals', 'notEqual', 'contains', 'notContains', 'startsWith', 'endsWith'],
defaultOption: 'contains',
debounceMs: 100,
};
const filterParamsBoolean = {
filterOptions: ['equals'],
defaultOption: 'equals',
maxNumConditions: 1,
debounceMs: 0,
};
/*
* FORMATTERS
*/
function booleanFormatter(params) {
return (params.value >= 1) ? '✅ (1)' : '❌ (0)';
}
function lowCo2Formatter(params) {
return (params.value >= 1) ? '🍃 (1)' : '❌ (0)';
}
function nullFormatter(params) {
return (params.value >= 0.01) ? params.value : '?';
}
/*
* GRID
*/
const gridOptions = {
columnDefs: [
// groupId: 0
{
headerName: 'Machine Type',
children: [
{
headerName: 'Name',
field: "name",
cellRenderer: params => {
return '<a href="./'+ params.data.region +'/'+ params.value +'.html">'+ params.value + '</a>';
},
tooltipValueGetter: params => {
return 'Machine type '+ params.value +' ('+ params.data.vCpus + ' vCPUs, '+ params.data.memoryGB + ' GB, '+ params.data.bandwidth + ' Gbps) in region '+ params.data.region;
},
pinned: 'left',
//rowDrag: true,
checkboxSelection: true,
width: 180,
},
]
},
// groupId: 1
{
headerName: 'Region',
children: [
{
headerName: 'Name',
field: "region",
tooltipField: 'region',
width: 120,
},
{
headerName: 'Location',
field: "regionLocation",
columnGroupShow: 'open',
tooltipField: 'regionLocationLong',
width: 120
},
{
headerName: 'Country',
field: "regionLocationCountryCode",
headerTooltip: 'ISO 3166-1 alpha-2 country code',
columnGroupShow: 'open',
width: 90
},
{
headerName: 'Low CO2',
field: "regionLowCo2",
columnGroupShow: 'open',
filterParams: filterParamsBoolean,
valueFormatter: lowCo2Formatter,
width: 90
},
{
headerName: 'CFE%',
headerTooltip: 'Google CFE%: Average percentage of carbon free energy consumed in a particular location on an hourly basis',
field: "regionCfe",
columnGroupShow: 'open',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
valueFormatter: nullFormatter,
width: 90
},
{
headerName: 'gCO2eq/kWh',
headerTooltip: 'Grid carbon intensity (gCO2eq/kWh): Average lifecycle gross emissions per unit of energy from the grid',
field: "regionCo2Kwh",
columnGroupShow: 'open',
filter: 'agNumberColumnFilter',
filterParams: filterLowerParamsNumber,
valueFormatter: nullFormatter,
width: 120
},
]
},
// groupId: 2
{
headerName: 'Zones',
children: [
{
headerName: '#Zones',
field: "zoneCount",
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
cellClass: params => {
if (params.value <= 1) { return 'warning' }
},
width: 90,
headerTooltip: 'Available in zones',
},
{
headerName: 'Names',
field: "zones",
columnGroupShow: 'open',
tooltipField: 'zones',
width: 180,
headerTooltip: 'Available in zone names',
},
]
},
// groupId: 3
// groupId is used in setColumnGroupState for inital filter
{
headerName: 'Prozessor',
children: [
{
headerName: 'vCPUs',
field: "vCpus",
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
cellClass: params => {
if (params.data.sharedCpu >= 1) { return 'sharedCpu' }
},
headerTooltip: 'A vCPU represents a single logical CPU thread',
width: 90,
},
{
headerName: 'Frequency',
field: "cpuBaseClock",
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'CPU base clock frequency',
width: 120,
cellClass: 'frequency',
},
{
headerName: 'Turbo Frequency',
field: "cpuTurboClock",
columnGroupShow: 'open',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'CPU all-core turbo frequency / effective frequency',
width: 120,
cellClass: 'frequency',
},
{
headerName: 'Max. Turbo Frequency',
field: "cpuSingleMaxTurboClock",
columnGroupShow: 'open',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'CPU single-core max turbo frequency / max boost frequency',
width: 120,
cellClass: 'frequency',
},
{
headerName: 'Shared',
field: 'sharedCpu',
columnGroupShow: 'open',
filterParams: filterParamsBoolean,
valueFormatter: booleanFormatter,
headerTooltip: 'Fractional vCPU (1, 0) [Each vCPU can burst up to 100% of CPU time, for short periods, before returning to the time limitations]',
width: 90
},
{
headerName: 'Intel',
field: 'intel',
columnGroupShow: 'open',
filterParams: filterParamsBoolean,
valueFormatter: booleanFormatter,
headerTooltip: 'Intel CPU processors (1, 0)',
width: 90
},
{
headerName: 'AMD',
field: 'amd',
columnGroupShow: 'open',
filterParams: filterParamsBoolean,
valueFormatter: booleanFormatter,
headerTooltip: 'AMD CPU processors (1, 0)',
width: 90
},
{
headerName: 'Arm',
field: 'arm',
columnGroupShow: 'open',
filterParams: filterParamsBoolean,
valueFormatter: booleanFormatter,
headerTooltip: 'Arm-based CPU processors (1, 0)',
width: 90
},
{
headerName: '#Available',
field: 'availableCpuPlatformCount',
columnGroupShow: 'open',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'Available CPU platforms for machine type in regions',
width: 90
},
{
headerName: 'Available CPU Platform',
field: 'availableCpuPlatform',
columnGroupShow: 'open',
headerTooltip: 'Available CPU flatform for machine type in region',
tooltipField: 'availableCpuPlatform'
},
{
headerName: '#Div',
field: 'notAvailableCpuPlatformCount',
columnGroupShow: 'open',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
cellClass: params => {
if (params.value >= 1) { return 'warning' }
},
headerTooltip: 'Not available CPU platforms for machine type in regions',
width: 90
},
{
headerName: '#Platform',
field: 'cpuPlatformCount',
columnGroupShow: 'open',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'Available CPU platforms for machine type in regions',
width: 90
},
{
headerName: 'CPU Platform',
field: 'cpuPlatform',
columnGroupShow: 'open',
headerTooltip: 'Available CPU platform for machine type',
tooltipField: 'cpuPlatform'
},
]
},
// groupId: 4
{
headerName: 'Benchmark',
children: [
{
headerName: 'CoreMark',
field: "coremarkScore",
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'EEMBC CoreMark Benchmark (please see www.eembc.org/coremark)',
width: 120
},
{
headerName: 'StdDev%',
field: "standardDeviation",
columnGroupShow: 'open',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'EEMBC CoreMark Standard Deviation (%)',
width: 120
},
{
headerName: '#Samples',
field: "sampleCount",
columnGroupShow: 'open',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'EEMBC CoreMark Sample Count',
width: 120
},
{
headerName: 'SAPS',
field: 'saps',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
columnGroupShow: 'open',
headerTooltip: 'SAP Standard Benchmark (please see SAP Note 1612283 and 2456432)',
width: 90
}
]
},
// groupId: 5
{
headerName: 'Memory',
children: [
{
headerName: 'RAM',
field: "memoryGB",
cellClass: 'memory',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'Random-access memory (GB)',
width: 120,
},
]
},
// groupId: 6
{
headerName: 'Network',
children: [
{ headerName: 'Bandwidth', field: "bandwidth", cellClass: 'bandwidth', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, headerTooltip: 'Maximum egress bandwidth (Gbps) cannot exceed the number given', width: 120, },
{ headerName: 'Tier 1', field: "tier1", cellClass: 'bandwidth', columnGroupShow: 'open', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, headerTooltip: 'High-bandwidth (Gbps) networking for larger machine types', width: 120 },
]
},
// groupId: 7
{
headerName: 'Storage',
children: [
{
headerName: 'Disk Size',
field: "diskSizeTiB",
cellClass: 'diskSize',
width: 100,
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'Max. total persistent disk size (TB) [Disk usage is charged separately from machine type pricing!]'
},
{
headerName: '#Disks',
field: "disks",
columnGroupShow: 'open',
width: 90,
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'Max. number of persistent disks (PDs) [Disk usage is charged separately from machine type pricing!]'
},
{
headerName: 'Local SSD',
field: "localSsd",
columnGroupShow: 'open',
filterParams: filterParamsBoolean,
valueFormatter: booleanFormatter,
width: 90,
headerTooltip: 'VM supports local solid-state drive (SSD) block storage'
},
]
},
// groupId: 8
{
headerName: '$ Hour',
children: [
{
headerName: 'Hour',
field: "hour",
width: 90,
cellClass: 'currency',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
// Default sorting on the hour column
sort: 'asc',
headerTooltip: 'Costs per hour'
},
{
headerName: 'Spot',
field: 'hourSpot',
width: 90,
cellClass: 'currency',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'Costs per hour spot provisioning model (Spot VM)'
},
{
headerName: 'CoreMark/$h',
field: "coremarkHour",
width: 120,
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
valueFormatter: nullFormatter,
columnGroupShow: 'open',
headerTooltip: 'EEMBC CoreMark Benchmark / costs per hour'
},
{
headerName: 'SAPS/$h',
field: "sapsHour",
width: 110,
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
valueFormatter: nullFormatter,
columnGroupShow: 'open',
headerTooltip: 'SAP Standard Benchmark / costs per hour'
}
]
},
// groupId: 9
{
headerName: '$ Month',
children: [
{
headerName: 'Month',
field: "month",
width: 120,
cellClass: 'currency',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'Costs per month'
},
{
headerName: 'SUD',
field: "sud",
filterParams: filterParamsBoolean,
valueFormatter: booleanFormatter,
width: 90,
columnGroupShow: 'open',
headerTooltip: 'Instance with SUD (sustained use discounts are automatic discounts for running specific Compute Engine resources)'
},
{
headerName: '1Y CUD',
field: "month1yCud",
width: 120,
cellClass: 'currency',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
columnGroupShow: 'open',
headerTooltip: 'Costs per month with 1 year commitment (CUD)'
},
{
headerName: '3Y CUD',
field: "month3yCud",
width: 120,
cellClass: 'currency',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
columnGroupShow: 'open',
headerTooltip: 'Costs per month with 3 year commitment (CUD)'
},
{
headerName: 'Spot',
field: 'monthSpot',
width: 120,
cellClass: 'currency',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
columnGroupShow: 'open',
headerTooltip: 'Costs per month spot provisioning model (Spot VM)'
}
]
},
// groupId: 10
{
headerName: 'Licenses',
children: [
{
headerName: 'SLES',
field: 'monthSles',
width: 100,
cellClass: 'currency',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
headerTooltip: 'SUSE Linux Enterprise Server (cost per month)'
},
{ headerName: 'RHEL', field: 'monthRhel', width: 100, cellClass: 'currency', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, columnGroupShow: 'open', headerTooltip: 'Red Hat Enterprise Linux (cost per month)' },
{ headerName: 'RHEL w. 1Y CUD', field: 'monthRhel1yCud', width: 120, cellClass: 'currency', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, columnGroupShow: 'open', headerTooltip: 'Red Hat Enterprise Linux with 1 year CUD (cost per month)' },
{ headerName: 'RHEL w. 3Y CUD', field: 'monthRhel3yCud', width: 120, cellClass: 'currency', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, columnGroupShow: 'open', headerTooltip: 'Red Hat Enterprise Linux with 3 year CUD (cost per month)' },
{ headerName: 'Windows', field: 'monthWindows', width: 120, cellClass: 'currency', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, columnGroupShow: 'open', headerTooltip: 'Microsoft Windows Server (cost per month)' },
{ headerName: 'SLES for SAP', field: 'monthSlesSap', width: 120, cellClass: 'currency', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, columnGroupShow: 'open', headerTooltip: 'SUSE Linux Enterprise Server for SAP (cost per month)' },
{ headerName: 'SLES for SAP w. 1Y CUD', field: 'monthSlesSap1yCud', width: 120, cellClass: 'currency', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, columnGroupShow: 'open', headerTooltip: 'SUSE Linux Enterprise Server for SAP with 1 year CUD (cost per month)' },
{ headerName: 'SLES for SAP w. 3Y CUD', field: 'monthSlesSap3yCud', width: 120, cellClass: 'currency', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, columnGroupShow: 'open', headerTooltip: 'SUSE Linux Enterprise Server for SAP with 3 year CUD (cost per month)' },
{ headerName: 'RHEL for SAP', field: 'monthRhelSap', width: 120, cellClass: 'currency', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, columnGroupShow: 'open', headerTooltip: 'Red Hat Enterprise Linux for SAP (cost per month)' },
{ headerName: 'RHEL for SAP w. 1Y CUD', field: 'monthRhelSap1yCud', width: 120, cellClass: 'currency', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, columnGroupShow: 'open', headerTooltip: 'Red Hat Enterprise Linux for SAP with 1 year CUD (cost per month)' },
{ headerName: 'RHEL for SAP w. 3Y CUD', field: 'monthRhelSap3yCud', width: 120, cellClass: 'currency', filter: 'agNumberColumnFilter', filterParams: filterParamsNumber, columnGroupShow: 'open', headerTooltip: 'Red Hat Enterprise Linux for SAP with 3 year CUD (cost per month)' },
]
},
// groupId: 11
// groupId is used in setColumnGroupState for inital filter
{
headerName: 'More... (SAP, GPU)',
children: [
{
headerName: 'Family',
field: "family",
width: 180,
tooltipField: 'family',
headerTooltip: 'A curated set of processor and hardware configurations optimized for specific workloads'
},
{
headerName: 'Spot',
field: "spot",
filterParams: filterParamsBoolean,
valueFormatter: booleanFormatter,
width: 90,
columnGroupShow: 'open',
headerTooltip: 'Instance supports spot provisioning mode (Spot VM)'
},
{
headerName: 'SAP',
field: "sap",
filterParams: filterParamsBoolean,
valueFormatter: booleanFormatter,
width: 80,
columnGroupShow: 'open',
headerTooltip: 'Certified for SAP applications on Google Cloud'
},
{
headerName: 'HANA',
field: "hana",
filterParams: filterParamsBoolean,
valueFormatter: booleanFormatter,
width: 90,
columnGroupShow: 'open',
headerTooltip: 'Certified for SAP HANA on Google Cloud'
},
{
headerName: 'Series',
field: "series",
width: 110,
columnGroupShow: 'open',
headerTooltip: 'Machine families are further classified by series and generation'
},
{
headerName: 'GPUs',
field: "acceleratorCount",
columnGroupShow: 'open',
filter: 'agNumberColumnFilter',
filterParams: filterParamsNumber,
width: 100
},
{
headerName: 'GPU Type',
field: "acceleratorType",
columnGroupShow: 'open'
}
]
}
],
// Defaults
defaultColDef: {
resizable: true,
sortable: true,
minWidth: 90,
maxWidth: 400,
//width: 110,
filter: 'agTextColumnFilter',
filterParams: filterParamsText,
floatingFilter: true,
//editable: true,
},
groupHideOpenParents: true,
tooltipShowDelay: 0,
debounceVerticalScrollbar: true,
ensureDomOrder: true,
suppressColumnVirtualisation: true,
rowBuffer: 60,
rowSelection: 'multiple',
rowMultiSelectWithClick: true,
//rowDragManaged: true,
//rowDragMultiRow: true,
pagination: true,
paginationPageSize: 50,
//domLayout: 'autoHeight',
};
// lookup the container we want the Grid to use
const eGridDiv = document.querySelector('#myGrid');
// create the grid passing in the div to use together with the columns & data we want to use
const gridApi = agGrid.createGrid(eGridDiv, gridOptions);
// fetch the row data to use and one ready provide it to the Grid via the Grid API
fetch('instance_in_region.json?[% timestamp %]')
.then(response => response.json())
.then(data => {
gridApi.setGridOption('rowData', data)
}
);
/*
* URL FILTER
*/
// URL params for initial filter
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const urlRegion = urlParams.get('region') || '';
const urlName = urlParams.get('name') || '';
const urlGPU = urlParams.get('gpu') || '';
const urlSAP = urlParams.get('sap') || '';
const urlHANA = urlParams.get('hana') || '';
const urlPlatform = urlParams.get('platform') || '';
const urlARM = urlParams.get('arm') || '';
// fist time data is rendered into the grid
gridApi.setGridOption('onFirstDataRendered', function () {
console.log('firstDataRendered');
// Initial filter with URL params
let filterName = urlName.replace(/[^\w\d\-]/g,"");
let filterRegion = urlRegion.replace(/[^\w\d\-]/g,"");
let filterPlatform = urlPlatform.replace(/[^\w\d]/g,"");
let filterGPU = (urlGPU >= 1) ? '1' : '';
let filterSAP = (urlSAP >= 1) ? '1' : '';
let filterHANA = (urlHANA >= 1) ? '1' : '';
let filterARM = (urlARM >= 1) ? '1' : '';
// Set filter
var hardcodedFilter = {
name: {
type: 'equals',
filter: filterName,
},
region: {
type: 'equals',
filter: filterRegion,
},
availableCpuPlatform: {
type: 'contains',
filter: filterPlatform,
},
acceleratorCount: {
type: 'greaterThanOrEqual',
filter: filterGPU,
},
sap: {
type: 'equals',
filter: filterSAP,
},
hana: {
type: 'equals',
filter: filterHANA,
},
arm: {
type: 'equals',
filter: filterARM,
},
};
// Open groups
var hardcodedGroupState = [];
if (filterPlatform || filterARM ) {
hardcodedGroupState.push({ groupId: '3', open: true });
}
if (filterGPU || filterSAP || filterHANA) {
hardcodedGroupState.push({ groupId: '11', open: true });
}
// wait 500ms, because maybe the DOM isn't completely ready yet
setTimeout(function(){
gridApi.setColumnGroupState(hardcodedGroupState);
gridApi.setFilterModel(hardcodedFilter);
}, 500);
});
/*
* KEYBOARD
*/
document.addEventListener('keydown', function(event) {
// Copy selected rows with shown column
if ((event.ctrlKey || event.metaKey) && event.key === 'c') {
navigator.clipboard.writeText(gridApi.getDataAsCsv({
skipColumnGroupHeaders: true,
skipColumnHeaders: true,
allColumns: false,
onlySelected: true,
}));
}
// Copy selected rows with all column
if ((event.ctrlKey || event.metaKey) && event.key === 'x') {
navigator.clipboard.writeText(gridApi.getDataAsCsv({
skipColumnGroupHeaders: true,
skipColumnHeaders: true,
allColumns: true,
onlySelected: true,
}));
}
if ((event.ctrlKey || event.metaKey) && event.key === '/') {
document.querySelector('[aria-label="vCPUs Filter Input"]').focus();
}
});