Browse Source

Merge a2db9e6d59 into 0fee18908f

pull/6264/merge
Kenrick Tandrian 2 days ago
committed by GitHub
parent
commit
463df463cf
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      libs/common/src/lib/interfaces/lookup-item.interface.ts
  2. 1
      libs/ui/src/lib/holdings-table/holdings-table.component.ts
  3. 2
      libs/ui/src/lib/no-transactions-info/no-transactions-info.component.ts
  4. 8
      libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts
  5. 6
      libs/ui/src/lib/services/admin.service.ts
  6. 2
      libs/ui/src/lib/services/data.service.ts
  7. 2
      libs/ui/src/lib/shared/abstract-mat-form-field.ts
  8. 4
      libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.ts
  9. 8
      libs/ui/src/lib/tags-selector/tags-selector.component.ts
  10. 4
      libs/ui/src/lib/toggle/toggle.component.ts
  11. 1
      libs/ui/tsconfig.json

2
libs/common/src/lib/interfaces/lookup-item.interface.ts

@ -7,7 +7,7 @@ export interface LookupItem {
assetSubClass: AssetSubClass; assetSubClass: AssetSubClass;
currency: string; currency: string;
dataProviderInfo: DataProviderInfo; dataProviderInfo: DataProviderInfo;
dataSource: DataSource; dataSource: DataSource | null;
name: string; name: string;
symbol: string; symbol: string;
} }

1
libs/ui/src/lib/holdings-table/holdings-table.component.ts

@ -106,6 +106,7 @@ export class GfHoldingsTableComponent {
protected canShowDetails(holding: PortfolioPosition): boolean { protected canShowDetails(holding: PortfolioPosition): boolean {
return ( return (
this.hasPermissionToOpenDetails() && this.hasPermissionToOpenDetails() &&
!!holding.assetSubClass &&
!this.ignoreAssetSubClasses.includes(holding.assetSubClass) !this.ignoreAssetSubClasses.includes(holding.assetSubClass)
); );
} }

2
libs/ui/src/lib/no-transactions-info/no-transactions-info.component.ts

@ -24,5 +24,5 @@ export class GfNoTransactionsInfoComponent {
@HostBinding('class.has-border') @Input() hasBorder = true; @HostBinding('class.has-border') @Input() hasBorder = true;
public routerLinkPortfolioActivities = public routerLinkPortfolioActivities =
internalRoutes.portfolio.subRoutes.activities.routerLink; internalRoutes.portfolio.subRoutes?.activities.routerLink;
} }

8
libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

@ -140,16 +140,18 @@ export class GfPortfolioProportionChartComponent
if ( if (
chartData[this.data[symbol][this.keys[0]].toUpperCase()] chartData[this.data[symbol][this.keys[0]].toUpperCase()]
.subCategory[this.data[symbol][this.keys[1]]] ?.subCategory?.[this.data[symbol][this.keys[1]]]
) { ) {
// @ts-ignore
chartData[ chartData[
this.data[symbol][this.keys[0]].toUpperCase() this.data[symbol][this.keys[0]].toUpperCase()
].subCategory[this.data[symbol][this.keys[1]]].value = chartData[ ].subCategory[this.data[symbol][this.keys[1]]].value = chartData[
this.data[symbol][this.keys[0]].toUpperCase() this.data[symbol][this.keys[0]].toUpperCase()
].subCategory[this.data[symbol][this.keys[1]]].value.plus( ].subCategory?.[this.data[symbol][this.keys[1]]].value.plus(
this.data[symbol].value || 0 this.data[symbol].value || 0
); );
} else { } else {
// @ts-ignore
chartData[ chartData[
this.data[symbol][this.keys[0]].toUpperCase() this.data[symbol][this.keys[0]].toUpperCase()
].subCategory[this.data[symbol][this.keys[1]] ?? UNKNOWN_KEY] = { ].subCategory[this.data[symbol][this.keys[1]] ?? UNKNOWN_KEY] = {
@ -278,12 +280,14 @@ export class GfPortfolioProportionChartComponent
Object.keys(item.subCategory ?? {}).forEach((subCategory) => { Object.keys(item.subCategory ?? {}).forEach((subCategory) => {
if (item.name === UNKNOWN_KEY) { if (item.name === UNKNOWN_KEY) {
// @ts-ignore
backgroundColorSubCategory.push(item.color); backgroundColorSubCategory.push(item.color);
} else { } else {
backgroundColorSubCategory.push( backgroundColorSubCategory.push(
Color(item.color).lighten(lightnessRatio).hex() Color(item.color).lighten(lightnessRatio).hex()
); );
} }
// @ts-ignore
dataSubCategory.push(item.subCategory[subCategory].value.toNumber()); dataSubCategory.push(item.subCategory[subCategory].value.toNumber());
labelSubCategory.push(subCategory); labelSubCategory.push(subCategory);

6
libs/ui/src/lib/services/admin.service.ts

@ -132,7 +132,7 @@ export class AdminService {
public fetchJobs({ status }: { status?: JobStatus[] }) { public fetchJobs({ status }: { status?: JobStatus[] }) {
let params = new HttpParams(); let params = new HttpParams();
if (status?.length > 0) { if (status && status.length > 0) {
params = params.append('status', status.join(',')); params = params.append('status', status.join(','));
} }
@ -158,8 +158,8 @@ export class AdminService {
}) { }) {
let params = new HttpParams(); let params = new HttpParams();
params = params.append('skip', skip); if (skip) params = params.append('skip', skip);
params = params.append('take', take); if (take) params = params.append('take', take);
return this.http.get<AdminUsersResponse>('/api/v1/admin/user', { params }); return this.http.get<AdminUsersResponse>('/api/v1/admin/user', { params });
} }

2
libs/ui/src/lib/services/data.service.ts

@ -89,7 +89,7 @@ export class DataService {
public buildFiltersAsQueryParams({ filters }: { filters?: Filter[] }) { public buildFiltersAsQueryParams({ filters }: { filters?: Filter[] }) {
let params = new HttpParams(); let params = new HttpParams();
if (filters?.length > 0) { if (filters && filters.length > 0) {
const { const {
ACCOUNT: filtersByAccount, ACCOUNT: filtersByAccount,
ASSET_CLASS: filtersByAssetClass, ASSET_CLASS: filtersByAssetClass,

2
libs/ui/src/lib/shared/abstract-mat-form-field.ts

@ -137,7 +137,7 @@ export abstract class AbstractMatFormField<T>
public ngDoCheck() { public ngDoCheck() {
if (this.ngControl) { if (this.ngControl) {
this.errorState = this.ngControl.invalid && this.ngControl.touched; this.errorState = !!(this.ngControl.invalid && this.ngControl.touched);
this.stateChanges.next(); this.stateChanges.next();
} }
} }

4
libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.component.ts

@ -185,7 +185,7 @@ export class GfSymbolAutocompleteComponent
public ngDoCheck() { public ngDoCheck() {
if (this.ngControl) { if (this.ngControl) {
this.validateRequired(); this.validateRequired();
this.errorState = this.ngControl.invalid && this.ngControl.touched; this.errorState = !!(this.ngControl.invalid && this.ngControl.touched);
this.stateChanges.next(); this.stateChanges.next();
} }
} }
@ -225,7 +225,7 @@ export class GfSymbolAutocompleteComponent
? !super.value?.dataSource || !super.value?.symbol ? !super.value?.dataSource || !super.value?.symbol
: false; : false;
if (requiredCheck) { if (requiredCheck) {
this.ngControl.control.setErrors({ invalidData: true }); this.ngControl.control?.setErrors({ invalidData: true });
} }
} }
} }

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

@ -77,7 +77,7 @@ export class GfTagsSelectorComponent
this.tagInputControl.valueChanges this.tagInputControl.valueChanges
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((value) => { .subscribe((value) => {
this.filteredOptions.next(this.filterTags(value)); this.filteredOptions.next(this.filterTags(value ?? ''));
}); });
addIcons({ addCircleOutline, closeOutline }); addIcons({ addCircleOutline, closeOutline });
@ -100,21 +100,23 @@ export class GfTagsSelectorComponent
if (!tag && this.hasPermissionToCreateTag) { if (!tag && this.hasPermissionToCreateTag) {
tag = { tag = {
id: undefined, id: '',
name: event.option.value as string, name: event.option.value as string,
userId: null userId: null
}; };
} }
if (tag) {
this.tagsSelected.update((tags) => { this.tagsSelected.update((tags) => {
return [...(tags ?? []), tag]; return [...(tags ?? []), tag];
}); });
}
const newTags = this.tagsSelected(); const newTags = this.tagsSelected();
this.onChange(newTags); this.onChange(newTags);
this.onTouched(); this.onTouched();
this.tagInput.nativeElement.value = ''; this.tagInput.nativeElement.value = '';
this.tagInputControl.setValue(undefined); this.tagInputControl.setValue(null);
} }
public onRemoveTag(tag: Tag) { public onRemoveTag(tag: Tag) {

4
libs/ui/src/lib/toggle/toggle.component.ts

@ -26,13 +26,15 @@ export class GfToggleComponent implements OnChanges {
@Output() valueChange = new EventEmitter<Pick<ToggleOption, 'value'>>(); @Output() valueChange = new EventEmitter<Pick<ToggleOption, 'value'>>();
public optionFormControl = new FormControl<string>(undefined); public optionFormControl = new FormControl<string | null>(null);
public ngOnChanges() { public ngOnChanges() {
this.optionFormControl.setValue(this.defaultValue); this.optionFormControl.setValue(this.defaultValue);
} }
public onValueChange() { public onValueChange() {
if (this.optionFormControl.value !== null) {
this.valueChange.emit({ value: this.optionFormControl.value }); this.valueChange.emit({ value: this.optionFormControl.value });
} }
}
} }

1
libs/ui/tsconfig.json

@ -19,6 +19,7 @@
"target": "es2020", "target": "es2020",
// TODO: Remove once solved in tsconfig.base.json // TODO: Remove once solved in tsconfig.base.json
"strict": false, "strict": false,
"strictNullChecks": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true "noFallthroughCasesInSwitch": true
}, },

Loading…
Cancel
Save