diff --git a/Documents/SCRIPTS_MSSQL.md b/Documents/SCRIPTS_MSSQL.md index 3e80d8d..4ab7373 100644 --- a/Documents/SCRIPTS_MSSQL.md +++ b/Documents/SCRIPTS_MSSQL.md @@ -40,8 +40,8 @@ GO ```sql CREATE TABLE [configuration] ( - [Id] bigint NOT NULL, - [TeamId] varchar(32) NOT NULL, + [Id] varchar(32) NOT NULL, + [TeamId] varchar(32) NOT NULL, [Name] varchar(100) NOT NULL, [Secret] varchar(255) NOT NULL, [Description] varchar(500) NULL, @@ -83,33 +83,21 @@ GO ```sql CREATE TABLE [configuration_archive] ( - [Id] bigint NOT NULL, - [AppId] varchar(32) NOT NULL, - [Environment] varchar(50) NOT NULL, + [Id] varchar(32) NOT NULL, [Data] text NULL, [Operator] varchar(64) NOT NULL, [ArchiveTime] datetime NOT NULL, PRIMARY KEY CLUSTERED ([Id]) ) GO - -ALTER TABLE [configuration_archive] SET (LOCK_ESCALATION = TABLE) -GO - -CREATE UNIQUE NONCLUSTERED INDEX [IDX_CONFIG_ARCHIVE_UNIQUE] -ON [configuration_archive] ( - [AppId] ASC, - [Environment] ASC -) -GO ``` # configuration_item ```sql CREATE TABLE [configuration_item] ( - [Id] bigint NOT NULL, - [ConfigurationId] bigint NOT NULL, + [Id] bigint NOT NULL, + [ConfigurationId] varchar(32) NOT NULL, [Key] varchar(255) NOT NULL, [Value] text NULL, [UpdateTime] datetime DEFAULT getdate() NOT NULL, @@ -139,10 +127,10 @@ GO ```sql CREATE TABLE [configuration_revision] ( - [Id] bigint NOT NULL, - [ConfigurationId] bigint NOT NULL, + [Id] bigint NOT NULL, + [ConfigurationId] varchar(32) NOT NULL, [Data] text NULL, - [Comment] varchar(1000) COLLATE SQL_Latin1_General_CP1_CI_AS DEFAULT NULL NULL, + [Comment] varchar(1000) NULL, [Version] varchar(25) NOT NULL, [Operator] varchar(64) NOT NULL, [CreateTime] datetime DEFAULT getdate() NOT NULL, @@ -260,6 +248,7 @@ CREATE TABLE [user] ( [AccessFailedCount] int NOT NULL, [LockoutEnd] datetime DEFAULT NULL NULL, [Reserved] bit DEFAULT 0 NOT NULL, + [IsAdmin] bit DEFAULT 0 NOT NULL, [Source] int NOT NULL, [CreateTime] datetime getdate() NOT NULL, [UpdateTime] datetime getdate() NOT NULL, @@ -289,26 +278,4 @@ ON [user] ( [Phone] ASC ) GO -``` - -# user_role - -```sql -CREATE TABLE [user_role] ( - [Id] bigint NOT NULL, - [UserId] varchar(32) NOT NULL, - [Name] varchar(100) NOT NULL, - PRIMARY KEY CLUSTERED ([Id]) -) -GO - -ALTER TABLE [user_role] SET (LOCK_ESCALATION = TABLE) -GO - -CREATE UNIQUE NONCLUSTERED INDEX [IDX_USER_ROLE_UNIQUE] -ON [user_role] ( - [UserId] ASC, - [Name] ASC -) -GO ``` \ No newline at end of file diff --git a/Documents/SCRIPTS_MYSQL.md b/Documents/SCRIPTS_MYSQL.md index d915de3..15290ec 100644 --- a/Documents/SCRIPTS_MYSQL.md +++ b/Documents/SCRIPTS_MYSQL.md @@ -149,6 +149,7 @@ CREATE TABLE `user` ( `AccessFailedCount` int NOT NULL DEFAULT 0, `LockoutEnd` datetime NULL DEFAULT NULL, `Reserved` bit(1) NOT NULL DEFAULT b'0', + `IsAdmin` bit(1) NOT NULL DEFAULT b'0', `Source` int NOT NULL, `CreateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `UpdateTime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, @@ -159,16 +160,4 @@ CREATE TABLE `user` ( UNIQUE INDEX `IDX_USER_EMAIL`(`Email` ASC) USING BTREE, UNIQUE INDEX `IDX_USER_PHONE`(`Phone` ASC) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic; -``` - -# user_role - -```sql -CREATE TABLE `user_role` ( - `Id` bigint NOT NULL, - `UserId` varchar(32) NOT NULL, - `Name` varchar(100) NOT NULL, - PRIMARY KEY (`Id`) USING BTREE, - UNIQUE INDEX `IDX_USER_ROLE_UNIQUE`(`UserId` ASC, `Name` ASC) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic; ``` \ No newline at end of file diff --git a/Documents/SCRIPTS_PGSQL.md b/Documents/SCRIPTS_PGSQL.md index e093293..c16ba7a 100644 --- a/Documents/SCRIPTS_PGSQL.md +++ b/Documents/SCRIPTS_PGSQL.md @@ -29,7 +29,7 @@ CREATE INDEX "IDX_OPERATE_LOG_USER_NAME" ON "public"."operate_log" USING btree ( ```sql CREATE TABLE "public"."configuration" ( - "Id" int8 NOT NULL, + "Id" varchar(32) COLLATE "pg_catalog"."default" NOT NULL, "TeamId" varchar(32) COLLATE "pg_catalog"."default" NOT NULL, "Name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL, "Secret" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, @@ -60,7 +60,7 @@ CREATE UNIQUE INDEX "IDX_CONFIG_UNIQUE" ON "public"."configuration" USING btree ```sql CREATE TABLE "public"."configuration_archive" ( - "Id" int8 NOT NULL, + "Id" varchar(32) COLLATE "pg_catalog"."default" NOT NULL, "AppId" varchar(32) COLLATE "pg_catalog"."default" NOT NULL, "Environment" varchar(50) COLLATE "pg_catalog"."default" NOT NULL, "Data" text COLLATE "pg_catalog"."default", @@ -69,11 +69,6 @@ CREATE TABLE "public"."configuration_archive" ( PRIMARY KEY ("Id") ) ; - -CREATE UNIQUE INDEX "IDX_CONFIG_ARCHIVE_UNIQUE" ON "public"."configuration_archive" USING btree ( - "AppId" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, - "Environment" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST -); ``` # configuration_item @@ -81,7 +76,7 @@ CREATE UNIQUE INDEX "IDX_CONFIG_ARCHIVE_UNIQUE" ON "public"."configuration_archi ```sql CREATE TABLE "public"."configuration_item" ( "Id" int8 NOT NULL, - "ConfigurationId" int8 NOT NULL, + "ConfigurationId" varchar(32) COLLATE "pg_catalog"."default" NOT NULL, "Key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, "Value" text COLLATE "pg_catalog"."default", "UpdatedTime" timestamp(6) NOT NULL, @@ -104,7 +99,7 @@ CREATE UNIQUE INDEX "IDX_CONFIG_ITEM_UNIQUE" ON "public"."configuration_item" US ```sql CREATE TABLE "public"."configuration_revision" ( "Id" int8 NOT NULL, - "ConfigurationId" int8 NOT NULL, + "ConfigurationId" varchar(32) COLLATE "pg_catalog"."default" NOT NULL, "Data" text COLLATE "pg_catalog"."default", "Comment" varchar(1000) COLLATE "pg_catalog"."default", "Version" varchar(25) COLLATE "pg_catalog"."default" NOT NULL, @@ -198,6 +193,7 @@ CREATE TABLE "public"."user" ( "AccessFailedCount" int4 NOT NULL DEFAULT 0, "LockoutEnd" timestamp(6), "Reserved" bool NOT NULL DEFAULT false, + "IsAdmin" bool NOT NULL DEFAULT false, "Source" int4 NOT NULL, "CreateTime" timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, "UpdateTime" timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -216,21 +212,4 @@ CREATE INDEX "IDX_USER_PHONE" ON "public"."user" USING btree ( CREATE INDEX "IDX_USER_USERNAME" ON "public"."user" USING btree ( "UserName" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); -``` - -# user_role - -```sql -CREATE TABLE "public"."user_role" ( - "Id" int8 NOT NULL, - "UserId" varchar(32) COLLATE "pg_catalog"."default" NOT NULL, - "Name" varchar(100) COLLATE "pg_catalog"."default" NOT NULL, - PRIMARY KEY ("Id") -) -; - -CREATE UNIQUE INDEX "IDX_USER_ROLE_UNIQUE" ON "public"."user_role" USING btree ( - "UserId" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, - "Name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST -); ``` \ No newline at end of file diff --git a/Documents/SCRIPTS_SQLITE.md b/Documents/SCRIPTS_SQLITE.md index 5cc0deb..330aeef 100644 --- a/Documents/SCRIPTS_SQLITE.md +++ b/Documents/SCRIPTS_SQLITE.md @@ -31,7 +31,7 @@ ON "operate_log" ( ```sqlite CREATE TABLE "configuration" ( - "Id" integer NOT NULL, + "Id" text(32) NOT NULL, "TeamId" text(32) NOT NULL, "Name" text NOT NULL, "Secret" text(50) NOT NULL, @@ -65,20 +65,12 @@ ON "configuration" ( ```sqlite CREATE TABLE "configuration_archive" ( - "Id" integer NOT NULL, - "AppId" text(32) NOT NULL, - "Environment" text NOT NULL, + "Id" text(32) NOT NULL, "Data" text, "Operator" text NOT NULL, "ArchiveTime" text NOT NULL, PRIMARY KEY ("Id") ); - -CREATE UNIQUE INDEX "IDX_CONFIG_ARCHIVE_UNIQUE" -ON "configuration_archive" ( - "AppId" ASC, - "Environment" ASC -); ``` # configuration_item @@ -86,7 +78,7 @@ ON "configuration_archive" ( ```sqlite CREATE TABLE "configuration_item" ( "Id" integer NOT NULL, - "ConfigurationId" integer NOT NULL, + "ConfigurationId" text(32) NOT NULL, "Key" text NOT NULL, "Value" text, "UpdateTime" text NOT NULL, @@ -110,7 +102,7 @@ ON "configuration_item" ( ```sqlite CREATE TABLE "configuration_revision" ( "Id" integer NOT NULL, - "ConfigurationId" integer NOT NULL, + "ConfigurationId" text(32) NOT NULL, "Data" text, "Comment" text, "Version" text NOT NULL, @@ -206,6 +198,7 @@ CREATE TABLE "user" ( "AccessFailedCount" integer NOT NULL DEFAULT 0, "LockoutEnd" text, "Reserved" integer NOT NULL DEFAULT 0, + "IsAdmin" integer NOT NULL DEFAULT 0, "Source" integer NOT NULL, "CreateTime" text NOT NULL DEFAULT CURRENT_TIMESTAMP, "UpdateTime" text NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -226,21 +219,4 @@ CREATE UNIQUE INDEX "IDX_USER_USERNAME" ON "user" ( "UserName" ASC ); -``` - -# user_role - -```sqlite -CREATE TABLE "user_role" ( - "Id" integer NOT NULL, - "UserId" text(32) NOT NULL, - "Name" text(20) NOT NULL, - PRIMARY KEY ("Id") -); - -CREATE UNIQUE INDEX "IDX_USER_ROLE_UNIQUE" -ON "user_role" ( - "UserId" ASC, - "Name" ASC -); ``` \ No newline at end of file diff --git a/Source/Starfish.Webapp/Pages/Home.razor b/Source/Starfish.Webapp/Pages/Home.razor index e8162ce..4f3b879 100644 --- a/Source/Starfish.Webapp/Pages/Home.razor +++ b/Source/Starfish.Webapp/Pages/Home.razor @@ -4,7 +4,7 @@ @inject IDashboardApi DashboardApi -Home +@(Resources.IDS_HOME_PAGE_TITLE) diff --git a/Source/Starfish.Webapp/Pages/User/Edit.razor b/Source/Starfish.Webapp/Pages/User/Edit.razor index d659621..ffcf715 100644 --- a/Source/Starfish.Webapp/Pages/User/Edit.razor +++ b/Source/Starfish.Webapp/Pages/User/Edit.razor @@ -102,7 +102,7 @@ { if (!string.Equals(Password, Confirm)) { - throw new Exception("Password not match."); + throw new ValidationException(Resources.IDS_ERROR_PASSWORD_NOT_MATCH); } var request = new UserCreateDto diff --git a/Source/Starfish.Webapp/Pages/User/Login.razor b/Source/Starfish.Webapp/Pages/User/Login.razor index 6b942ac..8805891 100644 --- a/Source/Starfish.Webapp/Pages/User/Login.razor +++ b/Source/Starfish.Webapp/Pages/User/Login.razor @@ -6,6 +6,7 @@ @inject NavigationManager Navigation @inject AuthenticationStateProvider Authentication +@inject IConfiguration Configuration @inject IJSRuntime Script @inject IToastService ToastService @inject IIdentityApi Api @@ -19,7 +20,7 @@ Starfish -
配置管理和服务发现
+
@(Resources.IDS_COMMON_SUBTITLE)
@@ -28,10 +29,10 @@ - + - + @@ -40,15 +41,17 @@
@(Resources.IDS_LOGIN_BUTTON_TEXT_LOGIN) - - Forget password? + + @(Resources.IDS_LOGIN_BUTTON_TEXT_FORGET_PASSWORD)
- - Register new user? + @if (Configuration.GetValue("FeatureManagement:UserRegistration")) + { + @(Resources.IDS_LOGIN_BUTTON_TEXT_REGISTER) + }
- + @code { @@ -113,10 +116,10 @@ private async Task SubmitAsync(CancellationToken cancellationToken = default) { var dto = new AuthRequestDto - { - UserName = UserName, - Password = Password - }; + { + UserName = UserName, + Password = Password + }; return await Api.GrantTokenAsync(dto, cancellationToken).EnsureSuccess(cancellationToken); } diff --git a/Source/Starfish.Webapp/Pages/User/Register.razor b/Source/Starfish.Webapp/Pages/User/Register.razor index 50426e4..a1cea41 100644 --- a/Source/Starfish.Webapp/Pages/User/Register.razor +++ b/Source/Starfish.Webapp/Pages/User/Register.razor @@ -15,7 +15,7 @@ Starfish -
配置管理和服务发现
+
@(Resources.IDS_COMMON_SUBTITLE)
diff --git a/Source/Starfish.Webapp/Pages/User/ResetPassword.razor b/Source/Starfish.Webapp/Pages/User/ResetPassword.razor index fa71f12..be355c8 100644 --- a/Source/Starfish.Webapp/Pages/User/ResetPassword.razor +++ b/Source/Starfish.Webapp/Pages/User/ResetPassword.razor @@ -51,7 +51,7 @@ if (!string.Equals(Password, Confirm)) { - throw new ValidationException("Password and confirm password are not the same."); + throw new ValidationException(Resources.IDS_ERROR_PASSWORD_NOT_MATCH); } var data = new ResetPasswordRequestDto() diff --git a/Source/Starfish.Webapp/Properties/Resources.resx b/Source/Starfish.Webapp/Properties/Resources.resx index 9e01898..ac3bad6 100644 --- a/Source/Starfish.Webapp/Properties/Resources.resx +++ b/Source/Starfish.Webapp/Properties/Resources.resx @@ -183,6 +183,9 @@ Submit + + Configuration management & service discovery + Yes @@ -342,6 +345,9 @@ Sync to Redis + + The password you entered are not the same. + Configuration @@ -366,9 +372,18 @@ Teams + + Home + + + Forget password? + Login + + Register new user + Login diff --git a/Source/Starfish.Webapp/Properties/Resources.zh-Hans.resx b/Source/Starfish.Webapp/Properties/Resources.zh-Hans.resx index 299150b..761112a 100644 --- a/Source/Starfish.Webapp/Properties/Resources.zh-Hans.resx +++ b/Source/Starfish.Webapp/Properties/Resources.zh-Hans.resx @@ -183,6 +183,9 @@ 提交 + + 配置管理和服务发现 + @@ -342,6 +345,9 @@ 同步到Redis + + 您输入的密码不一致。 + 配置 @@ -366,9 +372,18 @@ 团队 + + 首页 + + + 忘记密码? + 登录 + + 注册新用户 + 登录 diff --git a/Source/Starfish.Webapp/Properties/Resources.zh-Hant.resx b/Source/Starfish.Webapp/Properties/Resources.zh-Hant.resx index 734f742..5b87aa0 100644 --- a/Source/Starfish.Webapp/Properties/Resources.zh-Hant.resx +++ b/Source/Starfish.Webapp/Properties/Resources.zh-Hant.resx @@ -183,6 +183,9 @@ 提交 + + 配置管理和服務發現 + @@ -342,6 +345,9 @@ 同步到Redis + + 您輸入的密碼不一致。 + 配置 @@ -366,9 +372,18 @@ 團隊 + + 首頁 + + + 忘記密碼? + 登入 + + 註冊新用戶 + 登入 diff --git a/Source/Starfish.Webapp/wwwroot/appsettings.json b/Source/Starfish.Webapp/wwwroot/appsettings.json index a4e849a..fd9f7ab 100644 --- a/Source/Starfish.Webapp/wwwroot/appsettings.json +++ b/Source/Starfish.Webapp/wwwroot/appsettings.json @@ -8,5 +8,8 @@ "Api": { "BaseUrl": "http://localhost:5229", "Timeout": 10000 + }, + "FeatureManagement": { + "UserRegistration": false } }