diff --git a/src/Squidex/app/features/settings/pages/languages/language.component.ts b/src/Squidex/app/features/settings/pages/languages/language.component.ts index 60332b4a3..dc7b19c74 100644 --- a/src/Squidex/app/features/settings/pages/languages/language.component.ts +++ b/src/Squidex/app/features/settings/pages/languages/language.component.ts @@ -77,14 +77,14 @@ export class LanguageComponent implements OnInit, OnChanges, OnDestroy { this.resetEditForm(); } - public toggleEditing() { - this.isEditing = !this.isEditing; - } - public addLanguage() { this.addFallbackLanguage(this.otherLanguage); } + public toggleEditing() { + this.isEditing = !this.isEditing; + } + public removeFallbackLanguage(language: AppLanguageDto) { this.fallbackLanguages.splice(this.fallbackLanguages.indexOf(language), 1); diff --git a/src/Squidex/app/features/settings/pages/more/more-page.component.html b/src/Squidex/app/features/settings/pages/more/more-page.component.html index a2ba2ae18..43a4fb990 100644 --- a/src/Squidex/app/features/settings/pages/more/more-page.component.html +++ b/src/Squidex/app/features/settings/pages/more/more-page.component.html @@ -1,39 +1,31 @@ - - - More - - - - - - + + More + - - - - Danger Zone + + + Danger Zone - - - - Archive App + + + + Archive App - Once you archive an app, there is no going back. Please be certain. - - - - Archive App - - + Once you archive an app, there is no going back. Please be certain. + + + + Archive App + - + \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.html b/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.html index b609ca655..feecbb4da 100644 --- a/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.html +++ b/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.ts b/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.ts index ee09bc166..022e3a52f 100644 --- a/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.ts +++ b/src/Squidex/app/features/settings/pages/patterns/patterns-page.component.ts @@ -8,26 +8,25 @@ import { Component, OnInit } from '@angular/core'; import { - AppContext, AppPatternDto, AppPatternsDto, AppPatternsService, - HistoryChannelUpdated, + AppsState, + DialogService, UpdatePatternDto } from '@app/shared'; @Component({ selector: 'sqx-patterns-page', styleUrls: ['./patterns-page.component.scss'], - templateUrl: './patterns-page.component.html', - providers: [ - AppContext - ] + templateUrl: './patterns-page.component.html' }) export class PatternsPageComponent implements OnInit { public appPatterns: AppPatternsDto; - constructor(public readonly ctx: AppContext, + constructor( + public readonly appsState: AppsState, + private readonly dialogs: DialogService, private readonly appPatternsService: AppPatternsService ) { } @@ -37,40 +36,40 @@ export class PatternsPageComponent implements OnInit { } public load() { - this.appPatternsService.getPatterns(this.ctx.appName).retry(2) + this.appPatternsService.getPatterns(this.appsState.appName) .subscribe(dtos => { this.updatePatterns(dtos); }, error => { - this.ctx.notifyError(error); + this.dialogs.notifyError(error); }); } public addPattern(pattern: AppPatternDto) { const requestDto = new UpdatePatternDto(pattern.name, pattern.pattern, pattern.message); - this.appPatternsService.postPattern(this.ctx.appName, requestDto, this.appPatterns.version) + this.appPatternsService.postPattern(this.appsState.appName, requestDto, this.appPatterns.version) .subscribe(dto => { this.updatePatterns(this.appPatterns.addPattern(dto.payload, dto.version)); }, error => { - this.ctx.notifyError(error); + this.dialogs.notifyError(error); }); } public updatePattern(pattern: AppPatternDto, update: UpdatePatternDto) { - this.appPatternsService.putPattern(this.ctx.appName, pattern.patternId, update, this.appPatterns.version) + this.appPatternsService.putPattern(this.appsState.appName, pattern.patternId, update, this.appPatterns.version) .subscribe(dto => { this.updatePatterns(this.appPatterns.updatePattern(pattern.update(update), dto.version)); }, error => { - this.ctx.notifyError(error); + this.dialogs.notifyError(error); }); } public removePattern(pattern: AppPatternDto) { - this.appPatternsService.deletePattern(this.ctx.appName, pattern.patternId, this.appPatterns.version) + this.appPatternsService.deletePattern(this.appsState.appName, pattern.patternId, this.appPatterns.version) .subscribe(dto => { this.updatePatterns(this.appPatterns.deletePattern(pattern, dto.version)); }, error => { - this.ctx.notifyError(error); + this.dialogs.notifyError(error); }); } @@ -81,7 +80,5 @@ export class PatternsPageComponent implements OnInit { return a.name.localeCompare(b.name); }), patterns.version); - - this.ctx.bus.emit(new HistoryChannelUpdated()); } } \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/plans/plans-page.component.html b/src/Squidex/app/features/settings/pages/plans/plans-page.component.html index 368ee6c78..2fd047081 100644 --- a/src/Squidex/app/features/settings/pages/plans/plans-page.component.html +++ b/src/Squidex/app/features/settings/pages/plans/plans-page.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/Squidex/app/features/settings/pages/plans/plans-page.component.ts b/src/Squidex/app/features/settings/pages/plans/plans-page.component.ts index 2715c2ad4..b61254872 100644 --- a/src/Squidex/app/features/settings/pages/plans/plans-page.component.ts +++ b/src/Squidex/app/features/settings/pages/plans/plans-page.component.ts @@ -6,23 +6,23 @@ */ import { Component, OnDestroy, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; import { Subscription } from 'rxjs'; import { ApiUrlConfig, - AppContext, AppPlansDto, + AppsState, + AuthService, ChangePlanDto, + DialogService, PlansService } from '@app/shared'; @Component({ selector: 'sqx-plans-page', styleUrls: ['./plans-page.component.scss'], - templateUrl: './plans-page.component.html', - providers: [ - AppContext - ] + templateUrl: './plans-page.component.html' }) export class PlansPageComponent implements OnDestroy, OnInit { private queryParamsSubscription: Subscription; @@ -35,9 +35,13 @@ export class PlansPageComponent implements OnDestroy, OnInit { public isDisabled = false; - constructor(public readonly ctx: AppContext, + constructor( + public readonly appsState: AppsState, + private readonly apiUrl: ApiUrlConfig, + private readonly authState: AuthService, + private readonly dialogs: DialogService, private readonly plansService: PlansService, - private readonly apiUrl: ApiUrlConfig + private readonly route: ActivatedRoute ) { } @@ -47,7 +51,7 @@ export class PlansPageComponent implements OnDestroy, OnInit { public ngOnInit() { this.queryParamsSubscription = - this.ctx.route.queryParams.subscribe(params => { + this.route.queryParams.subscribe(params => { this.overridePlanId = params['planId']; }); @@ -55,7 +59,7 @@ export class PlansPageComponent implements OnDestroy, OnInit { } public load(showInfo = false) { - this.plansService.getPlans(this.ctx.appName) + this.plansService.getPlans(this.appsState.appName) .subscribe(dto => { if (this.overridePlanId) { this.plans = dto.changePlanId(this.overridePlanId); @@ -63,30 +67,31 @@ export class PlansPageComponent implements OnDestroy, OnInit { this.plans = dto; } - this.planOwned = !dto.planOwner || (dto.planOwner === this.ctx.userId); + this.planOwned = !dto.planOwner || (dto.planOwner === this.authState.user!.id); if (showInfo) { - this.ctx.notifyInfo('Plans reloaded.'); + this.dialogs.notifyInfo('Plans reloaded.'); } }, error => { - this.ctx.notifyError(error); + this.dialogs.notifyError(error); }); } public changePlan(planId: string) { this.isDisabled = true; - this.plansService.putPlan(this.ctx.appName, new ChangePlanDto(planId), this.plans.version) + this.plansService.putPlan(this.appsState.appName, new ChangePlanDto(planId), this.plans.version) + .do(() => { + this.isDisabled = false; + }) .subscribe(dto => { if (dto.payload.redirectUri && dto.payload.redirectUri.length > 0) { window.location.href = dto.payload.redirectUri; } else { this.plans = this.plans.changePlanId(planId, dto.version); - this.isDisabled = false; } }, error => { - this.ctx.notifyError(error); - this.isDisabled = false; + this.dialogs.notifyError(error); }); } }