From bfc36ac15fce017184975f1b20592172d8f386dc Mon Sep 17 00:00:00 2001 From: liukaiming-alipay Date: Thu, 16 Jan 2025 14:29:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- osgraph-web/src/components/project-search/index.tsx | 3 +++ osgraph-web/src/result/index.tsx | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/osgraph-web/src/components/project-search/index.tsx b/osgraph-web/src/components/project-search/index.tsx index 0c25eb9..d4b0333 100644 --- a/osgraph-web/src/components/project-search/index.tsx +++ b/osgraph-web/src/components/project-search/index.tsx @@ -32,6 +32,7 @@ export const ProjectSearch: React.FC<{ templateType?: string | any; getGraphLoading?: (loading: boolean) => void; graphExtendParams?: Record; + onUpdateTemplateId?: (templateId: number) => void; }> = ({ needFixed, debounceTimeout = 300, @@ -46,6 +47,7 @@ export const ProjectSearch: React.FC<{ graphParameterList, getGraphLoading, graphExtendParams, + onUpdateTemplateId, }) => { const { t, i18n } = useTranslation(); const navigate = useNavigate(); @@ -126,6 +128,7 @@ export const ProjectSearch: React.FC<{ }; const handleProjectChange = (value: string, item: any) => { + onUpdateTemplateId?.(item.data.id); if ( projectValue && GRAPH_TYPE_CLUSTER[projectValue as keyof typeof GRAPH_TYPE_CLUSTER] !== diff --git a/osgraph-web/src/result/index.tsx b/osgraph-web/src/result/index.tsx index bda57dd..948998b 100644 --- a/osgraph-web/src/result/index.tsx +++ b/osgraph-web/src/result/index.tsx @@ -287,6 +287,15 @@ export default () => { return newParams; }, [extendParams]); + const onUpdateTemplateId = (templateId: number) => { + setState((draft) => { + draft.locationState = { + ...locationState, + templateId, + }; + }); + }; + return (
{ onSearch={(data: any) => generateShareLink(data)} getGraphLoading={getGraphLoading} graphExtendParams={graphExtendParams} + onUpdateTemplateId={onUpdateTemplateId} />