diff --git a/src/Squidex/app/features/apps/pages/apps-page.component.ts b/src/Squidex/app/features/apps/pages/apps-page.component.ts
index bf4cfe374..c6f71d6ad 100644
--- a/src/Squidex/app/features/apps/pages/apps-page.component.ts
+++ b/src/Squidex/app/features/apps/pages/apps-page.component.ts
@@ -5,11 +5,9 @@
* Copyright (c) Sebastian Stehle. All rights reserved
*/
-import { Component, OnDestroy, OnInit } from '@angular/core';
-import { Subscription } from 'rxjs';
+import { Component, OnInit } from '@angular/core';
import {
- AppDto,
AppsStoreService,
fadeAnimation,
ModalView
@@ -23,12 +21,11 @@ import {
fadeAnimation
]
})
-export class AppsPageComponent implements OnInit, OnDestroy {
- private appsSubscription: Subscription;
+export class AppsPageComponent implements OnInit {
+ public addAppDialog = new ModalView();
- public modalDialog = new ModalView();
-
- public apps: AppDto[];
+ public apps =
+ this.appsStore.apps.map(a => a || []);
constructor(
private readonly appsStore: AppsStoreService
@@ -37,14 +34,5 @@ export class AppsPageComponent implements OnInit, OnDestroy {
public ngOnInit() {
this.appsStore.selectApp(null);
-
- this.appsSubscription =
- this.appsStore.apps.subscribe(apps => {
- this.apps = apps || [];
- });
- }
-
- public ngOnDestroy() {
- this.appsSubscription.unsubscribe();
}
}
\ No newline at end of file
diff --git a/src/Squidex/app/features/schemas/declarations.ts b/src/Squidex/app/features/schemas/declarations.ts
index fb1b35c9b..ef816d96f 100644
--- a/src/Squidex/app/features/schemas/declarations.ts
+++ b/src/Squidex/app/features/schemas/declarations.ts
@@ -12,6 +12,7 @@ export * from './pages/schema/types/number-validation.component';
export * from './pages/schema/types/string-ui.component';
export * from './pages/schema/types/string-validation.component';
export * from './pages/schema/field.component';
+export * from './pages/schema/schema-edit-form.component';
export * from './pages/schema/schema-page.component';
export * from './pages/schemas/schema-form.component';
export * from './pages/schemas/schemas-page.component';
\ No newline at end of file
diff --git a/src/Squidex/app/features/schemas/module.ts b/src/Squidex/app/features/schemas/module.ts
index 6ac695809..fea1809ae 100644
--- a/src/Squidex/app/features/schemas/module.ts
+++ b/src/Squidex/app/features/schemas/module.ts
@@ -20,6 +20,7 @@ import {
BooleanValidationComponent,
NumberUIComponent,
NumberValidationComponent,
+ SchemaEditFormComponent,
SchemaFormComponent,
SchemaPageComponent,
SchemasPageComponent,
@@ -63,6 +64,7 @@ const routes: Routes = [
BooleanValidationComponent,
NumberUIComponent,
NumberValidationComponent,
+ SchemaEditFormComponent,
SchemaFormComponent,
SchemaPageComponent,
SchemasPageComponent,
diff --git a/src/Squidex/app/features/schemas/pages/messages.ts b/src/Squidex/app/features/schemas/pages/messages.ts
index fd0aa058c..df456f988 100644
--- a/src/Squidex/app/features/schemas/pages/messages.ts
+++ b/src/Squidex/app/features/schemas/pages/messages.ts
@@ -8,6 +8,7 @@
export class SchemaUpdated {
constructor(
public readonly name: string,
+ public readonly label: string,
public readonly isPublished: boolean
) {
}
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
new file mode 100644
index 000000000..550373dc9
--- /dev/null
+++ b/src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.html
@@ -0,0 +1,40 @@
+
\ No newline at end of file
diff --git a/src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.scss b/src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.scss
new file mode 100644
index 000000000..8b410ef66
--- /dev/null
+++ b/src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.scss
@@ -0,0 +1,6 @@
+@import '_vars';
+@import '_mixins';
+
+texarea {
+ resize: none;
+}
\ No newline at end of file
diff --git a/src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.ts b/src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.ts
new file mode 100644
index 000000000..134b1eeb4
--- /dev/null
+++ b/src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.ts
@@ -0,0 +1,92 @@
+/*
+ * Squidex Headless CMS
+ *
+ * @license
+ * Copyright (c) Sebastian Stehle. All rights reserved
+ */
+
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+
+import {
+ fadeAnimation,
+ Notification,
+ NotificationService,
+ SchemasService
+} from 'shared';
+
+import { SchemaPropertiesDto } from './schema-properties';
+
+@Component({
+ selector: 'sqx-schema-edit-form',
+ styleUrls: ['./schema-edit-form.component.scss'],
+ templateUrl: './schema-edit-form.component.html',
+ animations: [
+ fadeAnimation
+ ]
+})
+export class SchemaEditFormComponent implements OnInit {
+ @Output()
+ public saved = new EventEmitter
();
+
+ @Output()
+ public cancelled = new EventEmitter();
+
+ @Input()
+ public schema: SchemaPropertiesDto;
+
+ @Input()
+ public appName: string;
+
+ public editForm: FormGroup =
+ this.formBuilder.group({
+ name: '',
+ label: ['',
+ [
+ Validators.maxLength(100)
+ ]],
+ hints: ['',
+ [
+ Validators.maxLength(1000)
+ ]]
+ });
+
+ constructor(
+ private readonly schemas: SchemasService,
+ private readonly formBuilder: FormBuilder,
+ private readonly notifications: NotificationService
+ ) {
+ }
+
+ public ngOnInit() {
+ this.editForm.patchValue(this.schema);
+ }
+
+ public saveSchema() {
+ this.editForm.markAsTouched();
+
+ if (this.editForm.valid) {
+ this.editForm.disable();
+
+ const requestDto = this.editForm.value;
+
+ this.schemas.putSchema(this.appName, this.schema.name, requestDto)
+ .subscribe(dto => {
+ this.reset();
+ this.saved.emit(new SchemaPropertiesDto(this.schema.name, requestDto.label, requestDto.hints));
+ }, error => {
+ this.editForm.enable();
+ this.notifications.notify(Notification.error(error.displayMessage));
+ });
+ }
+ }
+
+ public reset() {
+ this.editForm.reset();
+ }
+
+ public cancel() {
+ this.reset();
+ this.cancelled.emit();
+ }
+}
\ No newline at end of file
diff --git a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html
index a83df5ca4..ec41500cb 100644
--- a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html
+++ b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.html
@@ -14,8 +14,10 @@