Skip to content

Commit 77ceeb9

Browse files
authored
Bugfix/Credential Filter (#5553)
* update credential filter by name * update FlowListMenu and dialog components with refresh functionality
1 parent 5cdaf3c commit 77ceeb9

File tree

10 files changed

+45
-18
lines changed

10 files changed

+45
-18
lines changed

packages/ui/src/ui-component/button/FlowListMenu.jsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,24 @@ export default function FlowListMenu({ chatflow, isAgentCanvas, isAgentflowV2, s
102102

103103
const title = isAgentCanvas ? 'Agents' : 'Chatflow'
104104

105+
const refreshFlows = async () => {
106+
try {
107+
const params = {
108+
page: currentPage,
109+
limit: pageLimit
110+
}
111+
if (isAgentCanvas && isAgentflowV2) {
112+
await updateFlowsApi.request('AGENTFLOW', params)
113+
} else if (isAgentCanvas) {
114+
await updateFlowsApi.request('MULTIAGENT', params)
115+
} else {
116+
await updateFlowsApi.request(params)
117+
}
118+
} catch (error) {
119+
if (setError) setError(error)
120+
}
121+
}
122+
105123
const handleClick = (event) => {
106124
setAnchorEl(event.currentTarget)
107125
}
@@ -442,21 +460,25 @@ export default function FlowListMenu({ chatflow, isAgentCanvas, isAgentflowV2, s
442460
show={conversationStartersDialogOpen}
443461
dialogProps={conversationStartersDialogProps}
444462
onCancel={() => setConversationStartersDialogOpen(false)}
463+
onConfirm={refreshFlows}
445464
/>
446465
<ChatFeedbackDialog
447466
show={chatFeedbackDialogOpen}
448467
dialogProps={chatFeedbackDialogProps}
449468
onCancel={() => setChatFeedbackDialogOpen(false)}
469+
onConfirm={refreshFlows}
450470
/>
451471
<AllowedDomainsDialog
452472
show={allowedDomainsDialogOpen}
453473
dialogProps={allowedDomainsDialogProps}
454474
onCancel={() => setAllowedDomainsDialogOpen(false)}
475+
onConfirm={refreshFlows}
455476
/>
456477
<SpeechToTextDialog
457478
show={speechToTextDialogOpen}
458479
dialogProps={speechToTextDialogProps}
459480
onCancel={() => setSpeechToTextDialogOpen(false)}
481+
onConfirm={refreshFlows}
460482
/>
461483
{exportTemplateDialogOpen && (
462484
<ExportAsTemplateDialog

packages/ui/src/ui-component/dialog/AllowedDomainsDialog.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import useNotifier from '@/utils/useNotifier'
1313
// Project imports
1414
import AllowedDomains from '@/ui-component/extended/AllowedDomains'
1515

16-
const AllowedDomainsDialog = ({ show, dialogProps, onCancel }) => {
16+
const AllowedDomainsDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
1717
const portalElement = document.getElementById('portal')
1818
const dispatch = useDispatch()
1919

@@ -38,7 +38,7 @@ const AllowedDomainsDialog = ({ show, dialogProps, onCancel }) => {
3838
{dialogProps.title || 'Allowed Domains'}
3939
</DialogTitle>
4040
<DialogContent>
41-
<AllowedDomains dialogProps={dialogProps} />
41+
<AllowedDomains dialogProps={dialogProps} onConfirm={onConfirm} />
4242
</DialogContent>
4343
</Dialog>
4444
) : null

packages/ui/src/ui-component/dialog/ChatFeedbackDialog.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import useNotifier from '@/utils/useNotifier'
1313
// Project imports
1414
import ChatFeedback from '@/ui-component/extended/ChatFeedback'
1515

16-
const ChatFeedbackDialog = ({ show, dialogProps, onCancel }) => {
16+
const ChatFeedbackDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
1717
const portalElement = document.getElementById('portal')
1818
const dispatch = useDispatch()
1919

@@ -38,7 +38,7 @@ const ChatFeedbackDialog = ({ show, dialogProps, onCancel }) => {
3838
{dialogProps.title || 'Allowed Domains'}
3939
</DialogTitle>
4040
<DialogContent>
41-
<ChatFeedback dialogProps={dialogProps} />
41+
<ChatFeedback dialogProps={dialogProps} onConfirm={onConfirm} />
4242
</DialogContent>
4343
</Dialog>
4444
) : null

packages/ui/src/ui-component/dialog/SpeechToTextDialog.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import useNotifier from '@/utils/useNotifier'
1313
// Project imports
1414
import SpeechToText from '@/ui-component/extended/SpeechToText'
1515

16-
const SpeechToTextDialog = ({ show, dialogProps, onCancel }) => {
16+
const SpeechToTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
1717
const portalElement = document.getElementById('portal')
1818
const dispatch = useDispatch()
1919

@@ -38,7 +38,7 @@ const SpeechToTextDialog = ({ show, dialogProps, onCancel }) => {
3838
{dialogProps.title || 'Allowed Domains'}
3939
</DialogTitle>
4040
<DialogContent>
41-
<SpeechToText dialogProps={dialogProps} />
41+
<SpeechToText dialogProps={dialogProps} onConfirm={onConfirm} />
4242
</DialogContent>
4343
</Dialog>
4444
) : null

packages/ui/src/ui-component/dialog/StarterPromptsDialog.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import useNotifier from '@/utils/useNotifier'
1313
// Project imports
1414
import StarterPrompts from '@/ui-component/extended/StarterPrompts'
1515

16-
const StarterPromptsDialog = ({ show, dialogProps, onCancel }) => {
16+
const StarterPromptsDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
1717
const portalElement = document.getElementById('portal')
1818
const dispatch = useDispatch()
1919

@@ -38,7 +38,7 @@ const StarterPromptsDialog = ({ show, dialogProps, onCancel }) => {
3838
{dialogProps.title || 'Conversation Starter Prompts'}
3939
</DialogTitle>
4040
<DialogContent>
41-
<StarterPrompts dialogProps={dialogProps} />
41+
<StarterPrompts dialogProps={dialogProps} onConfirm={onConfirm} />
4242
</DialogContent>
4343
</Dialog>
4444
) : null

packages/ui/src/ui-component/extended/AllowedDomains.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import useNotifier from '@/utils/useNotifier'
1717
// API
1818
import chatflowsApi from '@/api/chatflows'
1919

20-
const AllowedDomains = ({ dialogProps }) => {
20+
const AllowedDomains = ({ dialogProps, onConfirm }) => {
2121
const dispatch = useDispatch()
2222

2323
useNotifier()
@@ -72,6 +72,7 @@ const AllowedDomains = ({ dialogProps }) => {
7272
}
7373
})
7474
dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data })
75+
onConfirm?.()
7576
}
7677
} catch (error) {
7778
enqueueSnackbar({
@@ -200,7 +201,8 @@ const AllowedDomains = ({ dialogProps }) => {
200201
}
201202

202203
AllowedDomains.propTypes = {
203-
dialogProps: PropTypes.object
204+
dialogProps: PropTypes.object,
205+
onConfirm: PropTypes.func
204206
}
205207

206208
export default AllowedDomains

packages/ui/src/ui-component/extended/ChatFeedback.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import useNotifier from '@/utils/useNotifier'
1717
// API
1818
import chatflowsApi from '@/api/chatflows'
1919

20-
const ChatFeedback = ({ dialogProps }) => {
20+
const ChatFeedback = ({ dialogProps, onConfirm }) => {
2121
const dispatch = useDispatch()
2222

2323
useNotifier()
@@ -57,6 +57,7 @@ const ChatFeedback = ({ dialogProps }) => {
5757
}
5858
})
5959
dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data })
60+
onConfirm?.()
6061
}
6162
} catch (error) {
6263
enqueueSnackbar({
@@ -102,7 +103,8 @@ const ChatFeedback = ({ dialogProps }) => {
102103
}
103104

104105
ChatFeedback.propTypes = {
105-
dialogProps: PropTypes.object
106+
dialogProps: PropTypes.object,
107+
onConfirm: PropTypes.func
106108
}
107109

108110
export default ChatFeedback

packages/ui/src/ui-component/extended/SpeechToText.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ const speechToTextProviders = {
239239
}
240240
}
241241

242-
const SpeechToText = ({ dialogProps }) => {
242+
const SpeechToText = ({ dialogProps, onConfirm }) => {
243243
const dispatch = useDispatch()
244244

245245
useNotifier()
@@ -271,6 +271,7 @@ const SpeechToText = ({ dialogProps }) => {
271271
}
272272
})
273273
dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data })
274+
onConfirm?.()
274275
}
275276
} catch (error) {
276277
enqueueSnackbar({
@@ -490,7 +491,8 @@ const SpeechToText = ({ dialogProps }) => {
490491
}
491492

492493
SpeechToText.propTypes = {
493-
dialogProps: PropTypes.object
494+
dialogProps: PropTypes.object,
495+
onConfirm: PropTypes.func
494496
}
495497

496498
export default SpeechToText

packages/ui/src/ui-component/extended/StarterPrompts.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import useNotifier from '@/utils/useNotifier'
1616
// API
1717
import chatflowsApi from '@/api/chatflows'
1818

19-
const StarterPrompts = ({ dialogProps }) => {
19+
const StarterPrompts = ({ dialogProps, onConfirm }) => {
2020
const dispatch = useDispatch()
2121

2222
useNotifier()
@@ -78,6 +78,7 @@ const StarterPrompts = ({ dialogProps }) => {
7878
}
7979
})
8080
dispatch({ type: SET_CHATFLOW, chatflow: saveResp.data })
81+
onConfirm?.()
8182
}
8283
} catch (error) {
8384
enqueueSnackbar({
@@ -206,9 +207,7 @@ const StarterPrompts = ({ dialogProps }) => {
206207
}
207208

208209
StarterPrompts.propTypes = {
209-
show: PropTypes.bool,
210210
dialogProps: PropTypes.object,
211-
onCancel: PropTypes.func,
212211
onConfirm: PropTypes.func
213212
}
214213

packages/ui/src/views/credentials/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const Credentials = () => {
104104
setSearch(event.target.value)
105105
}
106106
function filterCredentials(data) {
107-
return data.credentialName.toLowerCase().indexOf(search.toLowerCase()) > -1
107+
return data.name.toLowerCase().indexOf(search.toLowerCase()) > -1
108108
}
109109

110110
const listCredential = () => {

0 commit comments

Comments
 (0)