CONSOLE-5044: TypeScript port of events.jsx#15944
CONSOLE-5044: TypeScript port of events.jsx#15944openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
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. |
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.
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 = {
eb6430e to
c2c8684
Compare
|
/label px-approved |
|
/label docs-approved |
krishagarwal278
left a comment
There was a problem hiding this comment.
looks good overall. added a couple comments 👍🏻
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>
c2c8684 to
ee582e5
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: logonoff, vojtechszocs 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 |
|
/assign @yapei |
|
/assign @XiyunZhao |
|
/verified by @XiyunZhao |
|
@XiyunZhao: This PR has been marked as verified by 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. |
|
@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. |
Convert events.jsx to TypeScript with the following improvements:
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.