From 3dfdcd18fc4efa5858a7b9570cd407d645d2dff2 Mon Sep 17 00:00:00 2001 From: ioito Date: Wed, 9 Mar 2022 11:48:17 +0800 Subject: [PATCH] fix(region): remove nullable tag --- pkg/cloudcommon/db/enabledbase.go | 2 +- pkg/cloudid/models/cloudaccount.go | 2 +- pkg/cloudid/models/cloudpolicy.go | 2 +- pkg/cloudid/models/clouduser.go | 4 ++-- pkg/compute/models/cloudaccounts.go | 4 ++-- pkg/compute/models/deletepreventableresource.go | 2 +- pkg/compute/models/dnsrecords.go | 2 -- pkg/compute/models/dynamicschedtags.go | 2 +- pkg/compute/models/groups.go | 2 +- pkg/compute/models/guests.go | 6 +++--- pkg/compute/models/hosts.go | 2 +- pkg/compute/models/networks.go | 2 +- pkg/compute/models/scalinggroup_guest.go | 2 +- pkg/compute/models/schedpolicies.go | 2 +- pkg/compute/models/skus.go | 4 ++-- pkg/compute/models/storages.go | 7 +------ pkg/image/models/image_guest.go | 2 +- pkg/image/models/images.go | 8 ++++---- pkg/keystone/models/assignments.go | 2 +- pkg/keystone/models/credentials.go | 2 +- pkg/keystone/models/domains.go | 4 ++-- pkg/keystone/models/endpoints.go | 2 +- pkg/keystone/models/identity_provider.go | 8 ++++---- pkg/keystone/models/identitybase.go | 2 +- pkg/keystone/models/localusers.go | 2 +- pkg/keystone/models/policies.go | 2 +- pkg/keystone/models/projects.go | 2 +- pkg/keystone/models/rolepolicies.go | 2 +- pkg/keystone/models/services.go | 2 +- pkg/keystone/models/users.go | 6 +++--- pkg/monitor/models/datasource.go | 2 +- pkg/notify/models/receiver.go | 8 ++++---- pkg/notify/models/subcontact.go | 4 ++-- 33 files changed, 50 insertions(+), 57 deletions(-) diff --git a/pkg/cloudcommon/db/enabledbase.go b/pkg/cloudcommon/db/enabledbase.go index a6ac8a13d0..652c7aab4a 100644 --- a/pkg/cloudcommon/db/enabledbase.go +++ b/pkg/cloudcommon/db/enabledbase.go @@ -30,7 +30,7 @@ type SEnabledResourceBaseManager struct{} type SEnabledResourceBase struct { // 资源是否启用 - Enabled tristate.TriState `nullable:"false" default:"false" list:"user" create:"optional"` + Enabled tristate.TriState `default:"false" list:"user" create:"optional"` } type IEnabledBase interface { diff --git a/pkg/cloudid/models/cloudaccount.go b/pkg/cloudid/models/cloudaccount.go index da236560c0..bebbbfeb80 100644 --- a/pkg/cloudid/models/cloudaccount.go +++ b/pkg/cloudid/models/cloudaccount.go @@ -76,7 +76,7 @@ type SCloudaccount struct { Provider string `width:"64" charset:"ascii" list:"domain"` Brand string `width:"64" charset:"utf8" nullable:"true" list:"domain"` IamLoginUrl string `width:"512" charset:"ascii"` - SAMLAuth tristate.TriState `nullable:"false" list:"domain" default:"false"` + SAMLAuth tristate.TriState `list:"domain" default:"false"` AccessUrl string `width:"64" charset:"ascii" nullable:"true" list:"domain" update:"domain" create:"domain_optional"` } diff --git a/pkg/cloudid/models/cloudpolicy.go b/pkg/cloudid/models/cloudpolicy.go index b932133700..9c64a3da1e 100644 --- a/pkg/cloudid/models/cloudpolicy.go +++ b/pkg/cloudid/models/cloudpolicy.go @@ -80,7 +80,7 @@ type SCloudpolicy struct { Document *jsonutils.JSONDict `length:"long" charset:"ascii" list:"domain" update:"domain" create:"domain_required"` // 是否锁定, 若锁定后, 此策略不允许被绑定到用户或权限组, 仅管理员可以设置是否锁定 - Locked tristate.TriState `nullable:"false" get:"user" create:"optional" list:"user" default:"false"` + Locked tristate.TriState `get:"user" create:"optional" list:"user" default:"false"` CloudEnv string `width:"64" charset:"ascii" list:"domain" create:"domain_required"` } diff --git a/pkg/cloudid/models/clouduser.go b/pkg/cloudid/models/clouduser.go index a94054d499..97f11dcfa6 100644 --- a/pkg/cloudid/models/clouduser.go +++ b/pkg/cloudid/models/clouduser.go @@ -72,11 +72,11 @@ type SClouduser struct { Secret string `length:"0" charset:"ascii" nullable:"true" list:"user" create:"domain_optional"` // 是否可以控制台登录 - IsConsoleLogin tristate.TriState `nullable:"false" default:"false" list:"user" create:"optional"` + IsConsoleLogin tristate.TriState `default:"false" list:"user" create:"optional"` // 手机号码 MobilePhone string `width:"36" charset:"ascii" nullable:"true" list:"user" create:"domain_optional"` // 邮箱地址 - Email string `width:"36" charset:"ascii" nullable:"true" list:"user" create:"domain_optional"` + Email string `width:"36" charset:"ascii" list:"user" create:"domain_optional"` } func (manager *SClouduserManager) EnableGenerateName() bool { diff --git a/pkg/compute/models/cloudaccounts.go b/pkg/compute/models/cloudaccounts.go index 830fafc254..236f7aa2f4 100644 --- a/pkg/compute/models/cloudaccounts.go +++ b/pkg/compute/models/cloudaccounts.go @@ -101,7 +101,7 @@ type SCloudaccount struct { // 是否是公有云账号 // example: true - IsPublicCloud tristate.TriState `nullable:"false" get:"user" create:"optional" list:"user" default:"true"` + IsPublicCloud tristate.TriState `get:"user" create:"optional" list:"user" default:"true"` // 是否是本地IDC账号 // example: false @@ -161,7 +161,7 @@ type SCloudaccount struct { // 公有云子账号登录地址 IamLoginUrl string `width:"512" charset:"ascii" nullable:"false" list:"domain" update:"domain"` - SAMLAuth tristate.TriState `nullable:"false" get:"user" update:"domain" create:"optional" list:"user" default:"false"` + SAMLAuth tristate.TriState `get:"user" update:"domain" create:"optional" list:"user" default:"false"` vmwareHostWireCache map[string][]SVs2Wire SProjectMappingResourceBase diff --git a/pkg/compute/models/deletepreventableresource.go b/pkg/compute/models/deletepreventableresource.go index 5ffe617b4d..3cab6148e3 100644 --- a/pkg/compute/models/deletepreventableresource.go +++ b/pkg/compute/models/deletepreventableresource.go @@ -28,7 +28,7 @@ import ( type SDeletePreventableResourceBase struct { // 是否开启删除保护 // example: true - DisableDelete tristate.TriState `nullable:"false" default:"true" list:"user" update:"user" create:"optional" json:"disable_delete"` + DisableDelete tristate.TriState `default:"true" list:"user" update:"user" create:"optional" json:"disable_delete"` } type SDeletePreventableResourceBaseManager struct{} diff --git a/pkg/compute/models/dnsrecords.go b/pkg/compute/models/dnsrecords.go index e718397da3..5379f21174 100644 --- a/pkg/compute/models/dnsrecords.go +++ b/pkg/compute/models/dnsrecords.go @@ -63,8 +63,6 @@ type SDnsRecord struct { // DNS记录的过期时间,单位为秒 // example: 60 Ttl int `nullable:"true" default:"1" create:"optional" list:"user" update:"user" json:"ttl"` - - //Enabled tristate.TriState `nullable:"false" default:"true" create:"optional" list:"user"` } // GetRecordsSeparator implements IAdminSharableVirtualModelManager diff --git a/pkg/compute/models/dynamicschedtags.go b/pkg/compute/models/dynamicschedtags.go index 94c58975d3..019661b4d2 100644 --- a/pkg/compute/models/dynamicschedtags.go +++ b/pkg/compute/models/dynamicschedtags.go @@ -110,7 +110,7 @@ type SDynamicschedtag struct { // 动态调度标签对应的调度标签 // SchedtagId string `width:"36" charset:"ascii" nullable:"false" list:"user" create:"required" update:"admin"` - Enabled tristate.TriState `nullable:"false" default:"true" create:"optional" list:"user" update:"user"` + Enabled tristate.TriState `default:"true" create:"optional" list:"user" update:"user"` } func validateDynamicSchedtagInputData(data *jsonutils.JSONDict, create bool) error { diff --git a/pkg/compute/models/groups.go b/pkg/compute/models/groups.go index e1ef76e671..0870213c50 100644 --- a/pkg/compute/models/groups.go +++ b/pkg/compute/models/groups.go @@ -89,7 +89,7 @@ type SGroup struct { Granularity int `nullable:"false" list:"user" get:"user" create:"optional" update:"user" default:"1"` ForceDispersion tristate.TriState `list:"user" get:"user" create:"optional" update:"user" default:"true"` // 是否启用 - // Enabled tristate.TriState `nullable:"false" default:"true" create:"optional" list:"user" update:"user"` + // Enabled tristate.TriState `default:"true" create:"optional" list:"user" update:"user"` } // 主机组列表 diff --git a/pkg/compute/models/guests.go b/pkg/compute/models/guests.go index 033818cbe4..11609b55a8 100644 --- a/pkg/compute/models/guests.go +++ b/pkg/compute/models/guests.go @@ -145,8 +145,8 @@ type SGuest struct { // 管理员可见安全组Id AdminSecgrpId string `width:"36" charset:"ascii" nullable:"true" list:"domain" get:"domain"` - SrcIpCheck tristate.TriState `nullable:"false" default:"true" create:"optional" list:"user" update:"user"` - SrcMacCheck tristate.TriState `nullable:"false" default:"true" create:"optional" list:"user" update:"user"` + SrcIpCheck tristate.TriState `default:"true" create:"optional" list:"user" update:"user"` + SrcMacCheck tristate.TriState `default:"true" create:"optional" list:"user" update:"user"` // 虚拟化技术 // example: kvm @@ -155,7 +155,7 @@ type SGuest struct { // 套餐名称 InstanceType string `width:"64" charset:"utf8" nullable:"true" list:"user" create:"optional"` - SshableLastState tristate.TriState `nullable:"false" default:"false" list:"user"` + SshableLastState tristate.TriState `default:"false" list:"user"` } // 云主机实例列表 diff --git a/pkg/compute/models/hosts.go b/pkg/compute/models/hosts.go index 9a2592eaed..4efd304391 100644 --- a/pkg/compute/models/hosts.go +++ b/pkg/compute/models/hosts.go @@ -182,7 +182,7 @@ type SHost struct { IsImport bool `nullable:"true" default:"false" list:"domain" create:"domain_optional"` // 是否允许PXE启动 - EnablePxeBoot tristate.TriState `nullable:"false" default:"true" list:"domain" create:"domain_optional" update:"domain"` + EnablePxeBoot tristate.TriState `default:"true" list:"domain" create:"domain_optional" update:"domain"` // 主机UUID Uuid string `width:"64" nullable:"true" list:"domain" update:"domain" create:"domain_optional"` diff --git a/pkg/compute/models/networks.go b/pkg/compute/models/networks.go index 883693be02..8fefa0eb10 100644 --- a/pkg/compute/models/networks.go +++ b/pkg/compute/models/networks.go @@ -144,7 +144,7 @@ type SNetwork struct { // 该网段是否用于自动分配IP地址,如果为false,则用户需要明确选择该网段,才会使用该网段分配IP, // 如果为true,则用户不指定网段时,则自动从该值为true的网络中选择一个分配地址 - IsAutoAlloc tristate.TriState `nullable:"true" list:"user" get:"user" update:"user" create:"optional"` + IsAutoAlloc tristate.TriState `list:"user" get:"user" update:"user" create:"optional"` // 线路类型 BgpType string `width:"64" charset:"utf8" nullable:"false" list:"user" get:"user" update:"user" create:"optional"` diff --git a/pkg/compute/models/scalinggroup_guest.go b/pkg/compute/models/scalinggroup_guest.go index 00f79e7878..7c1edbadfd 100644 --- a/pkg/compute/models/scalinggroup_guest.go +++ b/pkg/compute/models/scalinggroup_guest.go @@ -52,7 +52,7 @@ type SScalingGroupGuest struct { ScalingGroupId string `width:"36" charset:"ascii" nullable:"false"` GuestStatus string `width:"36" charset:"ascii" nullable:"false" index:"true"` - Manual tristate.TriState `nullable:"false" default:"false"` + Manual tristate.TriState `default:"false"` } func (sggm *SScalingGroupGuestManager) GetSlaveFieldName() string { diff --git a/pkg/compute/models/schedpolicies.go b/pkg/compute/models/schedpolicies.go index 94160d0939..ea6fbaf1d7 100644 --- a/pkg/compute/models/schedpolicies.go +++ b/pkg/compute/models/schedpolicies.go @@ -61,7 +61,7 @@ type SSchedpolicy struct { Condition string `width:"1024" charset:"ascii" nullable:"false" list:"user" create:"required" update:"user"` Strategy string `width:"32" charset:"ascii" nullable:"false" list:"user" create:"required" update:"user"` - Enabled tristate.TriState `nullable:"false" default:"true" create:"optional" list:"user" update:"user"` + Enabled tristate.TriState `default:"true" create:"optional" list:"user" update:"user"` } func validateSchedpolicyInputData(data *jsonutils.JSONDict, create bool) error { diff --git a/pkg/compute/models/skus.go b/pkg/compute/models/skus.go index 260daeba5a..7414c1d382 100644 --- a/pkg/compute/models/skus.go +++ b/pkg/compute/models/skus.go @@ -94,7 +94,7 @@ type SServerSku struct { OsName string `width:"32" charset:"ascii" nullable:"true" list:"user" create:"admin_optional" update:"admin" default:"Any"` // Windows|Linux|Any - SysDiskResizable tristate.TriState `default:"true" nullable:"true" list:"user" create:"admin_optional" update:"admin"` + SysDiskResizable tristate.TriState `default:"true" list:"user" create:"admin_optional" update:"admin"` SysDiskType string `width:"128" charset:"ascii" nullable:"true" list:"user" create:"admin_optional" update:"admin"` SysDiskMinSizeGB int `nullable:"true" list:"user" create:"admin_optional" update:"admin"` // not required。 windows比较新的版本都是50G左右。 SysDiskMaxSizeGB int `nullable:"true" list:"user" create:"admin_optional" update:"admin"` // not required @@ -109,7 +109,7 @@ type SServerSku struct { NicType string `nullable:"true" list:"user" create:"admin_optional" update:"admin"` NicMaxCount int `default:"1" nullable:"true" list:"user" create:"admin_optional" update:"admin"` - GpuAttachable tristate.TriState `default:"true" nullable:"true" list:"user" create:"admin_optional" update:"admin"` + GpuAttachable tristate.TriState `default:"true" list:"user" create:"admin_optional" update:"admin"` GpuSpec string `width:"128" charset:"ascii" nullable:"true" list:"user" create:"admin_optional" update:"admin"` GpuCount int `nullable:"true" list:"user" create:"admin_optional" update:"admin"` GpuMaxCount int `nullable:"true" list:"user" create:"admin_optional" update:"admin"` diff --git a/pkg/compute/models/storages.go b/pkg/compute/models/storages.go index 5c111cd785..d30feb15d7 100644 --- a/pkg/compute/models/storages.go +++ b/pkg/compute/models/storages.go @@ -92,15 +92,10 @@ type SStorage struct { // 存储缓存Id StoragecacheId string `width:"36" charset:"ascii" nullable:"true" list:"domain" get:"domain" update:"domain" create:"domain_optional"` - // 是否启用 - // Enabled tristate.TriState `nullable:"false" default:"true" list:"user" create:"optional"` - // 状态 - // Status string `width:"36" charset:"ascii" nullable:"false" default:"offline" update:"domain" list:"user" create:"optional"` - // indicating whether system disk can be allocated in this storage // 是否可以用作系统盘存储 // example: true - IsSysDiskStore tristate.TriState `nullable:"false" default:"true" list:"user" create:"optional" update:"domain"` + IsSysDiskStore tristate.TriState `default:"true" list:"user" create:"optional" update:"domain"` } func (manager *SStorageManager) GetContextManagers() [][]db.IModelManager { diff --git a/pkg/image/models/image_guest.go b/pkg/image/models/image_guest.go index 88362e4db6..69953c6204 100644 --- a/pkg/image/models/image_guest.go +++ b/pkg/image/models/image_guest.go @@ -68,7 +68,7 @@ type SGuestImage struct { db.SSharableVirtualResourceBase db.SMultiArchResourceBase - Protected tristate.TriState `nullable:"false" default:"true" list:"user" get:"user" create:"optional" update:"user"` + Protected tristate.TriState `default:"true" list:"user" get:"user" create:"optional" update:"user"` } func (manager *SGuestImageManager) ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, diff --git a/pkg/image/models/images.go b/pkg/image/models/images.go index fe1482af7d..628235c9fe 100644 --- a/pkg/image/models/images.go +++ b/pkg/image/models/images.go @@ -130,13 +130,13 @@ type SImage struct { MinRamMB int32 `name:"min_ram" nullable:"false" default:"0" list:"user" create:"optional" update:"user"` // 是否有删除保护 - Protected tristate.TriState `nullable:"false" default:"true" list:"user" get:"user" create:"optional" update:"user"` + Protected tristate.TriState `default:"true" list:"user" get:"user" create:"optional" update:"user"` // 是否是标准镜像 - IsStandard tristate.TriState `nullable:"false" default:"false" list:"user" get:"user" create:"admin_optional" update:"user"` + IsStandard tristate.TriState `default:"false" list:"user" get:"user" create:"admin_optional" update:"user"` // 是否是主机镜像 - IsGuestImage tristate.TriState `nullable:"false" default:"false" create:"optional" list:"user"` + IsGuestImage tristate.TriState `default:"false" create:"optional" list:"user"` // 是否是数据盘镜像 - IsData tristate.TriState `nullable:"false" default:"false" create:"optional" list:"user"` + IsData tristate.TriState `default:"false" create:"optional" list:"user"` // image copy from url, save origin checksum before probe // 从镜像时长导入的镜像校验和 diff --git a/pkg/keystone/models/assignments.go b/pkg/keystone/models/assignments.go index 6c418fe02e..7416d8e2e3 100644 --- a/pkg/keystone/models/assignments.go +++ b/pkg/keystone/models/assignments.go @@ -75,7 +75,7 @@ type SAssignment struct { TargetId string `width:"64" charset:"ascii" nullable:"false" primary:"true" list:"admin"` RoleId string `width:"64" charset:"ascii" nullable:"false" primary:"true" list:"admin"` - Inherited tristate.TriState `nullable:"false" primary:"true" list:"admin"` + Inherited tristate.TriState `primary:"true" list:"admin"` } func (manager *SAssignmentManager) InitializeData() error { diff --git a/pkg/keystone/models/credentials.go b/pkg/keystone/models/credentials.go index 3554795602..f34f3a9214 100644 --- a/pkg/keystone/models/credentials.go +++ b/pkg/keystone/models/credentials.go @@ -81,7 +81,7 @@ type SCredential struct { EncryptedBlob string `nullable:"false" create:"required"` - Enabled tristate.TriState `nullable:"false" default:"true" list:"user" update:"user" create:"optional"` + Enabled tristate.TriState `default:"true" list:"user" update:"user" create:"optional"` } func (manager *SCredentialManager) InitializeData() error { diff --git a/pkg/keystone/models/domains.go b/pkg/keystone/models/domains.go index 99d88a48f6..16b1a349e0 100644 --- a/pkg/keystone/models/domains.go +++ b/pkg/keystone/models/domains.go @@ -60,8 +60,8 @@ type SDomain struct { Extra *jsonutils.JSONDict `nullable:"true"` - Enabled tristate.TriState `nullable:"false" default:"true" list:"admin" update:"admin" create:"admin_optional"` - IsDomain tristate.TriState `default:"false" nullable:"false"` + Enabled tristate.TriState `default:"true" list:"admin" update:"admin" create:"admin_optional"` + IsDomain tristate.TriState `default:"false"` // IdpId string `token:"parent_id" width:"64" charset:"ascii" index:"true" list:"admin"` diff --git a/pkg/keystone/models/endpoints.go b/pkg/keystone/models/endpoints.go index 0c58ad2b7f..623609a687 100644 --- a/pkg/keystone/models/endpoints.go +++ b/pkg/keystone/models/endpoints.go @@ -90,7 +90,7 @@ type SEndpoint struct { ServiceId string `width:"64" charset:"ascii" nullable:"false" list:"admin" create:"admin_required"` Url string `charset:"utf8" nullable:"false" list:"admin" update:"admin" create:"admin_required"` Extra *jsonutils.JSONDict `nullable:"true"` - Enabled tristate.TriState `nullable:"false" default:"true" list:"admin" update:"admin" create:"admin_optional"` + Enabled tristate.TriState `default:"true" list:"admin" update:"admin" create:"admin_optional"` RegionId string `width:"255" charset:"utf8" nullable:"true" list:"admin" create:"admin_required"` ServiceCertificateId string `nullable:"true" create:"admin_optional" update:"admin"` } diff --git a/pkg/keystone/models/identity_provider.go b/pkg/keystone/models/identity_provider.go index 3636e969eb..0d20b56fe2 100644 --- a/pkg/keystone/models/identity_provider.go +++ b/pkg/keystone/models/identity_provider.go @@ -89,9 +89,9 @@ type SIdentityProvider struct { TargetDomainId string `width:"64" charset:"ascii" nullable:"true" list:"domain" create:"admin_optional"` // 是否自动创建项目 - AutoCreateProject tristate.TriState `default:"true" nullable:"true" list:"domain" create:"domain_optional" update:"domain"` + AutoCreateProject tristate.TriState `default:"true" list:"domain" create:"domain_optional" update:"domain"` // 是否自动创建用户 - AutoCreateUser tristate.TriState `nullable:"true" list:"domain" create:"domain_optional" update:"domain"` + AutoCreateUser tristate.TriState `list:"domain" create:"domain_optional" update:"domain"` ErrorCount int `list:"domain"` @@ -104,9 +104,9 @@ type SIdentityProvider struct { // 认证源图标 IconUri string `width:"256" charset:"utf8" nullable:"true" list:"user" create:"domain_optional" update:"domain"` // 是否是SSO登录方式 - IsSso tristate.TriState `nullable:"true" list:"domain"` + IsSso tristate.TriState `list:"domain"` // 是否是缺省SSO登录方式 - IsDefault tristate.TriState `nullable:"true" list:"domain"` + IsDefault tristate.TriState `list:"domain"` } func (manager *SIdentityProviderManager) initializeAutoCreateUser() error { diff --git a/pkg/keystone/models/identitybase.go b/pkg/keystone/models/identitybase.go index 07138f58d9..0cda9fc9e2 100644 --- a/pkg/keystone/models/identitybase.go +++ b/pkg/keystone/models/identitybase.go @@ -81,7 +81,7 @@ func NewEnabledIdentityBaseResourceManager(dt interface{}, tableName string, key type SEnabledIdentityBaseResource struct { SIdentityBaseResource - Enabled tristate.TriState `nullable:"false" default:"true" list:"user" update:"domain" create:"domain_optional"` + Enabled tristate.TriState `default:"true" list:"user" update:"domain" create:"domain_optional"` } func (model *SIdentityBaseResource) GetIIdentityModelManager() IIdentityModelManager { diff --git a/pkg/keystone/models/localusers.go b/pkg/keystone/models/localusers.go index aec89b90d9..95a77c4a64 100644 --- a/pkg/keystone/models/localusers.go +++ b/pkg/keystone/models/localusers.go @@ -69,7 +69,7 @@ type SLocalUser struct { FailedAuthCount int `nullable:"true"` FailedAuthAt time.Time `nullable:"true"` - NeedResetPassword tristate.TriState `nullable:"false" default:"false" list:"domain"` + NeedResetPassword tristate.TriState `default:"false" list:"domain"` } func (user *SLocalUser) GetId() string { diff --git a/pkg/keystone/models/policies.go b/pkg/keystone/models/policies.go index 77c7f5a75b..3752267914 100644 --- a/pkg/keystone/models/policies.go +++ b/pkg/keystone/models/policies.go @@ -87,7 +87,7 @@ type SPolicy struct { Scope rbacutils.TRbacScope `nullable:"true" list:"user" create:"domain_required" update:"domain"` // 是否为系统权限 - IsSystem tristate.TriState `nullable:"false" default:"false" list:"domain" update:"admin" create:"admin_optional"` + IsSystem tristate.TriState `default:"false" list:"domain" update:"admin" create:"admin_optional"` // 匹配的项目标签 ProjectTags tagutils.TTagSet `nullable:"true" list:"user" update:"domain" create:"domain_optional"` diff --git a/pkg/keystone/models/projects.go b/pkg/keystone/models/projects.go index 129f8f5a58..fe8cba7384 100644 --- a/pkg/keystone/models/projects.go +++ b/pkg/keystone/models/projects.go @@ -79,7 +79,7 @@ type SProject struct { ParentId string `width:"64" charset:"ascii" list:"domain" create:"domain_optional"` - IsDomain tristate.TriState `default:"false" nullable:"false"` + IsDomain tristate.TriState `default:"false"` } func (manager *SProjectManager) GetContextManagers() [][]db.IModelManager { diff --git a/pkg/keystone/models/rolepolicies.go b/pkg/keystone/models/rolepolicies.go index 07137aebc4..e7bbb617d4 100644 --- a/pkg/keystone/models/rolepolicies.go +++ b/pkg/keystone/models/rolepolicies.go @@ -65,7 +65,7 @@ type SRolePolicy struct { // 权限ID, 主键 PolicyId string `width:"128" charset:"ascii" primary:"true" list:"domain" create:"domain_required"` // 是否需要认证 - Auth tristate.TriState `nullable:"false" default:"true" list:"domain" create:"domain_optional"` + Auth tristate.TriState `default:"true" list:"domain" create:"domain_optional"` // 匹配的IP白名单 Ips string `list:"domain" create:"domain_optional" update:"domain"` // 匹配开始时间 diff --git a/pkg/keystone/models/services.go b/pkg/keystone/models/services.go index c0c7d62bb4..ea5e29c1d4 100644 --- a/pkg/keystone/models/services.go +++ b/pkg/keystone/models/services.go @@ -68,7 +68,7 @@ type SService struct { db.SStandaloneResourceBase Type string `width:"255" charset:"utf8" list:"admin" create:"admin_required"` - Enabled tristate.TriState `nullable:"false" default:"true" list:"admin" update:"admin" create:"admin_optional"` + Enabled tristate.TriState `default:"true" list:"admin" update:"admin" create:"admin_optional"` Extra *jsonutils.JSONDict `nullable:"true" list:"admin"` ConfigVersion int `list:"admin" nullable:"false" default:"0"` diff --git a/pkg/keystone/models/users.go b/pkg/keystone/models/users.go index 764f752c45..6cc561719a 100644 --- a/pkg/keystone/models/users.go +++ b/pkg/keystone/models/users.go @@ -88,13 +88,13 @@ type SUser struct { LastLoginIp string `nullable:"true" list:"domain"` LastLoginSource string `nullable:"true" list:"domain"` - IsSystemAccount tristate.TriState `nullable:"false" default:"false" list:"domain" update:"admin" create:"admin_optional"` + IsSystemAccount tristate.TriState `default:"false" list:"domain" update:"admin" create:"admin_optional"` // deprecated DefaultProjectId string `width:"64" charset:"ascii" nullable:"true"` - AllowWebConsole tristate.TriState `nullable:"false" default:"true" list:"domain" update:"domain" create:"domain_optional"` - EnableMfa tristate.TriState `nullable:"false" default:"false" list:"domain" update:"domain" create:"domain_optional"` + AllowWebConsole tristate.TriState `default:"true" list:"domain" update:"domain" create:"domain_optional"` + EnableMfa tristate.TriState `default:"false" list:"domain" update:"domain" create:"domain_optional"` Lang string `width:"8" charset:"ascii" nullable:"false" list:"domain" update:"domain" create:"domain_optional"` } diff --git a/pkg/monitor/models/datasource.go b/pkg/monitor/models/datasource.go index 5a3e99ef1a..9165e3bb72 100644 --- a/pkg/monitor/models/datasource.go +++ b/pkg/monitor/models/datasource.go @@ -153,7 +153,7 @@ type SDataSource struct { User string `width:"64" charset:"utf8" nullable:"true"` Password string `width:"64" charset:"utf8" nullable:"true"` Database string `width:"64" charset:"utf8" nullable:"true"` - IsDefault tristate.TriState `nullable:"false" default:"false" create:"optional"` + IsDefault tristate.TriState `default:"false" create:"optional"` /* TimeInterval string BasicAuth bool diff --git a/pkg/notify/models/receiver.go b/pkg/notify/models/receiver.go index 33d2c22a0d..652aef0f9d 100644 --- a/pkg/notify/models/receiver.go +++ b/pkg/notify/models/receiver.go @@ -101,14 +101,14 @@ type SReceiver struct { Lang string `width:"8" charset:"ascii" nullable:"false" list:"user" update:"user"` // swagger:ignore - EnabledEmail tristate.TriState `nullable:"false" default:"false" update:"user"` + EnabledEmail tristate.TriState `default:"false" update:"user"` // swagger:ignore - VerifiedEmail tristate.TriState `nullable:"false" default:"false" update:"user"` + VerifiedEmail tristate.TriState `default:"false" update:"user"` // swagger:ignore - EnabledMobile tristate.TriState `nullable:"false" default:"false" update:"user"` + EnabledMobile tristate.TriState `default:"false" update:"user"` // swagger:ignore - VerifiedMobile tristate.TriState `nullable:"false" default:"false" update:"user"` + VerifiedMobile tristate.TriState `default:"false" update:"user"` // swagger:ignore subContactCache map[string]*SSubContact `json:"-"` diff --git a/pkg/notify/models/subcontact.go b/pkg/notify/models/subcontact.go index 2949e209a8..c2cef2723c 100644 --- a/pkg/notify/models/subcontact.go +++ b/pkg/notify/models/subcontact.go @@ -33,8 +33,8 @@ type SSubContact struct { Type string `width:"16" nullable:"false" index:"true"` Contact string `width:"128" nullable:"false"` ParentContactType string `width:"16" nullable:"false"` - Enabled tristate.TriState `nullable:"false" default:"false"` - Verified tristate.TriState `nullable:"false" default:"false"` + Enabled tristate.TriState `default:"false"` + Verified tristate.TriState `default:"false"` VerifiedNote string `width:"1024"` }