Fix/opportunities board (#2610)
* WIP * wip * update pipelineStepId * rename pipeline stage to pipeline step * rename pipelineProgress to Opportunity * fix UUID type not queried * fix boardColumnTotal * fix micros * fixing filters, sorts and fields * wip * wip * Fix opportunity board re-render --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com> Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
This commit is contained in:
@ -92,7 +92,10 @@ export const SettingsObjectFieldPreview = ({
|
||||
|
||||
const {
|
||||
defaultValue: relationDefaultValue,
|
||||
recordMapper: mainIdentifierMapper,
|
||||
labelIdentifierFieldPaths,
|
||||
imageIdentifierUrlField,
|
||||
imageIdentifierUrlPrefix,
|
||||
imageIdentifierFormat,
|
||||
} = useRelationFieldPreview({
|
||||
relationObjectMetadataId,
|
||||
skipDefaultValue:
|
||||
@ -104,6 +107,15 @@ export const SettingsObjectFieldPreview = ({
|
||||
? relationDefaultValue
|
||||
: dataTypes[fieldMetadata.type].defaultValue;
|
||||
|
||||
if (
|
||||
!labelIdentifierFieldPaths ||
|
||||
!imageIdentifierUrlField ||
|
||||
!imageIdentifierUrlPrefix ||
|
||||
!imageIdentifierFormat
|
||||
) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledContainer className={className}>
|
||||
<StyledObjectSummary>
|
||||
@ -146,7 +158,13 @@ export const SettingsObjectFieldPreview = ({
|
||||
iconName: 'FieldIcon',
|
||||
fieldMetadataId: fieldMetadata.id || '',
|
||||
label: fieldMetadata.label,
|
||||
metadata: { fieldName, mainIdentifierMapper },
|
||||
metadata: {
|
||||
fieldName,
|
||||
labelIdentifierFieldPaths,
|
||||
imageIdentifierUrlField,
|
||||
imageIdentifierUrlPrefix,
|
||||
imageIdentifierFormat,
|
||||
},
|
||||
},
|
||||
hotkeyScope: 'field-preview',
|
||||
}}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { useObjectMainIdentifier } from '@/object-metadata/hooks/useObjectMainIdentifier';
|
||||
import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings';
|
||||
import { useFindManyObjectRecords } from '@/object-record/hooks/useFindManyObjectRecords';
|
||||
import { MainIdentifierMapper } from '@/ui/object/field/types/MainIdentifierMapper';
|
||||
|
||||
export const useRelationFieldPreview = ({
|
||||
relationObjectMetadataId,
|
||||
@ -21,24 +20,18 @@ export const useRelationFieldPreview = ({
|
||||
skip: skipDefaultValue || !relationObjectMetadataItem,
|
||||
});
|
||||
|
||||
const { mainIdentifierMapper } = useObjectMainIdentifier(
|
||||
relationObjectMetadataItem,
|
||||
);
|
||||
|
||||
const recordMapper: MainIdentifierMapper | undefined =
|
||||
relationObjectMetadataItem && mainIdentifierMapper
|
||||
? (record: { id: string }) => {
|
||||
const mappedRecord = mainIdentifierMapper(record);
|
||||
|
||||
return {
|
||||
...mappedRecord,
|
||||
name: mappedRecord.name || relationObjectMetadataItem.labelSingular,
|
||||
};
|
||||
}
|
||||
: undefined;
|
||||
const {
|
||||
labelIdentifierFieldPaths,
|
||||
imageIdentifierUrlField,
|
||||
imageIdentifierUrlPrefix,
|
||||
imageIdentifierFormat,
|
||||
} = useObjectMainIdentifier(relationObjectMetadataItem);
|
||||
|
||||
return {
|
||||
defaultValue: relationObjects?.[0],
|
||||
recordMapper,
|
||||
labelIdentifierFieldPaths,
|
||||
imageIdentifierUrlField,
|
||||
imageIdentifierUrlPrefix,
|
||||
imageIdentifierFormat,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user