From 8cc3ece256a775bee78c86979a46b20cc66e160a Mon Sep 17 00:00:00 2001 From: Salih Date: Fri, 19 Aug 2022 15:31:32 +0300 Subject: [PATCH 01/10] Added project column --- .../Volo/Docs/Admin/Documents/DocumentDto.cs | 2 + .../DocsAdminApplicationAutoMapperProfile.cs | 3 +- .../Pages/Docs/Admin/Documents/Index.cshtml | 1 + .../Pages/Docs/Admin/Documents/index.js | 4 ++ .../Docs/Documents/DocumentWithoutContent.cs | 2 + .../Documents/EFCoreDocumentRepository.cs | 45 +++++++++--------- .../Docs/Documents/MongoDocumentRepository.cs | 47 ++++++++++--------- 7 files changed, 59 insertions(+), 45 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/DocumentDto.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/DocumentDto.cs index c415efa860..b574870fd8 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/DocumentDto.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/DocumentDto.cs @@ -8,6 +8,8 @@ namespace Volo.Docs.Admin.Documents public class DocumentDto : EntityDto { public virtual Guid ProjectId { get; set; } + + public virtual string ProjectName { get; set; } public virtual string Name { get; set; } diff --git a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/DocsAdminApplicationAutoMapperProfile.cs b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/DocsAdminApplicationAutoMapperProfile.cs index 86e6d46e0c..eaeb59cabb 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/DocsAdminApplicationAutoMapperProfile.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/DocsAdminApplicationAutoMapperProfile.cs @@ -1,4 +1,5 @@ using AutoMapper; +using Volo.Abp.AutoMapper; using Volo.Docs.Admin.Documents; using Volo.Docs.Admin.Projects; using Volo.Docs.Documents; @@ -11,7 +12,7 @@ namespace Volo.Docs.Admin public DocsAdminApplicationAutoMapperProfile() { CreateMap(); - CreateMap(); + CreateMap().Ignore(x => x.ProjectName); CreateMap(); } } diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml index 738327def9..776d504395 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml @@ -183,6 +183,7 @@ @L["Actions"] + @L["ProjectName"] @L["Name"] @L["Version"] @L["LanguageCode"] diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js index 5f4dc9b8d7..d85676e3f3 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/index.js @@ -79,6 +79,10 @@ $(function () { ], }, }, + { + target: 0, + data: 'projectName', + }, { target: 1, data: 'name', diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentWithoutContent.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentWithoutContent.cs index cde44614ae..4ef9c0e232 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentWithoutContent.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentWithoutContent.cs @@ -7,6 +7,8 @@ namespace Volo.Docs.Documents public Guid Id { get; set; } public virtual Guid ProjectId { get; set; } + + public virtual string ProjectName { get; set; } public virtual string Name { get; set; } diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs index 7656975f16..1de28f537c 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs @@ -67,23 +67,21 @@ namespace Volo.Docs.Documents int skipCount = 0, CancellationToken cancellationToken = default) { - var query = ApplyFilterForGetAll( + var query =await ApplyFilterForGetAll( await GetDbSetAsync(), projectId: projectId, name: name, version: version, languageCode: languageCode, - format: format, fileName: fileName, + format: format, creationTimeMin: creationTimeMin, creationTimeMax: creationTimeMax, lastUpdatedTimeMin: lastUpdatedTimeMin, lastUpdatedTimeMax: lastUpdatedTimeMax, lastSignificantUpdateTimeMin: lastSignificantUpdateTimeMin, lastSignificantUpdateTimeMax: lastSignificantUpdateTimeMax, - lastCachedTimeMin: lastCachedTimeMin, - lastCachedTimeMax: lastCachedTimeMax - ); + lastCachedTimeMin: lastCachedTimeMin, lastCachedTimeMax: lastCachedTimeMax); query = query.OrderBy(string.IsNullOrWhiteSpace(sorting) ? nameof(Document.Name) : sorting); return await query.PageBy(skipCount, maxResultCount).ToListAsync(GetCancellationToken(cancellationToken)); @@ -109,23 +107,21 @@ namespace Volo.Docs.Documents int skipCount = 0, CancellationToken cancellationToken = default) { - var query = ApplyFilterForGetAll( + var query = await ApplyFilterForGetAll( await GetDbSetAsync(), projectId: projectId, name: name, version: version, languageCode: languageCode, - format: format, fileName: fileName, + format: format, creationTimeMin: creationTimeMin, creationTimeMax: creationTimeMax, lastUpdatedTimeMin: lastUpdatedTimeMin, lastUpdatedTimeMax: lastUpdatedTimeMax, lastSignificantUpdateTimeMin: lastSignificantUpdateTimeMin, lastSignificantUpdateTimeMax: lastSignificantUpdateTimeMax, - lastCachedTimeMin: lastCachedTimeMin, - lastCachedTimeMax: lastCachedTimeMax - ); + lastCachedTimeMin: lastCachedTimeMin, lastCachedTimeMax: lastCachedTimeMax); return await query.LongCountAsync(GetCancellationToken(cancellationToken)); } @@ -153,7 +149,7 @@ namespace Volo.Docs.Documents return await (await GetDbSetAsync()).Where(x => x.Id == id).SingleAsync(cancellationToken: GetCancellationToken(cancellationToken)); } - protected virtual IQueryable ApplyFilterForGetAll( + protected virtual async Task> ApplyFilterForGetAll( IQueryable query, Guid? projectId, string name, @@ -200,19 +196,24 @@ namespace Volo.Docs.Documents d => d.LastCachedTime.Date >= lastCachedTimeMin.Value.Date) .WhereIf(lastCachedTimeMax.HasValue, d => d.LastCachedTime.Date <= lastCachedTimeMax.Value.Date) + .Join( (await GetDbContextAsync()).Projects, + d => d.ProjectId, + p => p.Id, + (d, p) => new { d, p }) .Select(x => new DocumentWithoutContent { - Id = x.Id, - ProjectId = x.ProjectId, - Name = x.Name, - Version = x.Version, - LanguageCode = x.LanguageCode, - FileName = x.FileName, - Format = x.Format, - CreationTime = x.CreationTime, - LastUpdatedTime = x.LastUpdatedTime, - LastSignificantUpdateTime = x.LastSignificantUpdateTime, - LastCachedTime = x.LastCachedTime + Id = x.d.Id, + ProjectId = x.d.ProjectId, + ProjectName = x.p.Name, + Name = x.d.Name, + Version = x.d.Version, + LanguageCode = x.d.LanguageCode, + FileName = x.d.FileName, + Format = x.d.Format, + CreationTime = x.d.CreationTime, + LastUpdatedTime = x.d.LastUpdatedTime, + LastSignificantUpdateTime = x.d.LastSignificantUpdateTime, + LastCachedTime = x.d.LastCachedTime }); } } diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs index 0086624d43..88c7514ae4 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs @@ -88,22 +88,21 @@ namespace Volo.Docs.Documents { return await - ApplyFilterForGetAll( + (await ApplyFilterForGetAll( await GetMongoQueryableAsync(cancellationToken), projectId: projectId, name: name, version: version, languageCode: languageCode, - format: format, fileName: fileName, + format: format, creationTimeMin: creationTimeMin, creationTimeMax: creationTimeMax, lastUpdatedTimeMin: lastUpdatedTimeMin, lastUpdatedTimeMax: lastUpdatedTimeMax, lastSignificantUpdateTimeMin: lastSignificantUpdateTimeMin, lastSignificantUpdateTimeMax: lastSignificantUpdateTimeMax, - lastCachedTimeMin: lastCachedTimeMin, - lastCachedTimeMax: lastCachedTimeMax) + lastCachedTimeMin: lastCachedTimeMin, lastCachedTimeMax: lastCachedTimeMax)) .OrderBy(string.IsNullOrWhiteSpace(sorting) ? "name asc" : sorting).As>() .PageBy>(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); @@ -132,22 +131,21 @@ namespace Volo.Docs.Documents return await - ApplyFilterForGetAll( + (await ApplyFilterForGetAll( await GetMongoQueryableAsync(cancellationToken), projectId: projectId, name: name, version: version, languageCode: languageCode, - format: format, fileName: fileName, + format: format, creationTimeMin: creationTimeMin, creationTimeMax: creationTimeMax, lastUpdatedTimeMin: lastUpdatedTimeMin, lastUpdatedTimeMax: lastUpdatedTimeMax, lastSignificantUpdateTimeMin: lastSignificantUpdateTimeMin, lastSignificantUpdateTimeMax: lastSignificantUpdateTimeMax, - lastCachedTimeMin: lastCachedTimeMin, - lastCachedTimeMax: lastCachedTimeMax) + lastCachedTimeMin: lastCachedTimeMin, lastCachedTimeMax: lastCachedTimeMax)) .OrderBy(string.IsNullOrWhiteSpace(sorting) ? "name asc" : sorting).As>() .PageBy>(skipCount, maxResultCount) .LongCountAsync(GetCancellationToken(cancellationToken)); @@ -158,7 +156,7 @@ namespace Volo.Docs.Documents return await (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.Id == id).SingleAsync(GetCancellationToken(cancellationToken)); } - protected virtual IMongoQueryable ApplyFilterForGetAll( + protected virtual async Task> ApplyFilterForGetAll( IMongoQueryable query, Guid? projectId, string name, @@ -240,20 +238,25 @@ namespace Volo.Docs.Documents { query = query.Where(d => d.LastCachedTime.Date <= lastCachedTimeMax.Value.Date); } - - return query.Select(x => new DocumentWithoutContent + var join = query.Join( + (await GetDbContextAsync(cancellationToken)).Projects, + d => d.ProjectId, + p => p.Id, + (d, p) => new { Document = d, Project = p }); + return join.Select(x => new DocumentWithoutContent { - Id = x.Id, - ProjectId = x.ProjectId, - Name = x.Name, - Version = x.Version, - LanguageCode = x.LanguageCode, - FileName = x.FileName, - Format = x.Format, - CreationTime = x.CreationTime, - LastUpdatedTime = x.LastUpdatedTime, - LastSignificantUpdateTime = x.LastSignificantUpdateTime, - LastCachedTime = x.LastCachedTime + Id = x.Document.Id, + ProjectId = x.Document.ProjectId, + ProjectName = x.Project.Name, + Name = x.Document.Name, + Version = x.Document.Version, + LanguageCode = x.Document.LanguageCode, + FileName = x.Document.FileName, + Format = x.Document.Format, + CreationTime = x.Document.CreationTime, + LastUpdatedTime = x.Document.LastUpdatedTime, + LastSignificantUpdateTime = x.Document.LastSignificantUpdateTime, + LastCachedTime = x.Document.LastCachedTime }); } } From 5664a988a109fc50c0d1428cc1dc33ef7b28c289 Mon Sep 17 00:00:00 2001 From: Salih Date: Fri, 19 Aug 2022 15:39:06 +0300 Subject: [PATCH 02/10] dash removed --- .../Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml index 776d504395..2fab21f615 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml @@ -111,7 +111,6 @@ name="LastUpdatedTimeMin" class="form-control datepicker" placeholder="@L["StartDate"].Value"> - - Date: Fri, 19 Aug 2022 15:59:42 +0300 Subject: [PATCH 03/10] search button moved next to language code input --- .../Pages/Docs/Admin/Documents/Index.cshtml | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml index 2fab21f615..36e0c82462 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Documents/Index.cshtml @@ -34,7 +34,7 @@ - +
@L["Project"].Value
@@ -45,7 +45,7 @@
- +
@L["Name"].Value
@@ -56,7 +56,7 @@
- +
@L["Version"].Value
@@ -67,17 +67,19 @@
- +
@L["LanguageCode"].Value
+ id="LanguageCode" + name="LanguageCode" + class="form-control">
- + + + @L["AdvancedFilters"] @@ -85,7 +87,7 @@