MI-9: Fix wallet reports identity filter (#139)

This commit is contained in:
Rinat Arsaev 2023-08-02 12:38:27 +04:00 committed by GitHub
parent 4a5ef4595a
commit 0e34106c13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 6 deletions

View File

@ -8,9 +8,9 @@ import { Report } from '@vality/swag-wallet';
import isEqual from 'lodash-es/isEqual';
import moment from 'moment';
import { Observable } from 'rxjs';
import { startWith, distinctUntilChanged, filter, map } from 'rxjs/operators';
import { startWith, distinctUntilChanged, filter, map, first } from 'rxjs/operators';
import { WalletDictionaryService } from '@dsh/app/api/wallet';
import { WalletDictionaryService, IdentitiesService } from '@dsh/app/api/wallet';
import { mapToTimestamp } from '@dsh/app/custom-operators';
import { QueryParamsService } from '@dsh/app/shared';
import { Column, ExpandedFragment } from '@dsh/app/shared/components/accordion-table';
@ -84,10 +84,16 @@ export class ReportsComponent implements OnInit {
private qp: QueryParamsService<Partial<Form>>,
private dialog: MatDialog,
private transloco: TranslocoService,
private walletDictionaryService: WalletDictionaryService
private walletDictionaryService: WalletDictionaryService,
private identitiesService: IdentitiesService
) {}
ngOnInit() {
this.identitiesService.identities$.pipe(first(), untilDestroyed(this)).subscribe((identities) => {
if (!this.form.value.identityID && identities.length === 1) {
this.form.patchValue({ identityID: identities[0].id });
}
});
this.form.valueChanges
.pipe(startWith(this.form.value), distinctUntilChanged(isEqual), untilDestroyed(this))
.subscribe((value) => {

View File

@ -2,7 +2,7 @@
<dsh-filter
[active]="isActive"
[label]="t('label')"
[activeLabel]="t('label', { name: (identity$ | async)?.name || '#' + savedValue })"
[activeLabel]="t('activeLabel', { name: (identity$ | async)?.name || '#' + savedValue })"
[content]="content"
(save)="save()"
(clear)="clear()"

View File

@ -175,7 +175,8 @@
"showAllStatuses": "Show all statuses"
},
"identityFilter": {
"label": "Wallet holder: {{name}}"
"activeLabel": "Wallet holder: {{name}}",
"label": "Wallet holder"
},
"inputs": {
"identityField": {

View File

@ -175,7 +175,8 @@
"showAllStatuses": "Показать все статусы"
},
"identityFilter": {
"label": "Владелец кошелька: {{name}}"
"activeLabel": "Владелец кошелька: {{name}}",
"label": "Владелец кошелька"
},
"inputs": {
"identityField": {