diff --git a/src/AgileConfig.Server.Apisite/Controllers/api/ConfigController.cs b/src/AgileConfig.Server.Apisite/Controllers/api/ConfigController.cs index 5a152c28..4d7bd2fd 100644 --- a/src/AgileConfig.Server.Apisite/Controllers/api/ConfigController.cs +++ b/src/AgileConfig.Server.Apisite/Controllers/api/ConfigController.cs @@ -300,10 +300,6 @@ public async Task Delete(string id, string env) { return (false, "Key不能为空"); } - if (string.IsNullOrEmpty(model.Value)) - { - return (false, "Value不能为空"); - } if (string.IsNullOrEmpty(model.AppId)) { return (false, "AppId不能为空"); diff --git a/src/AgileConfig.Server.Apisite/Models/ConfigVM.cs b/src/AgileConfig.Server.Apisite/Models/ConfigVM.cs index f7fd27c4..9799481d 100644 --- a/src/AgileConfig.Server.Apisite/Models/ConfigVM.cs +++ b/src/AgileConfig.Server.Apisite/Models/ConfigVM.cs @@ -27,7 +27,6 @@ public class ConfigVM: IAppIdModel [MaxLength(100, ErrorMessage = "配置键长度不能超过100位")] public string Key { get; set; } - [Required(ErrorMessage = "配置值不能为空")] [MaxLength(4000, ErrorMessage = "配置值长度不能超过4000位")] public string Value { get; set; } diff --git a/src/AgileConfig.Server.Data.Entity/User.cs b/src/AgileConfig.Server.Data.Entity/User.cs index fa4e94aa..5e04ab4f 100644 --- a/src/AgileConfig.Server.Data.Entity/User.cs +++ b/src/AgileConfig.Server.Data.Entity/User.cs @@ -1,6 +1,5 @@ using FreeSql.DataAnnotations; using System; -using System.Diagnostics; namespace AgileConfig.Server.Data.Entity { @@ -8,10 +7,10 @@ namespace AgileConfig.Server.Data.Entity [OraclePrimaryKeyName("agc_user_pk")] public class User { - [Column(Name = "id", StringLength = 50)] + [Column(Name = "id", StringLength = 256)] public string Id { get; set; } - [Column(Name= "user_name" , StringLength = 50)] + [Column(Name= "user_name" , StringLength = 256)] public string UserName { get; set; } [Column(Name = "password", StringLength = 50)] diff --git a/src/AgileConfig.Server.Service/ConfigService.cs b/src/AgileConfig.Server.Service/ConfigService.cs index 0db34291..2dc9d9b4 100644 --- a/src/AgileConfig.Server.Service/ConfigService.cs +++ b/src/AgileConfig.Server.Service/ConfigService.cs @@ -53,6 +53,11 @@ public async Task IfEnvEmptySetDefaultAsync(string env) public async Task AddAsync(Config config, string env) { + if (config.Value == null) + { + config.Value = ""; + } + using var dbcontext = FreeSqlDbContextFactory.Create(env); await dbcontext.Configs.AddAsync(config); @@ -352,6 +357,13 @@ private void ClearAppPublishedConfigsMd5CacheWithInheritanced(string appId, stri public async Task AddRangeAsync(List configs, string env) { + configs.ForEach(x => { + if (x.Value == null) + { + x.Value = ""; + } + }); + using var dbcontext = FreeSqlDbContextFactory.Create(env); await dbcontext.Configs.AddRangeAsync(configs); diff --git a/src/AgileConfig.Server.UI/react-ui-antd/src/locales/en-US/pages.ts b/src/AgileConfig.Server.UI/react-ui-antd/src/locales/en-US/pages.ts index 9db2f240..062cdeee 100644 --- a/src/AgileConfig.Server.UI/react-ui-antd/src/locales/en-US/pages.ts +++ b/src/AgileConfig.Server.UI/react-ui-antd/src/locales/en-US/pages.ts @@ -169,7 +169,8 @@ export default { 'pages.configs.table.cols.action.offline': 'Offline', 'pages.configs.table.cols.action.history': 'History', - 'pages.configs.from.add.title': 'Create', + 'pages.configs.from.title.add': 'Create', + 'pages.configs.from.title.edit': 'Edit', 'pages.configs.from.add.app': 'App', 'pages.configs.from.importjson.selectfile': 'Select file', diff --git a/src/AgileConfig.Server.UI/react-ui-antd/src/locales/zh-CN/pages.ts b/src/AgileConfig.Server.UI/react-ui-antd/src/locales/zh-CN/pages.ts index 83afd6c1..6e0e0b1e 100644 --- a/src/AgileConfig.Server.UI/react-ui-antd/src/locales/zh-CN/pages.ts +++ b/src/AgileConfig.Server.UI/react-ui-antd/src/locales/zh-CN/pages.ts @@ -167,7 +167,8 @@ export default { 'pages.configs.table.cols.action.offline': '下线', 'pages.configs.table.cols.action.history': '历史', - 'pages.configs.from.add.title': '新建配置', + 'pages.configs.from.title.add': '新建配置', + 'pages.configs.from.title.edit': '编辑配置', 'pages.configs.from.add.app': '应用', 'pages.configs.from.importjson.selectfile': '选择文件', diff --git a/src/AgileConfig.Server.UI/react-ui-antd/src/pages/Configs/comps/updateForm.tsx b/src/AgileConfig.Server.UI/react-ui-antd/src/pages/Configs/comps/updateForm.tsx index 6caeb02c..ce24a224 100644 --- a/src/AgileConfig.Server.UI/react-ui-antd/src/pages/Configs/comps/updateForm.tsx +++ b/src/AgileConfig.Server.UI/react-ui-antd/src/pages/Configs/comps/updateForm.tsx @@ -17,7 +17,7 @@ const UpdateForm : React.FC = (props)=>{ return ( = (props)=>{ { } } formRef={addFormRef} - title={intl.formatMessage({id:'pages.configs.from.add.title'})} + title={intl.formatMessage({id:'pages.configs.from.title.add'})} visible={createModalVisible} onVisibleChange={setCreateModalVisible} onFinish={ @@ -746,7 +746,7 @@ const configs: React.FC = (props: any) => {