Browse Source

Several bugfixes.

pull/447/head
Sebastian 6 years ago
parent
commit
58676e438e
  1. 8
      backend/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsIndex.cs
  2. 2
      backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AnnotateAssetDto.cs
  3. 2
      backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetQuery.cs
  4. 6
      backend/src/Squidex/Areas/Api/Controllers/Contents/Models/ContentDto.cs
  5. 4
      backend/src/Squidex/Areas/Api/Controllers/EventConsumers/Models/EventConsumerDto.cs
  6. 8
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Indexes/AppsIndexTests.cs
  7. 8
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Indexes/SchemasIndexTests.cs
  8. 8
      frontend/app/features/settings/pages/clients/client-connect-form.component.html

8
backend/src/Squidex.Domain.Apps.Entities/Apps/Indexes/AppsIndex.cs

@ -123,7 +123,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Indexes
{ {
var app = await grainFactory.GetGrain<IAppGrain>(appId).GetStateAsync(); var app = await grainFactory.GetGrain<IAppGrain>(appId).GetStateAsync();
if (IsFound(app.Value)) if (IsFound(app.Value, false))
{ {
return app.Value; return app.Value;
} }
@ -257,7 +257,7 @@ namespace Squidex.Domain.Apps.Entities.Apps.Indexes
var app = await grainFactory.GetGrain<IAppGrain>(appId).GetStateAsync(); var app = await grainFactory.GetGrain<IAppGrain>(appId).GetStateAsync();
if (IsFound(app.Value)) if (IsFound(app.Value, true))
{ {
await Index().RemoveAsync(appId); await Index().RemoveAsync(appId);
} }
@ -268,9 +268,9 @@ namespace Squidex.Domain.Apps.Entities.Apps.Indexes
} }
} }
private static bool IsFound(IAppEntity app) private static bool IsFound(IAppEntity entity, bool allowArchived)
{ {
return app.Version > EtagVersion.Empty && !app.IsArchived; return entity.Version > EtagVersion.Empty && (!entity.IsArchived || allowArchived);
} }
private IAppsByNameIndexGrain Index() private IAppsByNameIndexGrain Index()

2
backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AnnotateAssetDto.cs

@ -27,7 +27,7 @@ namespace Squidex.Areas.Api.Controllers.Assets.Models
/// <summary> /// <summary>
/// The new asset tags. /// The new asset tags.
/// </summary> /// </summary>
public HashSet<string> Tags { get; set; } public HashSet<string>? Tags { get; set; }
public AnnotateAsset ToCommand(Guid id) public AnnotateAsset ToCommand(Guid id)
{ {

2
backend/src/Squidex/Areas/Api/Controllers/Assets/Models/AssetQuery.cs

@ -52,7 +52,7 @@ namespace Squidex.Areas.Api.Controllers.Assets.Models
/// The resize mode when the width and height is defined. /// The resize mode when the width and height is defined.
/// </summary> /// </summary>
[FromQuery(Name = "mode")] [FromQuery(Name = "mode")]
public string Mode { get; set; } public string? Mode { get; set; }
public bool ShouldResize() public bool ShouldResize()
{ {

6
backend/src/Squidex/Areas/Api/Controllers/Contents/Models/ContentDto.cs

@ -89,17 +89,17 @@ namespace Squidex.Areas.Api.Controllers.Contents.Models
/// <summary> /// <summary>
/// The name of the schema. /// The name of the schema.
/// </summary> /// </summary>
public string SchemaName { get; set; } public string? SchemaName { get; set; }
/// <summary> /// <summary>
/// The display name of the schema. /// The display name of the schema.
/// </summary> /// </summary>
public string SchemaDisplayName { get; set; } public string? SchemaDisplayName { get; set; }
/// <summary> /// <summary>
/// The reference fields. /// The reference fields.
/// </summary> /// </summary>
public FieldDto[] ReferenceFields { get; set; } public FieldDto[]? ReferenceFields { get; set; }
/// <summary> /// <summary>
/// The version of the content. /// The version of the content.

4
backend/src/Squidex/Areas/Api/Controllers/EventConsumers/Models/EventConsumerDto.cs

@ -20,9 +20,9 @@ namespace Squidex.Areas.Api.Controllers.EventConsumers.Models
public string Name { get; set; } public string Name { get; set; }
public string Error { get; set; } public string? Error { get; set; }
public string Position { get; set; } public string? Position { get; set; }
public static EventConsumerDto FromEventConsumerInfo(EventConsumerInfo eventConsumerInfo, ApiController controller) public static EventConsumerDto FromEventConsumerInfo(EventConsumerInfo eventConsumerInfo, ApiController controller)
{ {

8
backend/tests/Squidex.Domain.Apps.Entities.Tests/Apps/Indexes/AppsIndexTests.cs

@ -19,6 +19,8 @@ using Squidex.Infrastructure.Security;
using Squidex.Infrastructure.Validation; using Squidex.Infrastructure.Validation;
using Xunit; using Xunit;
#pragma warning disable SA1133 // Do not combine attributes
namespace Squidex.Domain.Apps.Entities.Apps.Indexes namespace Squidex.Domain.Apps.Entities.Apps.Indexes
{ {
public sealed class AppsIndexTests public sealed class AppsIndexTests
@ -262,10 +264,10 @@ namespace Squidex.Domain.Apps.Entities.Apps.Indexes
.MustHaveHappened(); .MustHaveHappened();
} }
[Fact] [Theory, InlineData(true), InlineData(false)]
public async Task Should_remove_app_from_indexes_on_archive() public async Task Should_remove_app_from_indexes_on_archive(bool isArchived)
{ {
var app = SetupApp(0, false); var app = SetupApp(0, isArchived);
var context = var context =
new CommandContext(new ArchiveApp { AppId = appId.Id }, commandBus) new CommandContext(new ArchiveApp { AppId = appId.Id }, commandBus)

8
backend/tests/Squidex.Domain.Apps.Entities.Tests/Schemas/Indexes/SchemasIndexTests.cs

@ -18,6 +18,8 @@ using Squidex.Infrastructure.Orleans;
using Squidex.Infrastructure.Validation; using Squidex.Infrastructure.Validation;
using Xunit; using Xunit;
#pragma warning disable SA1133 // Do not combine attributes
namespace Squidex.Domain.Apps.Entities.Schemas.Indexes namespace Squidex.Domain.Apps.Entities.Schemas.Indexes
{ {
public class SchemasIndexTests public class SchemasIndexTests
@ -188,10 +190,10 @@ namespace Squidex.Domain.Apps.Entities.Schemas.Indexes
.MustNotHaveHappened(); .MustNotHaveHappened();
} }
[Fact] [Theory, InlineData(true), InlineData(false)]
public async Task Should_remove_schema_from_index_on_delete() public async Task Should_remove_schema_from_index_on_delete_when_existed_before(bool isDeleted)
{ {
var schema = SetupSchema(0, false); var schema = SetupSchema(0, isDeleted);
var context = var context =
new CommandContext(new DeleteSchema { SchemaId = schema.Id }, commandBus) new CommandContext(new DeleteSchema { SchemaId = schema.Id }, commandBus)

8
frontend/app/features/settings/pages/clients/client-connect-form.component.html

@ -116,9 +116,7 @@
<h5><span class="badge badge-pill badge-dark">3</span> Add your app name the CLI config</h5> <h5><span class="badge badge-pill badge-dark">3</span> Add your app name the CLI config</h5>
<p> <p>
<sqx-code> <sqx-code>sq config add {{appName}} {{appName}}:{{client.id}} {{client.secret}} -u {{apiUrl.value}}</sqx-code>
sq config add {{appName}} {{appName}}:{{client.id}} ${{client.secret}} -u ${{apiUrl.value}}
</sqx-code>
<sqx-form-hint> <sqx-form-hint>
You can manage configuration to multiple apps in the CLI and switch to an app. You can manage configuration to multiple apps in the CLI and switch to an app.
@ -130,9 +128,7 @@
<h5><span class="badge badge-pill badge-dark">4</span> Switch to your app in the CLI</h5> <h5><span class="badge badge-pill badge-dark">4</span> Switch to your app in the CLI</h5>
<p> <p>
<sqx-code> <sqx-code>sq config use {{appName}}</sqx-code>
sq config use {{appName}}
</sqx-code>
</p> </p>
</div> </div>
</ng-container> </ng-container>

Loading…
Cancel
Save