Browse Source

Admin: Refactoring

pull/53/head
Engincan VESKE 5 years ago
parent
commit
f5c8c2ffda
  1. 3
      src/EventHub.Admin.Application.Contracts/Events/EventListFilterDto.cs
  2. 8
      src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs
  3. 5
      src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs
  4. 4
      src/EventHub.Admin.Application/Users/UserAppService.cs
  5. 4
      src/EventHub.Admin.HttpApi.Host/appsettings.json
  6. 4
      src/EventHub.Admin.Web/Components/UserPicker/UserPicker.razor
  7. 2
      src/EventHub.Admin.Web/Pages/AttendeeDetail.razor
  8. 14
      src/EventHub.Admin.Web/Pages/EventManagement.razor
  9. 8
      src/EventHub.Admin.Web/Pages/EventManagement.razor.cs
  10. 2
      src/EventHub.Domain.Shared/Localization/EventHub/en.json
  11. 8
      src/EventHub.HttpApi.Host/appsettings.json
  12. 10
      src/EventHub.IdentityServer/appsettings.json

3
src/EventHub.Admin.Application.Contracts/Events/EventListFilterDto.cs

@ -7,11 +7,8 @@ namespace EventHub.Admin.Events
{
public DateTime? MinStartTime { get; set; }
public DateTime? MaxStartTime { get; set; }
public string Title { get; set; }
public string OrganizationDisplayName { get; set; }
public int? MinAttendeeCount { get; set; }
public int? MaxAttendeeCount { get; set; }
}

8
src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissionDefinitionProvider.cs

@ -19,9 +19,11 @@ namespace EventHub.Admin.Permissions
var eventPermissions = eventHubGroup.AddPermission(EventHubPermissions.Events.Default, L("Permission:EventManagement"));
eventPermissions.AddChild(EventHubPermissions.Events.Update, L("Permission:Edit"));
var eventRegistrationPermission = eventHubGroup.AddPermission(EventHubPermissions.Events.Registrations.Default, L("Permission:RegistrationManagement"));
eventRegistrationPermission.AddChild(EventHubPermissions.Events.Registrations.AddAttendee, L("Permission:AddAttendee"));
eventRegistrationPermission.AddChild(EventHubPermissions.Events.Registrations.RemoveAttendee, L("Permission:RemoveAttendee"));
var eventRegistrationPermissions = eventHubGroup.AddPermission(EventHubPermissions.Events.Registrations.Default, L("Permission:RegistrationManagement"));
eventRegistrationPermissions.AddChild(EventHubPermissions.Events.Registrations.AddAttendee, L("Permission:AddAttendee"));
eventRegistrationPermissions.AddChild(EventHubPermissions.Events.Registrations.RemoveAttendee, L("Permission:RemoveAttendee"));
var userPermissions = eventHubGroup.AddPermission(EventHubPermissions.Users.Default, L("Permission:UserManagement"));
}
private static LocalizableString L(string name)

5
src/EventHub.Admin.Application.Contracts/Permissions/EventHubPermissions.cs

@ -29,5 +29,10 @@
public const string RemoveAttendee = Default + ".RemoveAttendee";
}
}
public static class Users
{
public const string Default = GroupName + ".Users";
}
}
}

4
src/EventHub.Admin.Application/Users/UserAppService.cs

@ -3,12 +3,15 @@ using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using EventHub.Admin.Permissions;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
namespace EventHub.Admin.Users
{
[Authorize(EventHubPermissions.Users.Default)]
public class UserAppService : EventHubAdminAppService, IUserAppService
{
private readonly IRepository<IdentityUser, Guid> _identityUserRepository;
@ -35,7 +38,6 @@ namespace EventHub.Admin.Users
query = query.PageBy(input);
var users = await AsyncExecuter.ToListAsync(query);
return new PagedResultDto<UserDto>(totalCount, ObjectMapper.Map<List<IdentityUser>, List<UserDto>>(users));
}
}

4
src/EventHub.Admin.HttpApi.Host/appsettings.json

@ -10,5 +10,9 @@
"RequireHttpsMetadata": "true",
"SwaggerClientId": "EventHub_Swagger",
"SwaggerClientSecret": "1q2w3e*"
},
"AppUrls": {
"Account": "https://localhost:44313",
"Admin": "https://localhost:44307"
}
}

4
src/EventHub.Admin.Web/Components/UserPicker/UserPicker.razor

@ -32,8 +32,8 @@
</CaptionTemplate>
<DisplayTemplate>
@if (SelectAllUsers.ContainsKey(context.Id))
{
<Check TValue="bool" @bind-Checked="@SelectAllUsers[context.Id]"></Check>
{
<Check TValue="bool" @bind-Checked="@SelectAllUsers[context.Id]"></Check>
}
</DisplayTemplate>
</DataGridColumn>

2
src/EventHub.Admin.Web/Pages/AttendeeDetail.razor

@ -1,4 +1,4 @@
@page "/events/{EventId:guid}/attendees"
@page "/event/{EventId:guid}/attendees"
@using EventHub.Admin.Web.Components.UserPicker
@using EventHub.Admin.Events.Registrations
@using EventHub.Admin.Permissions

14
src/EventHub.Admin.Web/Pages/EventManagement.razor

@ -3,6 +3,7 @@
@using EventHub.Admin.Permissions
@using EventHub.Admin.Events
@using EventHub.Events
@using Volo.Abp.AspNetCore.Components.Notifications
@inherits EventHubComponentBase
@attribute [Authorize(EventHubPermissions.Events.Default)]
@inject IEventAppService EventAppService
@ -10,12 +11,10 @@
<Card>
<CardHeader>
@* ************************* PAGE HEADER ************************* *@
<h2>@L["Events"]</h2>
</CardHeader>
<CardBody>
@* ************************* SEARCH ************************* *@
<Form>
<div id="FilterSection" class="row mt-3">
<Column ColumnSize="ColumnSize.Is3">
@ -57,7 +56,6 @@
</div>
</Form>
@* ************************* DATA GRID ************************* *@
<DataGrid TItem="EventInListDto"
Data="EventList"
ReadData="OnDataGridReadAsync"
@ -76,7 +74,7 @@
</EntityAction>
<EntityAction TItem="EventInListDto"
RequiredPolicy="@EventHubPermissions.Events.Registrations.Default"
Clicked="@(() => NavigationManager.NavigateTo($"/events/{context.Id}/attendees"))"
Clicked="@(() => NavigationManager.NavigateTo($"/event/{context.Id}/attendees"))"
Text="@L["Attendees"]">
</EntityAction>
</EntityActions>
@ -107,8 +105,6 @@
</CardBody>
</Card>
@* ************************* EDIT MODAL ************************* *@
<Modal @ref="EditEventModal" Closing="@OnEditModalClosing">
<ModalContent Centered="true" Size="ModalSize.Large">
<Form id="EditEventForm">
@ -177,7 +173,7 @@
{
<Validation>
<Field>
<FieldLabel>@L["OnlineLink"]</FieldLabel>
<FieldLabel>@L["OnlineLink"] *</FieldLabel>
<MemoEdit @bind-Text="@EditingEvent.OnlineLink">
<Feedback>
<ValidationError/>
@ -190,7 +186,7 @@
{
<Validation>
<Field>
<FieldLabel>@L["Country"]</FieldLabel>
<FieldLabel>@L["Country"] *</FieldLabel>
<Select @bind-SelectedValue="@EditingEvent.CountryId">
@if (Countries != null && Countries.Any())
{
@ -205,7 +201,7 @@
<Validation>
<Field>
<FieldLabel>@L["City"]</FieldLabel>
<FieldLabel>@L["City"] *</FieldLabel>
<TextEdit TValue="string" @bind-Text="@EditingEvent.City">
<Feedback>
<ValidationError/>

8
src/EventHub.Admin.Web/Pages/EventManagement.razor.cs

@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Components.Web;
using System.IO;
using System.Globalization;
using NUglify.Helpers;
using Volo.Abp;
namespace EventHub.Admin.Web.Pages
{
@ -110,10 +111,15 @@ namespace EventHub.Admin.Web.Pages
private async Task UpdateEventAsync()
{
if (!EditingEvent.IsOnline && (!EditingEvent.CountryId.HasValue || string.IsNullOrWhiteSpace(EditingEvent.City)))
{
throw new UserFriendlyException(L["CountryAndCityRequiredForUpdateInPersonEvent"]);
}
await EventAppService.UpdateAsync(EditingEventId, EditingEvent);
await GetEventsAsync();
CoverImageUrl = string.Empty;
CoverImageUrl = string.Empty;
EditEventModal.Hide();
}

2
src/EventHub.Domain.Shared/Localization/EventHub/en.json

@ -143,6 +143,6 @@
"RemoveUser": "Remove User",
"AddAttendee": "Add Attendee",
"AddUser": "Add User",
"CountryAndCityRequiredForUpdateInPersonEvent": "You need to select a country and city to update the event."
}
}

8
src/EventHub.HttpApi.Host/appsettings.json

@ -10,5 +10,13 @@
"RequireHttpsMetadata": "true",
"SwaggerClientId": "EventHub_Swagger",
"SwaggerClientSecret": "1q2w3e*"
},
"AppUrls": {
"Account": "https://localhost:44313",
"Www": "https://localhost:44308",
"Api": "https://localhost:44362",
"ApiInternal": "https://localhost:44362",
"Admin": "https://localhost:44307",
"AdminApi": "https://localhost:44305"
}
}

10
src/EventHub.IdentityServer/appsettings.json

@ -4,5 +4,13 @@
},
"Redis": {
"Configuration": "localhost"
}
},
"AppUrls": {
"Account": "https://localhost:44313",
"Www": "https://localhost:44308",
"Api": "https://localhost:44362",
"ApiInternal": "https://localhost:44362",
"Admin": "https://localhost:44307",
"AdminApi": "https://localhost:44305"
}
}

Loading…
Cancel
Save