Skip to content

Conversation

SkyeYoung
Copy link
Member

@SkyeYoung SkyeYoung commented Jun 13, 2025

Please answer these questions before submitting a pull request, or your PR will get closed.

Why submit this pull request?

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches

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

Copy link
Contributor

@Copilot Copilot AI left a 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 and logger as optional in the StreamRouteProtocol schema.
  • Replace the “name” column with server_addr and server_port in the stream routes list.
  • Apply produceRmUpstreamWhenHas('service_id') via pipeProduce in add/detail forms.
  • Extend FormItemJsonInput with a toObject mode and customizable objValue.

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 in FormItemJsonInputProps, 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 where toObject is true/false and when objValue defaults are applied, ensuring JSON parsing and default-value logic behave as expected.
}, [rawVal, toObject, objValue]);

@SkyeYoung SkyeYoung changed the title fix(stream_routes): logic for processing data fix(stream_routes): JSONInput toObject logic Jun 13, 2025
@SkyeYoung SkyeYoung changed the title fix(stream_routes): JSONInput toObject logic fix(JSONInput): toObject logic Jun 13, 2025
Copy link
Member

@juzhiyuan juzhiyuan left a comment

Choose a reason for hiding this comment

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

LGTM

@SkyeYoung SkyeYoung merged commit 78d1c32 into apache:master Jun 13, 2025
5 checks passed
@SkyeYoung SkyeYoung deleted the young/fix/stream_routes-issues branch June 13, 2025 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants