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

feat: sync tenant infor to the desktop when creating app (including light apps) #1885

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jiayuan929
Copy link
Collaborator

@jiayuan929 jiayuan929 commented Jan 14, 2025

需要先合入 TE 分支的相关的 PR,再跑单测

checklist:

  • 创建应用:上云版功能正常,多租户版本将租户信息同步到桌面
  • 创建轻应用:上云版功能正常,多租户版本将租户信息同步到桌面

@jiayuan929 jiayuan929 closed this Jan 14, 2025
@jiayuan929 jiayuan929 reopened this Jan 14, 2025
@@ -25,6 +26,9 @@ class LightAppCreateSLZ(serializers.Serializer):
app_name = serializers.CharField(
required=True, allow_blank=False, max_length=20, help_text="轻应用名称", source="name"
)
app_tenant_mode = serializers.ChoiceField(
Copy link
Collaborator

Choose a reason for hiding this comment

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

现在都这么定义了,不使用 ChoiceField,减少后续 choices 变化带来的 migration 变动

app_tenant_mode = models.CharField(
        verbose_name="应用租户模式",
        max_length=16,
        default=AppTenantMode.GLOBAL.value,
        help_text="应用在租户层面的可用范围,可选值:全租户、指定租户",
    )

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这个是 slz ,不是 model 定义,用 ChoiceField 方便生成 swagger api 文档

Copy link
Collaborator

Choose a reason for hiding this comment

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

你看岔了,这个是 Serializer :)

Copy link
Collaborator

@piglei piglei left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -163,6 +167,18 @@ def create(
migrated_to_paasv3=0, # 是否已经迁移到Paas3.0
open_mode="new_tab", # 应用打开方式, desktop: 桌面打开, new_tab: 新标签页打开
)
# 桌面的应用表里面已经定义了租户相关字段,则写入
if hasattr(self.model, "app_tenant_mode"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit:不存在时考虑打印日志?

@@ -25,6 +26,9 @@ class LightAppCreateSLZ(serializers.Serializer):
app_name = serializers.CharField(
required=True, allow_blank=False, max_length=20, help_text="轻应用名称", source="name"
)
app_tenant_mode = serializers.ChoiceField(
Copy link
Collaborator

Choose a reason for hiding this comment

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

你看岔了,这个是 Serializer :)

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.

3 participants