Browse Source

Schemas state moved.

pull/271/head
Sebastian Stehle 8 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/schemas/schema-form.component';
export * from './pages/schemas/schemas-page.component';
export * from './state/schemas.state';
export * from './pages/schemas/schemas-page.component';

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 { Observable } from 'rxjs';
import { allParams } from '@app/framework';
import { SchemasState } from './../state/schemas.state';
import { allParams, SchemasState } from '@app/shared';
@Injectable()
export class SchemaMustExistGuard implements CanActivate {

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

@ -40,7 +40,6 @@ import {
SchemaPageComponent,
SchemasPageComponent,
SchemaScriptsFormComponent,
SchemasState,
StringUIComponent,
StringValidationComponent,
TagsUIComponent,
@ -68,8 +67,7 @@ const routes: Routes = [
RouterModule.forChild(routes)
],
providers: [
SchemaMustExistGuard,
SchemasState
SchemaMustExistGuard
],
declarations: [
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 { FormBuilder } from '@angular/forms';
import { fieldTypes, SchemaDetailsDto } from '@app/shared';
import { SchemasState, AddFieldForm } from './../../state/schemas.state';
import {
AddFieldForm,
fieldTypes,
SchemaDetailsDto,
SchemasState
} from '@app/shared';
@Component({
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 {
AppPatternDto,
createProperties,
EditFieldForm,
fadeAnimation,
FieldDto,
ModalView,
SchemaDetailsDto,
SchemasState,
UpdateFieldDto
} from '@app/shared';
import { SchemasState, EditFieldForm } from './../../state/schemas.state';
@Component({
selector: 'sqx-field',
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 { FormBuilder } from '@angular/forms';
import { SchemaDetailsDto } from '@app/shared';
import { SchemasState, EditSchemaForm } from './../../state/schemas.state';
import {
EditSchemaForm,
SchemaDetailsDto,
SchemasState
} from '@app/shared';
@Component({
selector: 'sqx-schema-edit-form',

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

@ -18,15 +18,14 @@ import {
fieldTypes,
MessageBus,
ModalView,
SchemaDetailsDto
SchemaDetailsDto,
SchemasState
} from '@app/shared';
import {
SchemaCloning
} from './../messages';
import { SchemasState } from './../../state/schemas.state';
@Component({
selector: 'sqx-schema-page',
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 { FormBuilder } from '@angular/forms';
import { SchemaDetailsDto } from '@app/shared';
import { SchemasState, EditScriptsForm } from './../../state/schemas.state';
import {
EditScriptsForm,
SchemaDetailsDto,
SchemasState
} from '@app/shared';
@Component({
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 { FormControl, FormGroup, Validators } from '@angular/forms';
import { ReferencesFieldPropertiesDto } from '@app/shared';
import { SchemasState } from './../../../state/schemas.state';
import { ReferencesFieldPropertiesDto, SchemasState } from '@app/shared';
@Component({
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 { FormBuilder } from '@angular/forms';
import { ApiUrlConfig, AppsState } from '@app/shared';
import { CreateForm, SchemasState } from './../../state/schemas.state';
import {
ApiUrlConfig,
AppsState,
CreateSchemaForm,
SchemasState
} from '@app/shared';
@Component({
selector: 'sqx-schema-form',
@ -24,7 +27,7 @@ export class SchemaFormComponent implements OnInit {
@Input()
public import: any;
public createForm: CreateForm;
public createForm: CreateSchemaForm;
public showImport = false;
@ -33,7 +36,7 @@ export class SchemaFormComponent implements OnInit {
public readonly appsState: AppsState,
private readonly schemasState: SchemasState
) {
this.createForm = new CreateForm(formBuilder);
this.createForm = new CreateSchemaForm(formBuilder);
}
public ngOnInit() {

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

@ -14,13 +14,12 @@ import {
AppsState,
MessageBus,
ModalView,
SchemaDto
SchemaDto,
SchemasState
} from '@app/shared';
import { SchemaCloning } from './../messages';
import { SchemasState } from './../../state/schemas.state';
@Component({
selector: 'sqx-schemas-page',
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 './state/apps.state';
export * from './state/schemas.state';
export * from './utils/messages';

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

@ -60,7 +60,8 @@ import {
UserPictureRefPipe,
UsersProviderService,
UsersService,
RichEditorComponent
RichEditorComponent,
SchemasState
} from './declarations';
@NgModule({
@ -139,6 +140,7 @@ export class SqxSharedModule {
ResolveSchemaGuard,
RulesService,
SchemasService,
SchemasState,
UIService,
UnsetAppGuard,
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 { IMock, It, Mock, Times } from 'typemoq';
import { AuthService, DialogService, Versioned, AddFieldDto, CreateSchemaDto, UpdateFieldDto } from '@app/shared';
import { SchemasState } from './schemas.state';
import {
AddFieldDto,
AppsState,
AuthService,
createProperties,
CreateSchemaDto,
DialogService,
DateTime,
FieldDto,
SchemaDetailsDto,
SchemaDto,
SchemasService,
UpdateFieldDto,
UpdateSchemaDto,
UpdateSchemaScriptsDto,
Version
Version,
Versioned
} from '@app/shared';
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 {
AddFieldDto,
AppsState,
AuthService,
createProperties,
CreateSchemaDto,
DateTime,
DialogService,
FieldDto,
Form,
ImmutableArray,
State,
ValidatorsEx,
Version
} from '@app/framework';
import { AppsState } from './apps.state';
import { AuthService } from './../services/auth.service';
import {
AddFieldDto,
createProperties,
CreateSchemaDto,
FieldDto,
SchemaDto,
SchemaDetailsDto,
SchemasService,
State,
UpdateFieldDto,
UpdateSchemaScriptsDto,
UpdateSchemaDto,
ValidatorsEx,
Version,
SchemaPropertiesDto,
FieldPropertiesDto
} from '@app/shared';
} from './../services/schemas.service';
const FALLBACK_NAME = 'my-schema';
export class CreateForm extends Form<FormGroup> {
export class CreateSchemaForm extends Form<FormGroup> {
public schemaName =
this.form.controls['name'].valueChanges.map(n => n || FALLBACK_NAME)
.startWith(FALLBACK_NAME);
Loading…
Cancel
Save