Skip to content

Commit 2774363

Browse files
committed
fix(access-control): fix blocks Select All check, filter empty platform columns
1 parent 8682c72 commit 2774363

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

apps/sim/ee/access-control/components/access-control.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -453,14 +453,16 @@ export function AccessControl() {
453453
const unassigned = Object.keys(platformCategories).filter((c) => !assignedCategories.has(c))
454454
const groups = unassigned.length > 0 ? [...categoryGroups, unassigned] : categoryGroups
455455

456-
return groups.map((column) =>
457-
column
458-
.map((category) => ({
459-
category,
460-
features: platformCategories[category] ?? [],
461-
}))
462-
.filter((section) => section.features.length > 0)
463-
)
456+
return groups
457+
.map((column) =>
458+
column
459+
.map((category) => ({
460+
category,
461+
features: platformCategories[category] ?? [],
462+
}))
463+
.filter((section) => section.features.length > 0)
464+
)
465+
.filter((column) => column.length > 0)
464466
}, [platformCategories])
465467

466468
const hasConfigChanges = useMemo(() => {
@@ -989,7 +991,9 @@ export function AccessControl() {
989991
onClick={() => {
990992
const allAllowed =
991993
editingConfig?.allowedIntegrations === null ||
992-
editingConfig?.allowedIntegrations?.length === allBlocks.length
994+
allBlocks.every((b) =>
995+
editingConfig?.allowedIntegrations?.includes(b.type)
996+
)
993997
setEditingConfig((prev) =>
994998
prev
995999
? {
@@ -1001,7 +1005,7 @@ export function AccessControl() {
10011005
}}
10021006
>
10031007
{editingConfig?.allowedIntegrations === null ||
1004-
editingConfig?.allowedIntegrations?.length === allBlocks.length
1008+
allBlocks.every((b) => editingConfig?.allowedIntegrations?.includes(b.type))
10051009
? 'Deselect All'
10061010
: 'Select All'}
10071011
</Button>

0 commit comments

Comments
 (0)