Repository navigation
refactor: convert the member attribute forms to TypeScript (CM-1592) - #5315
gaspergrom wants to merge 2 commits into
Conversation
member-form-attributes.vue and member-form-global-attributes.vue move to `<script setup lang="ts">` with typed props, emits and refs, and leave the vue/block-lang legacy list. Both get a defineOptions name, which only shows in devtools and warnings. The attributes form imports autocomplete-many-input instead of using the global registration, so vue-tsc checks its bindings. Changes the types force, with the same runtime behaviour: - modelValue on the attributes form is required. Its old default factory returned undefined and the manage-attributes drawer always passes it. record keeps an undefined default, which the !record branch reads. - The attribute sort wraps show and canDelete in Number(), the coercion `-` already applied to the booleans. - ContributorAttribute gains enrichment?, the source key the members enrichment worker writes and the sort reads. - The type label reads from the AttributeType enum through a Partial<Record<string, AttributeType>> alias, because multiSelect and special have no label and render blank, as on main. - Non-null assertions on ids and new labels: only existing attributes can be edited or deleted, and Update stays disabled while a label is empty. Refs linuxfoundation/lfx-cdp-insights-ops#292 Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
PR SummaryLow Risk Overview The profile attributes form now types Runtime behavior is intended to stay the same; this is mostly compile-time safety and lint cleanup. Reviewed by Cursor Bugbot for commit 79d64a6. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the member attribute forms’ TypeScript migration.
No open issues 🎉
What changed in this PR
Continues the member-form modernization after #5295 by converting both attribute forms to TypeScript while preserving existing runtime behavior.
Changes:
- Adds typed props, emits, form models, and handlers to both components.
- Imports the autocomplete component explicitly for binding checks and adds the optional
enrichmentcontributor attribute. - Removes both migrated forms from the ESLint legacy-file list.
| File | Description |
|---|---|
frontend/src/modules/member/components/form/member-form-global-attributes.vue |
Converts to TypeScript with typed attribute models and handlers. |
frontend/src/modules/member/components/form/member-form-attributes.vue |
Types component bindings and handlers; explicitly imports autocomplete. |
frontend/src/modules/contributor/types/Contributor.ts |
Adds optional enrichment to ContributorAttribute. |
frontend/.eslint/legacy-files.json |
Removes the two converted forms from legacy exemptions. |
Review effort: Balanced
Signed-off-by: Gašper Grom <gasper.grom@gmail.com> # Conflicts: # frontend/.eslint/legacy-files.json
Converts
member-form-attributes.vueandmember-form-global-attributes.vueto<script setup lang="ts">. F-03 (#5295) already removed their fields layer.defineOptionsname, which only affects devtools and warnings.member-form-attributes.vueimportsautocomplete-many-inputexplicitly instead of using the global registration, so vue-tsc checks its bindings.AttributeFieldderivesidandcanDeletefromFilterCustomAttribute.ContributorAttributegains an optionalenrichmentfield, which the enrichment worker already writes.modelValueis required on the attributes form (the old() => {}default returnedundefined, and the drawer always bindsv-model);recordkeeps itsundefineddefault;Number()wraps the booleans in the sort.null; with production data (options: null) the new option is dropped.Closes linuxfoundation/lfx-cdp-insights-ops#292