Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Event schema null checks #13478

Merged
merged 3 commits into from
Feb 26, 2025
Merged

Conversation

torchiaf
Copy link
Member

@torchiaf torchiaf commented Feb 21, 2025

Summary

Fixes #13477

Occurred changes and/or fixed issues

Technical notes summary

Areas or cases that should be tested

Areas which could experience regressions

Screenshot/Video

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes

@torchiaf torchiaf added this to the v2.11.0 milestone Feb 21, 2025
@torchiaf torchiaf requested a review from richard-cox February 21, 2025 19:30
@@ -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 ? [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paginationHeaders can be an empty array since the UI shows events only if event schema is not null:

    showEvents() {
      return this.isView && this.needEvents && this.eventSchema;
    },

@torchiaf torchiaf force-pushed the 13477-event-schema branch 3 times, most recently from a1af300 to 0ccfec7 Compare February 24, 2025 10:36
@@ -35,7 +35,7 @@ export default {

const schema = this.$store.getters['cluster/schemaFor'](EVENT);

const paginationHeaders = [
const paginationHeaders = schema ? [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are changes to this file needed? the events table isn't shown if the type can't been seen

Copy link
Member Author

@torchiaf torchiaf Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory no, this is just a null check for the component itself. It doesn't hurt, I would keep it, so that if the EventTable is shown by any mistake, the UI doesn't crash.

@torchiaf torchiaf requested a review from richard-cox February 24, 2025 11:39
torchiaf and others added 3 commits February 24, 2025 18:05
Signed-off-by: Francesco Torchia <[email protected]>
Signed-off-by: Francesco Torchia <[email protected]>
Copy link
Member

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note - this can also be reproduced outside of fleet with a user who is user-base and has view workload project role. looking at a workload should result in the event tab not showing

@torchiaf torchiaf merged commit 753469f into rancher:master Feb 26, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResourceTabs and Events table crash if user has no permissions for event schema
2 participants