@@ -17,6 +17,7 @@ export default {
17
17
const finalCounts = [];
18
18
const promises = [];
19
19
const topFifteenForResponseTime = [];
20
+ const schemaPromises = [];
20
21
21
22
clusterForCounts .forEach ((cluster , i ) => {
22
23
// Necessary to retrieve the proper display name of the cluster
@@ -31,9 +32,11 @@ export default {
31
32
isTableVisible: !! (i === 0 && clusterForCounts .length === 1 )
32
33
});
33
34
promises .push (this .$store .dispatch (' management/request' , { url: ` /k8s/clusters/${ cluster .mgmt ? .id }/ v1/ counts` }));
35
+ schemaPromises.push(this.$store.dispatch('management/request', { url: ` / k8s/ clusters/ ${ cluster .mgmt ? .id }/ v1/ schemas? exclude= metadata .managedFields ` }));
34
36
});
35
37
36
38
const countsPerCluster = await Promise.all(promises);
39
+ const schemasPerCluster = await Promise.all(schemaPromises);
37
40
38
41
countsPerCluster.forEach((clusterCount, index) => {
39
42
const counts = clusterCount.data?.[0]?.counts;
@@ -69,6 +72,14 @@ export default {
69
72
70
73
this.topFifteenForResponseTime = topFifteenForResponseTime;
71
74
this.finalCounts = finalCounts;
75
+
76
+ // Schemas
77
+ schemasPerCluster.forEach((schemas, index) => {
78
+ finalCounts[index].schemaCount = schemas?.data?.length || 0;
79
+ finalCounts[index].customSchemas = (schemas?.data?.filter((schema) => {
80
+ return schema.attributes?.group.includes('.') && !schema.attributes?.group.includes('.cattle.io') && !schema.attributes?.group.includes('.k8s.io');
81
+ }).map((schema) => schema.id) || []).sort();
82
+ });
72
83
},
73
84
74
85
data() {
@@ -148,7 +159,7 @@ export default {
148
159
systemInformation: this.systemInformation,
149
160
storeMapping: this.parseStoreData(this.storeMapping),
150
161
resourceCounts: this.finalCounts,
151
- responseTimes: this.responseTimes
162
+ responseTimes: this.responseTimes,
152
163
};
153
164
154
165
downloadFile(fileName, JSON.stringify(data), 'application/json')
@@ -352,6 +363,7 @@ export default {
352
363
<span>Cluster: <b>{{ cluster.name }}</b></span>
353
364
<span>Namespace: <b>{{ cluster.namespace }}</b></span>
354
365
<span>Total Resources: <b>{{ sumResourceCount(cluster.counts) }}</b></span>
366
+ <span>Total Schemas: <b>{{ cluster.schemaCount }}</b></span>
355
367
<span>Nodes: <b>{{ nodeCount(cluster.counts) }}</b></span>
356
368
<i
357
369
class="icon"
@@ -365,6 +377,22 @@ export default {
365
377
</tr>
366
378
</thead>
367
379
<tbody v-show="cluster.isTableVisible">
380
+ <tr>
381
+ <td colspan="3">
382
+ <div class="schema-title">
383
+ Custom Schemas
384
+ </div>
385
+ <div class="custom-schemas">
386
+ <div
387
+ v-for="name in cluster.customSchemas"
388
+ :key="name"
389
+ class="schema-name"
390
+ >
391
+ {{ name }}
392
+ </div>
393
+ </div>
394
+ </td>
395
+ </tr>
368
396
<tr>
369
397
<th>
370
398
Resource
@@ -445,6 +473,23 @@ table {
445
473
padding: 8px 5px;
446
474
min-width: 150px;
447
475
text-align: left;
476
+
477
+ .schema-title {
478
+ font-weight: bold;
479
+ margin-bottom: 4px;
480
+ }
481
+
482
+ .custom-schemas {
483
+ display: flex;
484
+ flex-wrap: wrap;
485
+
486
+ > .schema-name {
487
+ margin-right: 5px;
488
+ margin-bottom: 2px;
489
+ border: 1px solid var(--border);
490
+ padding: 2px 5px;
491
+ }
492
+ }
448
493
}
449
494
450
495
th {
@@ -511,7 +556,7 @@ table {
511
556
.resources-count-container {
512
557
.cluster-row {
513
558
display: grid;
514
- grid-template-columns: repeat(4 , 1fr) 20px;
559
+ grid-template-columns: repeat(5 , 1fr) 20px;
515
560
grid-template-rows: 1fr;
516
561
align-content: center;
517
562
font-weight: normal;
0 commit comments