Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/add iteration filter in manual test plan #1957

Merged
merged 4 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions shell/app/modules/project/pages/test-plan/plan-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import routeInfoStore from 'core/stores/route';
import testPlanStore from 'project/stores/test-plan';
import iterationStore from 'project/stores/iteration';
import { FormModalList } from 'app/interface/common';
import { useLoading } from 'core/stores/loading';
import { useMount } from 'react-use';

interface IProps {
visible: boolean;
Expand All @@ -37,6 +39,7 @@ const TestPlanModal = (props: IProps) => {
const iterationList = iterationStore.useStore((s) => s.iterationList);
const { getTestPlanItem, addTestPlan, updateTestPlan } = testPlanStore.effects;
const { cleanTestPlan } = testPlanStore.reducers;
const [loadingIterationList] = useLoading(iterationStore, ['getIterations']);

const handleOk = (values: any) => {
const copy = { ...values };
Expand All @@ -56,16 +59,16 @@ const TestPlanModal = (props: IProps) => {
}
};

React.useEffect(() => {
if (!iterationList.length) {
useMount(() => {
if (!iterationList.length && !loadingIterationList) {
iterationStore.effects.getIterations({
pageNo: 1,
pageSize: 100,
projectID: +params.projectId,
withoutIssueSummary: true,
});
}
}, [iterationList.length, params.projectId]);
});

React.useEffect(() => {
visible && testPlanId && getTestPlanItem(testPlanId);
Expand Down
18 changes: 17 additions & 1 deletion shell/app/modules/project/pages/test-plan/test-plan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { isEmpty } from 'lodash';
import { useEffectOnce } from 'react-use';
import { useLoading } from 'core/stores/loading';
import testPlanStore from 'project/stores/test-plan';
import iterationStore from 'project/stores/iteration';
import i18n from 'i18n';
import { ColumnProps } from 'core/common/interface';
import './test-plan.scss';
Expand Down Expand Up @@ -48,6 +49,7 @@ const TestPlan = () => {
const [filterObj, setFilterObj] = React.useState<Obj>({ isArchived: 'false' });
const [page, planList] = testPlanStore.useStore((s) => [s.planPaging, s.planList]);
const [isFetching] = useLoading(testPlanStore, ['getPlanList']);
const iterationList = iterationStore.useStore((s) => s.iterationList);

const updateModalProp = (a: object) => {
setModalProp({
Expand Down Expand Up @@ -245,6 +247,20 @@ const TestPlan = () => {
mode: 'multiple',
},
},
{
type: Select,
name: 'iterationID',
customProps: {
options: iterationList.map(({ id, title }) => (
<Option key={id} value={id}>
{title}
</Option>
)),
allowClear: true,
placeholder: i18n.t('dop:owned iteration'),
mode: 'multiple',
},
},
{
type: Input,
name: 'name',
Expand Down Expand Up @@ -273,7 +289,7 @@ const TestPlan = () => {
},
},
],
[],
[iterationList],
);

return (
Expand Down