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

Develop #28

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 9 additions & 42 deletions Documents/SCRIPTS_MSSQL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
```
13 changes: 1 addition & 12 deletions Documents/SCRIPTS_MYSQL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
```
31 changes: 5 additions & 26 deletions Documents/SCRIPTS_PGSQL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand All @@ -69,19 +69,14 @@ 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

```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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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
);
```
34 changes: 5 additions & 29 deletions Documents/SCRIPTS_SQLITE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -65,28 +65,20 @@ 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

```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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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
);
```
2 changes: 1 addition & 1 deletion Source/Starfish.Webapp/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@inject IDashboardApi DashboardApi

<PageTitle>Home</PageTitle>
<PageTitle>@(Resources.IDS_HOME_PAGE_TITLE)</PageTitle>

<FluentGrid>
<FluentGridItem lg="4" md="4" sm="6">
Expand Down
2 changes: 1 addition & 1 deletion Source/Starfish.Webapp/Pages/User/Edit.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 15 additions & 12 deletions Source/Starfish.Webapp/Pages/User/Login.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

@inject NavigationManager Navigation
@inject AuthenticationStateProvider Authentication
@inject IConfiguration Configuration
@inject IJSRuntime Script
@inject IToastService ToastService
@inject IIdentityApi Api
Expand All @@ -19,7 +20,7 @@
<img alt="logo" class="logo" src="logo.svg">
<span class="title" style="color:#fcab66; font-size: 24px;">Starfish</span>
</div>
<div class="desc">配置管理和服务发现</div>
<div class="desc">@(Resources.IDS_COMMON_SUBTITLE)</div>
</div>
<FluentCard>
<FluentStack Orientation="Orientation.Vertical" VerticalGap="12" HorizontalAlignment="HorizontalAlignment.Center">
Expand All @@ -28,10 +29,10 @@
<FluentTab Label="@(Resources.IDS_LOGIN_TAB_USERNAME)" Id="Tab-Password" Style="padding:16px 0">
<FluentStack Orientation="Orientation.Vertical">
<FluentTextField @bind-Value="UserName" Placeholder="@(Resources.IDS_LOGIN_PLACEHOLDER_USERNAME)" Style="width: 100%">
<FluentIcon Value="@(new Icons.Regular.Size24.Person())" Slot="start" Color="Color.Neutral"/>
<FluentIcon Value="@(new Icons.Regular.Size24.Person())" Slot="start" Color="Color.Neutral" />
</FluentTextField>
<FluentTextField @bind-Value="Password" Placeholder="@(Resources.IDS_LOGIN_PLACEHOLDER_PASSWORD)" Style="width: 100%" TextFieldType="TextFieldType.Password">
<FluentIcon Value="@(new Icons.Regular.Size24.ShieldKeyhole())" Slot="start" Color="Color.Neutral"/>
<FluentIcon Value="@(new Icons.Regular.Size24.ShieldKeyhole())" Slot="start" Color="Color.Neutral" />
</FluentTextField>
</FluentStack>
</FluentTab>
Expand All @@ -40,15 +41,17 @@
</FluentBodyContent>
<div style="width: 100%; display: flex;align-items: center;">
<FluentButton Style="width: 100px;" Loading="Loading" Appearance="Appearance.Accent" OnClick="@OnClick">@(Resources.IDS_LOGIN_BUTTON_TEXT_LOGIN)</FluentButton>
<FluentSpacer/>
<a href="">Forget password?</a>
<FluentSpacer />
<a href="">@(Resources.IDS_LOGIN_BUTTON_TEXT_FORGET_PASSWORD)</a>
</div>

<FluentButton Appearance="Appearance.Lightweight" OnClick="@OnRegisterClicked">Register new user?</FluentButton>
@if (Configuration.GetValue<bool>("FeatureManagement:UserRegistration"))
{
<FluentButton Appearance="Appearance.Lightweight" OnClick="@OnRegisterClicked">@(Resources.IDS_LOGIN_BUTTON_TEXT_REGISTER)</FluentButton>
}
</FluentStack>
</FluentCard>
</FluentStack>
<FluentToastProvider MaxToastCount="10"/>
<FluentToastProvider MaxToastCount="10" />
</div>

@code {
Expand Down Expand Up @@ -113,10 +116,10 @@
private async Task<AuthResponseDto> SubmitAsync(CancellationToken cancellationToken = default)
{
var dto = new AuthRequestDto
{
UserName = UserName,
Password = Password
};
{
UserName = UserName,
Password = Password
};
return await Api.GrantTokenAsync(dto, cancellationToken).EnsureSuccess(cancellationToken);
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Starfish.Webapp/Pages/User/Register.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<img alt="logo" class="logo" src="logo.svg">
<span class="title" style="color:#fcab66; font-size: 24px;">Starfish</span>
</div>
<div class="desc">配置管理和服务发现</div>
<div class="desc">@(Resources.IDS_COMMON_SUBTITLE)</div>
</div>
<FluentCard>
<FluentStack Orientation="Orientation.Vertical">
Expand Down
2 changes: 1 addition & 1 deletion Source/Starfish.Webapp/Pages/User/ResetPassword.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading
Loading