Skip to content

Commit

Permalink
用户管理功能更新
Browse files Browse the repository at this point in the history
  • Loading branch information
Codespilot committed Mar 5, 2024
1 parent d8ea3a2 commit c953706
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 33 deletions.
5 changes: 5 additions & 0 deletions Source/Starfish.Transit/Identity/UserDetailDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public class UserDetailDto
/// </summary>
public string NickName { get; set; }

/// <summary>
/// 是否管理员
/// </summary>
public bool IsAdmin { get; set; }

/// <summary>
/// 创建时间
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions Source/Starfish.Transit/Identity/UserItemDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ public class UserItemDto
/// 昵称
/// </summary>
public string NickName { get; set; }

/// <summary>
/// 是否管理员
/// </summary>
public bool IsAdmin { get; set; }
}
10 changes: 10 additions & 0 deletions Source/Starfish.Transit/Identity/UserUpdateDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@ public class UserUpdateDto
/// </summary>
public string Email { get; set; }

/// <summary>
/// 电话号码
/// </summary>
public string Phone { get; set; }

/// <summary>
/// 昵称
/// </summary>
public string NickName { get; set; }

/// <summary>
/// 是否是管理员
/// </summary>
public bool IsAdmin { get; set; }
}
32 changes: 32 additions & 0 deletions Source/Starfish.Transit/Misc/ConnectionInfoDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace Nerosoft.Starfish.Transit;

/// <summary>
/// 连接信息传输对象
/// </summary>
public class ConnectionInfoDto
{
/// <summary>
/// 配置Id
/// </summary>
public string ConfigurationId { get; set; }

/// <summary>
/// 配置名称
/// </summary>
public string ConfigurationName { get; set; }

/// <summary>
/// 连接Id
/// </summary>
public string ConnectionId { get; set; }

/// <summary>
/// 连接类型
/// </summary>
public string ConnectionType { get; set; }

/// <summary>
/// 连接时间
/// </summary>
public DateTime ConnectedTime { get; set; }
}
17 changes: 17 additions & 0 deletions Source/Starfish.Transit/Team/TeamMemberAppendDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Nerosoft.Starfish.Transit;

/// <summary>
/// 添加团队成员请求Dto
/// </summary>
public class TeamMemberAppendDto
{
/// <summary>
/// 用户Id
/// </summary>
public string UserId { get; set; }

/// <summary>
/// 角色
/// </summary>
public string Role { get; set; }
}
49 changes: 33 additions & 16 deletions Source/Starfish.Webapp/Pages/User/Edit.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<FluentDialogHeader ShowDismiss="true">
<FluentStack VerticalAlignment="VerticalAlignment.Center">
<FluentIcon Value="@(new Icons.Regular.Size24.People())"/>
<FluentIcon Value="@(new Icons.Regular.Size24.People())" />
<FluentLabel Typo="Typography.PaneHeader">
@Dialog.Instance.Parameters.Title
</FluentLabel>
Expand All @@ -16,25 +16,32 @@
<FluentTextField Style="width: 100%"
Label="@(Resources.IDS_USER_LABEL_USERNAME)"
@bind-Value="UserName"
ReadOnly="@(!string.IsNullOrEmpty(Content))"/>
ReadOnly="@(!string.IsNullOrEmpty(Content))" />
@if (string.IsNullOrEmpty(Content))
{
<FluentTextField Style="width: 100%"
Label="@(Resources.IDS_USER_LABEL_PASSWORD)"
@bind-Value="Password"
TextFieldType="TextFieldType.Password"/>
TextFieldType="TextFieldType.Password" />
<FluentTextField Style="width: 100%"
Label="@(Resources.IDS_USER_LABEL_CONFIRM_PASSWORD)"
@bind-Value="Confirm"
TextFieldType="TextFieldType.Password"/>
TextFieldType="TextFieldType.Password" />
}
<FluentTextField Style="width: 100%"
Label="@(Resources.IDS_USER_LABEL_NICKNAME)"
@bind-Value="NickName"/>
@bind-Value="NickName" />
<FluentTextField Style="width: 100%"
Label="@(Resources.IDS_USER_LABEL_EMAIL)"
@bind-Value="Email"
TextFieldType="TextFieldType.Email"/>
TextFieldType="TextFieldType.Email" />

<FluentTextField Style="width: 100%"
Label="@(Resources.IDS_USER_LABEL_PHONE)"
@bind-Value="Phone"
TextFieldType="TextFieldType.Tel" />

<FluentSwitch Label="@(Resources.IDS_USER_LABEL_IS_ADMIN)" @bind-Value="IsAdmin" />
</FluentStack>
</FluentDialogBody>

Expand Down Expand Up @@ -63,6 +70,10 @@

private string Email { get; set; }

private string Phone { get; set; }

private bool IsAdmin { get; set; }

protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
Expand All @@ -77,10 +88,12 @@
if (!string.IsNullOrEmpty(Content))
{
var request = new UserUpdateDto
{
NickName = NickName,
Email = Email
};
{
NickName = NickName,
Email = Email,
Phone = Phone,
IsAdmin = IsAdmin
};

await Api.UpdateAsync(Content, request)
.EnsureSuccess();
Expand All @@ -93,12 +106,14 @@
}

var request = new UserCreateDto
{
UserName = UserName,
Password = Password,
NickName = NickName,
Email = Email
};
{
UserName = UserName,
Password = Password,
NickName = NickName,
Email = Email,
Phone = Phone,
IsAdmin = IsAdmin
};

await Api.CreateAsync(request)
.EnsureSuccess();
Expand Down Expand Up @@ -140,6 +155,8 @@
UserName = result.UserName;
NickName = result.NickName;
Email = result.Email;
Phone = result.Phone;
IsAdmin = result.IsAdmin;
});
}

Expand Down
23 changes: 12 additions & 11 deletions Source/Starfish.Webapp/Pages/User/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,32 @@
<FluentGrid>
<FluentGridItem lg="12" sm="12" md="12">
<div class="search-bar">
<FluentSearch Placeholder="@(Resources.IDS_COMMON_PLACEHOLDER_KEYWORD)" @bind-Value="Criteria.Keyword"/>
<FluentSearch Placeholder="@(Resources.IDS_COMMON_PLACEHOLDER_KEYWORD)" @bind-Value="Criteria.Keyword" />
<FluentButton IconStart="@(new Icons.Regular.Size16.Search())" OnClick="@OnSearchClicked">@(Resources.IDS_COMMON_SEARCH)</FluentButton>
<FluentSpacer/>
<FluentSpacer />
<FluentButton IconStart="@(new Icons.Regular.Size16.Add())" Appearance="Appearance.Accent" OnClick="@(() => OnEditClicked(string.Empty))">@(Resources.IDS_USER_BUTTON_TEXT_ADD)</FluentButton>
</div>
</FluentGridItem>
<FluentGridItem lg="12" sm="12" md="12">
<FluentDataGrid ItemsProvider="_provider" Pagination="Pagination" ItemSize="46"
GenerateHeader="GenerateHeaderOption.Sticky" TGridItem="UserItemDto"
GridTemplateColumns="0.5fr 0.5fr 1fr 1fr 0.2fr">
GridTemplateColumns="0.5fr 0.5fr 1fr 1fr 0.4fr 0.2fr">
<TemplateColumn Title="@(Resources.IDS_USER_INDEX_COLUMN_USER_NAME)" Align="@Align.Start">
<FluentButton Appearance="Appearance.Lightweight" OnClick="@(() => OnDetailClicked(context.Id))">@(context.UserName)</FluentButton>
</TemplateColumn>
<PropertyColumn Class="data-grid-column" Title="@(Resources.IDS_USER_INDEX_COLUMN_NICK_NAME)" Property="@(c => c.NickName)"/>
<PropertyColumn Class="data-grid-column" Title="@(Resources.IDS_USER_INDEX_COLUMN_EMAIL)" Property="@(c => c.Email)"/>
<PropertyColumn Class="data-grid-column" Title="@(Resources.IDS_USER_INDEX_COLUMN_PHONE)" Property="@(c => c.Phone)"/>
<PropertyColumn Class="data-grid-column" Title="@(Resources.IDS_USER_INDEX_COLUMN_NICK_NAME)" Property="@(c => c.NickName)" />
<PropertyColumn Class="data-grid-column" Title="@(Resources.IDS_USER_INDEX_COLUMN_EMAIL)" Property="@(c => c.Email)" />
<PropertyColumn Class="data-grid-column" Title="@(Resources.IDS_USER_INDEX_COLUMN_PHONE)" Property="@(c => c.Phone)" />
<PropertyColumn Class="data-grid-column" Title="@(Resources.IDS_USER_INDEX_COLUMN_IS_ADMIN)" Property="@(c => c.IsAdmin ? Resources.IDS_COMMON_YES : Resources.IDS_COMMON_NO)" />
<TemplateColumn Title="@(Resources.IDS_COMMON_COLUMN_ACTIONS)" Align="@Align.Center">
<FluentButton IconEnd="@(new Icons.Regular.Size16.Edit())" OnClick="@(() => OnEditClicked(context.Id))"/>
<FluentButton IconEnd="@(new Icons.Regular.Size16.LockClosedKey())" OnClick="@(() => OnResetPasswordClicked(context.Id))"/>
<FluentButton IconEnd="@(new Icons.Regular.Size16.Edit())" OnClick="@(() => OnEditClicked(context.Id))" />
<FluentButton IconEnd="@(new Icons.Regular.Size16.LockClosedKey())" OnClick="@(() => OnResetPasswordClicked(context.Id))" />
</TemplateColumn>
</FluentDataGrid>
</FluentGridItem>

