From 5621495da864ac0dcae124ef78b4e37902862f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Sun, 29 Jun 2025 15:49:56 +0300 Subject: [PATCH] =?UTF-8?q?Dinamik=20Route=20D=C3=BCzenlemeleri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Seeds/ListFormsSeeder.cs | 286 +++++++++++++++++- .../Seeds/SeederData.json | 66 +++- .../PlatformConsts.cs | 3 +- .../Kurs.Platform.Domain/Data/SeedConsts.cs | 5 +- ui/src/views/list/useFilters.tsx | 2 +- 5 files changed, 354 insertions(+), 8 deletions(-) diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs index 02fd27b8..27f7d8c6 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/ListFormsSeeder.cs @@ -11016,13 +11016,13 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency #endregion #region BlogPost - if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.BlogPosts)) + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.BlogPost)) { var listFormBlogPosts = await _listFormRepository.InsertAsync( new ListForm { CultureName = LanguageCodes.En, - ListFormCode = ListFormCodes.Lists.BlogPosts, + ListFormCode = ListFormCodes.Lists.BlogPost, Name = AppCodes.BlogManagement.BlogPosts, Title = AppCodes.BlogManagement.BlogPosts, DataSourceCode = SeedConsts.DataSources.DefaultCode, @@ -11495,6 +11495,288 @@ public class ListFormsSeeder : IDataSeedContributor, ITransientDependency } #endregion + #region Route + if (!await _listFormRepository.AnyAsync(a => a.ListFormCode == ListFormCodes.Lists.Route)) + { + var listFormRoute = await _listFormRepository.InsertAsync( + new ListForm + { + CultureName = LanguageCodes.En, + ListFormCode = ListFormCodes.Lists.Route, + Name = AppCodes.Routes, + Title = AppCodes.Routes, + DataSourceCode = SeedConsts.DataSources.DefaultCode, + IsTenant = false, + IsBranch = false, + IsOrganizationUnit = false, + Description = AppCodes.Routes, + SelectCommandType = SelectCommandTypeEnum.Table, + SelectCommand = SelectCommandByTableName("Route"), + KeyFieldName = "Id", + KeyFieldDbSourceType = DbType.Guid, + DefaultFilter = "\"IsDeleted\" = 'false'", + SortMode = GridOptions.SortModeSingle, + FilterRowJson = JsonSerializer.Serialize(new GridFilterRowDto { Visible = true }), + HeaderFilterJson = JsonSerializer.Serialize(new { Visible = true }), + SearchPanelJson = JsonSerializer.Serialize(new { Visible = true }), + GroupPanelJson = JsonSerializer.Serialize(new { Visible = false }), + SelectionJson = JsonSerializer.Serialize(new SelectionDto + { + Mode = GridOptions.SelectionModeSingle, + AllowSelectAll = false + }), + ColumnOptionJson = JsonSerializer.Serialize(new + { + ColumnFixingEnabled = true, + }), + PermissionJson = JsonSerializer.Serialize(new PermissionCrudDto + { + C = AppCodes.Routes + ".Create", + R = AppCodes.Routes, + U = AppCodes.Routes + ".Update", + D = AppCodes.Routes + ".Delete", + E = AppCodes.Routes + ".Export" + }), + DeleteCommand = $"UPDATE \"{DbTablePrefix}Route\" SET \"DeleterId\"=@DeleterId, \"DeletionTime\"=CURRENT_TIMESTAMP, \"IsDeleted\"='true' WHERE \"Id\"=@Id", + DeleteFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue + { + FieldName = "DeleterId", + FieldDbType = DbType.Guid, + Value = "@USERID", + CustomValueType = FieldCustomValueTypeEnum.CustomKey + }, + new FieldsDefaultValue + { + FieldName = "Id", + FieldDbType = DbType.Guid, + Value = "@ID", + CustomValueType = FieldCustomValueTypeEnum.CustomKey + } + }), + PagerOptionJson = 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..." + }), + EditingOptionJson = JsonSerializer.Serialize(new GridEditingDto + { + Popup = new GridEditingPopupDto + { + Title = "Route Form", + Width = 500, + Height = 300 + }, + AllowDeleting = true, + AllowAdding = true, + AllowUpdating = true, + SendOnlyChangedFormValuesUpdate = false + }), + EditingFormJson = JsonSerializer.Serialize(new List + { + new() + { + Order = 1, + ColCount = 1, + ColSpan = 2, + ItemType = "group", + Items = + [ + new EditingFormItemDto { Order = 1, DataField = "Key", ColSpan = 2, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 2, DataField = "Path", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 3, DataField = "ComponentPath", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox }, + new EditingFormItemDto { Order = 4, DataField = "RouteType", ColSpan = 2, EditorType2 = EditorTypes.dxSelectBox }, + new EditingFormItemDto { Order = 5, DataField = "Authority", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox } + ] + } + }), + InsertFieldsDefaultValueJson = JsonSerializer.Serialize(new[] + { + new FieldsDefaultValue + { + FieldName = "CreationTime", + FieldDbType = DbType.DateTime, + Value = "@NOW", + CustomValueType = FieldCustomValueTypeEnum.CustomKey + }, + new FieldsDefaultValue + { + FieldName = "CreatorId", + FieldDbType = DbType.Guid, + Value = "@USERID", + CustomValueType = FieldCustomValueTypeEnum.CustomKey + } + }) + }); + + #region Route Fields + await _listFormFieldRepository.InsertManyAsync([ + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.Guid, + FieldName = "Id", + Width = 100, + ListOrderNo = 1, + Visible = false, + IsActive = true, + IsDeleted = false, + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Routes + ".Create", + R = AppCodes.Routes, + U = AppCodes.Routes + ".Update", + E = true, + Deny = false + }) + }, + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Key", + Width = 300, + ListOrderNo = 2, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new[] + { + new ValidationRuleDto { Type = "required" } + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Routes + ".Create", + R = AppCodes.Routes, + U = AppCodes.Routes + ".Update", + E = true, + Deny = false + }) + }, + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Path", + Width = 300, + ListOrderNo = 3, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new[] + { + new ValidationRuleDto { Type = "required" } + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Routes + ".Create", + R = AppCodes.Routes, + U = AppCodes.Routes + ".Update", + E = true, + Deny = false + }) + }, + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "ComponentPath", + Width = 300, + ListOrderNo = 4, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + ValidationRuleJson = JsonSerializer.Serialize(new[] + { + new ValidationRuleDto { Type = "required" } + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Routes + ".Create", + R = AppCodes.Routes, + U = AppCodes.Routes + ".Update", + E = true, + Deny = false + }) + }, + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "RouteType", + Width = 120, + ListOrderNo = 5, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = false, + LookupJson = JsonSerializer.Serialize(new LookupDto + { + + DataSourceType = UiLookupDataSourceTypeEnum.StaticData, + DisplayExpr = "name", + ValueExpr = "key", + LookupQuery = JsonSerializer.Serialize(new LookupDataDto[] { + new () { Key="public",Name="Public" }, + new () { Key="protected",Name="Protected" }, + }), + }), + ValidationRuleJson = JsonSerializer.Serialize(new[] + { + new ValidationRuleDto { Type = "required" } + }), + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Routes + ".Create", + R = AppCodes.Routes, + U = AppCodes.Routes + ".Update", + E = true, + Deny = false + }) + }, + new() + { + ListFormCode = listFormRoute.ListFormCode, + CultureName = LanguageCodes.En, + SourceDbType = DbType.String, + FieldName = "Authority", + Width = 120, + ListOrderNo = 6, + Visible = true, + IsActive = true, + IsDeleted = false, + AllowSearch = true, + PermissionJson = JsonSerializer.Serialize(new ListFormFieldPermissionDto + { + C = AppCodes.Routes + ".Create", + R = AppCodes.Routes, + U = AppCodes.Routes + ".Update", + E = true, + Deny = false + }) + } + ]); + #endregion + } + #endregion + #endregion } } diff --git a/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json b/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json index f24c9186..6a7c3d2b 100644 --- a/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json +++ b/api/src/Kurs.Platform.DbMigrator/Seeds/SeederData.json @@ -5263,6 +5263,12 @@ "tr": "Tanımlamalar", "en": "Definitions" }, + { + "resourceName": "Platform", + "key": "App.Routes", + "tr": "Rotalar", + "en": "Routes" + }, { "resourceName": "Platform", "key": "App.Definitions.Sector", @@ -6868,11 +6874,21 @@ "RequiredPermissionName": "App.PublicApis", "IsDisabled": false }, + { + "ParentCode": "App.Saas", + "Code": "App.Routes", + "DisplayName": "App.Routes", + "Order": 10, + "Url": "/admin/list/list-route", + "Icon": "FaSynagogue", + "RequiredPermissionName": "App.Routes", + "IsDisabled": false + }, { "ParentCode": "App.Saas", "Code": "App.BlogManagement", "DisplayName": "App.BlogManagement", - "Order": 10, + "Order": 11, "Url": null, "Icon": "FcTemplate", "RequiredPermissionName": null, @@ -6893,7 +6909,7 @@ "Code": "App.BlogManagement.Posts", "DisplayName": "App.BlogManagement.Posts", "Order": 2, - "Url": "/admin/list/list-blogposts", + "Url": "/admin/list/list-blogpost", "Icon": "FaWeixin", "RequiredPermissionName": "App.BlogManagement.Posts", "IsDisabled": false @@ -6902,7 +6918,7 @@ "ParentCode": "App.Saas", "Code": "App.ForumManagement", "DisplayName": "App.ForumManagement", - "Order": 11, + "Order": 12, "Url": "/saas/forumManagement", "Icon": "FcReading", "RequiredPermissionName": "App.ForumManagement", @@ -7197,6 +7213,10 @@ { "Name": "App.Definitions", "DisplayName": "App.Definitions" + }, + { + "Name": "App.Routes", + "DisplayName": "App.Routes" } ], "PermissionDefinitionRecords": [ @@ -7296,6 +7316,14 @@ "IsEnabled": true, "MultiTenancySide": 2 }, + { + "GroupName": "App.Routes", + "Name": "App.Routes", + "ParentName": null, + "DisplayName": "App.Routes", + "IsEnabled": true, + "MultiTenancySide": 2 + }, { "GroupName": "App.Languages", "Name": "App.Languages.Language", @@ -7856,6 +7884,38 @@ "IsEnabled": true, "MultiTenancySide": 2 }, + { + "GroupName": "App.Routes", + "Name": "App.Routes.Create", + "ParentName": "App.Routes", + "DisplayName": "Create", + "IsEnabled": true, + "MultiTenancySide": 2 + }, + { + "GroupName": "App.Routes", + "Name": "App.Routes.Delete", + "ParentName": "App.Routes", + "DisplayName": "Delete", + "IsEnabled": true, + "MultiTenancySide": 2 + }, + { + "GroupName": "App.Routes", + "Name": "App.Routes.Export", + "ParentName": "App.Routes", + "DisplayName": "Export", + "IsEnabled": true, + "MultiTenancySide": 2 + }, + { + "GroupName": "App.Routes", + "Name": "App.Routes.Update", + "ParentName": "App.Routes", + "DisplayName": "Update", + "IsEnabled": true, + "MultiTenancySide": 2 + }, { "GroupName": "AbpIdentity", "Name": "App.ClaimType.Create", diff --git a/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs b/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs index 50abf8be..89f853a0 100644 --- a/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs +++ b/api/src/Kurs.Platform.Domain.Shared/PlatformConsts.cs @@ -359,7 +359,8 @@ public static class PlatformConsts public const string SkillType = "list-skilltype"; public const string UomCategory = "list-uomcategory"; public const string BlogCategory = "list-blogcategory"; - public const string BlogPosts = "list-blogposts"; + public const string BlogPost = "list-blogpost"; + public const string Route = "list-route"; public const string ListformField = "list-listformfield"; } diff --git a/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs b/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs index 760f73fc..0d74be91 100644 --- a/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs +++ b/api/src/Kurs.Platform.Domain/Data/SeedConsts.cs @@ -352,7 +352,7 @@ public static class SeedConsts public static class BlogManagement { public const string Default = Prefix.App + ".BlogManagement"; - + public const string BlogPosts = Default + ".Posts"; public const string BlogCategory = Default + ".Category"; } @@ -381,6 +381,9 @@ public static class SeedConsts public const string SkillType = Default + ".SkillType"; public const string UomCategory = Default + ".UomCategory"; } + + public const string Routes = Prefix.App + ".Routes"; + } public static class DataSources diff --git a/ui/src/views/list/useFilters.tsx b/ui/src/views/list/useFilters.tsx index a08fcc8f..bcaa370c 100644 --- a/ui/src/views/list/useFilters.tsx +++ b/ui/src/views/list/useFilters.tsx @@ -168,7 +168,7 @@ const useFilters = ({ } else if (itemData.id === 'openPivotGrid') { navigate(`/pivot/${listFormCode}`) } else if (itemData.id === 'openManage') { - window.open(`/admin/listform/edit/${listFormCode}`, isPwaMode ? '_self' : '_blank') + window.open(`/saas/listform/edit/${listFormCode}`, isPwaMode ? '_self' : '_blank') } else if (itemData.id === 'clearFilter') { // gridin bütün filtrelerini temizle const grid = gridRef.current?.instance