Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs improvements #19277

Merged
merged 3 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<ProjectReference Include="..\..\src\Volo.Docs.Web\Volo.Docs.Web.csproj" />
<ProjectReference Include="..\..\src\Volo.Docs.Admin.Web\Volo.Docs.Admin.Web.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Autofac\Volo.Abp.Autofac.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.Caching.StackExchangeRedis\Volo.Abp.Caching.StackExchangeRedis.csproj" />
<ProjectReference Include="..\..\..\..\modules\basic-theme\src\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic\Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj" />
<ProjectReference Include="..\VoloDocs.EntityFrameworkCore\VoloDocs.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\modules\identity\src\Volo.Abp.Identity.Application\Volo.Abp.Identity.Application.csproj" />
Expand All @@ -42,6 +43,7 @@
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.Web\Volo.Abp.Account.Web.csproj" />
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.Application\Volo.Abp.Account.Application.csproj" />
<ProjectReference Include="..\..\..\..\modules\account\src\Volo.Abp.Account.HttpApi\Volo.Abp.Account.HttpApi.csproj" />

</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
using Volo.Abp.PermissionManagement.HttpApi;
using Volo.Abp.Validation.Localization;
using Volo.Docs.Documents.FullSearch.Elastic;
using Volo.Abp.Caching.StackExchangeRedis;

namespace VoloDocs.Web
{
Expand All @@ -57,6 +58,7 @@ namespace VoloDocs.Web
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpPermissionManagementHttpApiModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule)
,typeof(AbpCachingStackExchangeRedisModule)
)]
public class VoloDocsWebModule : AbpModule
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ public virtual async Task ClearCacheAsync(ClearCacheInput input)
await _versionCache.RemoveAsync(versionCacheKey, true);

var documents = await _documentRepository.GetListByProjectId(project.Id);

foreach (var document in documents)
{
var documentUpdateInfoCacheKey = CacheKeyGenerator.GenerateDocumentUpdateInfoCacheKey(

var documentUpdateInfoCacheKeys = documents.Select(document =>
CacheKeyGenerator.GenerateDocumentUpdateInfoCacheKey(
project: project,
documentName: document.Name,
languageCode: document.LanguageCode,
version: document.Version
);

await _documentUpdateCache.RemoveAsync(documentUpdateInfoCacheKey);
)
);

await _documentUpdateCache.RemoveManyAsync(documentUpdateInfoCacheKeys);

documents.ForEach(document => document.LastCachedTime = DateTime.MinValue);

document.LastCachedTime = DateTime.MinValue;
await _documentRepository.UpdateAsync(document);
}
await _documentRepository.UpdateManyAsync(documents);
}

public virtual async Task PullAllAsync(PullAllDocumentInput input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,24 @@ public virtual async Task<NavigationNode> GetNavigationAsync(GetNavigationDocume
.Where(x => !x.Path.IsNullOrWhiteSpace())
.ToList();

var cacheKeys = leafs.Select(leaf =>
CacheKeyGenerator.GenerateDocumentUpdateInfoCacheKey(project, leaf.Path, input.LanguageCode, input.Version)
);
var documentUpdateInfos = await DocumentUpdateCache.GetManyAsync(cacheKeys);

foreach (var leaf in leafs)
{
var cacheKey =
CacheKeyGenerator.GenerateDocumentUpdateInfoCacheKey(project, leaf.Path, input.LanguageCode,
input.Version);
var documentUpdateInfo = await DocumentUpdateCache.GetAsync(cacheKey);
if (documentUpdateInfo != null)
var key = CacheKeyGenerator.GenerateDocumentUpdateInfoCacheKey(project, leaf.Path, input.LanguageCode, input.Version);
var (_, documentUpdateInfo) = documentUpdateInfos.FirstOrDefault(x => x.Key == key);

if (documentUpdateInfo == null)
{
leaf.CreationTime = documentUpdateInfo.CreationTime;
leaf.LastUpdatedTime = documentUpdateInfo.LastUpdatedTime;
leaf.LastSignificantUpdateTime = documentUpdateInfo.LastSignificantUpdateTime;
continue;
}

leaf.CreationTime = documentUpdateInfo.CreationTime;
leaf.LastUpdatedTime = documentUpdateInfo.LastUpdatedTime;
leaf.LastSignificantUpdateTime = documentUpdateInfo.LastSignificantUpdateTime;
}

await NavigationTreePostProcessor.ProcessAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ private async Task SetVersionAsync()
}

var output = await _projectAppService.GetVersionsAsync(Project.ShortName);
var versions = output.Items.ToList()
var versions = output.Items
.Select(v => new VersionInfoViewModel(v.DisplayName, v.Name))
.ToList();

Expand Down
Loading