FormSeeder ve Utils eklendi
This commit is contained in:
parent
b6ccb8c7c3
commit
7a0aa881d5
4 changed files with 349 additions and 1233 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -14,9 +14,10 @@ using Volo.Abp.DependencyInjection;
|
||||||
using Volo.Abp.Domain.Repositories;
|
using Volo.Abp.Domain.Repositories;
|
||||||
using Volo.Abp.Identity;
|
using Volo.Abp.Identity;
|
||||||
using Volo.Abp.TenantManagement;
|
using Volo.Abp.TenantManagement;
|
||||||
using static Kurs.Platform.PlatformConsts;
|
|
||||||
using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity;
|
using AbpIdentity = Kurs.Platform.Data.Seeds.SeedConsts.AbpIdentity;
|
||||||
using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes;
|
using AppCodes = Kurs.Platform.Data.Seeds.SeedConsts.AppCodes;
|
||||||
|
using static Kurs.Platform.PlatformConsts;
|
||||||
|
using static Kurs.Platform.PlatformSeeder.Utils;
|
||||||
|
|
||||||
namespace Kurs.Platform.Data.Seeds;
|
namespace Kurs.Platform.Data.Seeds;
|
||||||
|
|
||||||
|
|
@ -42,116 +43,6 @@ public class ListSeeder : IDataSeedContributor, ITransientDependency
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly string DefaultFilterJson = "\"IsDeleted\" = 'false'";
|
|
||||||
private readonly string DefaultColumnOptionJson = JsonSerializer.Serialize(new
|
|
||||||
{
|
|
||||||
ColumnFixingEnabled = true,
|
|
||||||
ColumnAutoWidth = true,
|
|
||||||
ColumnChooserEnabled = true,
|
|
||||||
AllowColumnResizing = true,
|
|
||||||
AllowColumnReordering = true,
|
|
||||||
ColumnResizingMode = "widget",
|
|
||||||
});
|
|
||||||
private readonly string DefaultLayoutJson = JsonSerializer.Serialize(new LayoutDto()
|
|
||||||
{
|
|
||||||
Grid = true,
|
|
||||||
Card = true,
|
|
||||||
Pivot = true,
|
|
||||||
Chart = true,
|
|
||||||
DefaultLayout = "grid",
|
|
||||||
CardLayoutColumn = 4
|
|
||||||
});
|
|
||||||
private readonly string DefaultSelectionSingleJson = JsonSerializer.Serialize(new SelectionDto
|
|
||||||
{
|
|
||||||
Mode = GridOptions.SelectionModeSingle,
|
|
||||||
AllowSelectAll = false
|
|
||||||
});
|
|
||||||
private readonly string DefaultSelectionMultipleJson = JsonSerializer.Serialize(new SelectionDto
|
|
||||||
{
|
|
||||||
AllowSelectAll = true,
|
|
||||||
Mode = GridOptions.SelectionModeMultiple,
|
|
||||||
SelectAllMode = GridOptions.SelectionAllModeAllPages
|
|
||||||
});
|
|
||||||
private readonly string DefaultPagerOptionJson = JsonSerializer.Serialize(new GridPagerOptionDto
|
|
||||||
{
|
|
||||||
Visible = true,
|
|
||||||
AllowedPageSizes = "10,20,50,100",
|
|
||||||
ShowPageSizeSelector = true,
|
|
||||||
ShowNavigationButtons = true,
|
|
||||||
ShowInfo = false,
|
|
||||||
InfoText = "Page {0} of {1} ({2} items)",
|
|
||||||
DisplayMode = GridColumnOptions.PagerDisplayModeAdaptive,
|
|
||||||
ScrollingMode = GridColumnOptions.ScrollingModeStandard,
|
|
||||||
LoadPanelEnabled = "auto",
|
|
||||||
LoadPanelText = "Loading..."
|
|
||||||
});
|
|
||||||
private readonly string DefaultColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto
|
|
||||||
{
|
|
||||||
AllowReordering = true,
|
|
||||||
});
|
|
||||||
private readonly string DefaultPivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
|
|
||||||
{
|
|
||||||
IsPivot = true
|
|
||||||
});
|
|
||||||
private readonly string DefaultValidationRuleRequiredJson = JsonSerializer.Serialize(new ValidationRuleDto[]
|
|
||||||
{
|
|
||||||
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }
|
|
||||||
});
|
|
||||||
private readonly string DefaultValidationRuleEmailJson = JsonSerializer.Serialize(new ValidationRuleDto[]
|
|
||||||
{
|
|
||||||
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.email) }
|
|
||||||
});
|
|
||||||
private string DefaultPermissionJson(string c, string r, string u, string d, string e, string i, string a)
|
|
||||||
{
|
|
||||||
return JsonSerializer.Serialize(new PermissionCrudDto
|
|
||||||
{
|
|
||||||
C = c,
|
|
||||||
R = r,
|
|
||||||
U = u,
|
|
||||||
D = d,
|
|
||||||
E = e,
|
|
||||||
I = i,
|
|
||||||
A = a,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
private string DefaultPermissionJson(string permissionName)
|
|
||||||
{
|
|
||||||
return JsonSerializer.Serialize(new PermissionCrudDto
|
|
||||||
{
|
|
||||||
C = permissionName + ".Create",
|
|
||||||
R = permissionName,
|
|
||||||
U = permissionName + ".Update",
|
|
||||||
D = permissionName + ".Delete",
|
|
||||||
E = permissionName + ".Export",
|
|
||||||
I = permissionName + ".Import",
|
|
||||||
A = permissionName + ".Activity",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
private string DefaultFieldPermissionJson(string permissionName)
|
|
||||||
{
|
|
||||||
return JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
|
||||||
{
|
|
||||||
C = permissionName + ".Create",
|
|
||||||
R = permissionName,
|
|
||||||
U = permissionName + ".Update",
|
|
||||||
E = true,
|
|
||||||
I = false,
|
|
||||||
Deny = false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
private string DefaultFieldPermissionJson(string c, string r, string u, bool e, bool i, bool d)
|
|
||||||
{
|
|
||||||
return JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
|
||||||
{
|
|
||||||
C = c,
|
|
||||||
R = r,
|
|
||||||
U = u,
|
|
||||||
E = e,
|
|
||||||
I = i,
|
|
||||||
Deny = d
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SeedAsync(DataSeedContext context)
|
public async Task SeedAsync(DataSeedContext context)
|
||||||
{
|
{
|
||||||
#region Tenant
|
#region Tenant
|
||||||
|
|
|
||||||
128
api/src/Kurs.Platform.DbMigrator/Seeds/Utils.cs
Normal file
128
api/src/Kurs.Platform.DbMigrator/Seeds/Utils.cs
Normal file
|
|
@ -0,0 +1,128 @@
|
||||||
|
using System;
|
||||||
|
using System.Text.Json;
|
||||||
|
using Kurs.Platform.Enums;
|
||||||
|
using Kurs.Platform.ListForms;
|
||||||
|
using static Kurs.Platform.PlatformConsts;
|
||||||
|
|
||||||
|
namespace Kurs.Platform.PlatformSeeder;
|
||||||
|
|
||||||
|
public static class Utils
|
||||||
|
{
|
||||||
|
public static readonly string DefaultEditingOptionJson = JsonSerializer.Serialize(new GridEditingDto
|
||||||
|
{
|
||||||
|
AllowDeleting = true,
|
||||||
|
AllowAdding = true,
|
||||||
|
AllowUpdating = true,
|
||||||
|
ConfirmDelete = true,
|
||||||
|
});
|
||||||
|
|
||||||
|
public static readonly string DefaultFilterJson = "\"IsDeleted\" = 'false'";
|
||||||
|
public static readonly string DefaultColumnOptionJson = JsonSerializer.Serialize(new
|
||||||
|
{
|
||||||
|
ColumnFixingEnabled = true,
|
||||||
|
ColumnAutoWidth = true,
|
||||||
|
ColumnChooserEnabled = true,
|
||||||
|
AllowColumnResizing = true,
|
||||||
|
AllowColumnReordering = true,
|
||||||
|
ColumnResizingMode = "widget",
|
||||||
|
});
|
||||||
|
public static readonly string DefaultLayoutJson = JsonSerializer.Serialize(new LayoutDto()
|
||||||
|
{
|
||||||
|
Grid = true,
|
||||||
|
Card = true,
|
||||||
|
Pivot = true,
|
||||||
|
Chart = true,
|
||||||
|
DefaultLayout = "grid",
|
||||||
|
CardLayoutColumn = 4
|
||||||
|
});
|
||||||
|
public static readonly string DefaultSelectionSingleJson = JsonSerializer.Serialize(new SelectionDto
|
||||||
|
{
|
||||||
|
Mode = GridOptions.SelectionModeSingle,
|
||||||
|
AllowSelectAll = false
|
||||||
|
});
|
||||||
|
public static readonly string DefaultSelectionMultipleJson = JsonSerializer.Serialize(new SelectionDto
|
||||||
|
{
|
||||||
|
AllowSelectAll = true,
|
||||||
|
Mode = GridOptions.SelectionModeMultiple,
|
||||||
|
SelectAllMode = GridOptions.SelectionAllModeAllPages
|
||||||
|
});
|
||||||
|
public static readonly string DefaultPagerOptionJson = JsonSerializer.Serialize(new GridPagerOptionDto
|
||||||
|
{
|
||||||
|
Visible = true,
|
||||||
|
AllowedPageSizes = "10,20,50,100",
|
||||||
|
ShowPageSizeSelector = true,
|
||||||
|
ShowNavigationButtons = true,
|
||||||
|
ShowInfo = false,
|
||||||
|
InfoText = "Page {0} of {1} ({2} items)",
|
||||||
|
DisplayMode = GridColumnOptions.PagerDisplayModeAdaptive,
|
||||||
|
ScrollingMode = GridColumnOptions.ScrollingModeStandard,
|
||||||
|
LoadPanelEnabled = "auto",
|
||||||
|
LoadPanelText = "Loading..."
|
||||||
|
});
|
||||||
|
public static readonly string DefaultColumnCustomizationJson = JsonSerializer.Serialize(new ColumnCustomizationDto
|
||||||
|
{
|
||||||
|
AllowReordering = true,
|
||||||
|
});
|
||||||
|
public static readonly string DefaultPivotSettingsJson = JsonSerializer.Serialize(new ListFormFieldPivotSettingsDto
|
||||||
|
{
|
||||||
|
IsPivot = true
|
||||||
|
});
|
||||||
|
public static readonly string DefaultValidationRuleRequiredJson = JsonSerializer.Serialize(new ValidationRuleDto[]
|
||||||
|
{
|
||||||
|
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.required) }
|
||||||
|
});
|
||||||
|
public static readonly string DefaultValidationRuleEmailJson = JsonSerializer.Serialize(new ValidationRuleDto[]
|
||||||
|
{
|
||||||
|
new ValidationRuleDto() { Type = Enum.GetName(UiColumnValidationRuleTypeEnum.email) }
|
||||||
|
});
|
||||||
|
public static string DefaultPermissionJson(string c, string r, string u, string d, string e, string i, string a)
|
||||||
|
{
|
||||||
|
return JsonSerializer.Serialize(new PermissionCrudDto
|
||||||
|
{
|
||||||
|
C = c,
|
||||||
|
R = r,
|
||||||
|
U = u,
|
||||||
|
D = d,
|
||||||
|
E = e,
|
||||||
|
I = i,
|
||||||
|
A = a,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public static string DefaultPermissionJson(string permissionName)
|
||||||
|
{
|
||||||
|
return JsonSerializer.Serialize(new PermissionCrudDto
|
||||||
|
{
|
||||||
|
C = permissionName + ".Create",
|
||||||
|
R = permissionName,
|
||||||
|
U = permissionName + ".Update",
|
||||||
|
D = permissionName + ".Delete",
|
||||||
|
E = permissionName + ".Export",
|
||||||
|
I = permissionName + ".Import",
|
||||||
|
A = permissionName + ".Activity",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public static string DefaultFieldPermissionJson(string permissionName)
|
||||||
|
{
|
||||||
|
return JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
||||||
|
{
|
||||||
|
C = permissionName + ".Create",
|
||||||
|
R = permissionName,
|
||||||
|
U = permissionName + ".Update",
|
||||||
|
E = true,
|
||||||
|
I = false,
|
||||||
|
Deny = false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public static string DefaultFieldPermissionJson(string c, string r, string u, bool e, bool i, bool d)
|
||||||
|
{
|
||||||
|
return JsonSerializer.Serialize(new ListFormFieldPermissionDto
|
||||||
|
{
|
||||||
|
C = c,
|
||||||
|
R = r,
|
||||||
|
U = u,
|
||||||
|
E = e,
|
||||||
|
I = i,
|
||||||
|
Deny = d
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -312,7 +312,7 @@ public static class LookupQueryValues
|
||||||
$"SELECT \"Name\" AS \"Key\", " +
|
$"SELECT \"Name\" AS \"Key\", " +
|
||||||
$"CONCAT(\"Name\", ' (', \"DisplayName\", ')') AS \"Name\" " +
|
$"CONCAT(\"Name\", ' (', \"DisplayName\", ')') AS \"Name\" " +
|
||||||
$"FROM \"AbpPermissions\" " +
|
$"FROM \"AbpPermissions\" " +
|
||||||
$"WHERE \"IsDeleted\" = 'false' " +
|
$"WHERE \"IsEnabled\" = 'false' " +
|
||||||
$"ORDER BY \"Name\";";
|
$"ORDER BY \"Name\";";
|
||||||
|
|
||||||
public static string MenuCodeValues =
|
public static string MenuCodeValues =
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue