Merge pull request #16939 from abpframework/issue-16814

Issue 16814
pull/16981/head
Gizem Mutu Kurt 2 years ago committed by GitHub
commit cf7397ff44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,18 +13,19 @@ using VoloDocs.EntityFrameworkCore;
namespace Migrations
{
[DbContext(typeof(VoloDocsDbContext))]
[Migration("20220923075101_Initial")]
[Migration("20230622110108_Initial")]
partial class Initial
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("ProductVersion", "6.0.5")
.HasAnnotation("ProductVersion", "7.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
@ -112,6 +113,9 @@ namespace Migrations
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -298,6 +302,9 @@ namespace Migrations
.HasDefaultValue(false)
.HasColumnName("EmailConfirmed");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -326,6 +333,9 @@ namespace Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<DateTimeOffset?>("LastPasswordChangeTime")
.HasColumnType("datetimeoffset");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
@ -374,6 +384,9 @@ namespace Migrations
.HasColumnType("nvarchar(256)")
.HasColumnName("SecurityStamp");
b.Property<bool>("ShouldChangePasswordOnNextLogin")
.HasColumnType("bit");
b.Property<string>("Surname")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)")
@ -436,6 +449,33 @@ namespace Migrations
b.ToTable("AbpUserClaims", (string)null);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("EndTime")
.HasColumnType("datetime2");
b.Property<Guid>("SourceUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("StartTime")
.HasColumnType("datetime2");
b.Property<Guid>("TargetUserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.ToTable("AbpUserDelegations", (string)null);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.Property<Guid>("UserId")
@ -576,6 +616,9 @@ namespace Migrations
.HasColumnType("nvarchar(128)")
.HasColumnName("DisplayName");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");

@ -5,8 +5,10 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
@ -53,6 +55,7 @@ namespace Migrations
ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Code = table.Column<string>(type: "nvarchar(95)", maxLength: 95, nullable: false),
DisplayName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
EntityVersion = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
@ -133,6 +136,7 @@ namespace Migrations
IsDefault = table.Column<bool>(type: "bit", nullable: false),
IsStatic = table.Column<bool>(type: "bit", nullable: false),
IsPublic = table.Column<bool>(type: "bit", nullable: false),
EntityVersion = table.Column<int>(type: "int", nullable: false),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true)
},
@ -181,6 +185,22 @@ namespace Migrations
table.PrimaryKey("PK_AbpSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpUserDelegations",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
SourceUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TargetUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
StartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
EndTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpUserDelegations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AbpUsers",
columns: table => new
@ -204,6 +224,9 @@ namespace Migrations
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
AccessFailedCount = table.Column<int>(type: "int", nullable: false, defaultValue: 0),
ShouldChangePasswordOnNextLogin = table.Column<bool>(type: "bit", nullable: false),
EntityVersion = table.Column<int>(type: "int", nullable: false),
LastPasswordChangeTime = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
@ -578,6 +601,7 @@ namespace Migrations
column: "UserName");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
@ -610,6 +634,9 @@ namespace Migrations
migrationBuilder.DropTable(
name: "AbpUserClaims");
migrationBuilder.DropTable(
name: "AbpUserDelegations");
migrationBuilder.DropTable(
name: "AbpUserLogins");

@ -19,10 +19,10 @@ namespace Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("ProductVersion", "6.0.5")
.HasAnnotation("ProductVersion", "7.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
{
@ -110,6 +110,9 @@ namespace Migrations
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -296,6 +299,9 @@ namespace Migrations
.HasDefaultValue(false)
.HasColumnName("EmailConfirmed");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -324,6 +330,9 @@ namespace Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<DateTimeOffset?>("LastPasswordChangeTime")
.HasColumnType("datetimeoffset");
b.Property<bool>("LockoutEnabled")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
@ -372,6 +381,9 @@ namespace Migrations
.HasColumnType("nvarchar(256)")
.HasColumnName("SecurityStamp");
b.Property<bool>("ShouldChangePasswordOnNextLogin")
.HasColumnType("bit");
b.Property<string>("Surname")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)")
@ -434,6 +446,33 @@ namespace Migrations
b.ToTable("AbpUserClaims", (string)null);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("EndTime")
.HasColumnType("datetime2");
b.Property<Guid>("SourceUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("StartTime")
.HasColumnType("datetime2");
b.Property<Guid>("TargetUserId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier")
.HasColumnName("TenantId");
b.HasKey("Id");
b.ToTable("AbpUserDelegations", (string)null);
});
modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
{
b.Property<Guid>("UserId")
@ -574,6 +613,9 @@ namespace Migrations
.HasColumnType("nvarchar(128)")
.HasColumnName("DisplayName");
b.Property<int>("EntityVersion")
.HasColumnType("int");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace Volo.Docs.Documents
@ -16,7 +17,7 @@ namespace Volo.Docs.Documents
Task<DocumentResourceDto> GetResourceAsync(GetDocumentResourceInput input);
Task<List<DocumentSearchOutput>> SearchAsync(DocumentSearchInput input);
Task<PagedResultDto<DocumentSearchOutput>> SearchAsync(DocumentSearchInput input);
Task<bool> FullSearchEnabledAsync();

@ -9,6 +9,7 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Volo.Docs.Caching;
using Volo.Docs.Documents.FullSearch.Elastic;
@ -176,16 +177,16 @@ namespace Volo.Docs.Documents
);
}
public async Task<List<DocumentSearchOutput>> SearchAsync(DocumentSearchInput input)
public async Task<PagedResultDto<DocumentSearchOutput>> SearchAsync(DocumentSearchInput input)
{
var project = await _projectRepository.GetAsync(input.ProjectId);
input.Version = GetProjectVersionPrefixIfExist(project) + input.Version;
var esDocs =
await _documentFullSearch.SearchAsync(input.Context, project.Id, input.LanguageCode, input.Version);
var esDocResult =
await _documentFullSearch.SearchAsync(input.Context, project.Id, input.LanguageCode, input.Version, input.SkipCount, input.MaxResultCount);
return esDocs.Select(esDoc => new DocumentSearchOutput //TODO: auto map
return new PagedResultDto<DocumentSearchOutput>(esDocResult.TotalCount,esDocResult.EsDocuments.Select(esDoc => new DocumentSearchOutput //TODO: auto map
{
Name = esDoc.Name,
FileName = esDoc.FileName,
@ -194,7 +195,7 @@ namespace Volo.Docs.Documents
Highlight = esDoc.Highlight
}).Where(x =>
x.FileName != project.NavigationDocumentName && x.FileName != project.ParametersDocumentName)
.ToList();
.ToList());
}
public async Task<bool> FullSearchEnabledAsync()

@ -138,7 +138,7 @@ namespace Volo.Docs.Documents.FullSearch.Elastic
.DeleteByQueryAsync(request, cancellationToken));
}
public virtual async Task<List<EsDocument>> SearchAsync(string context, Guid projectId, string languageCode,
public virtual async Task<EsDocumentResult> SearchAsync(string context, Guid projectId, string languageCode,
string version, int? skipCount = null, int? maxResultCount = null,
CancellationToken cancellationToken = default)
{
@ -212,7 +212,7 @@ namespace Volo.Docs.Documents.FullSearch.Elastic
docs.Add(doc);
}
return docs;
return new EsDocumentResult { EsDocuments = docs, TotalCount = response.Total };
}
protected virtual void HandleError(IElasticsearchResponse response)

