Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions packages-answers/ui/src/Admin/Chatflows/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
// Bulk update confirmation dialog state
const [bulkUpdateDialogOpen, setBulkUpdateDialogOpen] = useState(false)
const [bulkUpdateIncludeName, setBulkUpdateIncludeName] = useState(false)
const [bulkUpdateInProgress, setBulkUpdateInProgress] = useState(false)

// Versioning state
const [versionModalOpen, setVersionModalOpen] = useState(false)
Expand Down Expand Up @@ -338,7 +339,7 @@

useEffect(() => {
refreshChatflows()
}, [flowType, agentflowVersion])

Check warning on line 342 in packages-answers/ui/src/Admin/Chatflows/index.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useEffect has a missing dependency: 'refreshChatflows'. Either include it or remove the dependency array

if (error) {
return (
Expand Down Expand Up @@ -1030,7 +1031,7 @@
<Button
variant='contained'
size='small'
disabled={selectedForUpdate.length === 0}
disabled={selectedForUpdate.length === 0 || bulkUpdateInProgress}
onClick={() => {
setBulkUpdateIncludeName(false)
setBulkUpdateDialogOpen(true)
Expand All @@ -1047,7 +1048,9 @@
}
}}
>
Update Selected ({selectedForUpdate.length})
{bulkUpdateInProgress
? `Updating ${selectedForUpdate.length}…`
: `Update Selected (${selectedForUpdate.length})`}
</Button>
</Box>
</Box>
Expand Down Expand Up @@ -1087,18 +1090,18 @@
</Button>
<Button
variant='contained'
disabled={bulkUpdateInProgress}
onClick={async () => {
setBulkUpdateDialogOpen(false)
setBulkUpdateInProgress(true)
try {
const response = await chatflowsApi.bulkUpdateChatflows(selectedForUpdate, {
await chatflowsApi.bulkUpdateChatflows(selectedForUpdate, {
updateName: bulkUpdateIncludeName
})
if (response.updated > 0) {
window.location.reload()
}
setSelectedForUpdate([])
window.location.reload()
} catch (error) {
console.error('Bulk update failed:', error)
setBulkUpdateInProgress(false)
}
}}
sx={{
Expand All @@ -1107,7 +1110,9 @@
'&:hover': { bgcolor: alpha(theme.palette.warning.main, 0.9) }
}}
>
Update {selectedForUpdate.length} Chatflow{selectedForUpdate.length !== 1 ? 's' : ''}
{bulkUpdateInProgress
? `Updating ${selectedForUpdate.length} Chatflow${selectedForUpdate.length !== 1 ? 's' : ''}…`
: `Update ${selectedForUpdate.length} Chatflow${selectedForUpdate.length !== 1 ? 's' : ''}`}
</Button>
</DialogActions>
</Dialog>
Expand Down
Loading