Skip to content

fix(ui): keep tag addresses when editing a tag rule in the form - #1651

Open
AsperforMias wants to merge 1 commit into
apache:developfrom
AsperforMias:fix/tag-rule-form-addresses
Open

AsperforMias wants to merge 1 commit into
apache:developfrom
AsperforMias:fix/tag-rule-form-addresses

Conversation

@AsperforMias

@AsperforMias AsperforMias commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

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 this PR

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
  • Console
  • Core Component

Please check any characteristics that apply to this pull request.

The tag rule forms only read each tag's match and rebuilt tags from it,
on save and when syncing the form to the YAML tab, so addresses were
dropped. A tag without match also made the edit form throw while
loading, and the tags after it were lost. Map tags to the form and back
in one module that keeps both labels and addresses, use it in the edit
and add forms, and open address-only tags in the address editor.

Tag rule addresses have no exclusion operator, so the address editor
offers only "=", and a new tag starts with it. A tag in the address
editor no longer saves the label hidden by deleting the last one, since
a label match takes precedence over the addresses.

Fixes apache#1649
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editing a tag rule in the UI form drops the addresses of its tags

1 participant