Skip to content

Conversation

@GaoNeng-wWw
Copy link
Collaborator

@GaoNeng-wWw GaoNeng-wWw commented Aug 23, 2025

PR

请位于 #89 之后合并. 该PR解决了如果没有批量删除权限则不显示批量删除按钮的问题

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

如果用户没有 batch-remove 权限也会显示 i18nuser 批量删除

Issue Number: N/A

What is the new behavior?

如果用户没有 batch-remove 权限将不会显示 i18nuser 批量删除

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features
    • Batch Remove is now permission-gated in Locale and User Manager tabs. Only users with the appropriate permissions can see and use the bulk delete action, improving access control and reducing accidental mass operations.
    • No changes to the underlying delete behavior; only button visibility/availability is affected.

@coderabbitai
Copy link

coderabbitai bot commented Aug 23, 2025

Walkthrough

Adds v-permission directives to gate “Batch Remove” buttons in locale and user info tabs. Minor attribute reordering and whitespace adjustments occur in the locale component without behavioral changes. No logic, API, or exported entity modifications.

Changes

Cohort / File(s) Summary
Permission gating for Batch Remove
template/tinyvue/src/views/locale/components/add-locale.vue, template/tinyvue/src/views/userManager/info/components/info-tab.vue
Added v-permission directives: i18n::batch-remove for locale, user::batch-remove for user info. Limits button availability based on permissions; no change to underlying handlers or emitted events.
Attribute/whitespace tweaks
template/tinyvue/src/views/locale/components/add-locale.vue
Reordered attributes (e.g., @click) on TinyButton elements and added minor whitespace/newline adjustments; no semantic impact.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor U as User
    participant C as Vue Component
    participant P as v-permission Directive
    participant B as Batch Remove Button
    participant H as onBatchRemove Handler

    U->>C: Open view
    C->>P: Evaluate permission ('i18n::batch-remove' or 'user::batch-remove')
    alt Has permission
        P-->>B: Enable/Show
        U->>B: Click
        B->>H: Invoke handler
        H-->>C: emit('batchRemove')
    else Lacks permission
        P-->>B: Disable/Hide
        U -x B: Click blocked
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paw—permissions check!
Batch buttons wait on guarded deck.
Clicks may hop, or stay in burrow,
Locale and users keep it thorough.
Small tweaks, neat fields align—
Carrots count, and all’s just fine. 🥕🐇

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the bug Something isn't working label Aug 23, 2025
@GaoNeng-wWw GaoNeng-wWw changed the title fix(web): if not batch-remove should not display i18n or user batch-r… fix(web): if not batch-remove permission should not display i18n or user batch-remove button Aug 23, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
template/tinyvue/src/views/locale/components/add-locale.vue (1)

3-5: Potentially invalid TinyButton prop: confirm show-footer usage

show-footer is typically a dialog property, not a TinyButton prop. If unsupported on TinyButton, it will become a stray DOM attribute. Please confirm and remove if unnecessary.

Apply if confirmed:

-    <tiny-button show-footer type="primary" round @click="onOpen">
+    <tiny-button type="primary" round @click="onOpen">
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ce0a135 and 021b5a7.

📒 Files selected for processing (2)
  • template/tinyvue/src/views/locale/components/add-locale.vue (4 hunks)
  • template/tinyvue/src/views/userManager/info/components/info-tab.vue (1 hunks)
🔇 Additional comments (4)
template/tinyvue/src/views/userManager/info/components/info-tab.vue (1)

13-17: LGTM: Batch Remove button correctly guarded by v-permission

  • Repo-wide grep confirms only two Vue UI triggers for “batch remove”:
    • template/tinyvue/src/views/userManager/info/components/info-tab.vue (lines 13–17) uses v-permission="'user::batch-remove'"
    • template/tinyvue/src/views/locale/components/add-locale.vue uses v-permission="'i18n::batch-remove'"
  • No other unguarded batchRemove or batch-remove buttons found in the codebase.
  • Please verify that the translation key 'locale.batchRemove' matches the naming conventions for user-page labels (e.g. userInfo.*) and update it if needed.
