Bugfix/Credential Filter (#5553)

* update credential filter by name

* update FlowListMenu and dialog components with refresh functionality
This commit is contained in:
Henry Heng
2025-12-05 13:09:25 +00:00
committed by GitHub
parent 5cdaf3c494
commit 77ceeb9a3e
10 changed files with 45 additions and 18 deletions
@@ -102,6 +102,24 @@ export default function FlowListMenu({ chatflow, isAgentCanvas, isAgentflowV2, s
const title = isAgentCanvas ? 'Agents' : 'Chatflow' const title = isAgentCanvas ? 'Agents' : 'Chatflow'
const refreshFlows = async () => {
try {
const params = {
page: currentPage,
limit: pageLimit
}
if (isAgentCanvas && isAgentflowV2) {
await updateFlowsApi.request('AGENTFLOW', params)
} else if (isAgentCanvas) {
await updateFlowsApi.request('MULTIAGENT', params)
} else {
await updateFlowsApi.request(params)
}
} catch (error) {
if (setError) setError(error)
}
}
const handleClick = (event) => { const handleClick = (event) => {
setAnchorEl(event.currentTarget) setAnchorEl(event.currentTarget)
} }
@@ -442,21 +460,25 @@ export default function FlowListMenu({ chatflow, isAgentCanvas, isAgentflowV2, s
show={conversationStartersDialogOpen} show={conversationStartersDialogOpen}
dialogProps={conversationStartersDialogProps} dialogProps={conversationStartersDialogProps}
onCancel={() => setConversationStartersDialogOpen(false)} onCancel={() => setConversationStartersDialogOpen(false)}
onConfirm={refreshFlows}
/> />
<ChatFeedbackDialog <ChatFeedbackDialog
show={chatFeedbackDialogOpen} show={chatFeedbackDialogOpen}
dialogProps={chatFeedbackDialogProps} dialogProps={chatFeedbackDialogProps}
onCancel={() => setChatFeedbackDialogOpen(false)} onCancel={() => setChatFeedbackDialogOpen(false)}
onConfirm={refreshFlows}
/> />
<AllowedDomainsDialog <AllowedDomainsDialog
show={allowedDomainsDialogOpen} show={allowedDomainsDialogOpen}
dialogProps={allowedDomainsDialogProps} dialogProps={allowedDomainsDialogProps}
onCancel={() => setAllowedDomainsDialogOpen(false)} onCancel={() => setAllowedDomainsDialogOpen(false)}
onConfirm={refreshFlows}
/> />
<SpeechToTextDialog <SpeechToTextDialog
show={speechToTextDialogOpen} show={speechToTextDialogOpen}
dialogProps={speechToTextDialogProps} dialogProps={speechToTextDialogProps}
onCancel={() => setSpeechToTextDialogOpen(false)} onCancel={() => setSpeechToTextDialogOpen(false)}
onConfirm={refreshFlows}
/> />
{exportTemplateDialogOpen && ( {exportTemplateDialogOpen && (
<ExportAsTemplateDialog <ExportAsTemplateDialog
@@ -13,7 +13,7 @@ import useNotifier from '@/utils/useNotifier'
// Project imports // Project imports
import AllowedDomains from '@/ui-component/extended/AllowedDomains' import AllowedDomains from '@/ui-component/extended/AllowedDomains'
const AllowedDomainsDialog = ({ show, dialogProps, onCancel }) => { const AllowedDomainsDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
const portalElement = document.getElementById('portal') const portalElement = document.getElementById('portal')
const dispatch = useDispatch() const dispatch = useDispatch()
@@ -38,7 +38,7 @@ const AllowedDomainsDialog = ({ show, dialogProps, onCancel }) => {
{dialogProps.title || 'Allowed Domains'} {dialogProps.title || 'Allowed Domains'}
</DialogTitle> </DialogTitle>
<DialogContent> <DialogContent>
<AllowedDomains dialogProps={dialogProps} /> <AllowedDomains dialogProps={dialogProps} onConfirm={onConfirm} />
</DialogContent> </DialogContent>
</Dialog> </Dialog>
) : null ) : null
@@ -13,7 +13,7 @@ import useNotifier from '@/utils/useNotifier'
// Project imports // Project imports
import ChatFeedback from '@/ui-component/extended/ChatFeedback' import ChatFeedback from '@/ui-component/extended/ChatFeedback'
const ChatFeedbackDialog = ({ show, dialogProps, onCancel }) => { const ChatFeedbackDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
const portalElement = document.getElementById('portal') const portalElement = document.getElementById('portal')
const dispatch = useDispatch() const dispatch = useDispatch()
@@ -38,7 +38,7 @@ const ChatFeedbackDialog = ({ show, dialogProps, onCancel }) => {
{dialogProps.title || 'Allowed Domains'} {dialogProps.title || 'Allowed Domains'}
</DialogTitle> </DialogTitle>
<DialogContent> <DialogContent>
<ChatFeedback dialogProps={dialogProps} /> <ChatFeedback dialogProps={dialogProps} onConfirm={onConfirm} />
</DialogContent> </DialogContent>
</Dialog> </Dialog>
) : null ) : null
@@ -13,7 +13,7 @@ import useNotifier from '@/utils/useNotifier'
// Project imports // Project imports
import SpeechToText from '@/ui-component/extended/SpeechToText' import SpeechToText from '@/ui-component/extended/SpeechToText'
const SpeechToTextDialog = ({ show, dialogProps, onCancel }) => { const SpeechToTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
const portalElement = document.getElementById('portal') const portalElement = document.getElementById('portal')
const dispatch = useDispatch() const dispatch = useDispatch()
@@ -38,7 +38,7 @@ const SpeechToTextDialog = ({ show, dialogProps, onCancel }) => {
{dialogProps.title || 'Allowed Domains'} {dialogProps.title || 'Allowed Domains'}
</DialogTitle> </DialogTitle>
<DialogContent> <DialogContent>
<SpeechToText dialogProps={dialogProps} /> <SpeechToText dialogProps={dialogProps} onConfirm={onConfirm} />
</DialogContent> </DialogContent>
</Dialog> </Dialog>
) : null ) : null
@@ -13,7 +13,7 @@ import useNotifier from '@/utils/useNotifier'
// Project imports // Project imports
import StarterPrompts from '@/ui-component/extended/StarterPrompts' import StarterPrompts from '@/ui-component/extended/StarterPrompts'
const StarterPromptsDialog = ({ show, dialogProps, onCancel }) => { const StarterPromptsDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
const portalElement = document.getElementById('portal') const portalElement = document.getElementById('portal')
const dispatch = useDispatch() const dispatch = useDispatch()
@@ -38,7 +38,7 @@ const StarterPromptsDialog = ({ show, dialogProps, onCancel }) => {
{dialogProps.title || 'Conversation Starter Prompts'} {dialogProps.title || 'Conversation Starter Prompts'}
</DialogTitle> </DialogTitle>
<DialogContent> <DialogContent>
<StarterPrompts dialogProps={dialogProps} /> <StarterPrompts dialogProps={dialogProps} onConfirm={onConfirm} />
</DialogContent> </DialogContent>
</Dialog> </Dialog>
) : null ) : null
@@ -17,7 +17,7 @@ import useNotifier from '@/utils/useNotifier'
// API // API
import chatflowsApi from '@/api/chatflows' import chatflowsApi from '@/api/chatflows'
const AllowedDomains = ({ dialogProps }) => { const AllowedDomains = ({ dialogProps, onConfirm }) => {
const dispatch = useDispatch() const dispatch = useDispatch()
useNotifier() useNotifier()
@@ -72,6 +72,7 @@ const AllowedDomains = ({ dialogProps }) => {
} }
}) })
dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data }) dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data })
onConfirm?.()
} }
} catch (error) { } catch (error) {
enqueueSnackbar({ enqueueSnackbar({
@@ -200,7 +201,8 @@ const AllowedDomains = ({ dialogProps }) => {
} }
AllowedDomains.propTypes = { AllowedDomains.propTypes = {
dialogProps: PropTypes.object dialogProps: PropTypes.object,
onConfirm: PropTypes.func
} }
export default AllowedDomains export default AllowedDomains
@@ -17,7 +17,7 @@ import useNotifier from '@/utils/useNotifier'
// API // API
import chatflowsApi from '@/api/chatflows' import chatflowsApi from '@/api/chatflows'
const ChatFeedback = ({ dialogProps }) => { const ChatFeedback = ({ dialogProps, onConfirm }) => {
const dispatch = useDispatch() const dispatch = useDispatch()
useNotifier() useNotifier()
@@ -57,6 +57,7 @@ const ChatFeedback = ({ dialogProps }) => {
} }
}) })
dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data }) dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data })
onConfirm?.()
} }
} catch (error) { } catch (error) {
enqueueSnackbar({ enqueueSnackbar({
@@ -102,7 +103,8 @@ const ChatFeedback = ({ dialogProps }) => {
} }
ChatFeedback.propTypes = { ChatFeedback.propTypes = {
dialogProps: PropTypes.object dialogProps: PropTypes.object,
onConfirm: PropTypes.func
} }
export default ChatFeedback export default ChatFeedback
@@ -239,7 +239,7 @@ const speechToTextProviders = {
} }
} }
const SpeechToText = ({ dialogProps }) => { const SpeechToText = ({ dialogProps, onConfirm }) => {
const dispatch = useDispatch() const dispatch = useDispatch()
useNotifier() useNotifier()
@@ -271,6 +271,7 @@ const SpeechToText = ({ dialogProps }) => {
} }
}) })
dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data }) dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data })
onConfirm?.()
} }
} catch (error) { } catch (error) {
enqueueSnackbar({ enqueueSnackbar({
@@ -490,7 +491,8 @@ const SpeechToText = ({ dialogProps }) => {
} }
SpeechToText.propTypes = { SpeechToText.propTypes = {
dialogProps: PropTypes.object dialogProps: PropTypes.object,
onConfirm: PropTypes.func
} }
export default SpeechToText export default SpeechToText
@@ -16,7 +16,7 @@ import useNotifier from '@/utils/useNotifier'
// API // API
import chatflowsApi from '@/api/chatflows' import chatflowsApi from '@/api/chatflows'
const StarterPrompts = ({ dialogProps }) => { const StarterPrompts = ({ dialogProps, onConfirm }) => {
const dispatch = useDispatch() const dispatch = useDispatch()
useNotifier() useNotifier()
@@ -78,6 +78,7 @@ const StarterPrompts = ({ dialogProps }) => {
} }
}) })
dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data }) dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data })
onConfirm?.()
} }
} catch (error) { } catch (error) {
enqueueSnackbar({ enqueueSnackbar({
@@ -206,9 +207,7 @@ const StarterPrompts = ({ dialogProps }) => {
} }
StarterPrompts.propTypes = { StarterPrompts.propTypes = {
show: PropTypes.bool,
dialogProps: PropTypes.object, dialogProps: PropTypes.object,
onCancel: PropTypes.func,
onConfirm: PropTypes.func onConfirm: PropTypes.func
} }
+1 -1
View File
@@ -104,7 +104,7 @@ const Credentials = () => {
setSearch(event.target.value) setSearch(event.target.value)
} }
function filterCredentials(data) { function filterCredentials(data) {
return data.credentialName.toLowerCase().indexOf(search.toLowerCase()) > -1 return data.name.toLowerCase().indexOf(search.toLowerCase()) > -1
} }
const listCredential = () => { const listCredential = () => {