Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化应用中,文件夹内的新增按钮,根据文件夹权进行显示 #3195

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

2277419213
Copy link
Contributor

目前文件夹的新增按钮是根据团队的权限,在文件夹内没有权限的话,还是显示新增按钮,要等提交时才会报错没有权限

Copy link

cla-assistant bot commented Nov 20, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


勤劳上班的卑微小张 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

{userInfo?.team.permission.hasWritePer &&
folderDetail?.type !== AppTypeEnum.httpPlugin && (
{(folderDetail?.permission
? folderDetail?.permission.hasWritePer
Copy link
Collaborator

Choose a reason for hiding this comment

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

写法有点问题,可以直接简化 folderDetail?.permission?.hasWritePer && xxx 即可

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不可以吧,如果在文件夹外,folderDetail是空的,也就是folderDetail?.permission?.hasWritePer是空的,会导致按钮出不来,用三目主要是判断在不在文件夹内

Copy link
Collaborator

@c121914yu c121914yu Nov 21, 2024

Choose a reason for hiding this comment

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

噢噢,get。那直接写成或条件好了😂三目运算看着怪怪的,好像也不对,这个写法是,有写权限就能创建。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

或也不对,现在的用户体验是,团队权限是写权限【userInfo?.team.permission.hasWritePer=true】,但是文件夹是读权限【folderDetail?.permission?.hasWritePer=false】,可以看到新增按钮,点击新增出弹窗,输入应用名称,点击任意模板,提示无权限,如果改成(folderDetail?.permission?.hasWritePer || userInfo?.team.permission.hasWritePer && folderDetail?.type !== AppTypeEnum.httpPlugin),没有文件夹权限,但是团队权限有,还是会出来,应该只有三目运算符了

Copy link
Collaborator

Choose a reason for hiding this comment

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

按目前设计的话,应该分两种。

  1. 根目录: 有团队写权限
  2. 目录内: 团队有写权限(后续应该去掉这个),且有目录写权限,且不是 HTTP plugin 目录

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants