Skip to content

Commit

Permalink
Add Event schema null checks
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Torchia <[email protected]>
  • Loading branch information
torchiaf committed Feb 24, 2025
1 parent d669a7c commit a1af300
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
28 changes: 15 additions & 13 deletions shell/components/form/ResourceTabs/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
},
Expand Down
5 changes: 3 additions & 2 deletions shell/pages/c/_cluster/explorer/EventsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
const schema = this.$store.getters['cluster/schemaFor'](EVENT);
const paginationHeaders = [
const paginationHeaders = schema ? [
reason,
STEVE_EVENT_OBJECT,
MESSAGE,
Expand All @@ -49,7 +49,7 @@ export default {
defaultSort: true,
},
headerFromSchemaColString('Count', schema, this.$store.getters, true),
];
] : [];
return {
schema,
Expand Down Expand Up @@ -88,6 +88,7 @@ export default {

<template>
<PaginatedResourceTable
v-if="!!schema"
:schema="schema"
:headers="eventHeaders"
:pagination-headers="paginationHeaders"
Expand Down

0 comments on commit a1af300

Please sign in to comment.