From 451419f1a4f92b37f338c11155e1c5362d87758d Mon Sep 17 00:00:00 2001 From: Zero Date: Fri, 6 Aug 2021 13:51:10 +0800 Subject: [PATCH] fix(msp): fix the bug that projectid is missing when query app (#873) fix(msp): fix the bug that projectid is missing when query app --- .../modules/cmp/common/components/log-tag-selector.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shell/app/modules/cmp/common/components/log-tag-selector.tsx b/shell/app/modules/cmp/common/components/log-tag-selector.tsx index d5b2b80491..3d111af267 100644 --- a/shell/app/modules/cmp/common/components/log-tag-selector.tsx +++ b/shell/app/modules/cmp/common/components/log-tag-selector.tsx @@ -24,6 +24,7 @@ import { getApps } from 'common/services'; import i18n from 'i18n'; import { Loading as IconLoading } from '@icon-park/react'; import './log-tag-selector.scss'; +import routeInfoStore from 'core/stores/route'; const MenuItem = Menu.Item; @@ -378,6 +379,7 @@ const loadMap = { const LoadMoreMenu = (props: ILoadMoreProps) => { const { menuInfo, setDynamicMenu = noop, onSelect = noop } = props; + const { projectId } = routeInfoStore.useStore((s) => s.params); const [{ pageNo, pageSize, hasMore, list, loading }, updater] = useUpdate({ pageNo: 1, @@ -393,10 +395,12 @@ const LoadMoreMenu = (props: ILoadMoreProps) => { }, [pageNo, pageSize]); const getData = (query: any) => { - const loadFun = loadMap[menuInfo.dynamicMenu.dimension].loadData; + const { dimension } = menuInfo.dynamicMenu; + const loadFun = loadMap[dimension].loadData; + const extraQuery = dimension === 'app' ? { projectId } : {}; if (loadFun) { updater.loading(true); - const res = loadFun(query); + const res = loadFun({ ...query, ...extraQuery }); if (res && isPromise(res)) { res.then((resData: any) => { const { total, list: curList } = resData.data || {};