diff --git a/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs b/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs index b7fe15978..6c7785e60 100644 --- a/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs +++ b/src/Squidex/Areas/Api/Controllers/Schemas/Models/FieldPropertiesDto.cs @@ -6,6 +6,7 @@ // ========================================================================== using System; +using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Runtime.Serialization; @@ -57,6 +58,11 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models /// public string EditorUrl { get; set; } + /// + /// Tags for automation processes. + /// + public ReadOnlyCollection Tags { get; set; } + public abstract FieldProperties ToProperties(); public static Type[] Subtypes() diff --git a/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaPropertiesDto.cs b/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaPropertiesDto.cs index bc0ad9316..ecff3be2d 100644 --- a/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaPropertiesDto.cs +++ b/src/Squidex/Areas/Api/Controllers/Schemas/Models/SchemaPropertiesDto.cs @@ -5,6 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== +using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations; namespace Squidex.Areas.Api.Controllers.Schemas.Models @@ -22,5 +23,10 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models /// [StringLength(1000)] public string Hints { get; set; } + + /// + /// Tags for automation processes. + /// + public ReadOnlyCollection Tags { get; set; } } } diff --git a/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpdateSchemaDto.cs b/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpdateSchemaDto.cs index 0de26e8df..f2d23b23b 100644 --- a/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpdateSchemaDto.cs +++ b/src/Squidex/Areas/Api/Controllers/Schemas/Models/UpdateSchemaDto.cs @@ -5,6 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== +using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations; using Squidex.Domain.Apps.Core.Schemas; using Squidex.Domain.Apps.Entities.Schemas.Commands; @@ -26,6 +27,11 @@ namespace Squidex.Areas.Api.Controllers.Schemas.Models [StringLength(1000)] public string Hints { get; set; } + /// + /// Tags for automation processes. + /// + public ReadOnlyCollection Tags { get; set; } + public UpdateSchema ToCommand() { var properties = SimpleMapper.Map(this, new SchemaProperties()); diff --git a/src/Squidex/app/features/schemas/pages/schema/forms/field-form-common.component.ts b/src/Squidex/app/features/schemas/pages/schema/forms/field-form-common.component.ts index 772950100..3076ccc91 100644 --- a/src/Squidex/app/features/schemas/pages/schema/forms/field-form-common.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/forms/field-form-common.component.ts @@ -5,8 +5,8 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { Component, Input, OnInit } from '@angular/core'; -import { FormControl, FormGroup } from '@angular/forms'; +import { Component, Input } from '@angular/core'; +import { FormGroup } from '@angular/forms'; import { FieldDto } from '@app/shared'; @@ -83,10 +83,22 @@ import { FieldDto } from '@app/shared'; + +
+ + +
+ + + + Tags to annotate your field for automation processes. + +
+
` }) -export class FieldFormCommonComponent implements OnInit { +export class FieldFormCommonComponent { public readonly standalone = { standalone: true }; @Input() @@ -97,27 +109,4 @@ export class FieldFormCommonComponent implements OnInit { @Input() public field: FieldDto; - - public ngOnInit() { - this.editForm.setControl('isRequired', - new FormControl(this.field.properties.isRequired)); - - this.editForm.setControl('isListField', - new FormControl(this.field.properties.isListField)); - - this.editForm.setControl('isReferenceField', - new FormControl(this.field.properties.isReferenceField)); - - this.editForm.setControl('editorUrl', - new FormControl(this.field.properties.editorUrl)); - - this.editForm.setControl('hints', - new FormControl(this.field.properties.hints)); - - this.editForm.setControl('placeholder', - new FormControl(this.field.properties.placeholder)); - - this.editForm.setControl('label', - new FormControl(this.field.properties.label)); - } } \ No newline at end of file diff --git a/src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.html b/src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.html index 3af647d3f..7150a23bf 100644 --- a/src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.html +++ b/src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.html @@ -26,6 +26,16 @@ + +
+ + + + + + + Tags to annotate your schema for automation processes. +
diff --git a/src/Squidex/app/shared/services/schemas.service.spec.ts b/src/Squidex/app/shared/services/schemas.service.spec.ts index 0af51cbeb..ddc7b88c5 100644 --- a/src/Squidex/app/shared/services/schemas.service.spec.ts +++ b/src/Squidex/app/shared/services/schemas.service.spec.ts @@ -575,7 +575,8 @@ describe('SchemasService', () => { lastModifiedBy: `modifier${id}`, properties: { label: `label${id}${suffix}`, - hints: `hints${id}${suffix}` + hints: `hints${id}${suffix}`, + tags: [`tags${id}${suffix}`] }, version: `${id}`, _links: { @@ -598,7 +599,8 @@ describe('SchemasService', () => { version: `${id}`, properties: { label: `label${id}${suffix}`, - hints: `hints${id}${suffix}` + hints: `hints${id}${suffix}`, + tags: [`tags${id}${suffix}`] }, previewUrls: { 'Default': 'url' @@ -772,7 +774,7 @@ export function createSchema(id: number, suffix = '') { `schema-id${id}`, `schema-name${id}${suffix}`, `category${id}${suffix}`, - new SchemaPropertiesDto(`label${id}${suffix}`, `hints${id}${suffix}`), + new SchemaPropertiesDto(`label${id}${suffix}`, `hints${id}${suffix}`, [`tags${id}${suffix}`]), id % 2 === 0, id % 3 === 0, DateTime.parseISO_UTC(`${id % 1000 + 2000}-12-12T10:10:00`), `creator${id}`, @@ -789,7 +791,7 @@ export function createSchemaDetails(id: number, suffix = '') { `schema-id${id}`, `schema-name${id}${suffix}`, `category${id}${suffix}`, - new SchemaPropertiesDto(`label${id}${suffix}`, `hints${id}${suffix}`), + new SchemaPropertiesDto(`label${id}${suffix}`, `hints${id}${suffix}`, [`tags${id}${suffix}`]), id % 2 === 0, id % 3 === 0, DateTime.parseISO_UTC(`${id % 1000 + 2000}-12-12T10:10:00`), `creator${id}`, diff --git a/src/Squidex/app/shared/services/schemas.service.ts b/src/Squidex/app/shared/services/schemas.service.ts index d0b17d4a4..59234d3ae 100644 --- a/src/Squidex/app/shared/services/schemas.service.ts +++ b/src/Squidex/app/shared/services/schemas.service.ts @@ -260,7 +260,8 @@ export class NestedFieldDto extends FieldDto { export class SchemaPropertiesDto { constructor( public readonly label?: string, - public readonly hints?: string + public readonly hints?: string, + public readonly tags?: ReadonlyArray ) { } } @@ -599,7 +600,7 @@ function parseSchemas(response: any) { item.id, item.name, item.category, - new SchemaPropertiesDto(item.properties.label, item.properties.hints), + new SchemaPropertiesDto(item.properties.label, item.properties.hints, item.properties.tags), item.isSingleton, item.isPublished, DateTime.parseISO_UTC(item.created), item.createdBy, @@ -614,7 +615,7 @@ function parseSchemas(response: any) { function parseSchemaWithDetails(response: any) { const fields = response.fields.map((item: any) => parseField(item)); - const properties = new SchemaPropertiesDto(response.properties.label, response.properties.hints); + const properties = new SchemaPropertiesDto(response.properties.label, response.properties.hints, response.properties.tags); return new SchemaDetailsDto(response._links, response.id, diff --git a/src/Squidex/app/shared/services/schemas.types.ts b/src/Squidex/app/shared/services/schemas.types.ts index b44a0c58d..f2d667d9a 100644 --- a/src/Squidex/app/shared/services/schemas.types.ts +++ b/src/Squidex/app/shared/services/schemas.types.ts @@ -139,6 +139,7 @@ export abstract class FieldPropertiesDto { public readonly isRequired: boolean = false; public readonly label?: string; public readonly placeholder?: string; + public readonly tags?: ReadonlyArray; public get isTranslateable() { return false; diff --git a/src/Squidex/app/shared/state/schemas.forms.ts b/src/Squidex/app/shared/state/schemas.forms.ts index b67f00f21..c78bb5a31 100644 --- a/src/Squidex/app/shared/state/schemas.forms.ts +++ b/src/Squidex/app/shared/state/schemas.forms.ts @@ -169,7 +169,8 @@ export class EditFieldForm extends Form