-
Notifications
You must be signed in to change notification settings - Fork 66
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
base: main
Are you sure you want to change the base?
Conversation
@@ -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( |
There was a problem hiding this comment.
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="应用在租户层面的可用范围,可选值:全租户、指定租户",
)
There was a problem hiding this comment.
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 文档
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你看岔了,这个是 Serializer :)
There was a problem hiding this 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"): |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你看岔了,这个是 Serializer :)
需要先合入 TE 分支的相关的 PR,再跑单测
checklist: