mirror of
https://github.com/valitydev/control-center.git
synced 2024-11-06 02:25:17 +00:00
Fix domain objects ids selector (#98)
This commit is contained in:
parent
b8d7b8059f
commit
b31a564493
@ -15,21 +15,18 @@ export function createDomainObjectExtension(
|
||||
determinant: (data) =>
|
||||
of(
|
||||
isTypeWithAliases(data?.trueParent, refType, 'domain') &&
|
||||
isTypeWithAliases(data, 'ObjectID', 'domain')
|
||||
(isTypeWithAliases(data, 'ObjectID', 'domain') ||
|
||||
// TODO: 'field.name' must be passed as an argument
|
||||
['id', 'symbolic_code'].includes(data.field?.name))
|
||||
),
|
||||
extension: () =>
|
||||
options().pipe(
|
||||
map((objects) => ({
|
||||
options: objects
|
||||
.sort((a, b) =>
|
||||
typeof a.value === 'number' && typeof b.value === 'number'
|
||||
? a.value - b.value
|
||||
: 0
|
||||
)
|
||||
.map((o) => ({
|
||||
details: o,
|
||||
...o,
|
||||
})),
|
||||
options: objects.sort((a, b) =>
|
||||
typeof a.value === 'number' && typeof b.value === 'number'
|
||||
? a.value - b.value
|
||||
: 0
|
||||
),
|
||||
isIdentifier: true,
|
||||
}))
|
||||
),
|
||||
|
@ -15,11 +15,11 @@ export const DOMAIN_OBJECTS_TO_OPTIONS: {
|
||||
[N in keyof OtherDomainObjects]-?: (o: OtherDomainObjects[N]) => MetadataFormExtensionOption;
|
||||
} = {
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
currency: (o) => ({ value: o.ref.symbolic_code, label: o.data.name }),
|
||||
currency: (o) => ({ value: o.ref.symbolic_code, label: o.data.name, details: o }),
|
||||
payment_method: null,
|
||||
globals: null,
|
||||
identity_provider: (o) => ({ value: o.ref.id }),
|
||||
dummy_link: (o) => ({ value: o.ref.id, label: o.data.link.id }),
|
||||
identity_provider: (o) => ({ value: o.ref.id, details: o }),
|
||||
dummy_link: (o) => ({ value: o.ref.id, label: o.data.link.id, details: o }),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
};
|
||||
|
||||
@ -27,5 +27,5 @@ export function defaultDomainObjectToOption(o: DomainRefDataObjects[keyof Domain
|
||||
let label: string;
|
||||
if ('name' in o.data) label = o.data.name;
|
||||
if ('id' in o.data && !label) label = o.data.id;
|
||||
return { value: o.ref.id, label };
|
||||
return { value: o.ref.id, label, details: o };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user