<FluentGridItem lg="12" sm="12" md="12">
<FluentDataGridPaginator State="@Pagination"/>
<FluentDataGridPaginator State="@Pagination" />
</FluentGridItem>
</FluentGrid>
</FluentCard>
Expand All @@ -59,10 +60,10 @@
{
List<UserItemDto> items = null;
var tasks = new List<Task>
{
{
Api.SearchAsync(Criteria, request.StartIndex, Pagination.ItemsPerPage, request.CancellationToken)
.EnsureSuccess(result => items = result, request.CancellationToken)
};
};

if (request.StartIndex == 0)
{
Expand Down
9 changes: 9 additions & 0 deletions Source/Starfish.Webapp/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,9 @@
<data name="IDS_USER_INDEX_COLUMN_EMAIL" xml:space="preserve">
<value>Email</value>
</data>
<data name="IDS_USER_INDEX_COLUMN_IS_ADMIN" xml:space="preserve">
<value>Administrator</value>
</data>
<data name="IDS_USER_INDEX_COLUMN_NICK_NAME" xml:space="preserve">
<value>Nick name</value>
</data>
Expand All @@ -588,12 +591,18 @@
<data name="IDS_USER_LABEL_EMAIL" xml:space="preserve">
<value>Email</value>
</data>
<data name="IDS_USER_LABEL_IS_ADMIN" xml:space="preserve">
<value>Administrator</value>
</data>
<data name="IDS_USER_LABEL_NICKNAME" xml:space="preserve">
<value>Nick name</value>
</data>
<data name="IDS_USER_LABEL_PASSWORD" xml:space="preserve">
<value>Password</value>
</data>
<data name="IDS_USER_LABEL_PHONE" xml:space="preserve">
<value>Phone number</value>
</data>
<data name="IDS_USER_LABEL_USERNAME" xml:space="preserve">
<value>User name</value>
</data>
Expand Down
9 changes: 9 additions & 0 deletions Source/Starfish.Webapp/Properties/Resources.zh-Hans.resx
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,9 @@
<data name="IDS_USER_INDEX_COLUMN_EMAIL" xml:space="preserve">
<value>邮箱</value>
</data>
<data name="IDS_USER_INDEX_COLUMN_IS_ADMIN" xml:space="preserve">
<value>管理员</value>
</data>
<data name="IDS_USER_INDEX_COLUMN_NICK_NAME" xml:space="preserve">
<value>昵称</value>
</data>
Expand All @@ -588,12 +591,18 @@
<data name="IDS_USER_LABEL_EMAIL" xml:space="preserve">
<value>邮箱</value>
</data>
<data name="IDS_USER_LABEL_IS_ADMIN" xml:space="preserve">
<value>管理员</value>
</data>
<data name="IDS_USER_LABEL_NICKNAME" xml:space="preserve">
<value>昵称</value>
</data>
<data name="IDS_USER_LABEL_PASSWORD" xml:space="preserve">
<value>密码</value>
</data>
<data name="IDS_USER_LABEL_PHONE" xml:space="preserve">
<value>手机号</value>
</data>
<data name="IDS_USER_LABEL_USERNAME" xml:space="preserve">
<value>用户名</value>
</data>
Expand Down
15 changes: 9 additions & 6 deletions Source/Starfish.Webapp/Properties/Resources.zh-Hant.resx
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,6 @@
<data name="IDS_HOME_COLUMN_CONFIGURATION" xml:space="preserve">
<value>配置</value>
</data>
<data name="IDS_HOME_COLUMN_CONFIGURATION_ID" xml:space="preserve">
<value>配置Id</value>
</data>
<data name="IDS_HOME_COLUMN_CONFIGURATION_NAME" xml:space="preserve">
<value>配置名稱</value>
</data>
<data name="IDS_HOME_COLUMN_CONNECTED_TIME" xml:space="preserve">
<value>連接時間</value>
</data>
Expand Down Expand Up @@ -576,6 +570,9 @@
<data name="IDS_USER_INDEX_COLUMN_EMAIL" xml:space="preserve">
<value>電子郵件</value>
</data>
<data name="IDS_USER_INDEX_COLUMN_IS_ADMIN" xml:space="preserve">
<value>管理員</value>
</data>
<data name="IDS_USER_INDEX_COLUMN_NICK_NAME" xml:space="preserve">
<value>昵稱</value>
</data>
Expand All @@ -594,12 +591,18 @@
<data name="IDS_USER_LABEL_EMAIL" xml:space="preserve">
<value>電子郵件</value>
</data>
<data name="IDS_USER_LABEL_IS_ADMIN" xml:space="preserve">
<value>管理員</value>
</data>
<data name="IDS_USER_LABEL_NICKNAME" xml:space="preserve">
<value>昵稱</value>
</data>
<data name="IDS_USER_LABEL_PASSWORD" xml:space="preserve">
<value>密碼</value>
</data>
<data name="IDS_USER_LABEL_PHONE" xml:space="preserve">
<value>手機號</value>
</data>
<data name="IDS_USER_LABEL_USERNAME" xml:space="preserve">
<value>用戶名</value>
</data>
Expand Down

0 comments on commit c953706

Please sign in to comment.