AsperforMias opened a new pull request, #1651:
URL: https://github.com/apache/dubbo-admin/pull/1651

   **Please provide a description of this PR:**
   
   Fixes #1649.
   
   Editing a tag rule in the form, including turning it off, dropped the 
`addresses` of its tags: the form only read each tag's `match` when loading and 
rebuilt tags from `name` and `match` on save. A tag without `match` also made 
loading throw, so the tags after it were lost.
   
   The form → YAML tab sync of both the edit and the add form rebuilt tags the 
same way, so switching to the YAML tab also dropped the addresses.
   
   Tags are now mapped to the form and back in `tagFormItem.ts`, which keeps 
both labels and addresses. The edit form (loading, saving and the YAML tab 
sync) and the add form (loading from the YAML tab, the YAML tab sync and 
saving) use it. A tag that only has addresses opens in the address editor, and 
addresses typed with either `,` or `,` are split. Tag rule addresses have no 
exclusion operator, so the address editor offers only `=` (a new tag used to 
start with an empty operator, previewed as "不等于"). Deleting the last label 
switches a tag to the address editor but only hides that label; it is no longer 
saved there, because a label match takes precedence over the addresses in the 
tag router.
   
   Validation: unit tests for the mapping; the full vitest suite passes, 
prettier and type-check report nothing for the changed files, and eslint only 
reports the parse error that `addByFormView.vue` already has on develop. In the 
mock-mode UI, driven by a headless browser:
   
   - Opening the edit form of a rule whose tags only have addresses shows them, 
and saving sends 
`{"name":"v1","match":[],"addresses":["192.168.1.1:20880","192.168.1.2:20880"]}`
 and the second tag. On develop the page throws `Cannot read properties of 
undefined (reading 'forEach')` and saving sends `{"name":"v1","match":[]}` only.
   - Switching the edit form to the YAML tab, back to the form and to the YAML 
tab again keeps the addresses. Without the tab sync change the YAML tab shows 
the tags without addresses.
   - In the add view, a rule entered in the YAML tab with both labels and 
addresses keeps both after switching to the form tab and back. Without the 
change the addresses are dropped.
   - In the add form, adding a tag, deleting its only label and entering an 
address previews "地址 等于" and sends 
`{"name":"gray","match":[],"addresses":["10.0.0.1:20880"]}`. Without the change 
the preview says "地址 不等于" and the tag also carries the deleted empty label, 
`"match":[{"key":"","value":{"":""}}]`.
   
   Edit form of a rule whose tags only have addresses:
   
   | develop | this PR |
   |---|---|
   | 
![develop](https://raw.githubusercontent.com/AsperforMias/dubbo-admin/tag-rule-form-screenshots/admin-tag-develop.png)
 | ![this 
PR](https://raw.githubusercontent.com/AsperforMias/dubbo-admin/tag-rule-form-screenshots/admin-tag-branch.png)
 |
   
   **To help us figure out who should review this PR, please put an X in all 
the areas that this PR affects.**
   
   - [ ] Docs
   - [ ] Installation
   - [ ] User Experience
   - [ ] Dubboctl
   - [x] Console
   - [ ] Core Component
   
   **Please check any characteristics that apply to this pull request.**
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [PR] fix(ui): keep tag ... AsperforMias (via GitHub) via notifications

Reply via email to