Browse Source

feat: call gatherSymbol after currency addition (#5421)

pull/5434/head
Sven Günther 4 months ago
parent
commit
26d697f092
  1. 14
      apps/client/src/app/components/admin-market-data/admin-market-data.component.ts
  2. 6
      apps/client/src/app/components/admin-market-data/create-asset-profile-dialog/create-asset-profile-dialog.component.ts

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

@ -63,7 +63,7 @@ import {
} from 'ionicons/icons'; } from 'ionicons/icons';
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, of } from 'rxjs';
import { distinctUntilChanged, switchMap, takeUntil } from 'rxjs/operators'; import { distinctUntilChanged, switchMap, takeUntil } from 'rxjs/operators';
import { AdminMarketDataService } from './admin-market-data.service'; import { AdminMarketDataService } from './admin-market-data.service';
@ -480,11 +480,21 @@ export class GfAdminMarketDataComponent
dialogRef dialogRef
.afterClosed() .afterClosed()
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ dataSource, symbol } = {}) => { .subscribe(({ dataSource, symbol, isCurrency } = {}) => {
if (dataSource && symbol) { if (dataSource && symbol) {
this.adminService this.adminService
.addAssetProfile({ dataSource, symbol }) .addAssetProfile({ dataSource, symbol })
.pipe( .pipe(
switchMap(() => {
// Call gatherSymbol for currencies to collect historical data
if (isCurrency) {
return this.adminService.gatherSymbol({
dataSource,
symbol
});
}
return of(null);
}),
switchMap(() => { switchMap(() => {
this.isLoading = true; this.isLoading = true;
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();

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

@ -117,7 +117,11 @@ export class GfCreateAssetProfileDialogComponent implements OnInit, OnDestroy {
}) })
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe(() => { .subscribe(() => {
this.dialogRef.close(); this.dialogRef.close({
dataSource: 'MANUAL',
symbol: `${currency}USD`,
isCurrency: true
});
}); });
} else if (this.mode === 'manual') { } else if (this.mode === 'manual') {
this.dialogRef.close({ this.dialogRef.close({

Loading…
Cancel
Save