Skip to content

Commit 7670114

Browse files
authored
Include schema info on the diagnostic view and download (#13983)
* Include schema info on the diagnostic view and download * Fix lint
1 parent 8b96f26 commit 7670114

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

shell/pages/diagnostic.vue

+47-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default {
1717
const finalCounts = [];
1818
const promises = [];
1919
const topFifteenForResponseTime = [];
20+
const schemaPromises = [];
2021
2122
clusterForCounts.forEach((cluster, i) => {
2223
// Necessary to retrieve the proper display name of the cluster
@@ -31,9 +32,11 @@ export default {
3132
isTableVisible: !!(i === 0 && clusterForCounts.length === 1)
3233
});
3334
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` }));
3436
});
3537
3638
const countsPerCluster = await Promise.all(promises);
39+
const schemasPerCluster = await Promise.all(schemaPromises);
3740
3841
countsPerCluster.forEach((clusterCount, index) => {
3942
const counts = clusterCount.data?.[0]?.counts;
@@ -69,6 +72,14 @@ export default {
6972
7073
this.topFifteenForResponseTime = topFifteenForResponseTime;
7174
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+
});
7283
},
7384
7485
data() {
@@ -148,7 +159,7 @@ export default {
148159
systemInformation: this.systemInformation,
149160
storeMapping: this.parseStoreData(this.storeMapping),
150161
resourceCounts: this.finalCounts,
151-
responseTimes: this.responseTimes
162+
responseTimes: this.responseTimes,
152163
};
153164
154165
downloadFile(fileName, JSON.stringify(data), 'application/json')
@@ -352,6 +363,7 @@ export default {
352363
<span>Cluster: <b>{{ cluster.name }}</b></span>
353364
<span>Namespace: <b>{{ cluster.namespace }}</b></span>
354365
<span>Total Resources: <b>{{ sumResourceCount(cluster.counts) }}</b></span>
366+
<span>Total Schemas: <b>{{ cluster.schemaCount }}</b></span>
355367
<span>Nodes: <b>{{ nodeCount(cluster.counts) }}</b></span>
356368
<i
357369
class="icon"
@@ -365,6 +377,22 @@ export default {
365377
</tr>
366378
</thead>
367379
<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>
368396
<tr>
369397
<th>
370398
Resource
@@ -445,6 +473,23 @@ table {
445473
padding: 8px 5px;
446474
min-width: 150px;
447475
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+
}
448493
}
449494
450495
th {
@@ -511,7 +556,7 @@ table {
511556
.resources-count-container {
512557
.cluster-row {
513558
display: grid;
514-
grid-template-columns: repeat(4, 1fr) 20px;
559+
grid-template-columns: repeat(5, 1fr) 20px;
515560
grid-template-rows: 1fr;
516561
align-content: center;
517562
font-weight: normal;

0 commit comments

Comments
 (0)