ius-sharma opened a new pull request, #697:
URL: https://github.com/apache/shenyu-dashboard/pull/697

   <!-- Describe the purpose of this PR -->
   Fixes #618
   
   ### Motivation
   When saving an MCP tool from the JSON editor, `ToolsModal` previously 
hardcoded rule-level properties (`sort: 1`, `loged: true`, `matchMode: "0"`, 
`matchRestful: false`), resetting existing rule values.
   
   ### Modifications
   - Preserved existing rule-level values (`sort`, `loged`, `matchMode`, 
`matchRestful`, and `ruleConditions`) in `handleJsonSubmit`.
   - Tracked form rule values during mode switches (`syncFormToJson`) so 
adjustments made before switching to JSON mode are not lost.
   - Applied default rule values only when creating new tools or when fields 
are undefined.
   - Removed redundant duplicate name validation check in `handleJsonSubmit`.
   - Added regression unit tests in 
`src/routes/Plugin/McpServer/ToolsModal.test.js` covering:
     - Existing tool rule-level value preservation on JSON submit
     - New tool default rule-level values
     - Form-to-JSON mode switch value preservation
     - Direct JSON editor rule property overrides
   
   ### Verification
   - Ran unit tests:
     ```bash
     npm test -- src/routes/Plugin/McpServer/ToolsModal.test.js


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to