IMP-183: Default all_of for "Add shop routing candidate" (#337)

This commit is contained in:
Rinat Arsaev 2024-03-04 17:20:33 +07:00 committed by GitHub
parent e7cae6e727
commit 9299741c2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 5 deletions

View File

@ -136,6 +136,7 @@ export class RoutingRulesetComponent {
.open(DomainThriftFormDialogComponent<RoutingCandidate>, {
type: 'RoutingCandidate',
title: 'Add shop routing candidate',
object: { allowed: { all_of: new Set([{ constant: true }]) } },
action: (params) => this.routingRulesService.addShopRule(refId, params),
})
.afterClosed(),

View File

@ -6,7 +6,6 @@ import {
FormControlSuperclass,
createControlProviders,
getValueChanges,
compareDifferentTypes,
} from '@vality/ng-core';
import { ThriftType } from '@vality/thrift-ts';
import { combineLatest, defer, ReplaySubject, switchMap, Observable } from 'rxjs';
@ -53,7 +52,6 @@ export class PrimitiveFieldComponent<T>
}))
: [],
),
map((o) => o.sort((a, b) => compareDifferentTypes(a.value, b.value))),
shareReplay({ refCount: true, bufferSize: 1 }),
);
selectedExtensionOption$ = combineLatest([

View File

@ -10,8 +10,9 @@ import { getUnionKey, getUnionValue } from '../../../../utils';
import { DomainStoreService } from '../../../api/domain-config';
import { PartiesStoreService } from '../../../api/payment-processing';
import { getTerminalShopWalletDelegates } from '../../../sections/terminals/utils/get-terminal-shop-wallet-delegates';
import { SidenavInfoService } from '../sidenav-info';
import { CardComponent } from '../sidenav-info/components/card/card.component';
import { DomainThriftViewerComponent } from '../thrift-api-crud';
import { DomainThriftViewerComponent, DomainObjectCardComponent } from '../thrift-api-crud';
@Component({
selector: 'cc-terminal-delegates-card',
@ -32,11 +33,21 @@ export class TerminalDelegatesCardComponent implements OnChanges {
header: 'Routing Rule',
field: 'terminalRule.data.name',
description: 'terminalRule.ref.id',
click: (d) => {
this.sidenavInfoService.toggle(DomainObjectCardComponent, {
ref: { routing_rules: { id: d.terminalRule.ref.id } },
});
},
},
{
header: 'Ruleset',
field: 'rule.data.name',
description: 'rule.ref.id',
click: (d) => {
this.sidenavInfoService.toggle(DomainObjectCardComponent, {
ref: { routing_rules: { id: d.rule.ref.id } },
});
},
},
{
field: 'party',
@ -102,6 +113,7 @@ export class TerminalDelegatesCardComponent implements OnChanges {
constructor(
private partiesStoreService: PartiesStoreService,
private domainStoreService: DomainStoreService,
private sidenavInfoService: SidenavInfoService,
) {}
ngOnChanges(changes: ComponentChanges<TerminalDelegatesCardComponent>) {

View File

@ -5,6 +5,7 @@ import { MatButtonModule } from '@angular/material/button';
import { DialogSuperclass, DialogModule, DEFAULT_DIALOG_CONFIG } from '@vality/ng-core';
import { ValueType } from '@vality/thrift-ts';
import { Observable } from 'rxjs';
import { DeepPartial } from 'utility-types';
import { DomainThriftFormComponent } from '../domain-thrift-form';
@ -20,14 +21,14 @@ export class DomainThriftFormDialogComponent<T = unknown, R = unknown> extends D
title: string;
action: (object: T) => Observable<R>;
namespace?: string;
object?: T;
object?: T extends object ? DeepPartial<T> : T;
actionType?: 'create' | 'update';
},
{ object?: T; result?: R; error?: unknown }
> {
static defaultDialogConfig = DEFAULT_DIALOG_CONFIG.large;
control = this.fb.control(this.dialogData.object ?? null);
control = this.fb.control<T>((this.dialogData.object as T) ?? null);
get actionType() {
return (