Skip to content

Commit

Permalink
fix(msp): fix the bug that projectid is missing when query app (#873)
Browse files Browse the repository at this point in the history
fix(msp): fix the bug that projectid is missing when query app
  • Loading branch information
Zero-Rock authored Aug 6, 2021
1 parent f37c327 commit 451419f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions shell/app/modules/cmp/common/components/log-tag-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand All @@ -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 || {};
Expand Down

0 comments on commit 451419f

Please sign in to comment.