@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace Volo.Docs.Documents.FullSearch.Elastic;
public class EsDocumentResult
{
public EsDocumentResult()
{
EsDocuments = new List<EsDocument>();
}
public long TotalCount { get; set; }
public List<EsDocument> EsDocuments { get; set; }
}

@ -19,7 +19,7 @@ namespace Volo.Docs.Documents.FullSearch.Elastic
Task DeleteAllByProjectIdAsync(Guid projectId, CancellationToken cancellationToken = default);
Task<List<EsDocument>> SearchAsync(string context, Guid projectId, string languageCode,
Task<EsDocumentResult> SearchAsync(string context, Guid projectId, string languageCode,
string version, int? skipCount = null, int? maxResultCount = null,
CancellationToken cancellationToken = default);

@ -1,16 +1,17 @@
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Modeling;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Client.ClientProxying;
using Volo.Abp.Http.Modeling;
using Volo.Docs.Documents;
using System.Collections.Generic;
// ReSharper disable once CheckNamespace
namespace Volo.Docs.Documents.ClientProxies;
namespace Volo.Docs.Documents;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IDocumentAppService), typeof(DocsDocumentClientProxy))]
@ -48,9 +49,9 @@ public partial class DocsDocumentClientProxy : ClientProxyBase<IDocumentAppServi
});
}
public virtual async Task<List<DocumentSearchOutput>> SearchAsync(DocumentSearchInput input)
public virtual async Task<PagedResultDto<DocumentSearchOutput>> SearchAsync(DocumentSearchInput input)
{
return await RequestAsync<List<DocumentSearchOutput>>(nameof(SearchAsync), new ClientProxyRequestTypeValue
return await RequestAsync<PagedResultDto<DocumentSearchOutput>>(nameof(SearchAsync), new ClientProxyRequestTypeValue
{
{ typeof(DocumentSearchInput), input }
});

@ -1,6 +1,6 @@
// This file is part of DocsDocumentClientProxy, you can customize it here
// ReSharper disable once CheckNamespace
namespace Volo.Docs.Documents.ClientProxies;
namespace Volo.Docs.Documents;
public partial class DocsDocumentClientProxy
{

@ -1,16 +1,18 @@
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Modeling;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Client.ClientProxying;
using Volo.Docs.Projects;
using Volo.Abp.Http.Modeling;
using Volo.Docs.Documents;
using Volo.Docs.Projects;
// ReSharper disable once CheckNamespace
namespace Volo.Docs.Projects.ClientProxies;
namespace Volo.Docs.Projects;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IProjectAppService), typeof(DocsProjectClientProxy))]

@ -1,6 +1,6 @@
// This file is part of DocsProjectClientProxy, you can customize it here
// ReSharper disable once CheckNamespace
namespace Volo.Docs.Projects.ClientProxies;
namespace Volo.Docs.Projects;
public partial class DocsProjectClientProxy
{

@ -8,11 +8,107 @@
"controllerName": "DocsProject",
"controllerGroupName": "Project",
"isRemoteService": true,
"isIntegrationService": false,
"apiVersion": null,
"type": "Volo.Docs.Projects.DocsProjectController",
"interfaces": [
{
"type": "Volo.Docs.Projects.IProjectAppService"
"type": "Volo.Docs.Projects.IProjectAppService",
"name": "IProjectAppService",
"methods": [
{
"name": "GetListAsync",
"parametersOnMethod": [],
"returnValue": {
"type": "Volo.Abp.Application.Dtos.ListResultDto<Volo.Docs.Projects.ProjectDto>",
"typeSimple": "Volo.Abp.Application.Dtos.ListResultDto<Volo.Docs.Projects.ProjectDto>"
}
},
{
"name": "GetAsync",
"parametersOnMethod": [
{
"name": "shortName",
"typeAsString": "System.String, System.Private.CoreLib",
"type": "System.String",
"typeSimple": "string",
"isOptional": false,
"defaultValue": null
}
],
"returnValue": {
"type": "Volo.Docs.Projects.ProjectDto",
"typeSimple": "Volo.Docs.Projects.ProjectDto"
}
},
{
"name": "GetVersionsAsync",
"parametersOnMethod": [
{
"name": "shortName",
"typeAsString": "System.String, System.Private.CoreLib",
"type": "System.String",
"typeSimple": "string",
"isOptional": false,
"defaultValue": null
}
],
"returnValue": {
"type": "Volo.Abp.Application.Dtos.ListResultDto<Volo.Docs.Projects.VersionInfoDto>",
"typeSimple": "Volo.Abp.Application.Dtos.ListResultDto<Volo.Docs.Projects.VersionInfoDto>"
}
},
{
"name": "GetDefaultLanguageCodeAsync",
"parametersOnMethod": [
{
"name": "shortName",
"typeAsString": "System.String, System.Private.CoreLib",
"type": "System.String",
"typeSimple": "string",
"isOptional": false,
"defaultValue": null
},
{
"name": "version",
"typeAsString": "System.String, System.Private.CoreLib",
"type": "System.String",
"typeSimple": "string",
"isOptional": false,
"defaultValue": null
}
],
"returnValue": {
"type": "System.String",
"typeSimple": "string"
}
},
{
"name": "GetLanguageListAsync",
"parametersOnMethod": [
{
"name": "shortName",
"typeAsString": "System.String, System.Private.CoreLib",
"type": "System.String",
"typeSimple": "string",
"isOptional": false,
"defaultValue": null
},
{
"name": "version",
"typeAsString": "System.String, System.Private.CoreLib",
"type": "System.String",
"typeSimple": "string",
"isOptional": false,
"defaultValue": null
}
],
"returnValue": {
"type": "Volo.Docs.Documents.LanguageConfig",
"typeSimple": "Volo.Docs.Documents.LanguageConfig"
}
}
]
}
],
"actions": {
@ -225,11 +321,142 @@
"controllerName": "DocsDocument",
"controllerGroupName": "Document",
"isRemoteService": true,
"isIntegrationService": false,
"apiVersion": null,
"type": "Volo.Docs.Documents.DocsDocumentController",
"interfaces": [
{
"type": "Volo.Docs.Documents.IDocumentAppService"
"type": "Volo.Docs.Documents.IDocumentAppService",
"name": "IDocumentAppService",
"methods": [
{
"name": "GetAsync",
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.Docs.Documents.GetDocumentInput, Volo.Docs.Application.Contracts",
"type": "Volo.Docs.Documents.GetDocumentInput",
"typeSimple": "Volo.Docs.Documents.GetDocumentInput",
"isOptional": false,
"defaultValue": null
}
],
"returnValue": {
"type": "Volo.Docs.Documents.DocumentWithDetailsDto",
"typeSimple": "Volo.Docs.Documents.DocumentWithDetailsDto"
}
},
{
"name": "GetDefaultAsync",
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.Docs.Documents.GetDefaultDocumentInput, Volo.Docs.Application.Contracts",
"type": "Volo.Docs.Documents.GetDefaultDocumentInput",
"typeSimple": "Volo.Docs.Documents.GetDefaultDocumentInput",
"isOptional": false,
"defaultValue": null
}
],
"returnValue": {
"type": "Volo.Docs.Documents.DocumentWithDetailsDto",
"typeSimple": "Volo.Docs.Documents.DocumentWithDetailsDto"
}
},
{
"name": "GetNavigationAsync",
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.Docs.Documents.GetNavigationDocumentInput, Volo.Docs.Application.Contracts",
"type": "Volo.Docs.Documents.GetNavigationDocumentInput",
"typeSimple": "Volo.Docs.Documents.GetNavigationDocumentInput",
"isOptional": false,
"defaultValue": null
}
],
"returnValue": {
"type": "Volo.Docs.Documents.NavigationNode",
"typeSimple": "Volo.Docs.Documents.NavigationNode"
}
},
{
"name": "GetParametersAsync",
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.Docs.Documents.GetParametersDocumentInput, Volo.Docs.Application.Contracts",
"type": "Volo.Docs.Documents.GetParametersDocumentInput",
"typeSimple": "Volo.Docs.Documents.GetParametersDocumentInput",
"isOptional": false,
"defaultValue": null
}
],
"returnValue": {
"type": "Volo.Docs.Documents.DocumentParametersDto",
"typeSimple": "Volo.Docs.Documents.DocumentParametersDto"
}
},
{
"name": "GetResourceAsync",
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.Docs.Documents.GetDocumentResourceInput, Volo.Docs.Application.Contracts",
"type": "Volo.Docs.Documents.GetDocumentResourceInput",
"typeSimple": "Volo.Docs.Documents.GetDocumentResourceInput",
"isOptional": false,
"defaultValue": null
}
],
"returnValue": {
"type": "Volo.Docs.Documents.DocumentResourceDto",
"typeSimple": "Volo.Docs.Documents.DocumentResourceDto"
}
},
{
"name": "SearchAsync",
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "Volo.Docs.Documents.DocumentSearchInput, Volo.Docs.Application.Contracts",
"type": "Volo.Docs.Documents.DocumentSearchInput",
"typeSimple": "Volo.Docs.Documents.DocumentSearchInput",
"isOptional": false,
"defaultValue": null
}
],
"returnValue": {
"type": "Volo.Abp.Application.Dtos.PagedResultDto<Volo.Docs.Documents.DocumentSearchOutput>",
"typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto<Volo.Docs.Documents.DocumentSearchOutput>"
}
},
{
"name": "FullSearchEnabledAsync",
"parametersOnMethod": [],
"returnValue": {
"type": "System.Boolean",
"typeSimple": "boolean"
}
},
{
"name": "GetUrlsAsync",
"parametersOnMethod": [
{
"name": "prefix",
"typeAsString": "System.String, System.Private.CoreLib",
"type": "System.String",
"typeSimple": "string",
"isOptional": false,
"defaultValue": null
}
],
"returnValue": {
"type": "System.Collections.Generic.List<System.String>",
"typeSimple": "[string]"
}
}
]
}
],
"actions": {
@ -532,8 +759,8 @@
}
],
"returnValue": {
"type": "System.Collections.Generic.List<Volo.Docs.Documents.DocumentSearchOutput>",
"typeSimple": "[Volo.Docs.Documents.DocumentSearchOutput]"
"type": "Volo.Abp.Application.Dtos.PagedResultDto<Volo.Docs.Documents.DocumentSearchOutput>",
"typeSimple": "Volo.Abp.Application.Dtos.PagedResultDto<Volo.Docs.Documents.DocumentSearchOutput>"
},
"allowAnonymous": null,
"implementFrom": "Volo.Docs.Documents.IDocumentAppService"
@ -657,6 +884,7 @@
"controllerName": "DocumentResource",
"controllerGroupName": "DocumentResource",
"isRemoteService": true,
"isIntegrationService": false,
"apiVersion": null,
"type": "Volo.Docs.Areas.Documents.DocumentResourceController",
"interfaces": [],

@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
namespace Volo.Docs.Documents
@ -49,7 +50,7 @@ namespace Volo.Docs.Documents
[HttpPost]
[Route("search")]
public Task<List<DocumentSearchOutput>> SearchAsync(DocumentSearchInput input)
public Task<PagedResultDto<DocumentSearchOutput>> SearchAsync(DocumentSearchInput input)
{
return DocumentAppService.SearchAsync(input);
}

@ -41,45 +41,53 @@
</div>
</form>
<div class="card mt-4 rounded">
<div class="card-header">
<h5 class="text-center ">@L["SearchResults"]</h5>
</div>
<div class="p-5 card-body">
@foreach (var docs in Model.SearchOutputs)
{
<div class="row">
<div class="col">
<div class="pb-4 small">
@functions
{
string RemoveFileExtensionFromPath(string path)
@if (!Model.KeyWord.IsNullOrWhiteSpace())
{
<div class="card mt-4 rounded">
<div class="card-header">
<h5 class="text-center ">@L["SearchResults"]</h5>
</div>
<div class="px-5 pt-5 card-body">
@foreach (var docs in Model.SearchOutputs)
{
<div class="row">
<div class="col">
<div class="pb-4 small">
@functions
{
if (path == null)
string RemoveFileExtensionFromPath(string path)
{
return null;
if (path == null)
{
return null;
}
return path.EndsWith("." + @Model.Project.Format)
? path.Left(path.Length - Model.Project.Format.Length - 1)
: path;
}
return path.EndsWith("." + @Model.Project.Format)
? path.Left(path.Length - Model.Project.Format.Length - 1)
: path;
}
}
<h5 class="mb-3">
<a href="/@Model.LanguageCode/@Model.ProjectName/@Model.Version/@RemoveFileExtensionFromPath(docs.Name)">
@RemoveFileExtensionFromPath(docs.Name)
</a>
</h5>
<div class="mb-4">
@foreach (var highlight in docs.Highlight)
{
<p class="mb-2">@Html.Raw(highlight)</p>
}
</div>
</div>
<h5 class="mb-3">
<a href="/@Model.LanguageCode/@Model.ProjectName/@Model.Version/@RemoveFileExtensionFromPath(docs.Name)">
@RemoveFileExtensionFromPath(docs.Name)
</a>
</h5>
<div class="mb-4">
@foreach (var highlight in docs.Highlight)
{
<p class="mb-2">@Html.Raw(highlight)</p>
}
</div>
</div>
</div>
</div>
</div>
}
}
@if (Model.PagerModel != null)
{
<abp-paginator model="Model.PagerModel" show-info="true" />
}
</div>
</div>
</div>
}
</div>

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination;
using Volo.Docs.Documents;
using Volo.Docs.GitHub.Documents.Version;
using Volo.Docs.HtmlConverting;
@ -24,6 +25,10 @@ namespace Volo.Docs.Pages.Documents
[BindProperty(SupportsGet = true)] public string LanguageCode { get; set; }
[BindProperty(SupportsGet = true)] public string KeyWord { get; set; }
[BindProperty(SupportsGet = true)] public int CurrentPage { get; set; } = 1;
public PagerModel PagerModel { get; set; }
public ProjectDto Project { get; set; }
@ -49,6 +54,11 @@ namespace Volo.Docs.Pages.Documents
return RedirectToPage("Index");
}
if (keyword.IsNullOrWhiteSpace())
{
return Page();
}
KeyWord = keyword;
Project = await _projectAppService.GetAsync(ProjectName);
@ -72,13 +82,25 @@ namespace Volo.Docs.Pages.Documents
}
}
SearchOutputs = await _documentAppService.SearchAsync(new DocumentSearchInput
var pagedSearchOutputs = await _documentAppService.SearchAsync(new DocumentSearchInput
{
ProjectId = Project.Id,
Context = KeyWord,
LanguageCode = LanguageCode,
Version = Version
Version = Version,
MaxResultCount = 10,
SkipCount = (CurrentPage - 1) * 10
});
SearchOutputs = pagedSearchOutputs.Items.ToList();
PagerModel = new PagerModel(pagedSearchOutputs.TotalCount, 10, CurrentPage, 10, Url.Page("Search", new
{
ProjectName,
Version,
LanguageCode,
KeyWord
}));
var highlightTag1 = Guid.NewGuid().ToString();
var highlightTag2 = Guid.NewGuid().ToString();

Loading…
Cancel
Save