template/tinyvue/src/views/locale/components/add-locale.vue (3)

6-8: LGTM: Permission-gate i18n batch-remove

v-permission="'i18n::batch-remove'" correctly restricts access to the batch removal action in the locale module and aligns with the PR objective.


66-73: Attribute reordering only

Non-functional attribute shuffle around @click="addLocale". No action needed.


219-228: No-op style change

End-of-file/style formatting adjustment only. No action needed.

Comment on lines 125 to 128
const onBatchRemove = () => {
emits('batchRemove')
emits('batchRemove')
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Type safety bug: missing 'batchRemove' in defineEmits causes TS error

emits('batchRemove') is called, but defineEmits only declares langChange and localChange. In <script lang="ts" setup>, this will produce a type error and can break builds with strict TS settings. Add batchRemove to the emit typings.

Apply:

-  const emits = defineEmits<{
-    langChange: [];
-    localChange: [];
-  }>();
+  const emits = defineEmits<{
+    langChange: [];
+    localChange: [];
+    batchRemove: [];
+  }>();

Optional: if the parent needs context (e.g., current selection), consider emitting a payload now or later:

emits('batchRemove' /*, payload? */)
🤖 Prompt for AI Agents
In template/tinyvue/src/views/locale/components/add-locale.vue around lines
125-128, the component calls emits('batchRemove') but defineEmits only declares
'langChange' and 'localChange', causing a TypeScript type error; update the
defineEmits call in the <script lang="ts" setup> block to include 'batchRemove'
(and, if you intend to pass data, add the appropriate payload type) so the
emitted event is properly typed and the TS build succeeds.

@kagol kagol merged commit 7c484e8 into opentiny:dev Aug 26, 2025
4 of 5 checks passed
kagol added a commit that referenced this pull request Sep 28, 2025
* style: remove console.log (#57)

* feat: change the style of the home page and menu page (#51)

* feat: change the style of the home page and menu page

* feat: revise inspection comments

* feat: Optimize the query table page, add corresponding functions, and modify the overall margin layout of Pro (#50)

* feat: 优化查询表格页面,增加相应功能,修改pro整体边距布局

* feat: 优化数据算法

* fix: 根据意见修改页面查询表格、用户管理、国际化管理页面 (#59)

* fix: 根据意见修改页面查询表格、用户管理、国际化管理页面

* fix: 统一分页pageSizes配置

* fix:修复刷新后表单数据丢失导致校验报错 (#58)

* fix:表单校验以及分页条目修改 (#61)

* feat: 监控页样式修改和解决初始化问题 (#60)

* feat: change the style of the home page and menu page

* feat: revise inspection comments

* feat: 监控页样式修改和解决初始化问题

* feat: 修改表格pageSizes格式

* fix: 表格和弹出框优化 (#62)

* fix: 表格和弹出框优化

* fix: 增加国际化

* feat: 解决查看菜单下级不能展开的问题 (#63)

* fix:i18n (#70)

* fix(web): data struct (#76)

* fix(web): select change (#81)

* fix(web): select change

* feat: uncomment search-box style

* fix(tiny-vue): user-manageer info-tab role id select

* fix(tiny-pro): if role id is undefined will send empty array not [null] (#83)

* fix(nestJS): added lost permissions (#89)

* fix(web): if not batch-remove should not display i18n or user batch-remove button (#90)

* chore: add `--no-frozen-lockfile` (#91)

* chore: release v1.3.0 (#95)

* fix:历史记录功能恢复 (#98)

* fix: fix tabs style (#100)

* fix(web): role table pager (#97)

* fix(web): role table pager

* chore: change default page-size to `10`

* fix(web): role filter (#99)

* feat: 支持初始化低代码设计器

---------

Co-authored-by: GaoNeng <31283122+GaoNeng-wWw@users.noreply.github.com>
Co-authored-by: wuyiping <42107997+wuyiping0628@users.noreply.github.com>
Co-authored-by: chenxi-20 <2465950588@qq.com>
Co-authored-by: liukun <953831480@qq.com>
Co-authored-by: Kagol <kagol@sina.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants