From a29037746b7210d8774e6d98d050e17a20954625 Mon Sep 17 00:00:00 2001 From: Ray <11846445+A77AY@users.noreply.github.com> Date: Tue, 30 Jun 2026 13:32:59 +0400 Subject: [PATCH 1/2] Refactor domain object field to use 'type' instead of 'name' for improved clarity and consistency --- src/app/machines/machines.component.html | 2 +- .../edit-candidate-dialog.component.html | 2 +- src/app/withdrawals/withdrawals.component.html | 4 ++-- .../create-shop-dialog/create-shop-dialog.component.html | 4 ++-- .../create-wallet-dialog/create-wallet-dialog.component.html | 4 ++-- .../domain-object-field/domain-object-field.component.html | 2 +- .../domain-object-field/domain-object-field.component.ts | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app/machines/machines.component.html b/src/app/machines/machines.component.html index f42a96e55..af1f8b7c6 100644 --- a/src/app/machines/machines.component.html +++ b/src/app/machines/machines.component.html @@ -13,7 +13,7 @@ > Status diff --git a/src/app/parties/party/routing-rules/candidates/components/edit-candidate-dialog/edit-candidate-dialog.component.html b/src/app/parties/party/routing-rules/candidates/components/edit-candidate-dialog/edit-candidate-dialog.component.html index 314968616..ba5f672d0 100644 --- a/src/app/parties/party/routing-rules/candidates/components/edit-candidate-dialog/edit-candidate-dialog.component.html +++ b/src/app/parties/party/routing-rules/candidates/components/edit-candidate-dialog/edit-candidate-dialog.component.html @@ -1,6 +1,6 @@
- +
diff --git a/src/components/create-shop-dialog/create-shop-dialog.component.html b/src/components/create-shop-dialog/create-shop-dialog.component.html index 2b35930f6..65fa31a7a 100644 --- a/src/components/create-shop-dialog/create-shop-dialog.component.html +++ b/src/components/create-shop-dialog/create-shop-dialog.component.html @@ -11,9 +11,9 @@
diff --git a/src/components/create-wallet-dialog/create-wallet-dialog.component.html b/src/components/create-wallet-dialog/create-wallet-dialog.component.html index 79938bba8..72e53a5d3 100644 --- a/src/components/create-wallet-dialog/create-wallet-dialog.component.html +++ b/src/components/create-wallet-dialog/create-wallet-dialog.component.html @@ -11,9 +11,9 @@
diff --git a/src/components/thrift-api-crud/domain/domain-object-field/domain-object-field.component.html b/src/components/thrift-api-crud/domain/domain-object-field/domain-object-field.component.html index e24d37241..0783228a5 100644 --- a/src/components/thrift-api-crud/domain/domain-object-field/domain-object-field.component.html +++ b/src/components/thrift-api-crud/domain/domain-object-field/domain-object-field.component.html @@ -2,7 +2,7 @@ [appearance]="appearance" [formControl]="control" [hint]="hint" - [label]="label || (name | titlecase)" + [label]="label || (type | titlecase)" [multiple]="multiple()" [options]="options$ | async" [progress]="!!(progress$ | async)" diff --git a/src/components/thrift-api-crud/domain/domain-object-field/domain-object-field.component.ts b/src/components/thrift-api-crud/domain/domain-object-field/domain-object-field.component.ts index ad6c1e9dd..172f7ae07 100644 --- a/src/components/thrift-api-crud/domain/domain-object-field/domain-object-field.component.ts +++ b/src/components/thrift-api-crud/domain/domain-object-field/domain-object-field.component.ts @@ -40,7 +40,7 @@ export class DomainObjectFieldComponent extends FormC > { private fetchDomainObjectsService = inject(FetchDomainObjectsService); - @Input() name: T; + @Input() type: T; @Input() label: string; @Input({ transform: booleanAttribute }) required: boolean; @Input() size?: SelectFieldComponent['size']; @@ -63,7 +63,7 @@ export class DomainObjectFieldComponent extends FormC search(search: string) { this.fetchDomainObjectsService.load( - { type: DomainObjectType[this.name], query: search }, + { type: DomainObjectType[this.type], query: search }, { size: 1000 }, ); } From 27a2e8fd6266fa3ade3494bf7e95436baed84691 Mon Sep 17 00:00:00 2001 From: Ray <11846445+A77AY@users.noreply.github.com> Date: Tue, 30 Jun 2026 14:01:49 +0400 Subject: [PATCH 2/2] Refactor domain metadata service to remove unused shop ID logic and streamline ID type mapping --- ...domain-metadata-view-extensions.service.ts | 38 +++++-------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/src/components/thrift-api-crud/domain/domain-thrift-viewer/services/domain-metadata-view-extensions/domain-metadata-view-extensions.service.ts b/src/components/thrift-api-crud/domain/domain-thrift-viewer/services/domain-metadata-view-extensions/domain-metadata-view-extensions.service.ts index 7fe634080..5c9c3eeb3 100644 --- a/src/components/thrift-api-crud/domain/domain-thrift-viewer/services/domain-metadata-view-extensions/domain-metadata-view-extensions.service.ts +++ b/src/components/thrift-api-crud/domain/domain-thrift-viewer/services/domain-metadata-view-extensions/domain-metadata-view-extensions.service.ts @@ -9,14 +9,15 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { Router } from '@angular/router'; import { ThriftAstMetadata, metadata$ } from '@vality/domain-proto'; -import { PartyConfigRef, Reference, ShopID, base } from '@vality/domain-proto/domain'; +import { PartyConfigRef, Reference, base } from '@vality/domain-proto/domain'; import { ThriftData, ThriftViewExtension, isTypeWithAliases } from '@vality/ng-thrift'; import { DomainObjectsStoreService } from '~/api/domain-config'; import { PartiesStoreService } from '~/api/payment-processing'; import { SidenavInfoService } from '../../../../../sidenav-info'; -import { DomainObjectCardComponent } from '../../../../domain'; + +const DOMAIN_OBJECT_ID_TYPE_MAP = { ShopConfigObject: 'ShopID', WalletConfigObject: 'WalletID' }; @Injectable({ providedIn: 'root', @@ -49,29 +50,6 @@ export class DomainMetadataViewExtensionsService { }), ), }, - { - determinant: (data) => of(isTypeWithAliases(data, 'ShopID', 'domain')), - extension: (_, shopId: ShopID) => - this.partiesStoreService.getShop(shopId).value$.pipe( - map((p) => ({ - value: p.data.name, - tooltip: shopId, - click: () => { - this.sidenavInfoService.toggle(DomainObjectCardComponent, { - ref: { shop_config: { id: shopId } }, - }); - }, - })), - startWith({ - value: String(shopId), - click: () => { - this.sidenavInfoService.toggle(DomainObjectCardComponent, { - ref: { shop_config: { id: shopId } }, - }); - }, - }), - ), - }, { determinant: (data) => of(isTypeWithAliases(data, 'Timestamp', 'base')), extension: (_, value: base.Timestamp) => @@ -106,17 +84,21 @@ export class DomainMetadataViewExtensionsService { f.type as string, ).ast; const refType = objectFields.find((n) => n.name === 'ref').type as string; + const idType = + DOMAIN_OBJECT_ID_TYPE_MAP[f.type as keyof typeof DOMAIN_OBJECT_ID_TYPE_MAP]; return { determinant: (data) => of( - isTypeWithAliases(data, refType, 'domain') && + (isTypeWithAliases(data, refType, 'domain') && !isTypeWithAliases( data?.trueParent?.trueParent, 'DomainObject', 'domain', - ), + )) || + (!!idType && isTypeWithAliases(data, idType, 'domain')), ), - extension: (_, refId) => { + extension: (_, refIdOrId) => { + const refId = idType ? { id: refIdOrId } : refIdOrId; const ref = { [f.name]: refId }; return this.domainObjectsStoreService.getLimitedObject(ref).value$.pipe( map((obj) => {