Commit Graph
2 Commits
Author SHA1 Message Date
Charis 205cbe7d26 chore(studio}: enforce import order, remove bare import specifiers (#44585) 2026-04-07 20:34:10 -04:00
Danny White 16308ad286 chore(studio): reuse key-value field array for log drains (#44060)
## What kind of change does this PR introduce?

Chore that resolves FE-2785.

## What is the current behavior?

The Log Drains headers section still uses a bespoke add-header mini form
and stores headers directly as a record in form state.

That makes it inconsistent with the shared `KeyValueFieldArray` pattern
already adopted elsewhere in Studio.

## What is the new behavior?

- reuses the shared `KeyValueFieldArray` in the Log Drains destination
sheet
- keeps the external submit contract unchanged by converting between:
  - form-only `headerEntries: { key, value }[]`
  - submitted `headers: Record<string, string>`
- preserves type-specific defaults:
  - webhook starts with `Content-Type: application/json`
  - OTLP starts with `Content-Type: application/x-protobuf`
- moves header validation into standard form errors for:
  - max 20 headers
  - duplicate header names
  - partially filled rows, while still allowing fully empty draft rows
- adds focused utility and sheet tests for the new adapter and
validation behaviour

| Before | After |
| --- | --- |
| <img width="1728" height="997" alt="Log Drains Settings Mallet
Toolshed Supabase-027E4669-8B02-4C43-8771-794E13799FA3"
src="https://github.com/user-attachments/assets/43ed6334-28ef-4d47-9747-dfb3221462ec"
/> | <img width="1728" height="997" alt="Log Drains Settings Mallet
Toolshed Supabase-68477EA1-6F56-4BE2-9355-C121896F11E4"
src="https://github.com/user-attachments/assets/9391bccd-3a50-4468-91e7-05059d41543c"
/> |

## Additional context

This is PR 4 of the DEPR-394 field-array stack.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Bug Fixes**
* Enhanced header validation with specific error messages for duplicate
headers and missing values.
  * Improved form behavior for edge cases in header entry management.

* **New Features**
* Added destination-specific default headers for clearer initial
configuration.

* **Tests**
* Added comprehensive test suite validating header management and form
submission behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-02 11:14:34 +11:00