Browse Source

Merge branch 'ghostfolio:main' into feature/fetch-holdings-for-yahoo-etf-and-mf

pull/6254/head
Kenrick Tandrian 5 days ago
committed by GitHub
parent
commit
5e19aee2b2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 39
      apps/client/src/app/components/admin-market-data/admin-market-data.component.ts
  3. 8
      apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts
  4. 14
      libs/common/src/lib/helper.ts
  5. 2
      libs/ui/src/lib/symbol-autocomplete/symbol-autocomplete.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
- Improved the usability of the create asset profile dialog in the market data section of the admin control panel
- Improved the language localization for Chinese (`zh`) - Improved the language localization for Chinese (`zh`)
- Improved the language localization for German (`de`) - Improved the language localization for German (`de`)
- Upgraded `angular` from version `21.0.6` to `21.1.1` - Upgraded `angular` from version `21.0.6` to `21.1.1`

39
apps/client/src/app/components/admin-market-data/admin-market-data.component.ts

@ -63,7 +63,7 @@ import {
import { DeviceDetectorService } from 'ngx-device-detector'; import { DeviceDetectorService } from 'ngx-device-detector';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { distinctUntilChanged, switchMap, takeUntil } from 'rxjs/operators'; import { distinctUntilChanged, takeUntil } from 'rxjs/operators';
import { AdminMarketDataService } from './admin-market-data.service'; import { AdminMarketDataService } from './admin-market-data.service';
import { GfAssetProfileDialogComponent } from './asset-profile-dialog/asset-profile-dialog.component'; import { GfAssetProfileDialogComponent } from './asset-profile-dialog/asset-profile-dialog.component';
@ -482,32 +482,27 @@ export class GfAdminMarketDataComponent
dialogRef dialogRef
.afterClosed() .afterClosed()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ dataSource, symbol } = {}) => { .subscribe((result) => {
if (dataSource && symbol) { if (!result) {
this.router.navigate(['.'], { relativeTo: this.route });
return;
}
const { addAssetProfile, dataSource, symbol } = result;
if (addAssetProfile && dataSource && symbol) {
this.adminService this.adminService
.addAssetProfile({ dataSource, symbol }) .addAssetProfile({ dataSource, symbol })
.pipe( .pipe(takeUntil(this.unsubscribeSubject))
switchMap(() => { .subscribe(() => {
this.isLoading = true; this.loadData();
this.changeDetectorRef.markForCheck();
return this.adminService.fetchAdminMarketData({
filters: this.activeFilters,
take: this.pageSize
});
}),
takeUntil(this.unsubscribeSubject)
)
.subscribe(({ marketData }) => {
this.dataSource = new MatTableDataSource(marketData);
this.dataSource.sort = this.sort;
this.isLoading = false;
this.changeDetectorRef.markForCheck();
}); });
} else {
this.loadData();
} }
this.router.navigate(['.'], { relativeTo: this.route }); this.onOpenAssetProfileDialog({ dataSource, symbol });
}); });
}); });
} }

8
apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts

@ -101,6 +101,7 @@ export class GfCreateAssetProfileDialogComponent implements OnDestroy, OnInit {
public onSubmit() { public onSubmit() {
if (this.mode === 'auto') { if (this.mode === 'auto') {
this.dialogRef.close({ this.dialogRef.close({
addAssetProfile: true,
dataSource: dataSource:
this.createAssetProfileForm.get('searchSymbol').value.dataSource, this.createAssetProfileForm.get('searchSymbol').value.dataSource,
symbol: this.createAssetProfileForm.get('searchSymbol').value.symbol symbol: this.createAssetProfileForm.get('searchSymbol').value.symbol
@ -127,10 +128,15 @@ export class GfCreateAssetProfileDialogComponent implements OnDestroy, OnInit {
takeUntil(this.unsubscribeSubject) takeUntil(this.unsubscribeSubject)
) )
.subscribe(() => { .subscribe(() => {
this.dialogRef.close(); this.dialogRef.close({
addAssetProfile: false,
dataSource: this.dataSourceForExchangeRates,
symbol: `${DEFAULT_CURRENCY}${currency}`
});
}); });
} else if (this.mode === 'manual') { } else if (this.mode === 'manual') {
this.dialogRef.close({ this.dialogRef.close({
addAssetProfile: true,
dataSource: 'MANUAL', dataSource: 'MANUAL',
symbol: `${this.ghostfolioPrefix}${this.createAssetProfileForm.get('addSymbol').value}` symbol: `${this.ghostfolioPrefix}${this.createAssetProfileForm.get('addSymbol').value}`
}); });

14
libs/common/src/lib/helper.ts

@ -223,8 +223,8 @@ export function getDateFormatString(aLocale?: string) {
); );
return formatObject return formatObject
.map((object) => { .map(({ type, value }) => {
switch (object.type) { switch (type) {
case 'day': case 'day':
return 'dd'; return 'dd';
case 'month': case 'month':
@ -232,7 +232,7 @@ export function getDateFormatString(aLocale?: string) {
case 'year': case 'year':
return 'yyyy'; return 'yyyy';
default: default:
return object.value; return value;
} }
}) })
.join(''); .join('');
@ -271,8 +271,8 @@ export function getLowercase(object: object, path: string) {
export function getNumberFormatDecimal(aLocale?: string) { export function getNumberFormatDecimal(aLocale?: string) {
const formatObject = new Intl.NumberFormat(aLocale).formatToParts(9999.99); const formatObject = new Intl.NumberFormat(aLocale).formatToParts(9999.99);
return formatObject.find((object) => { return formatObject.find(({ type }) => {
return object.type === 'decimal'; return type === 'decimal';
})?.value; })?.value;
} }
@ -281,8 +281,8 @@ export function getNumberFormatGroup(aLocale = getLocale()) {
useGrouping: true useGrouping: true
}).formatToParts(9999.99); }).formatToParts(9999.99);
return formatObject.find((object) => { return formatObject.find(({ type }) => {
return object.type === 'group'; return type === 'group';
})?.value; })?.value;
} }

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

@ -121,7 +121,7 @@ export class GfSymbolAutocompleteComponent
this.control.valueChanges this.control.valueChanges
.pipe( .pipe(
filter((query) => { filter((query) => {
if (query.length === 0) { if (query?.length === 0) {
this.showDefaultOptions(); this.showDefaultOptions();
return false; return false;

Loading…
Cancel
Save