mirror of https://github.com/Squidex/squidex.git
committed by
GitHub
31 changed files with 332 additions and 231 deletions
@ -0,0 +1,42 @@ |
|||
// ==========================================================================
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|||
// All rights reserved. Licensed under the MIT license.
|
|||
// ==========================================================================
|
|||
|
|||
using Squidex.Areas.Api.Controllers.Contents.Models; |
|||
using Squidex.Domain.Apps.Core.Schemas; |
|||
using Squidex.Domain.Apps.Entities.Contents; |
|||
using Squidex.Infrastructure.Queries; |
|||
using Squidex.Infrastructure.Reflection; |
|||
|
|||
namespace Squidex.Areas.Api.Controllers.Schemas.Models; |
|||
|
|||
public sealed class QueryModelDto |
|||
{ |
|||
public FilterSchema Schema { get; init; } = FilterSchema.Any; |
|||
|
|||
public IReadOnlyDictionary<FilterSchemaType, IReadOnlyList<CompareOperator>> Operators { get; init; } |
|||
|
|||
public StatusInfoDto[] Statuses { get; set; } |
|||
|
|||
public static async Task<QueryModelDto> FromModelAsync(QueryModel model, Schema? schema, IContentWorkflow workflow) |
|||
{ |
|||
var result = SimpleMapper.Map(model, new QueryModelDto()); |
|||
|
|||
if (schema != null) |
|||
{ |
|||
await result.AssignStatusesAsync(workflow, schema); |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
private async Task AssignStatusesAsync(IContentWorkflow workflow, Schema schema) |
|||
{ |
|||
var allStatuses = await workflow.GetAllAsync(schema); |
|||
|
|||
Statuses = allStatuses.Select(StatusInfoDto.FromDomain).ToArray(); |
|||
} |
|||
} |
|||
@ -1,22 +1,18 @@ |
|||
@if (logical) { |
|||
@if (actualLogical) { |
|||
<sqx-filter-logical |
|||
[filter]="logical" |
|||
(filterChange)="filterChange.emit()" |
|||
[filter]="actualLogical" |
|||
(filterChange)="filterChange.emit($event)" |
|||
[language]="language" |
|||
[languages]="languages" |
|||
[level]="level" |
|||
[model]="model" |
|||
(remove)="remove.emit()" |
|||
[statuses]="statuses"></sqx-filter-logical> |
|||
} |
|||
|
|||
@if (comparison) { |
|||
(remove)="remove.emit()"></sqx-filter-logical> |
|||
} @else if (actualComparison) { |
|||
<sqx-filter-comparison |
|||
[filter]="comparison" |
|||
(filterChange)="filterChange.emit()" |
|||
[filter]="actualComparison" |
|||
(filterChange)="filterChange.emit($event)" |
|||
[language]="language" |
|||
[languages]="languages" |
|||
[model]="model" |
|||
(remove)="remove.emit()" |
|||
[statuses]="statuses"></sqx-filter-comparison> |
|||
(remove)="remove.emit()"></sqx-filter-comparison> |
|||
} |
|||
|
|||
Loading…
Reference in new issue