From 69f5a9596149bf602a7881ee7942221d19c3343b Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Tue, 25 Apr 2017 19:40:22 +0200 Subject: [PATCH 1/4] OnPush reverted, see https://github.com/angular/angular/issues/10816 --- src/Squidex/Views/Shared/Docs.cshtml | 4 ++++ .../content/pages/content/content-field.component.ts | 5 ++--- .../content/pages/contents/content-item.component.ts | 3 +-- .../app/features/schemas/pages/schema/field.component.ts | 3 +-- .../schemas/pages/schema/types/boolean-ui.component.ts | 5 ++--- .../pages/schema/types/boolean-validation.component.ts | 5 ++--- .../schemas/pages/schema/types/date-time-ui.component.ts | 5 ++--- .../pages/schema/types/date-time-validation.component.ts | 5 ++--- .../schemas/pages/schema/types/geolocation-ui.component.ts | 5 ++--- .../pages/schema/types/geolocation-validation.component.ts | 5 ++--- .../features/schemas/pages/schema/types/json-ui.component.ts | 5 ++--- .../schemas/pages/schema/types/json-validation.component.ts | 3 +-- .../schemas/pages/schema/types/number-ui.component.ts | 5 ++--- .../pages/schema/types/number-validation.component.ts | 5 ++--- .../schemas/pages/schema/types/string-ui.component.ts | 5 ++--- .../pages/schema/types/string-validation.component.ts | 5 ++--- 16 files changed, 31 insertions(+), 42 deletions(-) diff --git a/src/Squidex/Views/Shared/Docs.cshtml b/src/Squidex/Views/Shared/Docs.cshtml index 5fa318d48..9e0837507 100644 --- a/src/Squidex/Views/Shared/Docs.cshtml +++ b/src/Squidex/Views/Shared/Docs.cshtml @@ -24,6 +24,10 @@ .method-content a { color: #3d7dd5 !important; } + + .redoc-markdown-block code { + color: #ffffff !important; + } diff --git a/src/Squidex/app/features/content/pages/content/content-field.component.ts b/src/Squidex/app/features/content/pages/content/content-field.component.ts index 2cd05a56a..a8bbd45da 100644 --- a/src/Squidex/app/features/content/pages/content/content-field.component.ts +++ b/src/Squidex/app/features/content/pages/content/content-field.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { AppLanguageDto, FieldDto } from 'shared'; @@ -13,8 +13,7 @@ import { AppLanguageDto, FieldDto } from 'shared'; @Component({ selector: 'sqx-content-field', styleUrls: ['./content-field.component.scss'], - templateUrl: './content-field.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: './content-field.component.html' }) export class ContentFieldComponent implements OnInit { @Input() diff --git a/src/Squidex/app/features/content/pages/contents/content-item.component.ts b/src/Squidex/app/features/content/pages/contents/content-item.component.ts index b38eaf408..04c341632 100644 --- a/src/Squidex/app/features/content/pages/contents/content-item.component.ts +++ b/src/Squidex/app/features/content/pages/contents/content-item.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'; import { AppComponentBase, @@ -25,7 +25,6 @@ import { selector: '[sqxContent]', styleUrls: ['./content-item.component.scss'], templateUrl: './content-item.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, animations: [ fadeAnimation ] diff --git a/src/Squidex/app/features/schemas/pages/schema/field.component.ts b/src/Squidex/app/features/schemas/pages/schema/field.component.ts index 4bfcc9379..864f4ea15 100644 --- a/src/Squidex/app/features/schemas/pages/schema/field.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/field.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { @@ -19,7 +19,6 @@ import { selector: 'sqx-field', styleUrls: ['./field.component.scss'], templateUrl: './field.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, animations: [ fadeAnimation ] diff --git a/src/Squidex/app/features/schemas/pages/schema/types/boolean-ui.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/boolean-ui.component.ts index 0b9c1d18f..0e45f586a 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/boolean-ui.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/boolean-ui.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { BooleanFieldPropertiesDto } from 'shared'; @@ -13,8 +13,7 @@ import { BooleanFieldPropertiesDto } from 'shared'; @Component({ selector: 'sqx-boolean-ui', styleUrls: ['boolean-ui.component.scss'], - templateUrl: 'boolean-ui.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'boolean-ui.component.html' }) export class BooleanUIComponent implements OnInit { @Input() 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 f73d4dc58..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 @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { FormControl, FormGroup } from '@angular/forms'; import { Observable } from 'rxjs'; @@ -14,8 +14,7 @@ import { BooleanFieldPropertiesDto } from 'shared'; @Component({ selector: 'sqx-boolean-validation', styleUrls: ['boolean-validation.component.scss'], - templateUrl: 'boolean-validation.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'boolean-validation.component.html' }) export class BooleanValidationComponent implements OnInit { @Input() diff --git a/src/Squidex/app/features/schemas/pages/schema/types/date-time-ui.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/date-time-ui.component.ts index 01bd49676..26d7e34fe 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/date-time-ui.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/date-time-ui.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Observable } from 'rxjs'; @@ -14,8 +14,7 @@ import { FloatConverter, NumberFieldPropertiesDto } from 'shared'; @Component({ selector: 'sqx-date-time-ui', styleUrls: ['date-time-ui.component.scss'], - templateUrl: 'date-time-ui.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'date-time-ui.component.html' }) export class DateTimeUIComponent implements OnInit { @Input() 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 1527b47ee..0e0b4e54a 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 @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { FormControl, FormGroup } from '@angular/forms'; import { Observable } from 'rxjs'; @@ -14,8 +14,7 @@ import { DateTimeFieldPropertiesDto, ValidatorsEx } from 'shared'; @Component({ selector: 'sqx-date-time-validation', styleUrls: ['date-time-validation.component.scss'], - templateUrl: 'date-time-validation.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'date-time-validation.component.html' }) export class DateTimeValidationComponent implements OnInit { @Input() diff --git a/src/Squidex/app/features/schemas/pages/schema/types/geolocation-ui.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/geolocation-ui.component.ts index 1fd5b9346..a0fc725a5 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/geolocation-ui.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/geolocation-ui.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { FormGroup, FormControl, Validators } from '@angular/forms'; import { GeolocationFieldPropertiesDto } from 'shared'; @@ -13,8 +13,7 @@ import { GeolocationFieldPropertiesDto } from 'shared'; @Component({ selector: 'sqx-geolocation-ui', styleUrls: ['geolocation-ui.component.scss'], - templateUrl: 'geolocation-ui.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'geolocation-ui.component.html' }) export class GeolocationUIComponent implements OnInit { @Input() diff --git a/src/Squidex/app/features/schemas/pages/schema/types/geolocation-validation.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/geolocation-validation.component.ts index e3f3a089f..098fcacdc 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/geolocation-validation.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/geolocation-validation.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { GeolocationFieldPropertiesDto } from 'shared'; @@ -13,8 +13,7 @@ import { GeolocationFieldPropertiesDto } from 'shared'; @Component({ selector: 'sqx-geolocation-validation', styleUrls: ['geolocation-validation.component.scss'], - templateUrl: 'geolocation-validation.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'geolocation-validation.component.html' }) export class GeolocationValidationComponent { @Input() diff --git a/src/Squidex/app/features/schemas/pages/schema/types/json-ui.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/json-ui.component.ts index 615759c53..9feebc666 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/json-ui.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/json-ui.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { JsonFieldPropertiesDto } from 'shared'; @@ -13,8 +13,7 @@ import { JsonFieldPropertiesDto } from 'shared'; @Component({ selector: 'sqx-json-ui', styleUrls: ['json-ui.component.scss'], - templateUrl: 'json-ui.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'json-ui.component.html' }) export class JsonUIComponent { @Input() diff --git a/src/Squidex/app/features/schemas/pages/schema/types/json-validation.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/json-validation.component.ts index 498c4eec5..f27882a24 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/json-validation.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/json-validation.component.ts @@ -13,8 +13,7 @@ import { JsonFieldPropertiesDto } from 'shared'; @Component({ selector: 'sqx-json-validation', styleUrls: ['json-validation.component.scss'], - templateUrl: 'json-validation.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'json-validation.component.html' }) export class JsonValidationComponent { @Input() 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 24c20b8d6..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 @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input, OnDestroy, OnInit } from '@angular/core'; +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Observable, Subscription } from 'rxjs'; @@ -14,8 +14,7 @@ import { FloatConverter, NumberFieldPropertiesDto } from 'shared'; @Component({ selector: 'sqx-number-ui', styleUrls: ['number-ui.component.scss'], - templateUrl: 'number-ui.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'number-ui.component.html' }) export class NumberUIComponent implements OnDestroy, OnInit { private editorSubscription: Subscription; 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 5cdb1f7bb..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 @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { FormControl, FormGroup } from '@angular/forms'; import { Observable } from 'rxjs'; @@ -14,8 +14,7 @@ import { NumberFieldPropertiesDto } from 'shared'; @Component({ selector: 'sqx-number-validation', styleUrls: ['number-validation.component.scss'], - templateUrl: 'number-validation.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'number-validation.component.html' }) export class NumberValidationComponent implements OnInit { @Input() 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 e08efe887..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 @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input, OnDestroy, OnInit } from '@angular/core'; +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Observable, Subscription } from 'rxjs'; @@ -14,8 +14,7 @@ import { StringFieldPropertiesDto } from 'shared'; @Component({ selector: 'sqx-string-ui', styleUrls: ['string-ui.component.scss'], - templateUrl: 'string-ui.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'string-ui.component.html' }) export class StringUIComponent implements OnDestroy, OnInit { private editorSubscription: Subscription; 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 9ecb0ae7c..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 @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input, OnDestroy, OnInit } from '@angular/core'; +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; import { FormControl, FormGroup } from '@angular/forms'; import { Observable, Subscription } from 'rxjs'; @@ -14,8 +14,7 @@ import { StringFieldPropertiesDto } from 'shared'; @Component({ selector: 'sqx-string-validation', styleUrls: ['string-validation.component.scss'], - templateUrl: 'string-validation.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + templateUrl: 'string-validation.component.html' }) export class StringValidationComponent implements OnDestroy, OnInit { private patternSubscription: Subscription; From 3536882cdcba7ee3c831f7026ffd4cd6e17d360b Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Tue, 25 Apr 2017 20:25:49 +0200 Subject: [PATCH 2/4] File was not saved --- .../schemas/pages/schema/types/json-validation.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Squidex/app/features/schemas/pages/schema/types/json-validation.component.ts b/src/Squidex/app/features/schemas/pages/schema/types/json-validation.component.ts index f27882a24..dcdbae808 100644 --- a/src/Squidex/app/features/schemas/pages/schema/types/json-validation.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/types/json-validation.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Sebastian Stehle. All rights reserved */ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { JsonFieldPropertiesDto } from 'shared'; From 5be2597fe1e36d8f121f507360cd1d7c1a4fe46a Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Tue, 25 Apr 2017 20:39:51 +0200 Subject: [PATCH 3/4] Tests fixed --- .../Caching/InvalidatingMemoryCacheTest.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Squidex.Infrastructure.Tests/Caching/InvalidatingMemoryCacheTest.cs b/tests/Squidex.Infrastructure.Tests/Caching/InvalidatingMemoryCacheTest.cs index 1ebc4e2b5..bbe4fd3de 100644 --- a/tests/Squidex.Infrastructure.Tests/Caching/InvalidatingMemoryCacheTest.cs +++ b/tests/Squidex.Infrastructure.Tests/Caching/InvalidatingMemoryCacheTest.cs @@ -63,7 +63,7 @@ namespace Squidex.Infrastructure.Caching { sut.Invalidate(123); - pubsub.Verify(x => x.Publish("CacheInvalidations", It.IsAny(), false), Times.Never()); + pubsub.Verify(x => x.Publish("CacheInvalidations", It.IsAny(), true), Times.Never()); } [Fact] @@ -71,7 +71,7 @@ namespace Squidex.Infrastructure.Caching { sut.Invalidate("a-key"); - pubsub.Verify(x => x.Publish("CacheInvalidations", "a-key", false), Times.Once()); + pubsub.Verify(x => x.Publish("CacheInvalidations", "a-key", true), Times.Once()); } [Fact] @@ -79,7 +79,7 @@ namespace Squidex.Infrastructure.Caching { ((IMemoryCache)sut).Invalidate("a-key"); - pubsub.Verify(x => x.Publish("CacheInvalidations", "a-key", false), Times.Once()); + pubsub.Verify(x => x.Publish("CacheInvalidations", "a-key", true), Times.Once()); } [Fact] From 7ae1e4a1fe6134d831fb74caf2bbd28a282d5ab1 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Wed, 26 Apr 2017 18:23:58 +0200 Subject: [PATCH 4/4] Close #26: Show notification when content cannot be saved because of validation errors. --- .../features/content/pages/content/content-page.component.ts | 2 ++ 1 file changed, 2 insertions(+) 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 151b72161..7cd5ca13a 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 @@ -137,6 +137,8 @@ export class ContentPageComponent extends AppComponentBase implements OnDestroy, this.enable(); }); } + } else { + this.notifyError('Content element not valid, please check the field with the red bar on the left in all languages (if localizable).'); } }