A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: queryGroup component add pathname param
shuai260ff708d2ed
diff --git a/ui/config-overrides.js b/ui/config-overrides.jsindex c8812ce6..35510f12 100644--- a/ui/config-overrides.js+++ b/ui/config-overrides.js@@ -18,12 +18,12 @@ module.exports = {const config = configFunction(proxy, allowedHost);config.proxy = {'/answer': {- target: 'http://10.0.20.88:8080',+ target: 'http://10.0.10.98:2060',changeOrigin: true,secure: false,},'/installation': {- target: 'http://10.0.20.88:8080',+ target: 'http://10.0.10.98:2060',changeOrigin: true,secure: false,},diff --git a/ui/src/components/QueryGroup/index.tsx b/ui/src/components/QueryGroup/index.tsxindex fae01621..15c3ad49 100644--- a/ui/src/components/QueryGroup/index.tsx+++ b/ui/src/components/QueryGroup/index.tsx@@ -1,6 +1,6 @@import { FC, memo } from 'react';import { ButtonGroup, Button, DropdownButton, Dropdown } from 'react-bootstrap';-import { useSearchParams } from 'react-router-dom';+import { useSearchParams, useNavigate } from 'react-router-dom';import { useTranslation } from 'react-i18next';import classNames from 'classnames';@@ -11,6 +11,7 @@ interface Props {currentSort: string;sortKey?: string;className?: string;+ pathname?: string;}const MAX_BUTTON_COUNT = 3;const Index: FC<Props> = ({@@ -19,8 +20,10 @@ const Index: FC<Props> = ({sortKey = 'order',i18nKeyPrefix = '',className = '',+ pathname = '',}) => {const [searchParams, setUrlSearchParams] = useSearchParams();+ const navigate = useNavigate();const { t } = useTranslation('translation', {keyPrefix: i18nKeyPrefix,@@ -36,7 +39,11 @@ const Index: FC<Props> = ({const handleClick = (e, type) => {e.preventDefault();const str = handleParams(type);- setUrlSearchParams(str);+ if (pathname) {+ navigate(`${pathname}${str}`);+ } else {+ setUrlSearchParams(str);+ }};const filteredData = data.filter((_, index) => index > MAX_BUTTON_COUNT - 2);@@ -69,7 +76,9 @@ const Index: FC<Props> = ({}: {}}- href={handleParams(key)}+ href={+ pathname ? `${pathname}${handleParams(key)}` : handleParams(key)+ }onClick={(evt) => handleClick(evt, key)}>{t(name)}</Button>@@ -95,7 +104,11 @@ const Index: FC<Props> = ({'d-block d-md-none',className,)}- href={handleParams(key)}+ href={+ pathname+ ? `${pathname}${handleParams(key)}`+ : handleParams(key)+ }onClick={(evt) => handleClick(evt, key)}>{t(name)}</Dropdown.Item>diff --git a/ui/src/components/QuestionList/index.tsx b/ui/src/components/QuestionList/index.tsxindex a353d9bd..469a6e58 100644--- a/ui/src/components/QuestionList/index.tsx+++ b/ui/src/components/QuestionList/index.tsx@@ -115,6 +115,7 @@ const QuestionList: FC<Props> = ({ source }) => {<QueryGroupdata={QuestionOrderKeys}currentSort={curOrder}+ pathname={source === 'questions' ? '/questions' : ''}i18nKeyPrefix="question"/></Col>diff --git a/ui/src/pages/Install/index.tsx b/ui/src/pages/Install/index.tsxindex f407e156..287f4f11 100644--- a/ui/src/pages/Install/index.tsx+++ b/ui/src/pages/Install/index.tsx@@ -21,7 +21,7 @@ import {const Index: FC = () => {const { t } = useTranslation('translation', { keyPrefix: 'install' });- const [step, setStep] = useState(3);+ const [step, setStep] = useState(1);const [loading, setLoading] = useState(true);const [errorData, setErrorData] = useState<{ [propName: string]: any }>({msg: '',