Browse Source

Feature/update confirmation dialog

pull/3671/head
Daniel Idem 1 year ago
parent
commit
3325f84551
  1. 18
      apps/client/src/app/components/access-table/access-table.component.ts
  2. 26
      apps/client/src/app/components/admin-market-data/admin-market-data.service.ts
  3. 1
      apps/client/src/app/components/admin-overview/admin-overview.component.ts
  4. 4
      apps/client/src/app/components/admin-platform/admin-platform.component.ts
  5. 4
      apps/client/src/app/components/admin-tag/admin-tag.component.ts
  6. 4
      apps/client/src/app/components/admin-users/admin-users.component.ts
  7. 19
      apps/client/src/app/components/user-account-settings/user-account-settings.component.ts

18
apps/client/src/app/components/access-table/access-table.component.ts

@ -1,3 +1,5 @@
import { ConfirmationDialogType } from '@ghostfolio/client/core/notification/confirmation-dialog/confirmation-dialog.type';
import { NotificationService } from '@ghostfolio/client/core/notification/notification.service';
import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config';
import { Access } from '@ghostfolio/common/interfaces';
@ -29,7 +31,7 @@ export class AccessTableComponent implements OnChanges, OnInit {
public defaultLanguageCode = DEFAULT_LANGUAGE_CODE;
public displayedColumns = [];
public constructor() {}
public constructor(private notificationService: NotificationService) {}
public ngOnInit() {}
@ -46,12 +48,12 @@ export class AccessTableComponent implements OnChanges, OnInit {
}
public onDeleteAccess(aId: string) {
const confirmation = confirm(
$localize`Do you really want to revoke this granted access?`
);
if (confirmation) {
this.accessDeleted.emit(aId);
}
this.notificationService.confirm({
confirmFn: () => {
this.accessDeleted.emit(aId);
},
confirmType: ConfirmationDialogType.Warn,
title: $localize`Do you really want to revoke this granted access?`
});
}
}

26
apps/client/src/app/components/admin-market-data/admin-market-data.service.ts

@ -50,27 +50,19 @@ export class AdminMarketDataService {
.pipe(
catchError(() => {
this.notificationService.alert({
title: '',
message: $localize`Oops! Could not delete profiles.`
title: $localize`Oops! Could not delete profiles.`
});
forkJoin(deleteRequests)
.pipe(
catchError(() => {
this.notificationService.alert({
title: $localize`Oops! Could not delete profiles.`
});
return EMPTY;
}),
finalize(() => {
return EMPTY;
}),
finalize(() => {
window.location.reload();
setTimeout(() => {
}, 300);
})
)
.subscribe(() => {});
setTimeout(() => {}, 300);
})
)
.subscribe(() => {});
},
confirmType: ConfirmationDialogType.Warn,
title: $localize`Do you really want to delete these profiles?`
});

1
apps/client/src/app/components/admin-overview/admin-overview.component.ts

@ -1,3 +1,4 @@
import { ConfirmationDialogType } from '@ghostfolio/client/core/notification/confirmation-dialog/confirmation-dialog.type';
import { NotificationService } from '@ghostfolio/client/core/notification/notification.service';
import { AdminService } from '@ghostfolio/client/services/admin.service';
import { CacheService } from '@ghostfolio/client/services/cache.service';

4
apps/client/src/app/components/admin-platform/admin-platform.component.ts

@ -47,10 +47,10 @@ export class AdminPlatformComponent implements OnInit, OnDestroy {
private dataService: DataService,
private deviceService: DeviceDetectorService,
private dialog: MatDialog,
private notificationService: NotificationService,
private route: ActivatedRoute,
private router: Router,
private userService: UserService,
private notificationService: NotificationService
private userService: UserService
) {
this.route.queryParams
.pipe(takeUntil(this.unsubscribeSubject))

4
apps/client/src/app/components/admin-tag/admin-tag.component.ts

@ -47,10 +47,10 @@ export class AdminTagComponent implements OnInit, OnDestroy {
private dataService: DataService,
private deviceService: DeviceDetectorService,
private dialog: MatDialog,
private notificationService: NotificationService,
private route: ActivatedRoute,
private router: Router,
private userService: UserService,
private notificationService: NotificationService
private userService: UserService
) {
this.route.queryParams
.pipe(takeUntil(this.unsubscribeSubject))

4
apps/client/src/app/components/admin-users/admin-users.component.ts

@ -41,8 +41,8 @@ export class AdminUsersComponent implements OnDestroy, OnInit {
private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private impersonationStorageService: ImpersonationStorageService,
private userService: UserService,
private notificationService: NotificationService
private notificationService: NotificationService,
private userService: UserService
) {
this.info = this.dataService.fetchInfo();

19
apps/client/src/app/components/user-account-settings/user-account-settings.component.ts

@ -1,5 +1,5 @@
import { NotificationService } from '@ghostfolio/client/core/notification/notification.service';
import { ConfirmationDialogType } from '@ghostfolio/client/core/notification/confirmation-dialog/confirmation-dialog.type';
import { NotificationService } from '@ghostfolio/client/core/notification/notification.service';
import { DataService } from '@ghostfolio/client/services/data.service';
import {
KEY_STAY_SIGNED_IN,
@ -76,8 +76,7 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit {
private snackBar: MatSnackBar,
private tokenStorageService: TokenStorageService,
private userService: UserService,
public webAuthnService: WebAuthnService,
private notificationService: NotificationService
public webAuthnService: WebAuthnService
) {
const { baseCurrency, currencies } = this.dataService.fetchInfo();
@ -157,21 +156,9 @@ export class UserAccountSettingsComponent implements OnDestroy, OnInit {
.pipe(
catchError(() => {
this.notificationService.alert({
title: '',
message: $localize`Oops! Incorrect Security Token.`
title: $localize`Oops! Incorrect Security Token.`
});
if (confirmation) {
this.dataService
.deleteOwnUser({
accessToken: this.deleteOwnUserForm.get('accessToken').value
})
.pipe(
catchError(() => {
this.notificationService.alert({
title: $localize`Oops! Incorrect Security Token.`
});
return EMPTY;
}),
takeUntil(this.unsubscribeSubject)

Loading…
Cancel
Save