Repository navigation
Commit 8b0fb16
authored
fix(frontend): hold the Python UDF parameter table's Name and Type cells locked when the panel enables its form group (apache#8848)
### What changes were proposed in this PR?
Closes apache#8847. The Python UDF operator's "UI parameters" table (apache#5043)
infers each parameter's name and type from the `self.UiParameter(...)`
declarations in the operator's code, so the widget disables those two
columns' controls as it builds each row: a name typed into the table
does not reach the code, and the parameter's value then never reaches it
either (checked on main: the table's name changes, the code's does not).
The lock does not survive on the operator property panel.
`setInteractivity(true)` enables the whole form group -- one task after
every render, and again whenever the workflow becomes modifiable, for
instance when a run ends -- and formly mirrors a control's state back
into `props.disabled`, so the one-time disable is simply undone. Which
state a given panel opening shows depends on which of the two ran last:
measured on main, the cells were editable on 4 of 5 openings, and always
after a run. The Form View, which never enables a group wholesale, has
always shown them locked, so the two views disagreed as well.
The widget now holds its own lock. On each cell it locks it registers
Angular's disabled-change hook of the control
(`registerOnDisabledChange`, the same hook formly's mirror and the
input's value accessor use): when a host enables the control, the hook
disables it again in the microtask after that enable, and announces the
status change as the enable did. Both details matter and were found on a
running instance:
- deferred to the microtask, because the input's value accessor is one
more hook on the same control, registered after this one when the cell
renders; disabling from inside the enable's own round of hooks left the
accessor having been told "enabled" last, so the box was editable over a
locked control;
- announced rather than silent (`disable()`, not `disable({emitEvent:
false})`), because ng-zorro's `nz-input` paints its `disabled` attribute
from the control's status changes; a silent disable left it painting the
box editable again at the next change detection.
A cell the widget configures editable -- the Value column, or any cell
once reconfigured -- is released from the hold, so whether it is
editable stays the host's call: a read-only panel still locks
everything, and a host that disables the whole field still reaches the
Value cell. The frame is untouched: two other approaches were tried
first and dropped, re-disabling from the frame after `enable()`
(formly's mirror has already set `props.disabled` to false by then) and
a formly expression on `props.disabled` (formly re-evaluates expressions
on model changes only, and registers them at populate, so `enable()`
never triggers one).
### Any related issues, documentation, discussions?
Closes apache#8847. Split out of apache#8846 (the same table under the Form View's
renames and hides), which is based on main and does not touch this; the
two are independent and can land in either order. The table's fixed
250px columns clip Name and Type at the panel's default 260px width,
which is why the cells have to be brought into view to see any of this;
that is a separate layout bug, filed separately.
### How was this PR tested?
Unit tests (vitest). The widget's spec: a locked cell's control is held
locked when a host enables it, in the microtask after the enable and
announcing the status change, while the Value cell is left to the host;
a cell configured editable again is released from the hold; a cell the
host disables again before the microtask is left alone; a control that
is not a `FormControl` gets no hook, and a control is hooked once
however often it is configured. A second spec stands the table up under
real formly (`FormlyModule.forRoot`, a form, the builder row template
formly-jsonschema produces, `nz-input` cells as in the app): the rows
build with Name and Type locked and Value editable; a wholesale
`form.enable()`, as the panel does, leaves Name and Type locked, read
from the inputs' `disabled` state and not only from the controls'; a
read-only `form.disable()` locks everything and a later `enable()` gives
only the Value cell back. Each guard was deletion-checked and turned a
named test red. eslint, prettier and the production (AOT) build pass;
the full frontend suite passes; every statement, function and branch
this PR adds is covered.
Checked on a local instance (a Python source feeding a Python UDF whose
code declares two UI parameters), the panel widened so the columns are
in view. On main the cells are editable on most openings (4 of 5) and
after every run; with this PR they stayed locked on every opening and
through a forced `setInteractivity(true)` followed by real
change-detection passes, read from the DOM as well as from the controls.
The Value cell follows the host in both.
#### Video
**Before**
https://github.com/user-attachments/assets/53ac4826-b5ec-4852-a5c9-22685306839d
**After**
https://github.com/user-attachments/assets/9bcc2a52-fdb3-4764-99cb-63a31a18fa44
### Was this PR authored or co-authored using generative AI tooling?
Yes. Generated-by: Claude Code (Anthropic). Co-authored with Claude,
reviewed line by line by the author before submission.
🤖 Generated with [Claude Code](https://claude.com/claude-code)1 parent 312a0ce commit 8b0fb16
3 files changed
Lines changed: 290 additions & 3 deletions
File tree
- frontend/src/app/workspace/component/ui-udf-parameters
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
133 | 215 | | |
134 | 216 | | |
135 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
208 | 212 | | |
209 | 213 | | |
210 | 214 | | |
211 | | - | |
212 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
213 | 257 | | |
214 | 258 | | |
215 | 259 | | |
| |||
0 commit comments