Browse Source

Address comments

pull/3337/head
Nicolas Fedor 1 year ago
committed by Thomas Kaul
parent
commit
7d54d93d97
  1. 4
      apps/client/src/app/components/admin-platform/admin-platform.component.ts
  2. 9
      apps/client/src/app/components/admin-platform/create-or-update-platform-dialog/create-or-update-platform-dialog.component.ts
  3. 4
      apps/client/src/app/components/admin-tag/admin-tag.component.ts
  4. 9
      apps/client/src/app/components/admin-tag/create-or-update-tag-dialog/create-or-update-tag-dialog.component.ts
  5. 2
      apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts
  6. 3
      apps/client/src/app/components/user-account-access/user-account-access.component.ts
  7. 8
      apps/client/src/app/pages/accounts/accounts-page.component.ts
  8. 6
      apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts
  9. 8
      apps/client/src/app/pages/portfolio/activities/activities-page.component.ts
  10. 6
      apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

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

@ -143,7 +143,7 @@ export class AdminPlatformComponent implements OnInit, OnDestroy {
dialogRef dialogRef
.afterClosed() .afterClosed()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((platform: CreatePlatformDto) => { .subscribe((platform: CreatePlatformDto | null) => {
if (platform) { if (platform) {
this.adminService this.adminService
.postPlatform(platform) .postPlatform(platform)
@ -180,7 +180,7 @@ export class AdminPlatformComponent implements OnInit, OnDestroy {
dialogRef dialogRef
.afterClosed() .afterClosed()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((platform: UpdatePlatformDto) => { .subscribe((platform: UpdatePlatformDto | null) => {
if (platform) { if (platform) {
this.adminService this.adminService
.putPlatform(platform) .putPlatform(platform)

9
apps/client/src/app/components/admin-platform/create-or-update-platform-dialog/create-or-update-platform-dialog.component.ts

@ -23,6 +23,7 @@ import { CreateOrUpdatePlatformDialogParams } from './interfaces/interfaces';
}) })
export class CreateOrUpdatePlatformDialog implements OnDestroy { export class CreateOrUpdatePlatformDialog implements OnDestroy {
public platformForm: FormGroup; public platformForm: FormGroup;
private unsubscribeSubject = new Subject<void>(); private unsubscribeSubject = new Subject<void>();
public constructor( public constructor(
@ -36,6 +37,10 @@ export class CreateOrUpdatePlatformDialog implements OnDestroy {
}); });
} }
public onCancel() {
this.dialogRef.close();
}
public async onSubmit() { public async onSubmit() {
try { try {
const platform: CreatePlatformDto | UpdatePlatformDto = { const platform: CreatePlatformDto | UpdatePlatformDto = {
@ -64,10 +69,6 @@ export class CreateOrUpdatePlatformDialog implements OnDestroy {
} }
} }
public onCancel() {
this.dialogRef.close();
}
public ngOnDestroy() { public ngOnDestroy() {
this.unsubscribeSubject.next(); this.unsubscribeSubject.next();
this.unsubscribeSubject.complete(); this.unsubscribeSubject.complete();

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

@ -142,7 +142,7 @@ export class AdminTagComponent implements OnInit, OnDestroy {
dialogRef dialogRef
.afterClosed() .afterClosed()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((tag: CreateTagDto) => { .subscribe((tag: CreateTagDto | null) => {
if (tag) { if (tag) {
this.adminService this.adminService
.postTag(tag) .postTag(tag)
@ -178,7 +178,7 @@ export class AdminTagComponent implements OnInit, OnDestroy {
dialogRef dialogRef
.afterClosed() .afterClosed()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((tag: UpdateTagDto) => { .subscribe((tag: UpdateTagDto | null) => {
if (tag) { if (tag) {
this.adminService this.adminService
.putTag(tag) .putTag(tag)

9
apps/client/src/app/components/admin-tag/create-or-update-tag-dialog/create-or-update-tag-dialog.component.ts

@ -23,6 +23,7 @@ import { CreateOrUpdateTagDialogParams } from './interfaces/interfaces';
}) })
export class CreateOrUpdateTagDialog implements OnDestroy { export class CreateOrUpdateTagDialog implements OnDestroy {
public tagForm: FormGroup; public tagForm: FormGroup;
private unsubscribeSubject = new Subject<void>(); private unsubscribeSubject = new Subject<void>();
public constructor( public constructor(
@ -35,6 +36,10 @@ export class CreateOrUpdateTagDialog implements OnDestroy {
}); });
} }
public onCancel() {
this.dialogRef.close();
}
public async onSubmit() { public async onSubmit() {
try { try {
const tag: CreateTagDto | UpdateTagDto = { const tag: CreateTagDto | UpdateTagDto = {
@ -62,10 +67,6 @@ export class CreateOrUpdateTagDialog implements OnDestroy {
} }
} }
public onCancel() {
this.dialogRef.close();
}
public ngOnDestroy() { public ngOnDestroy() {
this.unsubscribeSubject.next(); this.unsubscribeSubject.next();
this.unsubscribeSubject.complete(); this.unsubscribeSubject.complete();

2
apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts

@ -93,7 +93,7 @@ export class CreateOrUpdateAccessDialog implements OnDestroy {
takeUntil(this.unsubscribeSubject) takeUntil(this.unsubscribeSubject)
) )
.subscribe(() => { .subscribe(() => {
this.dialogRef.close({ access }); this.dialogRef.close(access);
}); });
} catch (error) { } catch (error) {
console.error(error); console.error(error);

3
apps/client/src/app/components/user-account-access/user-account-access.component.ts

@ -1,3 +1,4 @@
import { CreateAccessDto } from '@ghostfolio/api/app/access/create-access.dto';
import { DataService } from '@ghostfolio/client/services/data.service'; import { DataService } from '@ghostfolio/client/services/data.service';
import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UserService } from '@ghostfolio/client/services/user/user.service';
import { Access, User } from '@ghostfolio/common/interfaces'; import { Access, User } from '@ghostfolio/common/interfaces';
@ -113,7 +114,7 @@ export class UserAccountAccessComponent implements OnDestroy, OnInit {
width: this.deviceType === 'mobile' ? '100vw' : '50rem' width: this.deviceType === 'mobile' ? '100vw' : '50rem'
}); });
dialogRef.afterClosed().subscribe((access) => { dialogRef.afterClosed().subscribe((access: CreateAccessDto | null) => {
if (access) { if (access) {
this.update(); this.update();
} }

8
apps/client/src/app/pages/accounts/accounts-page.component.ts

@ -189,9 +189,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
dialogRef dialogRef
.afterClosed() .afterClosed()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((data: any) => { .subscribe((account: UpdateAccountDto | null) => {
const account: UpdateAccountDto = data?.account;
if (account) { if (account) {
this.dataService this.dataService
.putAccount(account) .putAccount(account)
@ -258,9 +256,7 @@ export class AccountsPageComponent implements OnDestroy, OnInit {
dialogRef dialogRef
.afterClosed() .afterClosed()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((data: any) => { .subscribe((account: CreateAccountDto | null) => {
const account: CreateAccountDto = data?.account;
if (account) { if (account) {
this.dataService this.dataService
.postAccount(account) .postAccount(account)

6
apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts

@ -123,6 +123,8 @@ export class CreateOrUpdateAccountDialog implements OnDestroy {
form: this.accountForm, form: this.accountForm,
object: account object: account
}); });
this.dialogRef.close(account as UpdateAccountDto);
} else { } else {
delete (account as CreateAccountDto).id; delete (account as CreateAccountDto).id;
@ -131,9 +133,9 @@ export class CreateOrUpdateAccountDialog implements OnDestroy {
form: this.accountForm, form: this.accountForm,
object: account object: account
}); });
}
this.dialogRef.close({ account }); this.dialogRef.close(account as CreateAccountDto);
}
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }

8
apps/client/src/app/pages/portfolio/activities/activities-page.component.ts

@ -287,9 +287,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
dialogRef dialogRef
.afterClosed() .afterClosed()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((data: any) => { .subscribe((transaction: UpdateOrderDto | null) => {
const transaction: UpdateOrderDto = data?.activity;
if (transaction) { if (transaction) {
this.dataService this.dataService
.putOrder(transaction) .putOrder(transaction)
@ -338,9 +336,7 @@ export class ActivitiesPageComponent implements OnDestroy, OnInit {
dialogRef dialogRef
.afterClosed() .afterClosed()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((data: any) => { .subscribe((transaction: CreateOrderDto | null) => {
const transaction: CreateOrderDto = data?.activity;
if (transaction) { if (transaction) {
this.dataService.postOrder(transaction).subscribe({ this.dataService.postOrder(transaction).subscribe({
next: () => { next: () => {

6
apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

@ -475,6 +475,8 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
ignoreFields: ['dataSource', 'date'], ignoreFields: ['dataSource', 'date'],
object: activity as UpdateOrderDto object: activity as UpdateOrderDto
}); });
this.dialogRef.close(activity as UpdateOrderDto);
} else { } else {
(activity as CreateOrderDto).updateAccountBalance = (activity as CreateOrderDto).updateAccountBalance =
this.activityForm.get('updateAccountBalance').value; this.activityForm.get('updateAccountBalance').value;
@ -485,9 +487,9 @@ export class CreateOrUpdateActivityDialog implements OnDestroy {
ignoreFields: ['dataSource', 'date'], ignoreFields: ['dataSource', 'date'],
object: activity object: activity
}); });
}
this.dialogRef.close({ activity }); this.dialogRef.close(activity as CreateOrderDto);
}
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }

Loading…
Cancel
Save