-
Notifications
You must be signed in to change notification settings - Fork 667
CONSOLE-5044: TypeScript port of events.jsx #15944
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
base: main
Are you sure you want to change the base?
Conversation
|
@logonoff: This pull request references CONSOLE-5044 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.22.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: logonoff The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
3a58c54 to
eb6430e
Compare
📝 WalkthroughWalkthroughThis pull request applies TypeScript type safety improvements to the events subsystem in the OpenShift Console frontend. Changes include converting untyped event-related helpers and components to strongly-typed functions and React functional components using explicit TypeScript interfaces. PropTypes usage was replaced with native TypeScript type definitions, and the standalone 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
|
@logonoff: This pull request references CONSOLE-5044 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.22.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
frontend/public/components/events.tsx (2)
187-254: Guard optionalsource/hostto avoid runtime crashes.Events from the newer API can omit
source; direct access tosource.component/source.hostcan throw and break rendering. Add optional guards and a fallback for missing host.🐛 Safer handling for optional source fields
const { involvedObject: obj, source, message, reason, series, reportingComponent } = event; + const sourceComponent = source?.component ?? reportingComponent; + const sourceHost = source?.host; - const component = source.component ? source.component : reportingComponent; + const component = sourceComponent; - {component === 'kubelet' && canListNode && ( + {component === 'kubelet' && sourceHost && canListNode && ( <Trans ns="public"> Generated from {{ sourceComponent: component }} on{' '} - <Link to={resourcePathFromModel(NodeModel, source.host)}> - {{ sourceHost: source.host }} + <Link to={resourcePathFromModel(NodeModel, sourceHost)}> + {{ sourceHost }} </Link> </Trans> )} {component === 'kubelet' && - !canListNode && + sourceHost && + !canListNode && t('Generated from {{ sourceComponent }} on {{ sourceHost }}', { sourceComponent: component, - sourceHost: source.host, + sourceHost, })} + {component === 'kubelet' && + !sourceHost && + t('Generated from {{ sourceComponent }}', { + sourceComponent: component, + })}
369-459: Clear loading state inmockmode to avoid a permanent spinner.When
mockis true, loading never flips to false, soNoEventsis overridden by the loading state.🐛 Ensure mock mode clears loading state
useEffect(() => { ws.current?.destroy(); setSortedEvents([]); + if (mock) { + setLoading(false); + setError(false); + return; + } if (!mock) { const webSocketID = `${namespace || 'all'}-sysevents`; const watchURLOptions = {
Convert events.jsx to TypeScript with the following improvements: - Replace PropTypes with TypeScript interfaces - Replace defaultProps with default parameters - Replace connectToFlags HOC with useFlag hook - Add proper type annotations for all components and functions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
eb6430e to
c2c8684
Compare
|
@logonoff: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/label px-approved |
|
/label docs-approved |
Convert events.jsx to TypeScript with the following improvements:
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.