strimzi: Add support for v1 resources and fix null crash#850
Open
AshutoshSharma-pixel wants to merge 1 commit into
Open
strimzi: Add support for v1 resources and fix null crash#850AshutoshSharma-pixel wants to merge 1 commit into
AshutoshSharma-pixel wants to merge 1 commit into
Conversation
Signed-off-by: Ashutosh Sharma <itsashutosh769@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Strimzi plugin to work with Strimzi 1.0+ clusters that only serve v1 CRDs, and hardens the UI against null list data that previously caused crashes when listing/creating topics and users.
Changes:
- Use
useStrimziApiVersionsin detail pages to selectv1resource classes when available (fallback tov1beta2). - Add
nullguards arounduseMemo/namespace+cluster derivation in Kafka topic/user list & form flows to prevent runtime crashes. - Apply a set of formatting/storybook/mock-data cleanups for readability and consistency.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| strimzi/src/utils/strimziApiVersion.test.ts | Minor formatting adjustment in API version resolver tests. |
| strimzi/src/StrimziIntro.stories.tsx | Storybook intro text formatting. |
| strimzi/src/storybookMocks/strimziMocks.ts | Mock data formatting; minor connector config key normalization. |
| strimzi/src/mapView.tsx | Formatting/readability changes; no functional logic change visible in diff. |
| strimzi/src/hooks/useTopologyTheme.ts | Condensed ternaries for theme color values. |
| strimzi/src/hooks/useStrimziApiVersions.ts | Minor formatting of initial state setup. |
| strimzi/src/components/users/Detail.tsx | Select KafkaUser resource class dynamically (v1 vs v1beta2). |
| strimzi/src/components/topics/Detail.tsx | Select KafkaTopic resource class dynamically (v1 vs v1beta2). |
| strimzi/src/components/kafkas/Detail.tsx | Select Kafka resource class dynamically (v1 vs v1beta2). |
| strimzi/src/components/connects/Detail.tsx | Select KafkaConnect resource class dynamically (v1 vs v1beta2). |
| strimzi/src/components/connectors/Detail.tsx | Select KafkaConnector resource class dynamically (v1 vs v1beta2); text formatting. |
| strimzi/src/components/TopicFormModal.tsx | Add defensive handling around cluster selection; formatting. |
| strimzi/src/components/KafkaUserList.tsx | Add null guards to prevent crashes when kafka cluster list is null; formatting. |
| strimzi/src/components/KafkaTopicList.tsx | Add null guards to prevent crashes when kafka cluster list is null; formatting. |
| strimzi/src/components/KafkaUserCreateFormModal.tsx | Add defensive handling around cluster selection; formatting. |
| strimzi/src/components/KafkaTopologyModal.tsx | Formatting/refactor of callback and markup. |
| strimzi/src/components/KafkaTopologyModal.stories.tsx | Formatting. |
| strimzi/src/components/KafkaClusterTopology.tsx | Formatting plus small functional implications around loading/state transitions. |
| strimzi/src/components/KafkaClusterTopology.stories.tsx | Formatting. |
| strimzi/src/components/KafkaList.tsx | Formatting. |
| strimzi/src/components/KafkaConnectorList.tsx | Formatting. |
| strimzi/src/components/KafkaConnectorList.stories.tsx | Formatting import + small inline simplification. |
| strimzi/src/components/KafkaConnectList.tsx | Formatting. |
| strimzi/src/components/Toast.tsx | Formatting (arrow fn parens removal). |
| strimzi/src/components/Toast.stories.tsx | Formatting. |
| strimzi/src/components/StrimziNotInstalledMessage.tsx | Formatting. |
| strimzi/src/components/StrimziErrorBoundary.tsx | Formatting/markup wrapping. |
| strimzi/src/components/SecureSecretDisplay.tsx | Formatting. |
| strimzi/src/components/SearchFilter.tsx | Formatting (arrow fn parens removal). |
| strimzi/src/components/SearchFilter.stories.tsx | Formatting. |
| strimzi/src/components/ResourceEditor.tsx | Formatting + cleanup block braces. |
| strimzi/src/components/ResourceEditor.stories.tsx | Formatting. |
| strimzi/src/components/KafkaUserList.stories.tsx | Formatting. |
| strimzi/src/components/KafkaTopicList.stories.tsx | Formatting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
628
to
632
| ([nodePoolData, podSetData, podData]: [ | ||
| { items?: KafkaNodePool[] }, | ||
| { items?: StrimziPodSet[] }, | ||
| { items?: Pod[] } | ||
| { items?: Pod[] }, | ||
| ]) => { |
Comment on lines
+301
to
+307
| <Button | ||
| key="create" | ||
| variant="contained" | ||
| color="primary" | ||
| size="medium" | ||
| onClick={openCreateDialog} | ||
| > |
Comment on lines
+298
to
+304
| <Button | ||
| key="create" | ||
| variant="contained" | ||
| color="primary" | ||
| size="medium" | ||
| onClick={openCreateDialog} | ||
| > |
Comment on lines
+319
to
+324
| <Button | ||
| variant="contained" | ||
| color="primary" | ||
| onClick={onSubmit} | ||
| disabled={loading || !formData.name} | ||
| > |
Comment on lines
+435
to
+440
| <Button | ||
| variant="contained" | ||
| color="primary" | ||
| onClick={onSubmit} | ||
| disabled={loading || !formData.name} | ||
| > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #839
Strimzi 1.0.0 dropped v1beta2 and now only serves v1 resources. The plugin hardcoded v1beta2, causing a null crash in useMemo when listing topics or users.
Changes:
Updated detail pages for Kafka, KafkaTopic, KafkaUser, KafkaConnect and KafkaConnector to use useStrimziApiVersions hook and dynamically select the correct resource class, preferring v1 over v1beta2 when available
Added null guards in useMemo hooks in KafkaUserList.tsx and KafkaTopicList.tsx to prevent crashes when kafkaClusters resolves to null
Added null guards in KafkaUserCreateFormModal.tsx and TopicFormModal.tsx
All checks passing: tsc, lint, format.