Browse Source

Script fixes in UI

pull/107/head
Sebastian Stehle 9 years ago
parent
commit
302efedf1a
  1. 17
      src/Squidex.Domain.Apps.Events/Contents/ContentArchived.cs
  2. 14
      src/Squidex.Domain.Apps.Write/Contents/Commands/ArchiveContent.cs
  3. 9
      src/Squidex/app/features/schemas/pages/schema/schema-scripts-form.component.ts
  4. 12
      src/Squidex/app/shared/services/schemas.service.spec.ts
  5. 36
      src/Squidex/app/shared/services/schemas.service.ts

17
src/Squidex.Domain.Apps.Events/Contents/ContentArchived.cs

@ -0,0 +1,17 @@
// ==========================================================================
// ContentArchived.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using Squidex.Infrastructure.CQRS.Events;
namespace Squidex.Domain.Apps.Events.Contents
{
[EventType(nameof(ContentArchived))]
public sealed class ContentArchived : ContentEvent
{
}
}

14
src/Squidex.Domain.Apps.Write/Contents/Commands/ArchiveContent.cs

@ -0,0 +1,14 @@
// ==========================================================================
// ArchiveContent.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
namespace Squidex.Domain.Apps.Write.Contents.Commands
{
public sealed class ArchiveContent : ContentCommand
{
}
}

9
src/Squidex/app/features/schemas/pages/schema/schema-scripts-form.component.ts

@ -41,8 +41,7 @@ export class SchemaScriptsFormComponent extends ComponentBase implements OnInit
'Create',
'Update',
'Delete',
'Publish',
'Unpublish'
'Change'
];
public editFormSubmitted = false;
@ -52,8 +51,7 @@ export class SchemaScriptsFormComponent extends ComponentBase implements OnInit
scriptCreate: '',
scriptUpdate: '',
scriptDelete: '',
scriptPublish: '',
scriptUnpublish: ''
scriptChange: ''
});
constructor(dialogs: DialogService,
@ -84,8 +82,7 @@ export class SchemaScriptsFormComponent extends ComponentBase implements OnInit
this.editForm.controls['scriptCreate'].value,
this.editForm.controls['scriptUpdate'].value,
this.editForm.controls['scriptDelete'].value,
this.editForm.controls['scriptPublish'].value,
this.editForm.controls['scriptUnpublish'].value);
this.editForm.controls['scriptChange'].value);
this.schemas.putSchemaScripts(this.appName, this.schema.name, requestDto, this.schema.version)
.subscribe(dto => {

12
src/Squidex/app/shared/services/schemas.service.spec.ts

@ -70,8 +70,7 @@ describe('SchemaDto', () => {
'<script-create>',
'<script-update>',
'<script-delete>',
'<script-publish>',
'<script-unpublish>');
'<script-change>');
const schema_1 = new SchemaDetailsDto('1', 'name', properties, false, creator, creator, creation, creation, version, []);
const schema_2 = schema_1.configureScripts(newScripts, modifier, modified);
@ -80,8 +79,7 @@ describe('SchemaDto', () => {
expect(schema_2.scriptCreate).toEqual('<script-create>');
expect(schema_2.scriptUpdate).toEqual('<script-update>');
expect(schema_2.scriptDelete).toEqual('<script-delete>');
expect(schema_2.scriptPublish).toEqual('<script-publish>');
expect(schema_2.scriptUnpublish).toEqual('<script-unpublish>');
expect(schema_2.scriptChange).toEqual('<script-change>');
expect(schema_2.lastModified).toEqual(modifier);
expect(schema_2.lastModifiedBy).toEqual(modified);
});
@ -380,8 +378,7 @@ describe('SchemasService', () => {
scriptCreate: '<script-create>',
scriptUpdate: '<script-update>',
scriptDelete: '<script-delete>',
scriptPublish: '<script-publish>',
scriptUnpublish: '<script-unpublish>'
scriptChange: '<script-change>'
});
expect(schema).toEqual(
@ -403,8 +400,7 @@ describe('SchemasService', () => {
'<script-create>',
'<script-update>',
'<script-delete>',
'<script-publish>',
'<script-unpublish>'));
'<script-change>'));
}));
it('should provide entry from cache if not found',

36
src/Squidex/app/shared/services/schemas.service.ts

@ -126,8 +126,7 @@ export class SchemaDetailsDto extends SchemaDto {
public readonly scriptCreate?: string,
public readonly scriptUpdate?: string,
public readonly scriptDelete?: string,
public readonly scriptPublish?: string,
public readonly scriptUnpublish?: string
public readonly scriptChange?: string
) {
super(id, name, properties, isPublished, createdBy, lastModifiedBy, created, lastModified, version);
}
@ -146,8 +145,7 @@ export class SchemaDetailsDto extends SchemaDto {
this.scriptCreate,
this.scriptUpdate,
this.scriptDelete,
this.scriptPublish,
this.scriptUnpublish);
this.scriptChange);
}
public unpublish(user: string, now?: DateTime): SchemaDetailsDto {
@ -164,8 +162,7 @@ export class SchemaDetailsDto extends SchemaDto {
this.scriptCreate,
this.scriptUpdate,
this.scriptDelete,
this.scriptPublish,
this.scriptUnpublish);
this.scriptChange);
}
public configureScripts(scripts: UpdateSchemaScriptsDto, user: string, now?: DateTime): SchemaDetailsDto {
@ -182,8 +179,7 @@ export class SchemaDetailsDto extends SchemaDto {
scripts.scriptCreate,
scripts.scriptUpdate,
scripts.scriptDelete,
scripts.scriptPublish,
scripts.scriptUnpublish);
scripts.scriptChange);
}
public update(properties: SchemaPropertiesDto, user: string, now?: DateTime): SchemaDetailsDto {
@ -200,8 +196,7 @@ export class SchemaDetailsDto extends SchemaDto {
this.scriptCreate,
this.scriptUpdate,
this.scriptDelete,
this.scriptPublish,
this.scriptUnpublish);
this.scriptChange);
}
public addField(field: FieldDto, user: string, now?: DateTime): SchemaDetailsDto {
@ -218,8 +213,7 @@ export class SchemaDetailsDto extends SchemaDto {
this.scriptCreate,
this.scriptUpdate,
this.scriptDelete,
this.scriptPublish,
this.scriptUnpublish);
this.scriptChange);
}
public updateField(field: FieldDto, user: string, now?: DateTime): SchemaDetailsDto {
@ -236,8 +230,7 @@ export class SchemaDetailsDto extends SchemaDto {
this.scriptCreate,
this.scriptUpdate,
this.scriptDelete,
this.scriptPublish,
this.scriptUnpublish);
this.scriptChange);
}
public replaceFields(fields: FieldDto[], user: string, now?: DateTime): SchemaDetailsDto {
@ -254,8 +247,7 @@ export class SchemaDetailsDto extends SchemaDto {
this.scriptCreate,
this.scriptUpdate,
this.scriptDelete,
this.scriptPublish,
this.scriptUnpublish);
this.scriptChange);
}
public removeField(field: FieldDto, user: string, now?: DateTime): SchemaDetailsDto {
@ -272,8 +264,7 @@ export class SchemaDetailsDto extends SchemaDto {
this.scriptCreate,
this.scriptUpdate,
this.scriptDelete,
this.scriptPublish,
this.scriptUnpublish);
this.scriptChange);
}
}
@ -688,8 +679,7 @@ export class UpdateSchemaScriptsDto {
public readonly scriptCreate?: string,
public readonly scriptUpdate?: string,
public readonly scriptDelete?: string,
public readonly scriptPublish?: string,
public readonly scriptUnpublish?: string
public readonly scriptChange?: string
) {
}
}
@ -764,8 +754,7 @@ export class SchemasService {
response.scriptCreate,
response.scriptUpdate,
response.scriptDelete,
response.scriptPublish,
response.scriptUnpublish);
response.scriptChange);
})
.catch(error => {
if (error instanceof HttpErrorResponse && error.status === 404) {
@ -803,8 +792,7 @@ export class SchemasService {
response.scriptCreate,
response.scriptUpdate,
response.scriptDelete,
response.scriptPublish,
response.scriptUnpublish);
response.scriptChange);
})
.do(schema => {
this.localCache.set(`schema.${appName}.${schema.id}`, schema, 5000);

Loading…
Cancel
Save