yangzhang75 opened a new pull request, #9526:
URL: https://github.com/apache/texera/pull/9526

   ### What changes were proposed in this PR?
   
   Closes #9501.
   
   `user-dataset-version-filetree` is the file tree every dataset and model 
browser uses: the versions/files browser (dataset page, model page), the 
dataset-selection modal and the model-selection modal. Its click handler 
overrode the tree library's default click (`TOGGLE_ACTIVE`) with an emit of 
`selectedTreeNode` alone, so the tree never had an active node and the library 
never marked the clicked row. Where the host shows a preview (the dataset and 
model pages) the click had a visible result anyway; in the dataset-selection 
modal in file mode (a `fileName` property's **Select File**, e.g. CSV File 
Scan) the host only stores the path, so the picked file looked like every other 
row, the one sign of the pick was the Select button turning enabled, and 
re-clicking the picked file gave no feedback at all.
   
   - `user-dataset-version-filetree.component.ts`: a file click calls 
`TREE_ACTIONS.ACTIVATE(tree, node, $event)` before emitting -- `ACTIVATE` 
rather than `TOGGLE_ACTIVE`, so a second click on the picked file leaves it 
highlighted, as the selection it emits stands either way. Enter and Space on 
the focused node run the same handler: the library maps them to `TOGGLE_ACTIVE` 
by default, which would have stripped the highlight off the picked file while 
the host's selection stood, or marked a row the host never heard of. Folders 
toggle as before, activating nothing.
   - `isFileSelectable` input (default `true`): a host that browses a version's 
files without holding one leaves nothing for a click to mean, and a highlighted 
row there would promise a pick nothing takes, so a file click activates and 
emits nothing where it is `false`. The dataset-selection modal binds it to its 
file mode (its version mode shows the tree only to browse) and the 
model-selection modal, whose tree is not bound to a handler at all, sets it 
`false`. Every host that never binds it keeps the click it has and gains the 
highlight.
   - `user-dataset-version-filetree.component.scss`: the library's active row 
(`.node-content-wrapper-active`) takes the ant blue-1 fill the dashboard's 
selected list rows and the workspace's selected cards share, with ant's primary 
blue as the ring and text colour, in place of the library's own 
`#beebff`-behind-a-grey-shadow; an inset shadow rather than a border, which 
would eat 2 px of the content box the row's icon buttons and centring rely on 
under the app's border-box sizing. The `:hover` copy keeps that fill on the 
picked row instead of the library's hover tint.
   
   Left as it is, on purpose: the dataset and model pages preview a file on 
load without a click, and that file is not highlighted -- marking it needs the 
host to tell the tree which file it holds, which the UDF parameter-picker work 
adds (`activeFilePath`) and which belongs with it. Activating a node also lets 
the library scroll a row that is cut off at the viewport edge into view on 
click (`scrollOnActivate`), which it did not do before.
   
   #### Video
   
   **Before**
   
   <!-- before video -->
   
   **After**
   
   <!-- after video -->
   
   ### Any related issues, documentation, discussions?
   
   Closes #9501. Found while building the UDF parameter pickers (#9338); 
independent of them.
   
   ### How was this PR tested?
   
   - `user-dataset-version-filetree.component.spec.ts`: the two handler-level 
click tests (which called the handler with hand-made nodes) become a block that 
clicks real tree nodes through the library's own `mouseAction` dispatch, so 
what is pinned is the state the row's `node-content-wrapper-active` class is 
bound to: a file click emits `selectedTreeNode` and makes the file the active 
node; a second click on the same file keeps it active and emits it again; a 
click on another file moves the highlight; Enter and Space activate and emit as 
a click does, without toggling the pick off; where files cannot be picked a 
file click activates and emits nothing while a folder still expands; the input 
defaults to `true`; a folder click toggles expansion, activates nothing and 
emits nothing. Deletion-checked: without the `ACTIVATE` call three of these 
fail; with the keys left at the library default, the Enter/Space one; without 
the `isFileSelectable` gate, the cannot-be-picked one.
   - `user-dataset-version-filetree.component.browser.spec.ts` (real rows under 
the virtual scroll, real computed styles): the clicked row carries the active 
class, its neighbour does not, the computed background, ring and colour are the 
component's rather than the library's, and the row's content box is still the 
full node height; where files cannot be picked a click leaves the row's class 
and background as they were. Deletion-checked: without the style rule the first 
fails.
   - The dataset-selection and model-selection modal specs pass with the new 
binding; the full frontend suite, eslint, prettier and the production (AOT) 
build pass.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Yes. Generated-by: Claude Code (Claude Fable 5.1, Anthropic). Co-authored 
with Claude, reviewed line by line by the author before submission.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to