-
Notifications
You must be signed in to change notification settings - Fork 567
fix(JSONInput): toObject logic #3117
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
fix(JSONInput): toObject logic #3117
Conversation
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.
Pull Request Overview
This PR fixes data processing logic for stream_routes
components by making schema fields optional, updating displayed columns, applying upstream removal logic when service_id
is present, and enhancing the JSON input component to correctly handle object defaults.
- Mark
conf
andlogger
as optional in theStreamRouteProtocol
schema. - Replace the “name” column with
server_addr
andserver_port
in the stream routes list. - Apply
produceRmUpstreamWhenHas('service_id')
viapipeProduce
in add/detail forms. - Extend
FormItemJsonInput
with atoObject
mode and customizableobjValue
.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/types/schema/apisix/stream_routes.ts | Made conf and logger fields optional |
src/routes/stream_routes/index.tsx | Updated table columns to show server_addr and server_port |
src/routes/stream_routes/detail.$id.tsx | Integrated produceRmUpstreamWhenHas into the update mutation |
src/routes/stream_routes/add.tsx | Integrated produceRmUpstreamWhenHas into the create mutation |
src/components/form/JsonInput.tsx | Added toObject /objValue support and omitted prop from rest |
src/components/form-slice/FormPartStreamRoute/index.tsx | Passed toObject and objValue to JSON inputs |
Comments suppressed due to low confidence (2)
src/components/form/JsonInput.tsx:28
- [nitpick] Add a clear JSDoc comment for the new
objValue
prop inFormItemJsonInputProps
, specifying its intended use and expected structure to improve maintainability.
export type FormItemJsonInputProps<T extends FieldValues> = UseControllerProps<T> &
src/components/form/JsonInput.tsx:52
- Introduce unit tests for
FormItemJsonInput
covering scenarios wheretoObject
is true/false and whenobjValue
defaults are applied, ensuring JSON parsing and default-value logic behave as expected.
}, [rawVal, toObject, objValue]);
This reverts commit 3495126.
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.
LGTM
Please answer these questions before submitting a pull request, or your PR will get closed.
Why submit this pull request?
What changes will this PR take into?
Fixed data processing logic for stream_routes-related components to ensure that data can be correctly echoed or submitted.
These problems are found in PR #3113
JSONInput toObject logic