|
|
@ -130,6 +130,14 @@ export const ConvertFieldTypeTransformerEditor = ({ |
|
|
|
<> |
|
|
|
<> |
|
|
|
{options.conversions.map((c: ConvertFieldTypeOptions, idx: number) => { |
|
|
|
{options.conversions.map((c: ConvertFieldTypeOptions, idx: number) => { |
|
|
|
const targetField = findField(input?.[0], c.targetField); |
|
|
|
const targetField = findField(input?.[0], c.targetField); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Show "Join with" input when:
|
|
|
|
|
|
|
|
// - A join value exists (maintains backward compatibility)
|
|
|
|
|
|
|
|
// - Target field type is 'other' (Grafana 10) or 'string' (Grafana 11)
|
|
|
|
|
|
|
|
// This ensures consistent UI across versions where arrays may be classified differently.
|
|
|
|
|
|
|
|
const shouldRenderJoinWith = |
|
|
|
|
|
|
|
c.joinWith?.length || (targetField?.type && [FieldType.other, FieldType.string].includes(targetField.type)); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div key={`${c.targetField}-${idx}`}> |
|
|
|
<div key={`${c.targetField}-${idx}`}> |
|
|
|
<InlineFieldRow> |
|
|
|
<InlineFieldRow> |
|
|
@ -169,7 +177,7 @@ export const ConvertFieldTypeTransformerEditor = ({ |
|
|
|
)} |
|
|
|
)} |
|
|
|
{c.destinationType === FieldType.string && ( |
|
|
|
{c.destinationType === FieldType.string && ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
{(c.joinWith?.length || targetField?.type === FieldType.other) && ( |
|
|
|
{shouldRenderJoinWith && ( |
|
|
|
<InlineField |
|
|
|
<InlineField |
|
|
|
label={t('transformers.convert-field-type-transformer-editor.label-join-with', 'Join with')} |
|
|
|
label={t('transformers.convert-field-type-transformer-editor.label-join-with', 'Join with')} |
|
|
|
tooltip={t( |
|
|
|
tooltip={t( |
|
|
@ -182,7 +190,7 @@ export const ConvertFieldTypeTransformerEditor = ({ |
|
|
|
// eslint-disable-next-line @grafana/no-untranslated-strings
|
|
|
|
// eslint-disable-next-line @grafana/no-untranslated-strings
|
|
|
|
placeholder={'JSON'} |
|
|
|
placeholder={'JSON'} |
|
|
|
onChange={onJoinWithChange(idx)} |
|
|
|
onChange={onJoinWithChange(idx)} |
|
|
|
width={9} |
|
|
|
width={16} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</InlineField> |
|
|
|
</InlineField> |
|
|
|
)} |
|
|
|
)} |
|
|
|