Catch errors early in the pipe to not break it
This should hopefully give us more insight these issues when they happen again
This commit is contained in:
parent
467e67ff68
commit
a62308c3cf
4 changed files with 45 additions and 9 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, inject, OnInit} from '@angular/core';
|
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, inject, OnInit} from '@angular/core';
|
||||||
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
|
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
|
||||||
import {ToastrService} from 'ngx-toastr';
|
import {ToastrService} from 'ngx-toastr';
|
||||||
import {debounceTime, distinctUntilChanged, filter, switchMap, tap} from 'rxjs';
|
import {catchError, debounceTime, distinctUntilChanged, filter, of, switchMap, tap} from 'rxjs';
|
||||||
import {SettingsService} from '../settings.service';
|
import {SettingsService} from '../settings.service';
|
||||||
import {ServerSettings} from '../_models/server-settings';
|
import {ServerSettings} from '../_models/server-settings';
|
||||||
import {translate, TranslocoModule} from "@jsverse/transloco";
|
import {translate, TranslocoModule} from "@jsverse/transloco";
|
||||||
|
|
@ -46,15 +46,21 @@ export class ManageEmailSettingsComponent implements OnInit {
|
||||||
|
|
||||||
// Automatically save settings as we edit them
|
// Automatically save settings as we edit them
|
||||||
this.settingsForm.valueChanges.pipe(
|
this.settingsForm.valueChanges.pipe(
|
||||||
debounceTime(300),
|
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
|
debounceTime(300),
|
||||||
filter(_ => this.settingsForm.valid),
|
filter(_ => this.settingsForm.valid),
|
||||||
takeUntilDestroyed(this.destroyRef),
|
takeUntilDestroyed(this.destroyRef),
|
||||||
switchMap(_ => {
|
switchMap(_ => {
|
||||||
const data = this.packData();
|
const data = this.packData();
|
||||||
return this.settingsService.updateServerSettings(data);
|
return this.settingsService.updateServerSettings(data).pipe(catchError(err => {
|
||||||
|
console.error(err);
|
||||||
|
return of(null);
|
||||||
|
}));
|
||||||
}),
|
}),
|
||||||
tap(settings => {
|
tap(settings => {
|
||||||
|
if (!settings) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.serverSettings = settings;
|
this.serverSettings = settings;
|
||||||
this.cdRef.markForCheck();
|
this.cdRef.markForCheck();
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, inject, OnInit} from '@angular/core';
|
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, inject, OnInit} from '@angular/core';
|
||||||
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
|
import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms';
|
||||||
import {ToastrService} from 'ngx-toastr';
|
import {ToastrService} from 'ngx-toastr';
|
||||||
import {debounceTime, distinctUntilChanged, filter, switchMap, take, tap} from 'rxjs';
|
import {catchError, debounceTime, distinctUntilChanged, filter, of, switchMap, take, tap} from 'rxjs';
|
||||||
import {SettingsService} from '../settings.service';
|
import {SettingsService} from '../settings.service';
|
||||||
import {ServerSettings} from '../_models/server-settings';
|
import {ServerSettings} from '../_models/server-settings';
|
||||||
import {DirectoryPickerComponent, DirectoryPickerResult} from '../_modals/directory-picker/directory-picker.component';
|
import {DirectoryPickerComponent, DirectoryPickerResult} from '../_modals/directory-picker/directory-picker.component';
|
||||||
|
|
@ -55,9 +55,15 @@ export class ManageMediaSettingsComponent implements OnInit {
|
||||||
takeUntilDestroyed(this.destroyRef),
|
takeUntilDestroyed(this.destroyRef),
|
||||||
switchMap(_ => {
|
switchMap(_ => {
|
||||||
const data = this.packData();
|
const data = this.packData();
|
||||||
return this.settingsService.updateServerSettings(data);
|
return this.settingsService.updateServerSettings(data).pipe(catchError(err => {
|
||||||
|
console.error(err);
|
||||||
|
return of(null);
|
||||||
|
}));
|
||||||
}),
|
}),
|
||||||
tap(settings => {
|
tap(settings => {
|
||||||
|
if (!settings) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const encodingChanged = this.serverSettings.encodeMediaAs !== settings.encodeMediaAs;
|
const encodingChanged = this.serverSettings.encodeMediaAs !== settings.encodeMediaAs;
|
||||||
if (encodingChanged) {
|
if (encodingChanged) {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import {WikiLink} from "../../_models/wiki";
|
||||||
import {SettingItemComponent} from "../../settings/_components/setting-item/setting-item.component";
|
import {SettingItemComponent} from "../../settings/_components/setting-item/setting-item.component";
|
||||||
import {SettingSwitchComponent} from "../../settings/_components/setting-switch/setting-switch.component";
|
import {SettingSwitchComponent} from "../../settings/_components/setting-switch/setting-switch.component";
|
||||||
import {ConfirmService} from "../../shared/confirm.service";
|
import {ConfirmService} from "../../shared/confirm.service";
|
||||||
import {debounceTime, distinctUntilChanged, filter, switchMap, tap} from "rxjs";
|
import {catchError, debounceTime, distinctUntilChanged, filter, of, switchMap, tap} from "rxjs";
|
||||||
import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
|
import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
|
||||||
import {DefaultValuePipe} from "../../_pipes/default-value.pipe";
|
import {DefaultValuePipe} from "../../_pipes/default-value.pipe";
|
||||||
import {EnterBlurDirective} from "../../_directives/enter-blur.directive";
|
import {EnterBlurDirective} from "../../_directives/enter-blur.directive";
|
||||||
|
|
@ -85,9 +85,16 @@ export class ManageSettingsComponent implements OnInit {
|
||||||
takeUntilDestroyed(this.destroyRef),
|
takeUntilDestroyed(this.destroyRef),
|
||||||
switchMap(_ => {
|
switchMap(_ => {
|
||||||
const data = this.packData();
|
const data = this.packData();
|
||||||
return this.settingsService.updateServerSettings(data);
|
return this.settingsService.updateServerSettings(data).pipe(catchError(err => {
|
||||||
|
console.error(err);
|
||||||
|
return of(null);
|
||||||
|
}));
|
||||||
}),
|
}),
|
||||||
tap(settings => {
|
tap(settings => {
|
||||||
|
if (!settings) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.serverSettings = settings;
|
this.serverSettings = settings;
|
||||||
this.resetForm();
|
this.resetForm();
|
||||||
this.cdRef.markForCheck();
|
this.cdRef.markForCheck();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,18 @@ import {ToastrService} from 'ngx-toastr';
|
||||||
import {SettingsService} from '../settings.service';
|
import {SettingsService} from '../settings.service';
|
||||||
import {ServerSettings} from '../_models/server-settings';
|
import {ServerSettings} from '../_models/server-settings';
|
||||||
import {shareReplay} from 'rxjs/operators';
|
import {shareReplay} from 'rxjs/operators';
|
||||||
import {debounceTime, defer, distinctUntilChanged, filter, forkJoin, Observable, of, switchMap, tap} from 'rxjs';
|
import {
|
||||||
|
catchError,
|
||||||
|
debounceTime,
|
||||||
|
defer,
|
||||||
|
distinctUntilChanged,
|
||||||
|
filter,
|
||||||
|
forkJoin,
|
||||||
|
Observable,
|
||||||
|
of,
|
||||||
|
switchMap,
|
||||||
|
tap
|
||||||
|
} from 'rxjs';
|
||||||
import {ServerService} from 'src/app/_services/server.service';
|
import {ServerService} from 'src/app/_services/server.service';
|
||||||
import {Job} from 'src/app/_models/job/job';
|
import {Job} from 'src/app/_models/job/job';
|
||||||
import {UpdateNotificationModalComponent} from 'src/app/announcements/_components/update-notification/update-notification-modal.component';
|
import {UpdateNotificationModalComponent} from 'src/app/announcements/_components/update-notification/update-notification-modal.component';
|
||||||
|
|
@ -173,9 +184,15 @@ export class ManageTasksSettingsComponent implements OnInit {
|
||||||
// }),
|
// }),
|
||||||
switchMap(_ => {
|
switchMap(_ => {
|
||||||
const data = this.packData();
|
const data = this.packData();
|
||||||
return this.settingsService.updateServerSettings(data);
|
return this.settingsService.updateServerSettings(data).pipe(catchError(err => {
|
||||||
|
console.error(err);
|
||||||
|
return of(null);
|
||||||
|
}));
|
||||||
}),
|
}),
|
||||||
tap(settings => {
|
tap(settings => {
|
||||||
|
if (!settings) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.serverSettings = settings;
|
this.serverSettings = settings;
|
||||||
|
|
||||||
this.recurringTasks$ = this.serverService.getRecurringJobs().pipe(shareReplay());
|
this.recurringTasks$ = this.serverService.getRecurringJobs().pipe(shareReplay());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue