diff --git a/src/Squidex/app/features/content/pages/content/content-page.component.ts b/src/Squidex/app/features/content/pages/content/content-page.component.ts index 91b147f95..0b15b1e4a 100644 --- a/src/Squidex/app/features/content/pages/content/content-page.component.ts +++ b/src/Squidex/app/features/content/pages/content/content-page.component.ts @@ -67,23 +67,27 @@ export class ContentPageComponent extends AppComponentBase implements OnDestroy, public ngOnInit() { this.messageSubscription = - this.messageBus.of(ContentDeleted).subscribe(message => { - if (message.id === this.contentId) { - this.router.navigate(['../'], { relativeTo: this.route }); - } - }); + this.messageBus.of(ContentDeleted) + .subscribe(message => { + if (message.id === this.contentId) { + this.router.navigate(['../'], { relativeTo: this.route }); + } + }); - this.route.parent.data.map(p => p['appLanguages']).subscribe((languages: AppLanguageDto[]) => { - this.languages = languages; - }); + this.route.parent.data.map(p => p['appLanguages']) + .subscribe((languages: AppLanguageDto[]) => { + this.languages = languages; + }); - this.route.parent.data.map(p => p['schema']).subscribe((schema: SchemaDetailsDto) => { - this.setupForm(schema); - }); + this.route.parent.data.map(p => p['schema']) + .subscribe((schema: SchemaDetailsDto) => { + this.setupForm(schema); + }); - this.route.data.map(p => p['content']).subscribe((content: ContentDto) => { - this.populateForm(content); - }); + this.route.data.map(p => p['content']) + .subscribe((content: ContentDto) => { + this.populateForm(content); + }); } public saveContent() { diff --git a/src/Squidex/app/features/content/pages/contents/contents-page.component.ts b/src/Squidex/app/features/content/pages/contents/contents-page.component.ts index 7f9a92386..d7f693a04 100644 --- a/src/Squidex/app/features/content/pages/contents/contents-page.component.ts +++ b/src/Squidex/app/features/content/pages/contents/contents-page.component.ts @@ -84,27 +84,31 @@ export class ContentsPageComponent extends AppComponentBase implements OnDestroy public ngOnInit() { this.messageCreatedSubscription = - this.messageBus.of(ContentCreated).subscribe(message => { - this.itemLast++; - this.contentTotal++; - this.contentItems = this.contentItems.pushFront(this.createContent(message.id, message.data, message.version)); - }); + this.messageBus.of(ContentCreated) + .subscribe(message => { + this.itemLast++; + this.contentTotal++; + this.contentItems = this.contentItems.pushFront(this.createContent(message.id, message.data, message.version)); + }); this.messageUpdatedSubscription = - this.messageBus.of(ContentUpdated).subscribe(message => { - this.updateContents(message.id, undefined, message.data, message.version); - }); + this.messageBus.of(ContentUpdated) + .subscribe(message => { + this.updateContents(message.id, undefined, message.data, message.version); + }); - this.route.data.map(p => p['appLanguages']).subscribe((languages: AppLanguageDto[]) => { - this.languages = languages; - }); + this.route.data.map(p => p['appLanguages']) + .subscribe((languages: AppLanguageDto[]) => { + this.languages = languages; + }); - this.route.data.map(p => p['schema']).subscribe(schema => { - this.schema = schema; + this.route.data.map(p => p['schema']) + .subscribe(schema => { + this.schema = schema; - this.reset(); - this.load(); - }); + this.reset(); + this.load(); + }); } public search() { diff --git a/src/Squidex/app/features/content/pages/schemas/schemas-page.component.ts b/src/Squidex/app/features/content/pages/schemas/schemas-page.component.ts index bc8ea2c6f..bb696d0a3 100644 --- a/src/Squidex/app/features/content/pages/schemas/schemas-page.component.ts +++ b/src/Squidex/app/features/content/pages/schemas/schemas-page.component.ts @@ -26,8 +26,8 @@ import { export class SchemasPageComponent extends AppComponentBase { public schemasFilter = new FormControl(); public schemasFiltered = - Observable.of(null) - .merge(this.schemasFilter.valueChanges) + this.schemasFilter.valueChanges + .startWith(null) .distinctUntilChanged() .debounceTime(300) .combineLatest(this.loadSchemas(), diff --git a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts index afd1ebf73..2ec4e91e3 100644 --- a/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts @@ -84,15 +84,16 @@ export class SchemaPageComponent extends AppComponentBase implements OnInit { } public ngOnInit() { - this.route.data.map(p => p['schema']).subscribe((schema: SchemaDetailsDto) => { - this.schemaName = schema.name; - this.schemaFields = ImmutableArray.of(schema.fields); - this.schemaProperties = new SchemaPropertiesDto(schema.name, schema.label, schema.hints); + this.route.data.map(p => p['schema']) + .subscribe((schema: SchemaDetailsDto) => { + this.schemaName = schema.name; + this.schemaFields = ImmutableArray.of(schema.fields); + this.schemaProperties = new SchemaPropertiesDto(schema.name, schema.label, schema.hints); - this.version = schema.version; + this.version = schema.version; - this.isPublished = schema.isPublished; - }); + this.isPublished = schema.isPublished; + }); } public publish() { diff --git a/src/Squidex/app/features/schemas/pages/schema/types/boolean-validation.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/boolean-validation.component.ts index 14205bac8..58eff1ab4 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/boolean-validation.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/boolean-validation.component.ts @@ -30,8 +30,8 @@ export class BooleanValidationComponent implements OnInit { new FormControl(this.properties.defaultValue)); this.hideDefaultValue = - Observable.of(this.properties.isRequired) - .merge(this.editForm.get('isRequired').valueChanges) + this.editForm.get('isRequired').valueChanges + .startWith(this.properties.isRequired) .map(x => !!x); } } \ No newline at end of file diff --git a/src/Squidex/app/features/schemas/pages/schema/types/date-time-validation.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/date-time-validation.component.ts index 0509f0179..c3d65a206 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/date-time-validation.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/date-time-validation.component.ts @@ -42,8 +42,8 @@ export class DateTimeValidationComponent implements OnInit { ])); this.hideDefaultValue = - Observable.of(this.properties.isRequired) - .merge(this.editForm.get('isRequired').valueChanges) + this.editForm.get('isRequired').valueChanges + .startWith(this.properties.isRequired) .map(x => !!x); } } \ No newline at end of file diff --git a/src/Squidex/app/features/schemas/pages/schema/types/number-ui.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/number-ui.component.ts index c455d5892..7f8edc9c0 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/number-ui.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/number-ui.component.ts @@ -46,8 +46,8 @@ export class NumberUIComponent implements OnDestroy, OnInit { new FormControl(this.properties.allowedValues, [])); this.hideAllowedValues = - Observable.of(this.properties.editor) - .merge(this.editForm.get('editor').valueChanges) + this.editForm.get('editor').valueChanges + .startWith(this.properties.editor) .map(x => !x || x === 'Input' || x === 'Textarea'); this.editorSubscription = diff --git a/src/Squidex/app/features/schemas/pages/schema/types/number-validation.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/number-validation.component.ts index dc494977e..51fc8b779 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/number-validation.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/number-validation.component.ts @@ -36,8 +36,8 @@ export class NumberValidationComponent implements OnInit { new FormControl(this.properties.defaultValue)); this.hideDefaultValue = - Observable.of(this.properties.isRequired) - .merge(this.editForm.get('isRequired').valueChanges) + this.editForm.get('isRequired').valueChanges + .startWith(this.properties.isRequired) .map(x => !!x); } } \ No newline at end of file diff --git a/src/Squidex/app/features/schemas/pages/schema/types/string-ui.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/string-ui.component.ts index 2f75f145a..bb8a8f923 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/string-ui.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/string-ui.component.ts @@ -46,15 +46,16 @@ export class StringUIComponent implements OnDestroy, OnInit { new FormControl(this.properties.allowedValues)); this.hideAllowedValues = - Observable.of(this.properties.editor) - .merge(this.editForm.get('editor').valueChanges) + this.editForm.get('editor').valueChanges + .startWith(this.properties.editor) .map(x => !x || x === 'Input' || x === 'TextArea' || x === 'RichText' || x === 'Markdown'); this.editorSubscription = - this.hideAllowedValues.subscribe(isSelection => { - if (isSelection) { - this.editForm.get('allowedValues').setValue(undefined); - } - }); + this.hideAllowedValues + .subscribe(isSelection => { + if (isSelection) { + this.editForm.get('allowedValues').setValue(undefined); + } + }); } } \ No newline at end of file diff --git a/src/Squidex/app/features/schemas/pages/schema/types/string-validation.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/string-validation.component.ts index 265506ccb..0387c7099 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/string-validation.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/string-validation.component.ts @@ -49,13 +49,13 @@ export class StringValidationComponent implements OnDestroy, OnInit { new FormControl(this.properties.defaultValue)); this.hideDefaultValue = - Observable.of(false) - .merge(this.editForm.get('isRequired').valueChanges) + this.editForm.get('isRequired').valueChanges + .startWith(this.properties.isRequired) .map(x => !!x); this.hidePatternMessage = - Observable.of(false) - .merge(this.editForm.get('pattern').valueChanges) + this.editForm.get('pattern').valueChanges + .startWith('') .map(x => !x || x.trim().length === 0); this.patternSubscription = diff --git a/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts b/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts index 43e662008..baeb2dae0 100644 --- a/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts +++ b/src/Squidex/app/features/schemas/pages/schemas/schema-form.component.ts @@ -7,7 +7,6 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { Observable } from 'rxjs'; import { ApiUrlConfig, @@ -54,8 +53,8 @@ export class SchemaFormComponent { }); public schemaName = - Observable.of(FALLBACK_NAME) - .merge(this.createForm.get('name').valueChanges.map(n => n || FALLBACK_NAME)); + this.createForm.get('name').valueChanges.map(n => n || FALLBACK_NAME) + .startWith(FALLBACK_NAME); constructor( public readonly apiUrl: ApiUrlConfig, diff --git a/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts b/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts index a25f8d65e..27ffcc4c3 100644 --- a/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts +++ b/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts @@ -67,11 +67,12 @@ export class SchemasPageComponent extends AppComponentBase implements OnDestroy, this.updateSchemas(this.schemas, this.schemaQuery = q); }); - this.route.params.map(q => q['showDialog']).subscribe(showDialog => { - if (showDialog) { - this.addSchemaDialog.show(); - } - }); + this.route.params.map(q => q['showDialog']) + .subscribe(showDialog => { + if (showDialog) { + this.addSchemaDialog.show(); + } + }); this.messageSubscription = this.messageBus.of(SchemaUpdated) diff --git a/src/Squidex/app/framework/angular/json-editor.component.ts b/src/Squidex/app/framework/angular/json-editor.component.ts index 564b457e0..739293039 100644 --- a/src/Squidex/app/framework/angular/json-editor.component.ts +++ b/src/Squidex/app/framework/angular/json-editor.component.ts @@ -67,21 +67,22 @@ export class JsonEditorComponent implements ControlValueAccessor, AfterViewInit } public ngAfterViewInit() { - this.valueChanged.debounceTime(1000).subscribe(() => { - const isValid = this.aceEditor.getSession().getAnnotations().length === 0; + this.valueChanged.debounceTime(1000) + .subscribe(() => { + const isValid = this.aceEditor.getSession().getAnnotations().length === 0; - if (!isValid) { - this.changeCallback(null); - } else { - try { - const value = JSON.parse(this.aceEditor.getValue()); - - this.changeCallback(value); - } catch (e) { + if (!isValid) { this.changeCallback(null); + } else { + try { + const value = JSON.parse(this.aceEditor.getValue()); + + this.changeCallback(value); + } catch (e) { + this.changeCallback(null); + } } - } - }); + }); this.resourceLoader.loadScript('https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js').then(() => { this.aceEditor = ace.edit(this.editor.nativeElement); diff --git a/src/Squidex/app/shared/components/app-form.component.ts b/src/Squidex/app/shared/components/app-form.component.ts index 3866aa5d3..4ca6c71d2 100644 --- a/src/Squidex/app/shared/components/app-form.component.ts +++ b/src/Squidex/app/shared/components/app-form.component.ts @@ -7,7 +7,6 @@ import { Component, EventEmitter, Output } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { Observable } from 'rxjs'; import { ApiUrlConfig, ValidatorsEx } from 'framework'; @@ -41,8 +40,8 @@ export class AppFormComponent { }); public appName = - Observable.of(FALLBACK_NAME) - .merge(this.createForm.get('name').valueChanges.map(n => n || FALLBACK_NAME)); + this.createForm.get('name').valueChanges.map(n => n || FALLBACK_NAME) + .startWith(FALLBACK_NAME); constructor( public readonly apiUrl: ApiUrlConfig, diff --git a/src/Squidex/app/shared/services/apps-store.service.ts b/src/Squidex/app/shared/services/apps-store.service.ts index a45c49c42..7fca62d99 100644 --- a/src/Squidex/app/shared/services/apps-store.service.ts +++ b/src/Squidex/app/shared/services/apps-store.service.ts @@ -74,9 +74,10 @@ export class AppsStoreService { } private load() { - this.appsService.getApps().subscribe(apps => { - this.apps$.next(apps); - }); + this.appsService.getApps() + .subscribe(apps => { + this.apps$.next(apps); + }); } public selectApp(name: string | null): Promise { diff --git a/src/Squidex/app/shell/pages/internal/profile-menu.component.ts b/src/Squidex/app/shell/pages/internal/profile-menu.component.ts index fa8cb9de2..28aba25c5 100644 --- a/src/Squidex/app/shell/pages/internal/profile-menu.component.ts +++ b/src/Squidex/app/shell/pages/internal/profile-menu.component.ts @@ -43,16 +43,17 @@ export class ProfileMenuComponent implements OnInit, OnDestroy { public ngOnInit() { this.authenticationSubscription = - this.auth.isAuthenticated.take(1).subscribe(() => { - const user = this.auth.user; + this.auth.isAuthenticated.take(1) + .subscribe(() => { + const user = this.auth.user; - if (user) { - this.profilePictureUrl = user.pictureUrl; - this.profileDisplayName = user.displayName; + if (user) { + this.profilePictureUrl = user.pictureUrl; + this.profileDisplayName = user.displayName; - this.isAdmin = user.isAdmin; - } - }); + this.isAdmin = user.isAdmin; + } + }); } public logout() { diff --git a/src/Squidex/app/shell/pages/login/login-page.component.ts b/src/Squidex/app/shell/pages/login/login-page.component.ts index 2aa92c2db..d4baf4e29 100644 --- a/src/Squidex/app/shell/pages/login/login-page.component.ts +++ b/src/Squidex/app/shell/pages/login/login-page.component.ts @@ -22,13 +22,14 @@ export class LoginPageComponent implements OnInit { } public ngOnInit() { - this.auth.loginRedirectComplete().subscribe( - () => { - this.router.navigate(['/app'], { replaceUrl: true }); - }, - () => { - this.router.navigate(['/'], { replaceUrl: true }); - } - ); + this.auth.loginRedirectComplete() + .subscribe( + () => { + this.router.navigate(['/app'], { replaceUrl: true }); + }, + () => { + this.router.navigate(['/'], { replaceUrl: true }); + } + ); } } \ No newline at end of file diff --git a/src/Squidex/app/shell/pages/logout/logout-page.component.ts b/src/Squidex/app/shell/pages/logout/logout-page.component.ts index d189f4e5c..e17c1d1e1 100644 --- a/src/Squidex/app/shell/pages/logout/logout-page.component.ts +++ b/src/Squidex/app/shell/pages/logout/logout-page.component.ts @@ -22,13 +22,14 @@ export class LogoutPageComponent implements OnInit { } public ngOnInit() { - this.auth.logoutRedirectComplete().subscribe( - () => { - this.router.navigate(['/'], { replaceUrl: true }); - }, - () => { - this.router.navigate(['/'], { replaceUrl: true }); - } - ); + this.auth.logoutRedirectComplete() + .subscribe( + () => { + this.router.navigate(['/'], { replaceUrl: true }); + }, + () => { + this.router.navigate(['/'], { replaceUrl: true }); + } + ); } } \ No newline at end of file