Browse Source

Merge e377b51a04 into f122bd996b

pull/5669/merge
Jasmeet Singh 1 month ago
committed by GitHub
parent
commit
057c60334f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 12
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts
  3. 3
      apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html
  4. 9
      libs/ui/src/lib/tags-selector/tags-selector.component.ts

1
CHANGELOG.md

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Migrated the tags selector component of the holding detail dialog to form control
- Improved the usability of the _Cancel_ / _Close_ buttons in the create watchlist item dialog - Improved the usability of the _Cancel_ / _Close_ buttons in the create watchlist item dialog
- Refactored the `fireWealth` from `number` type to a structured object in the summary of the portfolio details endpoint - Refactored the `fireWealth` from `number` type to a structured object in the summary of the portfolio details endpoint
- Refactored the _Open Startup_ (`/open`) page to standalone - Refactored the _Open Startup_ (`/open`) page to standalone

12
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts

@ -100,7 +100,6 @@ import { HoldingDetailDialogParams } from './interfaces/interfaces';
templateUrl: 'holding-detail-dialog.html' templateUrl: 'holding-detail-dialog.html'
}) })
export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit { export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
public activityForm: FormGroup;
public accounts: Account[]; public accounts: Account[];
public assetClass: string; public assetClass: string;
public assetSubClass: string; public assetSubClass: string;
@ -155,6 +154,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
public transactionCount: number; public transactionCount: number;
public user: User; public user: User;
public value: number; public value: number;
public holdingForm: FormGroup;
private unsubscribeSubject = new Subject<void>(); private unsubscribeSubject = new Subject<void>();
@ -178,7 +178,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.activityForm = this.formBuilder.group({ this.holdingForm = this.formBuilder.group({
tags: [] as string[] tags: [] as string[]
}); });
@ -187,7 +187,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
{ id: this.data.symbol, type: 'SYMBOL' } { id: this.data.symbol, type: 'SYMBOL' }
]; ];
this.activityForm this.holdingForm
.get('tags') .get('tags')
.valueChanges.pipe(takeUntil(this.unsubscribeSubject)) .valueChanges.pipe(takeUntil(this.unsubscribeSubject))
.subscribe((tags: Tag[]) => { .subscribe((tags: Tag[]) => {
@ -427,7 +427,7 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
}; };
}); });
this.activityForm.setValue({ tags: this.tags }, { emitEvent: false }); this.holdingForm.setValue({ tags: this.tags }, { emitEvent: false });
this.transactionCount = transactionCount; this.transactionCount = transactionCount;
this.totalItems = transactionCount; this.totalItems = transactionCount;
@ -585,10 +585,6 @@ export class GfHoldingDetailDialogComponent implements OnDestroy, OnInit {
} }
} }
public onTagsChanged(tags: Tag[]) {
this.activityForm.get('tags').setValue(tags);
}
public onUpdateActivity(aActivity: Activity) { public onUpdateActivity(aActivity: Activity) {
this.router.navigate( this.router.navigate(
internalRoutes.portfolio.subRoutes.activities.routerLink, internalRoutes.portfolio.subRoutes.activities.routerLink,

3
apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.html

@ -412,11 +412,10 @@
</mat-tab-group> </mat-tab-group>
<gf-tags-selector <gf-tags-selector
[formControl]="holdingForm.get('tags')"
[hasPermissionToCreateTag]="hasPermissionToCreateOwnTag" [hasPermissionToCreateTag]="hasPermissionToCreateOwnTag"
[readonly]="!data.hasPermissionToUpdateOrder" [readonly]="!data.hasPermissionToUpdateOrder"
[tags]="activityForm.get('tags')?.value"
[tagsAvailable]="tagsAvailable" [tagsAvailable]="tagsAvailable"
(tagsChanged)="onTagsChanged($event)"
/> />
@if ( @if (

9
libs/ui/src/lib/tags-selector/tags-selector.component.ts

@ -5,12 +5,10 @@ import {
Component, Component,
CUSTOM_ELEMENTS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA,
ElementRef, ElementRef,
EventEmitter,
Input, Input,
OnChanges, OnChanges,
OnDestroy, OnDestroy,
OnInit, OnInit,
Output,
signal, signal,
ViewChild ViewChild
} from '@angular/core'; } from '@angular/core';
@ -63,11 +61,8 @@ export class GfTagsSelectorComponent
{ {
@Input() hasPermissionToCreateTag = false; @Input() hasPermissionToCreateTag = false;
@Input() readonly = false; @Input() readonly = false;
@Input() tags: Tag[];
@Input() tagsAvailable: Tag[]; @Input() tagsAvailable: Tag[];
@Output() tagsChanged = new EventEmitter<Tag[]>();
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>; @ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>;
public filteredOptions: Subject<Tag[]> = new BehaviorSubject([]); public filteredOptions: Subject<Tag[]> = new BehaviorSubject([]);
@ -88,12 +83,10 @@ export class GfTagsSelectorComponent
} }
public ngOnInit() { public ngOnInit() {
this.tagsSelected.set(this.tags);
this.updateFilters(); this.updateFilters();
} }
public ngOnChanges() { public ngOnChanges() {
this.tagsSelected.set(this.tags);
this.updateFilters(); this.updateFilters();
} }
@ -115,7 +108,6 @@ export class GfTagsSelectorComponent
}); });
const newTags = this.tagsSelected(); const newTags = this.tagsSelected();
this.tagsChanged.emit(newTags);
this.onChange(newTags); this.onChange(newTags);
this.onTouched(); this.onTouched();
this.tagInput.nativeElement.value = ''; this.tagInput.nativeElement.value = '';
@ -130,7 +122,6 @@ export class GfTagsSelectorComponent
}); });
const newTags = this.tagsSelected(); const newTags = this.tagsSelected();
this.tagsChanged.emit(newTags);
this.onChange(newTags); this.onChange(newTags);
this.onTouched(); this.onTouched();
this.updateFilters(); this.updateFilters();

Loading…
Cancel
Save