Browse Source

Schemas state moved.

pull/271/head
Sebastian Stehle 9 years ago
parent
commit
182eb89104
  1. 4
      src/Squidex/app/features/schemas/declarations.ts
  2. 4
      src/Squidex/app/features/schemas/guards/schema-must-exist.guard.ts
  3. 4
      src/Squidex/app/features/schemas/module.ts
  4. 9
      src/Squidex/app/features/schemas/pages/schema/field-wizard.component.ts
  5. 4
      src/Squidex/app/features/schemas/pages/schema/field.component.ts
  6. 7
      src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.ts
  7. 5
      src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts
  8. 7
      src/Squidex/app/features/schemas/pages/schema/schema-scripts-form.component.ts
  9. 4
      src/Squidex/app/features/schemas/pages/schema/types/references-validation.component.ts
  10. 13
      src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts
  11. 5
      src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts
  12. 1
      src/Squidex/app/shared/internal.ts
  13. 4
      src/Squidex/app/shared/module.ts
  14. 10
      src/Squidex/app/shared/state/schemas.state.spec.ts
  15. 26
      src/Squidex/app/shared/state/schemas.state.ts

4
src/Squidex/app/features/schemas/declarations.ts

@ -37,6 +37,4 @@ export * from './pages/schema/schema-page.component';
export * from './pages/schema/schema-scripts-form.component'; export * from './pages/schema/schema-scripts-form.component';
export * from './pages/schemas/schema-form.component'; export * from './pages/schemas/schema-form.component';
export * from './pages/schemas/schemas-page.component'; export * from './pages/schemas/schemas-page.component';
export * from './state/schemas.state';

4
src/Squidex/app/features/schemas/guards/schema-must-exist.guard.ts

@ -9,9 +9,7 @@ import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router'; import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { allParams } from '@app/framework'; import { allParams, SchemasState } from '@app/shared';
import { SchemasState } from './../state/schemas.state';
@Injectable() @Injectable()
export class SchemaMustExistGuard implements CanActivate { export class SchemaMustExistGuard implements CanActivate {

4
src/Squidex/app/features/schemas/module.ts

@ -40,7 +40,6 @@ import {
SchemaPageComponent, SchemaPageComponent,
SchemasPageComponent, SchemasPageComponent,
SchemaScriptsFormComponent, SchemaScriptsFormComponent,
SchemasState,
StringUIComponent, StringUIComponent,
StringValidationComponent, StringValidationComponent,
TagsUIComponent, TagsUIComponent,
@ -68,8 +67,7 @@ const routes: Routes = [
RouterModule.forChild(routes) RouterModule.forChild(routes)
], ],
providers: [ providers: [
SchemaMustExistGuard, SchemaMustExistGuard
SchemasState
], ],
declarations: [ declarations: [
FieldComponent, FieldComponent,

9
src/Squidex/app/features/schemas/pages/schema/field-wizard.component.ts

@ -8,9 +8,12 @@
import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core'; import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { FormBuilder } from '@angular/forms'; import { FormBuilder } from '@angular/forms';
import { fieldTypes, SchemaDetailsDto } from '@app/shared'; import {
AddFieldForm,
import { SchemasState, AddFieldForm } from './../../state/schemas.state'; fieldTypes,
SchemaDetailsDto,
SchemasState
} from '@app/shared';
@Component({ @Component({
selector: 'sqx-field-wizard', selector: 'sqx-field-wizard',

4
src/Squidex/app/features/schemas/pages/schema/field.component.ts

@ -11,15 +11,15 @@ import { FormBuilder } from '@angular/forms';
import { import {
AppPatternDto, AppPatternDto,
createProperties, createProperties,
EditFieldForm,
fadeAnimation, fadeAnimation,
FieldDto, FieldDto,
ModalView, ModalView,
SchemaDetailsDto, SchemaDetailsDto,
SchemasState,
UpdateFieldDto UpdateFieldDto
} from '@app/shared'; } from '@app/shared';
import { SchemasState, EditFieldForm } from './../../state/schemas.state';
@Component({ @Component({
selector: 'sqx-field', selector: 'sqx-field',
styleUrls: ['./field.component.scss'], styleUrls: ['./field.component.scss'],

7
src/Squidex/app/features/schemas/pages/schema/schema-edit-form.component.ts

@ -8,8 +8,11 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormBuilder } from '@angular/forms'; import { FormBuilder } from '@angular/forms';
import { SchemaDetailsDto } from '@app/shared'; import {
import { SchemasState, EditSchemaForm } from './../../state/schemas.state'; EditSchemaForm,
SchemaDetailsDto,
SchemasState
} from '@app/shared';
@Component({ @Component({
selector: 'sqx-schema-edit-form', selector: 'sqx-schema-edit-form',

5
src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts

@ -18,15 +18,14 @@ import {
fieldTypes, fieldTypes,
MessageBus, MessageBus,
ModalView, ModalView,
SchemaDetailsDto SchemaDetailsDto,
SchemasState
} from '@app/shared'; } from '@app/shared';
import { import {
SchemaCloning SchemaCloning
} from './../messages'; } from './../messages';
import { SchemasState } from './../../state/schemas.state';
@Component({ @Component({
selector: 'sqx-schema-page', selector: 'sqx-schema-page',
styleUrls: ['./schema-page.component.scss'], styleUrls: ['./schema-page.component.scss'],

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

@ -8,8 +8,11 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormBuilder } from '@angular/forms'; import { FormBuilder } from '@angular/forms';
import { SchemaDetailsDto } from '@app/shared'; import {
import { SchemasState, EditScriptsForm } from './../../state/schemas.state'; EditScriptsForm,
SchemaDetailsDto,
SchemasState
} from '@app/shared';
@Component({ @Component({
selector: 'sqx-schema-scripts-form', selector: 'sqx-schema-scripts-form',

4
src/Squidex/app/features/schemas/pages/schema/types/references-validation.component.ts

@ -8,9 +8,7 @@
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms'; import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ReferencesFieldPropertiesDto } from '@app/shared'; import { ReferencesFieldPropertiesDto, SchemasState } from '@app/shared';
import { SchemasState } from './../../../state/schemas.state';
@Component({ @Component({
selector: 'sqx-references-validation', selector: 'sqx-references-validation',

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

@ -8,9 +8,12 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormBuilder } from '@angular/forms'; import { FormBuilder } from '@angular/forms';
import { ApiUrlConfig, AppsState } from '@app/shared'; import {
ApiUrlConfig,
import { CreateForm, SchemasState } from './../../state/schemas.state'; AppsState,
CreateSchemaForm,
SchemasState
} from '@app/shared';
@Component({ @Component({
selector: 'sqx-schema-form', selector: 'sqx-schema-form',
@ -24,7 +27,7 @@ export class SchemaFormComponent implements OnInit {
@Input() @Input()
public import: any; public import: any;
public createForm: CreateForm; public createForm: CreateSchemaForm;
public showImport = false; public showImport = false;
@ -33,7 +36,7 @@ export class SchemaFormComponent implements OnInit {
public readonly appsState: AppsState, public readonly appsState: AppsState,
private readonly schemasState: SchemasState private readonly schemasState: SchemasState
) { ) {
this.createForm = new CreateForm(formBuilder); this.createForm = new CreateSchemaForm(formBuilder);
} }
public ngOnInit() { public ngOnInit() {

5
src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts

@ -14,13 +14,12 @@ import {
AppsState, AppsState,
MessageBus, MessageBus,
ModalView, ModalView,
SchemaDto SchemaDto,
SchemasState
} from '@app/shared'; } from '@app/shared';
import { SchemaCloning } from './../messages'; import { SchemaCloning } from './../messages';
import { SchemasState } from './../../state/schemas.state';
@Component({ @Component({
selector: 'sqx-schemas-page', selector: 'sqx-schemas-page',
styleUrls: ['./schemas-page.component.scss'], styleUrls: ['./schemas-page.component.scss'],

1
src/Squidex/app/shared/internal.ts

@ -39,6 +39,7 @@ export * from './services/users-provider.service';
export * from './services/users.service'; export * from './services/users.service';
export * from './state/apps.state'; export * from './state/apps.state';
export * from './state/schemas.state';
export * from './utils/messages'; export * from './utils/messages';

4
src/Squidex/app/shared/module.ts

@ -60,7 +60,8 @@ import {
UserPictureRefPipe, UserPictureRefPipe,
UsersProviderService, UsersProviderService,
UsersService, UsersService,
RichEditorComponent RichEditorComponent,
SchemasState
} from './declarations'; } from './declarations';
@NgModule({ @NgModule({
@ -139,6 +140,7 @@ export class SqxSharedModule {
ResolveSchemaGuard, ResolveSchemaGuard,
RulesService, RulesService,
SchemasService, SchemasService,
SchemasState,
UIService, UIService,
UnsetAppGuard, UnsetAppGuard,
UsagesService, UsagesService,

10
src/Squidex/app/features/schemas/state/schemas.state.spec.ts → src/Squidex/app/shared/state/schemas.state.spec.ts

@ -8,21 +8,25 @@
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { IMock, It, Mock, Times } from 'typemoq'; import { IMock, It, Mock, Times } from 'typemoq';
import { AuthService, DialogService, Versioned, AddFieldDto, CreateSchemaDto, UpdateFieldDto } from '@app/shared';
import { SchemasState } from './schemas.state'; import { SchemasState } from './schemas.state';
import { import {
AddFieldDto,
AppsState, AppsState,
AuthService,
createProperties, createProperties,
CreateSchemaDto,
DialogService,
DateTime, DateTime,
FieldDto, FieldDto,
SchemaDetailsDto, SchemaDetailsDto,
SchemaDto, SchemaDto,
SchemasService, SchemasService,
UpdateFieldDto,
UpdateSchemaDto, UpdateSchemaDto,
UpdateSchemaScriptsDto, UpdateSchemaScriptsDto,
Version Version,
Versioned
} from '@app/shared'; } from '@app/shared';
describe('SchemasState', () => { describe('SchemasState', () => {

26
src/Squidex/app/features/schemas/state/schemas.state.ts → src/Squidex/app/shared/state/schemas.state.ts

@ -12,32 +12,36 @@ import { Observable } from 'rxjs';
import '@app/framework/utils/rxjs-extensions'; import '@app/framework/utils/rxjs-extensions';
import { import {
AddFieldDto,
AppsState,
AuthService,
createProperties,
CreateSchemaDto,
DateTime, DateTime,
DialogService, DialogService,
FieldDto,
Form, Form,
ImmutableArray, ImmutableArray,
State,
ValidatorsEx,
Version
} from '@app/framework';
import { AppsState } from './apps.state';
import { AuthService } from './../services/auth.service';
import {
AddFieldDto,
createProperties,
CreateSchemaDto,
FieldDto,
SchemaDto, SchemaDto,
SchemaDetailsDto, SchemaDetailsDto,
SchemasService, SchemasService,
State,
UpdateFieldDto, UpdateFieldDto,
UpdateSchemaScriptsDto, UpdateSchemaScriptsDto,
UpdateSchemaDto, UpdateSchemaDto,
ValidatorsEx,
Version,
SchemaPropertiesDto, SchemaPropertiesDto,
FieldPropertiesDto FieldPropertiesDto
} from '@app/shared'; } from './../services/schemas.service';
const FALLBACK_NAME = 'my-schema'; const FALLBACK_NAME = 'my-schema';
export class CreateForm extends Form<FormGroup> { export class CreateSchemaForm extends Form<FormGroup> {
public schemaName = public schemaName =
this.form.controls['name'].valueChanges.map(n => n || FALLBACK_NAME) this.form.controls['name'].valueChanges.map(n => n || FALLBACK_NAME)
.startWith(FALLBACK_NAME); .startWith(FALLBACK_NAME);
Loading…
Cancel
Save