mirror of
https://github.com/valitydev/control-center.git
synced 2024-11-06 02:25:17 +00:00
Bump damsel@b04aba8 (#349)
This commit is contained in:
parent
4214fd6f45
commit
f426c74080
8
package-lock.json
generated
8
package-lock.json
generated
@ -21,7 +21,7 @@
|
||||
"@angular/router": "17.2.1",
|
||||
"@ngneat/input-mask": "6.0.0",
|
||||
"@vality/deanonimus-proto": "2.0.1-2a02d87.0",
|
||||
"@vality/domain-proto": "2.0.1-decfa45.0",
|
||||
"@vality/domain-proto": "2.0.1-b04aba8.0",
|
||||
"@vality/fistful-proto": "2.0.1-6600be9.0",
|
||||
"@vality/machinegun-proto": "1.0.0",
|
||||
"@vality/magista-proto": "2.0.2-28d11b9.0",
|
||||
@ -6416,9 +6416,9 @@
|
||||
"integrity": "sha512-mokuK6w+ExASdDE6+L9bM2SaS0yVPSyBvXavY8rRtNzZgVdmj7KSRiyGmXz41grhS6jcvD8aR85Nj4o7/iogmQ=="
|
||||
},
|
||||
"node_modules/@vality/domain-proto": {
|
||||
"version": "2.0.1-decfa45.0",
|
||||
"resolved": "https://registry.npmjs.org/@vality/domain-proto/-/domain-proto-2.0.1-decfa45.0.tgz",
|
||||
"integrity": "sha512-XzWkvotVjXxJKncBdbQC7SaOBjAEEqcQxy/eHdWEUz7wDfYvIHQx04iVEJJlMlagTMuOoVg5qPa5JCDIVs0N0g=="
|
||||
"version": "2.0.1-b04aba8.0",
|
||||
"resolved": "https://registry.npmjs.org/@vality/domain-proto/-/domain-proto-2.0.1-b04aba8.0.tgz",
|
||||
"integrity": "sha512-AKD5RkqiS+31hTUaLfh7I3vgYZ2yytwxp8J1jQZ7iPWURz/m5+6Yg4YKNj8Vyyxu3yzO13FxxPUnkTh/poCDWg=="
|
||||
},
|
||||
"node_modules/@vality/eslint-config": {
|
||||
"version": "8.2.0",
|
||||
|
@ -29,7 +29,7 @@
|
||||
"@angular/router": "17.2.1",
|
||||
"@ngneat/input-mask": "6.0.0",
|
||||
"@vality/deanonimus-proto": "2.0.1-2a02d87.0",
|
||||
"@vality/domain-proto": "2.0.1-decfa45.0",
|
||||
"@vality/domain-proto": "2.0.1-b04aba8.0",
|
||||
"@vality/fistful-proto": "2.0.1-6600be9.0",
|
||||
"@vality/machinegun-proto": "1.0.0",
|
||||
"@vality/magista-proto": "2.0.2-28d11b9.0",
|
||||
|
@ -4,10 +4,11 @@
|
||||
</cc-page-layout-actions>
|
||||
<v-table
|
||||
[(sort)]="sort"
|
||||
[columns]="columns$ | async"
|
||||
[columns]="columns"
|
||||
[data]="data$ | async"
|
||||
[filterByColumns]="[]"
|
||||
[progress]="progress$ | async"
|
||||
name="terminals"
|
||||
sortOnFront
|
||||
standaloneFilter
|
||||
(update)="update()"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, DestroyRef } from '@angular/core';
|
||||
import { Component, DestroyRef, isDevMode } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { Sort } from '@angular/material/sort';
|
||||
import { TerminalObject } from '@vality/domain-proto/domain';
|
||||
@ -23,75 +23,73 @@ import { getTerminalShopWalletDelegates } from './utils/get-terminal-shop-wallet
|
||||
templateUrl: './terminals.component.html',
|
||||
})
|
||||
export class TerminalsComponent {
|
||||
columns$ = this.terminalBalancesStoreService.balances$.pipe(
|
||||
map((balances): Column<TerminalObject>[] => [
|
||||
{ field: 'ref.id', sortable: true },
|
||||
{
|
||||
field: 'data.name',
|
||||
description: 'data.description',
|
||||
sortable: true,
|
||||
click: (d) => {
|
||||
this.sidenavInfoService.toggle(DomainObjectCardComponent, {
|
||||
ref: { terminal: d.ref },
|
||||
});
|
||||
},
|
||||
columns: Column<TerminalObject>[] = [
|
||||
{ field: 'ref.id', sortable: true },
|
||||
{
|
||||
field: 'data.name',
|
||||
description: 'data.description',
|
||||
sortable: true,
|
||||
click: (d) => {
|
||||
this.sidenavInfoService.toggle(DomainObjectCardComponent, {
|
||||
ref: { terminal: d.ref },
|
||||
});
|
||||
},
|
||||
{
|
||||
field: 'data.provider_ref.id',
|
||||
description: 'data.provider_ref.id',
|
||||
header: 'Provider',
|
||||
formatter: (d) => this.getProvider(d).pipe(map((p) => p?.data?.name || '')),
|
||||
sortable: true,
|
||||
click: (d) => {
|
||||
this.getProvider(d)
|
||||
.pipe(take(1), takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((provider) => {
|
||||
if (!provider) {
|
||||
return;
|
||||
}
|
||||
this.sidenavInfoService.toggle(DomainObjectCardComponent, {
|
||||
ref: { provider: provider.ref },
|
||||
});
|
||||
},
|
||||
{
|
||||
field: 'data.provider_ref.id',
|
||||
description: 'data.provider_ref.id',
|
||||
header: 'Provider',
|
||||
formatter: (d) => this.getProvider(d).pipe(map((p) => p?.data?.name || '')),
|
||||
sortable: true,
|
||||
click: (d) => {
|
||||
this.getProvider(d)
|
||||
.pipe(take(1), takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((provider) => {
|
||||
if (!provider) {
|
||||
return;
|
||||
}
|
||||
this.sidenavInfoService.toggle(DomainObjectCardComponent, {
|
||||
ref: { provider: provider.ref },
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
createPredicateColumn(
|
||||
'payments global allow',
|
||||
(d) => d.data.terms?.payments?.global_allow,
|
||||
),
|
||||
createPredicateColumn(
|
||||
'withdrawals global allow',
|
||||
(d) => d.data.terms?.wallet?.withdrawals?.global_allow,
|
||||
),
|
||||
{
|
||||
field: 'delegates',
|
||||
formatter: (d) =>
|
||||
this.getTerminalShopWalletDelegates(d).pipe(map((r) => r.length || '')),
|
||||
click: (d) => {
|
||||
this.sidenavInfoService.toggle(TerminalDelegatesCardComponent, { ref: d.ref });
|
||||
},
|
||||
},
|
||||
createPredicateColumn('payments global allow', (d) => d.data.terms?.payments?.global_allow),
|
||||
createPredicateColumn(
|
||||
'withdrawals global allow',
|
||||
(d) => d.data.terms?.wallet?.withdrawals?.global_allow,
|
||||
),
|
||||
{
|
||||
field: 'delegates',
|
||||
formatter: (d) =>
|
||||
this.getTerminalShopWalletDelegates(d).pipe(map((r) => r.length || '')),
|
||||
click: (d) => {
|
||||
this.sidenavInfoService.toggle(TerminalDelegatesCardComponent, {
|
||||
ref: d.ref,
|
||||
});
|
||||
},
|
||||
...(balances?.length
|
||||
? [
|
||||
createCurrencyColumn<TerminalObject>(
|
||||
'balance',
|
||||
(d) =>
|
||||
this.terminalBalancesStoreService
|
||||
.getTerminalBalance(d.ref.id)
|
||||
.pipe(
|
||||
map((b) =>
|
||||
b?.balance?.amount ? Number(b.balance.amount) : undefined,
|
||||
),
|
||||
},
|
||||
...(isDevMode()
|
||||
? [
|
||||
createCurrencyColumn<TerminalObject>(
|
||||
'balance',
|
||||
(d) =>
|
||||
this.terminalBalancesStoreService
|
||||
.getTerminalBalance(d.ref.id)
|
||||
.pipe(
|
||||
map((b) =>
|
||||
b?.balance?.amount ? Number(b.balance.amount) : undefined,
|
||||
),
|
||||
(d) =>
|
||||
this.terminalBalancesStoreService
|
||||
.getTerminalBalance(d.ref.id)
|
||||
.pipe(map((b) => b?.balance?.currency_code)),
|
||||
),
|
||||
]
|
||||
: []),
|
||||
]),
|
||||
);
|
||||
),
|
||||
(d) =>
|
||||
this.terminalBalancesStoreService
|
||||
.getTerminalBalance(d.ref.id)
|
||||
.pipe(map((b) => b?.balance?.currency_code)),
|
||||
{ sortable: true },
|
||||
),
|
||||
]
|
||||
: []),
|
||||
];
|
||||
data$ = this.domainStoreService.getObjects('terminal');
|
||||
progress$ = this.domainStoreService.isLoading$;
|
||||
sort: Sort = { active: 'data.name', direction: 'asc' };
|
||||
|
@ -13,7 +13,7 @@ export class AmountCurrencyService {
|
||||
toMajor(amount: number, symbolicCode: string) {
|
||||
return this.getCurrency(symbolicCode).pipe(
|
||||
first(),
|
||||
map((currency) => toMajorByExponent(amount, currency.data.exponent)),
|
||||
map((currency) => toMajorByExponent(amount, currency?.data?.exponent)),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { CurrencyColumn, PossiblyAsync, getPossiblyAsyncObservable } from '@vality/ng-core';
|
||||
import isNil from 'lodash-es/isNil';
|
||||
import { combineLatest, switchMap } from 'rxjs';
|
||||
import { combineLatest, switchMap, of } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { AmountCurrencyService } from '../../services';
|
||||
@ -22,15 +22,15 @@ export function createCurrencyColumn<T extends object>(
|
||||
getPossiblyAsyncObservable(selectSymbolicCode(d)),
|
||||
]).pipe(
|
||||
switchMap(([amount, code]) =>
|
||||
isNil(amount) ? undefined : amountCurrencyService.toMajor(amount, code),
|
||||
isNil(amount) ? of(undefined) : amountCurrencyService.toMajor(amount, code),
|
||||
),
|
||||
),
|
||||
typeParameters: {
|
||||
currencyCode: (d: T) => selectSymbolicCode(d),
|
||||
currencyCode: (d: T) => getPossiblyAsyncObservable(selectSymbolicCode(d)),
|
||||
exponent: (d: T) =>
|
||||
getPossiblyAsyncObservable(selectSymbolicCode(d)).pipe(
|
||||
switchMap((code) => amountCurrencyService.getCurrency(code)),
|
||||
map((c) => c.data.exponent),
|
||||
map((c) => c?.data?.exponent),
|
||||
),
|
||||
},
|
||||
...params,
|
||||
|
Loading…
Reference in New Issue
Block a user