Commit a92917c0 by heheer Committed by GitHub

fix team app template search (#5514)

parent e19eddf9
...@@ -95,6 +95,7 @@ export const iconPaths = { ...@@ -95,6 +95,7 @@ export const iconPaths = {
'common/refreshLight': () => import('./icons/common/refreshLight.svg'), 'common/refreshLight': () => import('./icons/common/refreshLight.svg'),
'common/resultLight': () => import('./icons/common/resultLight.svg'), 'common/resultLight': () => import('./icons/common/resultLight.svg'),
'common/retryLight': () => import('./icons/common/retryLight.svg'), 'common/retryLight': () => import('./icons/common/retryLight.svg'),
'common/rightArrow': () => import('./icons/common/rightArrow.svg'),
'common/rightArrowFill': () => import('./icons/common/rightArrowFill.svg'), 'common/rightArrowFill': () => import('./icons/common/rightArrowFill.svg'),
'common/rightArrowLight': () => import('./icons/common/rightArrowLight.svg'), 'common/rightArrowLight': () => import('./icons/common/rightArrowLight.svg'),
'common/routePushLight': () => import('./icons/common/routePushLight.svg'), 'common/routePushLight': () => import('./icons/common/routePushLight.svg'),
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 5 8" fill="none">
<path d="M3.08596 3.99987L0.610962 1.52487L1.31796 0.817871L4.49996 3.99987L1.31796 7.18187L0.610962 6.47487L3.08596 3.99987Z" />
</svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 5 8" fill="none"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 17" fill="none">
<path d="M3.08596 3.99987L0.610962 1.52487L1.31796 0.817871L4.49996 3.99987L1.31796 7.18187L0.610962 6.47487L3.08596 3.99987Z" /> <path fill-rule="evenodd" clip-rule="evenodd" d="M5.52851 3.82783C5.26816 4.08818 5.26816 4.51029 5.52851 4.77064L9.05711 8.29923L5.52851 11.8278C5.26816 12.0882 5.26816 12.5103 5.52851 12.7706C5.78886 13.031 6.21097 13.031 6.47132 12.7706L10.4713 8.77064C10.7317 8.51029 10.7317 8.08818 10.4713 7.82783L6.47132 3.82783C6.21097 3.56748 5.78886 3.56748 5.52851 3.82783Z" />
</svg> </svg>
\ No newline at end of file
...@@ -204,7 +204,7 @@ export function usePagination<DataT, ResT = {}>( ...@@ -204,7 +204,7 @@ export function usePagination<DataT, ResT = {}>(
<IconButton <IconButton
isDisabled={pageNum === maxPage} isDisabled={pageNum === maxPage}
icon="common/rightArrowLight" icon="common/rightArrow"
onClick={() => fetchData(pageNum + 1)} onClick={() => fetchData(pageNum + 1)}
/> />
{isPc && ( {isPc && (
......
import MyBox from '@fastgpt/web/components/common/MyBox'; import MyBox from '@fastgpt/web/components/common/MyBox';
import React, { useMemo } from 'react'; import React from 'react';
import { useContextSelector } from 'use-context-selector'; import { useContextSelector } from 'use-context-selector';
import { EDGE_TYPE, FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant'; import { EDGE_TYPE, FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
import type { FlowNodeItemType } from '@fastgpt/global/core/workflow/type/node'; import type { FlowNodeItemType } from '@fastgpt/global/core/workflow/type/node';
import { type Node, useReactFlow } from 'reactflow'; import { type Node } from 'reactflow';
import { WorkflowInitContext, WorkflowNodeEdgeContext } from '../context/workflowInitContext'; import { WorkflowNodeEdgeContext } from '../context/workflowInitContext';
import { useMemoizedFn } from 'ahooks'; import { useMemoizedFn } from 'ahooks';
import NodeTemplateListHeader from './components/NodeTemplates/header'; import NodeTemplateListHeader from './components/NodeTemplates/header';
import NodeTemplateList from './components/NodeTemplates/list'; import NodeTemplateList from './components/NodeTemplates/list';
......
...@@ -9,6 +9,7 @@ import { useRequest2 } from '@fastgpt/web/hooks/useRequest'; ...@@ -9,6 +9,7 @@ import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import { getSystemPluginPaths } from '@/web/core/app/api/plugin'; import { getSystemPluginPaths } from '@/web/core/app/api/plugin';
import { getAppFolderPath } from '@/web/core/app/api/app'; import { getAppFolderPath } from '@/web/core/app/api/app';
import FolderPath from '@/components/common/folder/Path'; import FolderPath from '@/components/common/folder/Path';
import { useDebounceEffect } from 'ahooks';
export enum TemplateTypeEnum { export enum TemplateTypeEnum {
'basic' = 'basic', 'basic' = 'basic',
...@@ -47,13 +48,19 @@ const NodeTemplateListHeader = ({ ...@@ -47,13 +48,19 @@ const NodeTemplateListHeader = ({
setSearchKey(''); setSearchKey('');
}, [templateType]); }, [templateType]);
useEffect(() => { useDebounceEffect(
loadNodeTemplates({ () => {
type: templateType, loadNodeTemplates({
parentId: '', type: templateType,
searchVal: searchKey parentId: '',
}); searchVal: searchKey
}, [searchKey, loadNodeTemplates, templateType]); });
},
[searchKey, loadNodeTemplates, templateType],
{
wait: 300
}
);
// Get paths // Get paths
const { data: paths = [] } = useRequest2( const { data: paths = [] } = useRequest2(
......
...@@ -83,7 +83,8 @@ export const useNodeTemplates = () => { ...@@ -83,7 +83,8 @@ export const useNodeTemplates = () => {
if (type === TemplateTypeEnum.teamPlugin) { if (type === TemplateTypeEnum.teamPlugin) {
// app, workflow-plugin, mcp // app, workflow-plugin, mcp
return getTeamPlugTemplates({ return getTeamPlugTemplates({
parentId parentId,
searchKey: searchVal
}).then((res) => res.filter((app) => app.id !== appId)); }).then((res) => res.filter((app) => app.id !== appId));
} }
if (type === TemplateTypeEnum.systemPlugin) { if (type === TemplateTypeEnum.systemPlugin) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment