From bcc6908dfe5bc5cad7a80634a33e6331726e085e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 27 Jun 2018 19:39:17 +0200 Subject: [PATCH] UI finalized and bugfixes in API. --- .../Contents/ContentQueryService.cs | 1 - .../Contents/SingletonCommandMiddleware.cs | 10 +- src/Squidex.Infrastructure/States/Store.cs | 4 +- .../Schemas/Models/SchemaDetailsDto.cs | 5 + src/Squidex/Config/Domain/EntitiesServices.cs | 3 + .../pages/content/content-page.component.html | 82 +++--- .../pages/schemas/schema-form.component.html | 46 ++- .../pages/schemas/schema-form.component.scss | 62 +++++ .../pages/schemas/schema-form.component.ts | 2 +- .../schema-must-exist-published.guard.spec.ts | 9 +- .../schema-must-exist-published.guard.ts | 10 +- .../app/shared/services/schemas.service.ts | 4 +- .../app/shared/state/contents.state.ts | 16 +- src/Squidex/app/shared/state/schemas.forms.ts | 1 + src/Squidex/app/theme/icomoon/demo.html | 34 ++- .../app/theme/icomoon/fonts/icomoon.eot | Bin 24360 -> 24880 bytes .../app/theme/icomoon/fonts/icomoon.svg | 2 + .../app/theme/icomoon/fonts/icomoon.ttf | Bin 24196 -> 24716 bytes .../app/theme/icomoon/fonts/icomoon.woff | Bin 24272 -> 24792 bytes .../theme/icomoon/icons/multiple-content.svg | 95 +++++++ .../theme/icomoon/icons/single-content.svg | 69 +++++ src/Squidex/app/theme/icomoon/selection.json | 261 ++++++++++++------ src/Squidex/app/theme/icomoon/style.css | 16 +- 23 files changed, 576 insertions(+), 156 deletions(-) create mode 100644 src/Squidex/app/theme/icomoon/icons/multiple-content.svg create mode 100644 src/Squidex/app/theme/icomoon/icons/single-content.svg diff --git a/src/Squidex.Domain.Apps.Entities/Contents/ContentQueryService.cs b/src/Squidex.Domain.Apps.Entities/Contents/ContentQueryService.cs index 5ec1f122e..c404d6476 100644 --- a/src/Squidex.Domain.Apps.Entities/Contents/ContentQueryService.cs +++ b/src/Squidex.Domain.Apps.Entities/Contents/ContentQueryService.cs @@ -63,7 +63,6 @@ namespace Squidex.Domain.Apps.Entities.Contents public async Task FindContentAsync(QueryContext context, Guid id, long version = -1) { Guard.NotNull(context, nameof(context)); - Guard.NotEmpty(id, nameof(id)); var schema = await GetSchemaAsync(context); diff --git a/src/Squidex.Domain.Apps.Entities/Contents/SingletonCommandMiddleware.cs b/src/Squidex.Domain.Apps.Entities/Contents/SingletonCommandMiddleware.cs index 2f1547416..6dd070600 100644 --- a/src/Squidex.Domain.Apps.Entities/Contents/SingletonCommandMiddleware.cs +++ b/src/Squidex.Domain.Apps.Entities/Contents/SingletonCommandMiddleware.cs @@ -7,6 +7,7 @@ using System; using System.Threading.Tasks; +using Squidex.Domain.Apps.Core.Contents; using Squidex.Domain.Apps.Entities.Contents.Commands; using Squidex.Domain.Apps.Entities.Schemas.Commands; using Squidex.Infrastructure; @@ -27,9 +28,14 @@ namespace Squidex.Domain.Apps.Entities.Contents { var schemaId = new NamedId(createSchema.SchemaId, createSchema.Name); - var command = SimpleMapper.Map(createSchema, new CreateContent { ContentId = Guid.Empty, SchemaId = schemaId, Publish = true }); + var data = new NamedContentData(); - await context.CommandBus.PublishAsync(command); + var contentId = Guid.Empty; + var content = new CreateContent { Data = data, ContentId = contentId, SchemaId = schemaId, Publish = true }; + + SimpleMapper.Map(context.Command, content); + + await context.CommandBus.PublishAsync(content); } } } diff --git a/src/Squidex.Infrastructure/States/Store.cs b/src/Squidex.Infrastructure/States/Store.cs index 461c443fb..89e162a54 100644 --- a/src/Squidex.Infrastructure/States/Store.cs +++ b/src/Squidex.Infrastructure/States/Store.cs @@ -42,7 +42,7 @@ namespace Squidex.Infrastructure.States public IPersistence WithEventSourcing(Type owner, TKey key, Func, Task> applyEvent) { - Guard.NotDefault(key, nameof(key)); + Guard.NotNull(key, nameof(key)); var snapshotStore = (ISnapshotStore)services.GetService(typeof(ISnapshotStore)); @@ -51,7 +51,7 @@ namespace Squidex.Infrastructure.States private IPersistence CreatePersistence(Type owner, TKey key, PersistenceMode mode, Func applySnapshot, Func, Task> applyEvent) { - Guard.NotDefault(key, nameof(key)); + Guard.NotNull(key, nameof(key)); var snapshotStore = (ISnapshotStore)services.GetService(typeof(ISnapshotStore)); diff --git a/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaDetailsDto.cs b/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaDetailsDto.cs index 850c6f938..c9c3c5909 100644 --- a/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaDetailsDto.cs +++ b/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaDetailsDto.cs @@ -36,6 +36,11 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models /// public string Category { get; set; } + /// + /// Indicates if the schema is a singleton. + /// + public bool IsSingleton { get; set; } + /// /// Indicates if the schema is published. /// diff --git a/src/Squidex/Config/Domain/EntitiesServices.cs b/src/Squidex/Config/Domain/EntitiesServices.cs index ab8132503..140a66cc6 100644 --- a/src/Squidex/Config/Domain/EntitiesServices.cs +++ b/src/Squidex/Config/Domain/EntitiesServices.cs @@ -128,6 +128,9 @@ namespace Squidex.Config.Domain services.AddSingletonAs() .As(); + services.AddSingletonAs() + .As(); + services.AddSingletonAs() .As(); diff --git a/src/Squidex/app/features/content/pages/content/content-page.component.html b/src/Squidex/app/features/content/pages/content/content-page.component.html index d6442b2a9..cdf90089e 100644 --- a/src/Squidex/app/features/content/pages/content/content-page.component.html +++ b/src/Squidex/app/features/content/pages/content/content-page.component.html @@ -3,7 +3,7 @@
- + @@ -32,7 +32,8 @@ + + + + +