Skip to content

fix: the button for associated documents within the shared knowledge base tag management section should be hidden - #8232

Merged
peslyn merged 1 commit into
v3from
pr@v3@fix_the_button_for_associated_documents_within_the_shared_knowledge_base_tag_management_section_shoule_be_hidden
Nov 30, 2026
Merged

peslyn merged 1 commit into
v3from
pr@v3@fix_the_button_for_associated_documents_within_the_shared_knowledge_base_tag_management_section_shoule_be_hidden

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: the button for associated documents within the shared knowledge base tag management section should be hidden

…base tag management section should be hidden
v-if="knowledgeDocPermission('docTag')"
@click="handleLinkDocuments([row.id])"
/>
</template>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Key observations:

  1. Logic change: disabled → v-if (intentional? verify UX)

    • Previously, the button was rendered but disabled during loading and without docEdit permission. Now it's hidden entirely when docTag permission is absent.
    • Hiding vs. disabling is a UX decision — disabling is usually preferred so users know the action exists but is unavailable. Confirm this is intended.
  2. Loss of loading guard

    • The old condition included loading (prevent double-clicks / actions mid-load). The new :disabled="!selectedDocuments.length" drops the loading check on the toolbar button, so the user can trigger handleBatchLinkDocuments while data is still loading. Likely a regression. Re-add:
      :disabled="!selectedDocuments.length || loading"
    • Same for the per-row dropdown item (line ~209): old had :disabled="loading && ...", now gone entirely. Consider restoring a loading guard.
  3. Attribute order / mixing v-if with other bindings

    • In the second diff, v-if is placed after :icon, which works but is inconsistent style. Also note: v-if + @click + disabled bindings — fine functionally, but keep a consistent ordering (place structural directives first).
    • Better practice: use v-if first in the tag.
  4. Permission naming consistency

    • knowledgeDocPermission is "document" scoped, but you're introducing docTag. If tagging is a distinct capability, consider whether it belongs under this function or a separate guard/namespace (e.g., docTag semantics vs. docEdit). If docTag should imply link/unlink rights, ensure backend perm definitions align.
  5. Inconsistent gating between toolbar and inline action

    • Toolbar uses v-if="knowledgeDocPermission('docTag')"; inline row action also now gates on 'docTag'. Good — they match. But previously both allowed viewing the control regardless of edit perms. Double-check that read-only users don't legitimately need to see these buttons (e.g., greyed out with tooltip).
  6. isSystemResource() branch

    • Verify perm.knowledge.system['docTag'] actually exists; adding a method to the union type without a corresponding runtime permission likely throws undefined is not a function. Ensure both system and non-system perm objects define docTag.
  7. Minor optimization

    • knowledgeDocPermission(...) is called in template; if used in multiple places consider a computed (e.g., canTag) to avoid repeated evaluation and keep template clean:
      const canTag = computed(() => knowledgeDocPermission('docTag'))

Summary of actionable issues: (a) dropped loading guard on both buttons — likely unintended regression; (b) confirm hide-vs-disable UX intent; (c) ensure docTag exists at runtime in all perm branches; (d) consider a computed and consistent directive ordering.

@peslyn
peslyn merged commit 28e7002 into v3 Nov 30, 2026
3 of 4 checks passed
@peslyn
peslyn deleted the pr@v3@fix_the_button_for_associated_documents_within_the_shared_knowledge_base_tag_management_section_shoule_be_hidden branch November 30, 2026 09:37
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.

2 participants