Skip to content

Refactor: rename variables and improve MetadataInitializationUI#71

Merged
ehennestad merged 31 commits intodevfrom
dev-refactor-and-improve-metadatainitializationui
Mar 17, 2026
Merged

Refactor: rename variables and improve MetadataInitializationUI#71
ehennestad merged 31 commits intodevfrom
dev-refactor-and-improve-metadatainitializationui

Conversation

@ehennestad
Copy link
Copy Markdown
Collaborator

@ehennestad ehennestad commented Mar 17, 2026

Summary

  • Rename throughout: expanded all abbreviated variable, property, and method names to full descriptive names (e.g. dlIdxdataLocationIndex, strIndinputValue, hBtnGroupbuttonGroup)
  • Refactor extraction logic: deduplicated metadata extraction logic, moved subfolder-level inference from MetadataInitializationUI into DataLocationModel
  • Improve error handling: surface extraction errors inline instead of silently swallowing them or showing blocking modal alerts; added proper handling for missing metadata extraction functions
  • Multi-folder selection: added UI support for selecting multiple folder levels to build session IDs, including a FolderMultiSelector button with truncated label and tooltip
  • Bug fix: refresh FolderMultiSelector button text when button width changes (e.g. toggling advanced view)

Test plan

  • Open the Metadata Initialization UI and verify all four metadata rows display correctly
  • Toggle advanced view on/off and confirm the FolderMultiSelector label truncates correctly at the new width
  • Select multiple folder levels in multi-select mode and confirm the button label and tooltip update
  • Switch between data locations and confirm the UI updates correctly

🤖 Generated with Claude Code

ehennestad and others added 30 commits March 17, 2026 11:44
- Extract combineFolderNamesFromPath and applyExtractionPattern as
  Static Hidden methods on DataLocationModel
- Move getSubstringFromFolder to Static Hidden; remove unused obj param,
  replace dataLocationIndex with dataLocationName
- MetadataInitializationUI.getFolderSubString and getCombinedFolderName
  now delegate to the model methods instead of duplicating logic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…anged (name matches what the callback actually does)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…x with setStringSearchMode)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ive name)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Position (replace cryptic layout variables)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ield/StringDetectResultField (expand abbreviations, align with data field names)

Also rename hInputEditbox/hComp → inputField (consistent, descriptive local variable name)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…abbreviation, conventional type-suffix ordering)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…what it holds)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ts/lastSequenceIndex in simplifyIndices

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…bbreviation)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…and abbreviations)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…mIndex/rowNumber/dataLocationIndex/folderPath/arrowIndicator (expand abbreviations)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fixed code issues
removed stale code
…dataInitializationUI

Unifies three inconsistent naming variants for the same UI concept.
Model field names (StringDetectMode, StringDetectInput) preserved for backward compatibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…I to DataLocationModel

Adds DataLocationModel.getDefaultSubfolderLevelForVariable() as a public
static method, encoding the mapping between metadata variable names and
subfolder types. Removes the private initFolderSelectionItemIndex() from
MetadataInitializationUI and updates the call site to use the model method,
passing variableName from metadataDefinitions instead of reading from a UI
control label. Also fixes a latent bug where find(isMatched) without a
limit returned multiple indices when duplicate subfolder types existed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update docstring
Fix bug with uninitialized boolean
Fixed static method calls
DataLocationModel.getSubstringFromFolder now throws a typed error
(NANSEN:DataLocationModel:FunctionNotFound) instead of propagating the raw
MATLAB:UndefinedFunction when a func-mode extraction function is missing.

MetadataInitializationUI catches this error in getFolderSubstring and
delegates to a new private alertFunctionNotFound method, which also
replaces the inline alert in onRunFunctionButtonClicked. The alert now
includes the variable name (e.g. "Subject ID") for clearer user feedback.
Also fixes an uninitialized functionExists variable in onRunFunctionButtonClicked.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…or showing modal alerts

- applyExtractionPattern now throws meaningful errors (InvalidIndexPattern,
  IndexOutOfRange, InvalidRegexPattern) instead of silently returning ''
- Add refreshStringResult for passive/programmatic updates: errors shown
  inline in the result field (no modal alert)
- Passive callers in onModelSet and onDataLocationModified now use
  refreshStringResult instead of onStringInputValueChanged, avoiding
  spurious IsDirty=true and out-of-context uialert popups
- User-driven callbacks (onStringInputValueChanged and updateStringResult
  call sites) retain uialert behaviour

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Call updateFolderSelectorButtonText after shifting folder selector controls so the FolderMultiSelector button displays the correct text based on its UserData (FolderItems and SelectedIndices). This ensures the UI label stays in sync after layout changes.
@github-actions
Copy link
Copy Markdown

Test Results

112 tests   112 ✅  14s ⏱️
  7 suites    0 💤
  1 files      0 ❌

Results for commit d47c1db.

@ehennestad ehennestad merged commit 584a6c3 into dev Mar 17, 2026
@ehennestad ehennestad deleted the dev-refactor-and-improve-metadatainitializationui branch March 17, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant