Commit f4845cc
fix(tables): rework lock settings as Table Security and gate locked actions (#7853)
* fix(tables): block schema-locked column edits and rework lock settings as Table Security
* fix(tables): read-only cell editors and add-row form for update-locked tables
- Update-locked tables open cell editors read-only; the expanded editor disables Save with the reason on hover, and empty cells that can't be edited open nothing
- New row opens the Add Row form when only updates are locked
- Row form reads and writes values by column id and uses one date-and-time picker
- ChipDatePicker follows InsideModalContext so its calendar is clickable in modals, and gains showTime/timeLabel in single mode
* fix(tables): open the add-row form for required columns and gate Save on required fields
- New row, Shift+Enter, and Insert row open the Add Row form at their position when updates are locked or any column is required
- Add Row and Update Row stay disabled until every required field has a value
- Add mode accepts an insert position; Shift+Enter anchors to the neighbor row id
* fix(tables): explain denied actions where the user meets them
Clicking a column header opened the full column editor on a schema-locked
table: every field was editable and Save only failed once the server refused
it. The header click is the primary way into that panel, so it now opens
read-only — values stay readable and selectable, a disabled `<fieldset>` makes
the controls inert, and Save carries the lock reason. Clicking a checkbox cell
on an update-locked table did nothing at all, while the keyboard paths
explained themselves; it now raises the same notice.
The column menu disabled only "Edit column" while "Insert column left/right"
and "Delete column" stayed live and explained the lock after the click. All
four are disabled now, each with a tooltip. A disabled `DropdownMenuItem` sets
`pointer-events: none`, so the tooltip wraps the row rather than the item.
"Hide column" is untouched: hiding a workflow output is a metadata change no
lock covers.
Notices now speak the modal's Allow/Deny vocabulary and name the row that
denies the action, and the tooltip strings live in `lock-copy` instead of
being written out at each call site. Drops the "This table is append-only"
copy, which no path could reach once New row and Shift+Enter started opening
the add-row form.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(tables): write only what the row form changed, and report failures once
The add/edit row form sent every column on every save. An untouched empty
column was written as `null`, so a no-op edit still bumped the row, and an
insert filled in nulls for columns the user never opened. It now sends only
the fields the user touched, and in edit mode only those whose value actually
differs — a save with nothing changed closes without a write. Checkboxes stay
the exception on insert: they always carry a concrete boolean, so a required
one the user never clicked still reaches the server as `false`.
A rejected write also arrived twice: the modal rendered the message inline and
the mutation toasted the same sentence. Row mutations take an opt-in
`suppressErrorToast` so the form owns its own failure; the cache self-heal on
a 423 still runs, only its toast is dropped.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* refactor(tables): drop the Table Security switch and its device-local store
"Enable Table Security" had no server representation: enabled-with-everything-
allowed and never-configured both save four `false` flags, so the difference
lived only in the browser that set it. Anyone else — another device, another
admin — saw the table as unconfigured, and the per-action choices behind the
switch were remembered per device too.
The modal now always shows the four Allow/Deny rows, mapped one-to-one onto
the server flags, so an unconfigured table opens on four `Allow`s and every
viewer sees the same state. That removes the reason for the preference store,
which is deleted along with its helpers and test. Stale
`table-security-preferences` keys are left where they are; nothing reads them.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(tables): stage only the Table Security rows an admin moves
The modal reset its draft only when it opened, so a lock another admin changed
while it sat open went stale behind it: the controls kept rendering the old
values and Save submitted all four flags, overwriting the newer state.
Only the rows this admin moves are staged now. Every other row keeps rendering
the authoritative value, so a concurrent change shows up in the open modal
instead of hiding behind it, and Save sends just that patch — the route already
takes a partial — so an untouched row can't carry a stale flag over someone
else's change. A row both admins moved is the one real conflict, and there the
explicit choice wins.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent 21291d7 commit f4845cc
23 files changed
Lines changed: 1481 additions & 439 deletions
File tree
- apps/sim
- app/workspace/[workspaceId]/tables/[tableId]
- components
- column-config-sidebar
- column-dropdown
- lock-settings-modal
- row-modal
- table-grid
- cells
- headers
- hooks/queries
- packages/emcn/src/components/chip-date-picker
Lines changed: 142 additions & 101 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
5 | 15 | | |
6 | 16 | | |
7 | 17 | | |
| |||
59 | 69 | | |
60 | 70 | | |
61 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
62 | 81 | | |
63 | 82 | | |
64 | 83 | | |
| |||
109 | 128 | | |
110 | 129 | | |
111 | 130 | | |
| 131 | + | |
| 132 | + | |
112 | 133 | | |
113 | 134 | | |
114 | 135 | | |
| |||
154 | 175 | | |
155 | 176 | | |
156 | 177 | | |
| 178 | + | |
| 179 | + | |
157 | 180 | | |
158 | 181 | | |
159 | 182 | | |
| |||
254 | 277 | | |
255 | 278 | | |
256 | 279 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
299 | 301 | | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
317 | 326 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
343 | 344 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
349 | 360 | | |
350 | | - | |
| 361 | + | |
351 | 362 | | |
352 | | - | |
353 | | - | |
354 | | - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
355 | 366 | | |
356 | 367 | | |
357 | | - | |
358 | | - | |
359 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
360 | 388 | | |
361 | 389 | | |
362 | 390 | | |
363 | 391 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
| 392 | + | |
368 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
369 | 410 | | |
370 | 411 | | |
371 | 412 | | |
| |||
Lines changed: 30 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 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 | + | |
26 | 56 | | |
27 | 57 | | |
28 | 58 | | |
| |||
37 | 67 | | |
38 | 68 | | |
39 | 69 | | |
40 | | - | |
41 | 70 | | |
42 | 71 | | |
43 | 72 | | |
| |||
0 commit comments