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} />