From 67008b1ceac803c2c7e0479f4feb1cd91dfdf2cb Mon Sep 17 00:00:00 2001
From: xxiaoxiong <2482929840@qq.com>
Date: Sat, 16 May 2026 11:30:29 +0800
Subject: [PATCH] feat: add Select All checkbox for credential workspace
sharing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes #5639
When managing credential sharing across multiple workspaces, users had to
manually check/uncheck each workspace individually. This was tedious and
time-consuming, especially when unsharing a credential from all workspaces.
Solution:
Add a "Select All" checkbox above the workspace list that allows users to:
- Check all workspaces with one click
- Uncheck all workspaces with one click
- Automatically updates when individual checkboxes are toggled
Changes:
**packages/ui/src/ui-component/dialog/ShareWithWorkspaceDialog.jsx**
- Import Checkbox and FormControlLabel from MUI
- Add `selectAll` state to track the select-all checkbox
- Add `handleSelectAllChange` to toggle all workspace checkboxes
- Add useEffect to sync selectAll state with individual row changes
- Add UI: "Select All" checkbox above the workspace grid
- Position: right-aligned next to "Workspaces" label
Features:
1. **One-click select all**: Check the "Select All" box to share with all workspaces
2. **One-click deselect all**: Uncheck to unshare from all workspaces
3. **Smart sync**: Checkbox automatically unchecks if any individual workspace is unchecked
4. **Clean UI**: Positioned next to "Workspaces" label, doesn't clutter the interface
Testing:
1. Go to Credentials page
2. Click the share icon (⋮ menu → Share) on any credential
3. ✅ See "Select All" checkbox in the top-right
4. Click "Select All"
5. ✅ All workspace checkboxes are checked
6. Click "Select All" again
7. ✅ All workspace checkboxes are unchecked
8. Check "Select All", then uncheck one workspace manually
9. ✅ "Select All" checkbox automatically unchecks
10. Click Save
11. ✅ Only selected workspaces receive the credential
Before: Had to scroll and click each workspace individually
After: One click to select/deselect all workspaces
---
.../dialog/ShareWithWorkspaceDialog.jsx | 31 ++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/packages/ui/src/ui-component/dialog/ShareWithWorkspaceDialog.jsx b/packages/ui/src/ui-component/dialog/ShareWithWorkspaceDialog.jsx
index f9ba47e73fd..67fa1e57920 100644
--- a/packages/ui/src/ui-component/dialog/ShareWithWorkspaceDialog.jsx
+++ b/packages/ui/src/ui-component/dialog/ShareWithWorkspaceDialog.jsx
@@ -6,7 +6,7 @@ import { enqueueSnackbar as enqueueSnackbarAction, closeSnackbar as closeSnackba
import { cloneDeep } from 'lodash'
// Material
-import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Box, Stack, OutlinedInput, Typography } from '@mui/material'
+import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Box, Stack, OutlinedInput, Typography, Checkbox, FormControlLabel } from '@mui/material'
// Project imports
import { StyledButton } from '@/ui-component/button/StyledButton'
@@ -47,6 +47,28 @@ const ShareWithWorkspaceDialog = ({ show, dialogProps, onCancel, setError }) =>
const [outputSchema, setOutputSchema] = useState([])
const [name, setName] = useState('')
+ const [selectAll, setSelectAll] = useState(false)
+
+ // Handle select all / deselect all
+ const handleSelectAllChange = (event) => {
+ const checked = event.target.checked
+ setSelectAll(checked)
+ setOutputSchema((prevRows) => {
+ return prevRows.map((row) => ({
+ ...row,
+ shared: checked
+ }))
+ })
+ }
+
+ // Update selectAll state when individual rows change
+ useEffect(() => {
+ if (outputSchema.length > 0) {
+ const allSelected = outputSchema.every((row) => row.shared)
+ const noneSelected = outputSchema.every((row) => !row.shared)
+ setSelectAll(allSelected ? true : noneSelected ? false : false)
+ }
+ }, [outputSchema])
const onRowUpdate = (newRow) => {
setTimeout(() => {
@@ -187,6 +209,13 @@ const ShareWithWorkspaceDialog = ({ show, dialogProps, onCancel, setError }) =>
+
+ Workspaces
+ }
+ label={Select All}
+ />
+