Commit 7f4cc38
authored
improvement(tables): show the lock chip only when a table is actually locked (#5967)
* improvement(tables): show the lock chip only when a table is actually locked
- The header chip rendered whenever an admin had the flag on, so an unlocked
table permanently carried a "Lock settings" entry. Header space is for
state: the chip now appears only once something is locked and names the
mode. The admin route to the panel on an unlocked table is the breadcrumb
dropdown, which already had it
- Keep the Append-only name when the schema is locked too. Append-only
describes the row semantics and a schema lock doesn't change them; the
detail line calls out the locked columns instead
* improvement(tables): resolve the lock flag server-side and record lock changes fully
- Drop NEXT_PUBLIC_TABLE_LOCKS. A feature flag's gating lives in AppConfig,
which has no client counterpart, so mirroring it into a public env var meant
AppConfig couldn't control the UI at all and org/user clauses could never
reach the client — only global on/off. The page now resolves the flag with
session context and passes it down, per the add-feature-flag skill. Embedded
renders default to false, failing closed; enforcement of stored locks is
unaffected either way
- Record the previous locks alongside the new ones and name the transitions in
the audit description, so the log answers who locked what without expanding
metadata. Forward the request for IP / user-agent capture
* fix(tables): resolve the lock flag with the same context on both gates
The page passed userId/orgId while the PATCH gate resolved the flag with no
context, so an org- or user-targeted rollout would show the settings panel and
then 403 on save — the rollout path the previous commit exists to enable.
Both now key on the workspace's host organization rather than the viewer's
active one, matching the convention getWorkspaceHostContextForViewer
documents: active-org describes the account, not the workspace host. The
route's lookup runs only when a lock is actually being turned on.1 parent 0dcbc56 commit 7f4cc38
6 files changed
Lines changed: 86 additions & 29 deletions
File tree
- apps/sim
- app
- api/table/[tableId]
- workspace/[workspaceId]/tables/[tableId]
- lib
- core/config
- table
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
157 | | - | |
158 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
159 | 172 | | |
160 | 173 | | |
161 | 174 | | |
| |||
164 | 177 | | |
165 | 178 | | |
166 | 179 | | |
167 | | - | |
| 180 | + | |
168 | 181 | | |
169 | 182 | | |
170 | 183 | | |
| |||
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
67 | 73 | | |
68 | 74 | | |
69 | 75 | | |
| |||
Lines changed: 25 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
10 | 17 | | |
11 | 18 | | |
12 | 19 | | |
13 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
14 | 29 | | |
15 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
16 | 39 | | |
17 | 40 | | |
18 | | - | |
| 41 | + | |
19 | 42 | | |
20 | 43 | | |
21 | 44 | | |
Lines changed: 13 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | 80 | | |
90 | 81 | | |
91 | 82 | | |
| |||
96 | 87 | | |
97 | 88 | | |
98 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
99 | 97 | | |
100 | 98 | | |
101 | 99 | | |
| |||
152 | 150 | | |
153 | 151 | | |
154 | 152 | | |
| 153 | + | |
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
| |||
644 | 643 | | |
645 | 644 | | |
646 | 645 | | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
647 | 649 | | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | 650 | | |
653 | | - | |
| 651 | + | |
654 | 652 | | |
655 | 653 | | |
656 | | - | |
| 654 | + | |
657 | 655 | | |
658 | 656 | | |
659 | 657 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
575 | | - | |
576 | 575 | | |
577 | 576 | | |
578 | 577 | | |
| |||
614 | 613 | | |
615 | 614 | | |
616 | 615 | | |
617 | | - | |
618 | 616 | | |
619 | 617 | | |
620 | 618 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
627 | 629 | | |
628 | 630 | | |
629 | 631 | | |
630 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
631 | 635 | | |
| 636 | + | |
632 | 637 | | |
| 638 | + | |
633 | 639 | | |
634 | 640 | | |
635 | 641 | | |
| |||
639 | 645 | | |
640 | 646 | | |
641 | 647 | | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
642 | 660 | | |
643 | 661 | | |
644 | 662 | | |
645 | 663 | | |
646 | 664 | | |
647 | 665 | | |
648 | 666 | | |
649 | | - | |
650 | | - | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
651 | 670 | | |
652 | 671 | | |
653 | 672 | | |
| |||
0 commit comments