From 3471b49832a5e264931362dc1c3ba82911d07911 Mon Sep 17 00:00:00 2001 From: Francesco Torchia Date: Fri, 21 Feb 2025 20:29:33 +0100 Subject: [PATCH 1/3] Add Event schema null checks Signed-off-by: Francesco Torchia --- shell/components/form/ResourceTabs/index.vue | 28 ++++++++++--------- .../pages/c/_cluster/explorer/EventsTable.vue | 5 ++-- shell/store/type-map.utils.ts | 4 +++ 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/shell/components/form/ResourceTabs/index.vue b/shell/components/form/ResourceTabs/index.vue index e80d5344a02..ee627f97158 100644 --- a/shell/components/form/ResourceTabs/index.vue +++ b/shell/components/form/ResourceTabs/index.vue @@ -75,23 +75,25 @@ export default { const inStore = this.$store.getters['currentStore'](EVENT); const eventSchema = this.$store.getters[`${ inStore }/schemaFor`](EVENT); // @TODO be smarter about which resources actually ever have events + const paginationHeaders = eventSchema ? [ + STEVE_EVENT_LAST_SEEN, + STEVE_EVENT_TYPE, + REASON, + headerFromSchemaColString('Subobject', eventSchema, this.$store.getters, true), + headerFromSchemaColString('Source', eventSchema, this.$store.getters, true), + MESSAGE, + headerFromSchemaColString('First Seen', eventSchema, this.$store.getters, true), + headerFromSchemaColString('Count', eventSchema, this.$store.getters, true), + STEVE_NAME_COL, + ] : []; + return { eventSchema, EVENT, - selectedTab: this.defaultTab, + selectedTab: this.defaultTab, inStore, - showConditions: false, - paginationHeaders: [ - STEVE_EVENT_LAST_SEEN, - STEVE_EVENT_TYPE, - REASON, - headerFromSchemaColString('Subobject', eventSchema, this.$store.getters, true), - headerFromSchemaColString('Source', eventSchema, this.$store.getters, true), - MESSAGE, - headerFromSchemaColString('First Seen', eventSchema, this.$store.getters, true), - headerFromSchemaColString('Count', eventSchema, this.$store.getters, true), - STEVE_NAME_COL, - ] + showConditions: false, + paginationHeaders }; }, diff --git a/shell/pages/c/_cluster/explorer/EventsTable.vue b/shell/pages/c/_cluster/explorer/EventsTable.vue index 01cfa54cd1b..5321b75566d 100644 --- a/shell/pages/c/_cluster/explorer/EventsTable.vue +++ b/shell/pages/c/_cluster/explorer/EventsTable.vue @@ -35,7 +35,7 @@ export default { const schema = this.$store.getters['cluster/schemaFor'](EVENT); - const paginationHeaders = [ + const paginationHeaders = schema ? [ reason, STEVE_EVENT_OBJECT, MESSAGE, @@ -49,7 +49,7 @@ export default { defaultSort: true, }, headerFromSchemaColString('Count', schema, this.$store.getters, true), - ]; + ] : []; return { schema, @@ -88,6 +88,7 @@ export default {