From df51bb4c4e081a00cd4876a352a7f7226fc372dc Mon Sep 17 00:00:00 2001 From: wulibaibao <13366578180@163.com> Date: Mon, 1 Apr 2024 10:58:37 +0800 Subject: [PATCH 01/31] =?UTF-8?q?fix:=20=E8=A1=A5=E5=85=A8ws=20job?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E9=A1=B9=E7=9B=AE=E6=9D=83=E9=99=90=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dashboard/Project/components/JobTable.tsx | 241 ++++++++++-------- 1 file changed, 130 insertions(+), 111 deletions(-) diff --git a/src/pages/WorkSpace/Dashboard/Project/components/JobTable.tsx b/src/pages/WorkSpace/Dashboard/Project/components/JobTable.tsx index a1f8c999..ff4e7c18 100644 --- a/src/pages/WorkSpace/Dashboard/Project/components/JobTable.tsx +++ b/src/pages/WorkSpace/Dashboard/Project/components/JobTable.tsx @@ -1,24 +1,24 @@ -import React, { useState, useRef, useEffect } from 'react' -import { JobListStateTag } from '@/pages/WorkSpace/TestResult/Details/components/index' -import lodash from 'lodash' +import React, { useState, useRef, useEffect } from 'react'; +import { JobListStateTag } from '@/pages/WorkSpace/TestResult/Details/components/index'; +import lodash from 'lodash'; import CommonPagination from '@/components/CommonPagination'; -import { deleteJobTest } from '@/pages/WorkSpace/TestResult/services' -import { message, Space, Typography, Tooltip, Popconfirm, Row, Spin, Button } from 'antd' -import ViewReports from './ViewReports' -import { queryTestResultList } from '@/pages/WorkSpace/TestResult/services' -import styled from 'styled-components' -import { useParams, Access, useAccess, useIntl, FormattedMessage, getLocale } from 'umi' -import RerunModal from '@/pages/WorkSpace/TestResult/Details/components/ReRunModal' -import styles from './index.less' +import { deleteJobTest } from '@/pages/WorkSpace/TestResult/services'; +import { message, Space, Typography, Tooltip, Popconfirm, Row, Spin, Button } from 'antd'; +import ViewReports from './ViewReports'; +import { queryTestResultList } from '@/pages/WorkSpace/TestResult/services'; +import styled from 'styled-components'; +import { useParams, Access, useAccess, useIntl, FormattedMessage, getLocale } from 'umi'; +import RerunModal from '@/pages/WorkSpace/TestResult/Details/components/ReRunModal'; +import styles from './index.less'; import { requestCodeMessage, AccessTootip } from '@/utils/utils'; import { ResizeHooksTable } from '@/utils/table.hooks'; import { ColumnEllipsisText } from '@/components/ColumnComponents'; import ChangeJobProjectDrawer from './ChangeJobProjectDrawer'; const TableBody = styled(Row)` - width : 100%; + width: 100%; // max-height: calc( 100% - 65px - 72px ); -` +`; const ColumnCircleText = styled.span` display: inline-block; @@ -30,93 +30,90 @@ const ColumnCircleText = styled.span` text-align: center; color: #ffffff; line-height: 18px; - cursor: pointer; -` + cursor: pointer; +`; const JobTable: React.FC = () => { - const { formatMessage } = useIntl() - const enLocale = getLocale() === 'en-US' + const { formatMessage } = useIntl(); + const enLocale = getLocale() === 'en-US'; - const { ws_id, project_id }: any = useParams() - const DEFAULT_TABLE_PARAMS = { page_num: 1, page_size: 10, ws_id, project_id } + const { ws_id, project_id }: any = useParams(); + const DEFAULT_TABLE_PARAMS = { page_num: 1, page_size: 10, ws_id, project_id }; - const [pageParams, setPageParams] = useState(DEFAULT_TABLE_PARAMS) - const changeJobProjectDrawer = useRef() as any + const [pageParams, setPageParams] = useState(DEFAULT_TABLE_PARAMS); + const changeJobProjectDrawer = useRef() as any; const [jobs, setJobs] = useState({ data: [], total: 0, - }) + }); const access = useAccess(); - const [loading, setLoading] = useState(true) - const [selectedRows, setSelectedRows] = useState([]) + const [loading, setLoading] = useState(true); + const [selectedRows, setSelectedRows] = useState([]); useEffect(() => { - getProjectJobs() - }, []) + getProjectJobs(); + }, []); - const rerunModal: any = useRef() + const rerunModal: any = useRef(); const getProjectJobs = async (params: any = DEFAULT_TABLE_PARAMS) => { - setLoading(true) - const { code, msg, ...data } = await queryTestResultList(params) - if (code !== 200) return requestCodeMessage(code, msg) + setLoading(true); + const { code, msg, ...data } = await queryTestResultList(params); + if (code !== 200) return requestCodeMessage(code, msg); // console.log(data) - setJobs(data) - setPageParams(params) - setLoading(false) - } + setJobs(data); + setPageParams(params); + setLoading(false); + }; const handleDelete = async (_: any) => { - const { code, msg } = await deleteJobTest({ job_id: _.id }) + const { code, msg } = await deleteJobTest({ job_id: _.id }); if (code !== 200) { - requestCodeMessage(code, msg) - return + requestCodeMessage(code, msg); + return; } - const { page_num, page_size } = pageParams - await getProjectJobs({ ws_id, project_id, page_num, page_size }) - message.success(formatMessage({ id: 'operation.success' })) - } + const { page_num, page_size } = pageParams; + await getProjectJobs({ ws_id, project_id, page_num, page_size }); + message.success(formatMessage({ id: 'operation.success' })); + }; - const handleTestReRun = (_: any) => rerunModal.current.show(_) + const handleTestReRun = (_: any) => rerunModal.current.show(_); const columns: any = [ { title: , dataIndex: 'id', fixed: 'left', - className: "dashboard_job_list_hover_name", + className: 'dashboard_job_list_hover_name', width: 80, render: (_: any) => ( - + {_} - ) + ), }, { title: , dataIndex: 'name', width: 200, ellipsis: { - showTitle: false + showTitle: false, }, - className: "dashboard_job_list_hover_name", + className: 'dashboard_job_list_hover_name', render: (_: any, row: any) => ( - + {_} - ) + ), }, { title: , width: 120, dataIndex: 'state', - render: (_: any, row: any) => + render: (_: any, row: any) => , }, { title: , //'测试类型', @@ -128,40 +125,46 @@ const JobTable: React.FC = () => { dataIndex: 'test_result', width: 160, render: (_: any) => { - const result = JSON.parse(_) + const result = JSON.parse(_); if (lodash.isNull(result)) { return ( - - - - - - + - + - + - - ) + ); } else { return ( - {result.total} - {result.pass} - {result.fail} + + {result.total} + + + {result.pass} + + + {result.fail} + - ) + ); } - } + }, }, { title: , //'所属项目', width: 120, dataIndex: 'project_name', ellipsis: { - showTitle: false + showTitle: false, }, - render: (_: any) => _ && {_} + render: (_: any) => _ && {_}, }, { title: , //'创建人', width: 80, ellipsis: true, - dataIndex: 'creator_name' + dataIndex: 'creator_name', }, { title: , //'开始时间', @@ -173,13 +176,13 @@ const JobTable: React.FC = () => { title: , //'完成时间', width: 180, ellipsis: true, - dataIndex: 'end_time' + dataIndex: 'end_time', }, { title: , width: enLocale ? 220 : 160, fixed: 'right', - key: "operation", + key: 'operation', render: (_: any) => { return ( @@ -188,15 +191,25 @@ const JobTable: React.FC = () => { accessible={access.WsMemberOperateSelf(_.creator)} fallback={ - {_.created_from === 'offline' ? - - : + {_.created_from === 'offline' ? ( + + + + ) : ( AccessTootip()}> - + + + - } + )} AccessTootip()}> - + @@ -205,15 +218,21 @@ const JobTable: React.FC = () => { > {/** case.离线任务上传后,不能重跑。 */} - {_.created_from === 'offline' ? - - - : + {_.created_from === 'offline' ? ( + + + + ) : ( handleTestReRun(_)}> - - + + + - } + )} } onConfirm={() => handleDelete(_)} @@ -226,42 +245,42 @@ const JobTable: React.FC = () => { - - ) - } - } - ] + ); + }, + }, + ]; const handleChangeProjectOk = () => { - message.success('操作成功!') - const page_num = Math.ceil((jobs?.total - selectedRows?.length) / pageParams.page_size) || 1 - const params = { ...pageParams, page_num } + message.success('操作成功!'); + const page_num = + Math.ceil((jobs?.total - selectedRows?.length) / pageParams.page_size) || 1; + const params = { ...pageParams, page_num }; - if (page_num < pageParams.page_num) - getProjectJobs(params) - else - getProjectJobs(pageParams) - setSelectedRows([]) - } + if (page_num < pageParams.page_num) getProjectJobs(params); + else getProjectJobs(pageParams); + setSelectedRows([]); + }; return ( - + + + { rowSelection={{ selectedRowKeys: selectedRows.map((i: any) => i.id), onChange: (rowkeys: any, selectedRows: any) => { - setSelectedRows(selectedRows) - } + setSelectedRows(selectedRows); + }, }} /> getProjectJobs({ ws_id, project_id, page_num, page_size }) + onPageChange={(page_num, page_size) => + getProjectJobs({ ws_id, project_id, page_num, page_size }) } /> @@ -291,7 +310,7 @@ const JobTable: React.FC = () => { - ) -} + ); +}; -export default JobTable \ No newline at end of file +export default JobTable; -- Gitee From 02c3bd9ca18c91b2db76b3af81f78a8e64f86fe0 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Mon, 15 Apr 2024 09:47:11 +0800 Subject: [PATCH 02/31] =?UTF-8?q?fix:=20=E5=90=8C=E6=AD=A5=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=97=B6=EF=BC=8C=E6=9F=A5=E8=AF=A2=E5=85=B6=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/RefenerceDetail/index.tsx | 23 ++++-- .../BasicTest/components/AddSuiteTest.tsx | 4 +- .../BasicTest/components/DeleteTips.tsx | 24 ++++-- .../BasicTest/components/SynchronizeModal.tsx | 73 +++++++++++++++++ .../SystemConf/TestSuite/BasicTest/index.tsx | 68 ++++++++++------ .../SystemConf/TestSuite/BasicTest/style.less | 4 +- .../components/ConfList/index.tsx | 4 +- .../components/MetricEditDrawer/index.tsx | 0 .../MetricTable/DeleteMetricPopover.less | 0 .../MetricTable/DeleteMetricPopover.tsx | 0 .../components/MetricTable/index.tsx | 0 .../components}/FuncOrPerfConfList/index.less | 0 .../components}/FuncOrPerfConfList/index.tsx | 12 ++- .../SuiteList/AddSuiteDrawer/index.tsx | 6 +- .../components/SuiteList/index.tsx | 58 ++++++++++---- src/pages/SystemConf/TestSuite/index.tsx | 80 ++++++++++--------- 16 files changed, 247 insertions(+), 109 deletions(-) create mode 100644 src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx rename src/pages/SystemConf/TestSuite/BusinessTest/{ => BusinessList/components}/FuncOrPerfConfList/components/MetricEditDrawer/index.tsx (100%) rename src/pages/SystemConf/TestSuite/BusinessTest/{ => BusinessList/components}/FuncOrPerfConfList/components/MetricTable/DeleteMetricPopover.less (100%) rename src/pages/SystemConf/TestSuite/BusinessTest/{ => BusinessList/components}/FuncOrPerfConfList/components/MetricTable/DeleteMetricPopover.tsx (100%) rename src/pages/SystemConf/TestSuite/BusinessTest/{ => BusinessList/components}/FuncOrPerfConfList/components/MetricTable/index.tsx (100%) rename src/pages/SystemConf/TestSuite/BusinessTest/{ => BusinessList/components}/FuncOrPerfConfList/index.less (100%) rename src/pages/SystemConf/TestSuite/BusinessTest/{ => BusinessList/components}/FuncOrPerfConfList/index.tsx (98%) diff --git a/src/pages/RefenerceDetail/index.tsx b/src/pages/RefenerceDetail/index.tsx index cfb165ab..44c24475 100644 --- a/src/pages/RefenerceDetail/index.tsx +++ b/src/pages/RefenerceDetail/index.tsx @@ -47,7 +47,7 @@ const Wapper = styled.div` const { Panel } = Collapse; const Refenerce = (props: any) => { const { type: $type } = useParams() as any - const { query: { pk } } = useLocation() as any + const { query: { pk, case_id_list, visible_range } } = useLocation() as any const [JobTotal, setJobTotal] = useState(0) const [JobData, setJobData] = useState([]) const [TempTotal, setTempTotal] = useState(0) @@ -82,24 +82,35 @@ const Refenerce = (props: any) => { return false }, [JobTotal]) - const init = async () => { + const initData = async () => { const { data } = await queryFormDate({ pk }) if (!data) return setSource(data) } - const queryListData = async () => { + const getListData = async () => { const { id } = source setLoading(true) const JobObj: any = { flag: 'job', ...params } const TempObj: any = { flag: 'template', ...tempParams } - if ($type === 'suite') { + // 同步操作参数 + if (case_id_list) { + JobObj.case_id_list = case_id_list + TempObj.case_id_list = case_id_list + } else if ($type === 'suite') { JobObj.suite_id = id TempObj.suite_id = id } else { JobObj.case_id_list = id TempObj.case_id_list = id } + + // 编辑操作传 visible_range; + // 同步、删除操作不传 visible_range; + if (visible_range) { + JobObj.visible_range = visible_range + TempObj.visible_range = visible_range + } const { total, data, code, msg } = await queryConfirm(JobObj) if (code !== 200) { requestCodeMessage(code, msg) @@ -121,12 +132,12 @@ const Refenerce = (props: any) => { React.useEffect(() => { if (!source) return - queryListData() + getListData() }, [source, params, tempParams]) useEffect(() => { if (!pk) return - init() + initData() }, [pk]) const JobColumns = [ diff --git a/src/pages/SystemConf/TestSuite/BasicTest/components/AddSuiteTest.tsx b/src/pages/SystemConf/TestSuite/BasicTest/components/AddSuiteTest.tsx index 462c9e8b..920157ed 100644 --- a/src/pages/SystemConf/TestSuite/BasicTest/components/AddSuiteTest.tsx +++ b/src/pages/SystemConf/TestSuite/BasicTest/components/AddSuiteTest.tsx @@ -14,7 +14,7 @@ import DeleteTips from './DeleteTips'; /** * @module 系统级 - * @description 新增、编辑suite级 + * @description 新增、编辑suite */ export default forwardRef( ({ onOk, wsList }: any, ref: any) => { @@ -110,7 +110,7 @@ export default forwardRef( if (s !== t) { setDisable(true) const { code } = await queryConfirm({ flag: 'pass', suite_id: dataSource.id, visible_range: s }) - if (code === 200) return delTip.current?.show({ ...dataSource, path: 'visible_range', visible_range: s }) + if (code === 200) return delTip.current?.show({ ...dataSource, path: 'visible_range', visible_range: s, optionType: 'edit' }) } } handleEditOK(val) diff --git a/src/pages/SystemConf/TestSuite/BasicTest/components/DeleteTips.tsx b/src/pages/SystemConf/TestSuite/BasicTest/components/DeleteTips.tsx index d5c3d4ad..08420ba9 100644 --- a/src/pages/SystemConf/TestSuite/BasicTest/components/DeleteTips.tsx +++ b/src/pages/SystemConf/TestSuite/BasicTest/components/DeleteTips.tsx @@ -34,11 +34,19 @@ const DeleteTip: React.ForwardRefRenderFunction = (props, ref) => const handleOpenRef = async () => { if (!setting) return - const { name, id } = setting - const pk = await saveRefenerceData({ name, id }) + const pk = await saveRefenerceData(setting) if (pk) window.open(`${basePath || "/refenerce/suite/"}?pk=${pk}`) } + const openRef = async () => { + if (!setting) return + const pk = await saveRefenerceData(setting) + // 编辑操作传 visible_range; + // 同步、删除操作不传 visible_range; + const { visible_range, optionType } = setting + if (pk) window.open(`${basePath || "/refenerce/suite/"}?pk=${pk}${optionType === 'edit'? `&visible_range=${visible_range}`: '' }`) + } + return ( = (props, ref) => open={visible} onCancel={hanldeCancel} footer={[ - , + // , @@ -69,7 +77,7 @@ const DeleteTip: React.ForwardRefRenderFunction = (props, ref) => diff --git a/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx b/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx new file mode 100644 index 00000000..d3fefdf8 --- /dev/null +++ b/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx @@ -0,0 +1,73 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions */ +import React from "react" +import { Modal, Button, Typography, Space } from "antd" +import { FormattedMessage, useIntl } from "umi" +import { ExclamationCircleOutlined } from "@ant-design/icons" +import { saveRefenerceData } from "@/utils/utils" + +const SynchronizeModal = (props: any, ref: any) => { + const { formatMessage } = useIntl() + const [visible, setVisible] = React.useState(false) + const [setting, setSetting] = React.useState() + + React.useImperativeHandle(ref, () => ({ + show(_: any) { + _ && setSetting(_) + setVisible(true) + } + })) + + const handleOk = () => { + props?.onOk(setting) + setVisible(false) + setSetting(null) + } + + const handleCancel = () => { + setVisible(false) + setSetting(null) + } + + const handleOpenRef = async () => { + if (!setting) return + const { name, id, delete_temp_case_id_list } = setting + const pk = await saveRefenerceData({ name, id }) + if (pk) window.open(`${props.basePath || "/refenerce/suite/"}?pk=${pk}&case_id_list=${delete_temp_case_id_list?.join()}`) + } + + return ( + } + centered={true} + open={visible} + onCancel={handleCancel} + footer={[ + // , + + ]} + width={600} + > + + + + + {setting?.msg || formatMessage({ id: 'TestSuite.suite.delete.warning' }, { data: setting?.name })} + + + + + + + + + ) +} + +export default React.forwardRef(SynchronizeModal) \ No newline at end of file diff --git a/src/pages/SystemConf/TestSuite/BasicTest/index.tsx b/src/pages/SystemConf/TestSuite/BasicTest/index.tsx index efd4563c..775c849b 100644 --- a/src/pages/SystemConf/TestSuite/BasicTest/index.tsx +++ b/src/pages/SystemConf/TestSuite/BasicTest/index.tsx @@ -23,7 +23,7 @@ import ConfEditDrawer from './components/CaseTable/ConfEditDrawer' import lodash from 'lodash' import { queryConfirm } from '@/pages/WorkSpace/JobTypeManage/services'; import { useSuiteProvider } from '../hooks'; - +import SynchronizeModal from './components/SynchronizeModal'; import DeleteTips from "./components/DeleteTips" import DeleteDefault from "./components/DeleteDefault" import MetricBatchDelete from './components/MetricTable/MetricBatchDelete'; @@ -49,7 +49,6 @@ const SuiteManagement: React.ForwardRefRenderFunction = (props const [pageParams, setPageParams] = useState(DEFAULT_PAGE_PARAMS) const [loading, setLoading] = useState(true) - const [sync, setSync] = useState(false) const [expandKey, setExpandKey] = useState([]) const [selectedRowKeys, setSelectedRowKeys] = useState([]) const [selectedRow, setSelectedRow] = useState([]) @@ -65,6 +64,7 @@ const SuiteManagement: React.ForwardRefRenderFunction = (props { id: 0, name: formatMessage({ id: 'operation.no' }) }, ] + const synchronizeRef: any = useRef(null) const confDrawer: any = useRef(null) const suiteEditDrawer: any = useRef(null) const deleteTipsRef = React.useRef(null) @@ -130,8 +130,8 @@ const SuiteManagement: React.ForwardRefRenderFunction = (props for (let i = 0; i < arr.length; i++) newArr.push(Number.parseInt(arr[i])) row.domain_list_str = newArr domainList.forEach((item: any) => { if (item.name == row.domain) row.domain = item.id }) - - suiteEditDrawer.current.show('edit', row) // 编辑Test Suite + // 编辑Test Suite + suiteEditDrawer.current.show('edit', row) } const onDesSubmit = async ({ doc, id }: any) => { @@ -151,9 +151,14 @@ const SuiteManagement: React.ForwardRefRenderFunction = (props const deleteOuter = async (row: any) => { const { code } = await queryConfirm({ flag: 'pass', suite_id: row.id }) - if (code === 200) - return deleteTipsRef.current?.show(row) - defaultDeleteRef.current?.show(row) + // 判断是否有引用 + if (code === 200) { + // 有引用 + deleteTipsRef.current?.show(row) + } else { + // 无引用 + defaultDeleteRef.current?.show(row) + } } const remOuter = async (row: any) => { @@ -168,20 +173,39 @@ const SuiteManagement: React.ForwardRefRenderFunction = (props getList() } - const synchro = async (row: any) => { - setSync(true) + // 同步判断弹窗: 201有引用 + const onSynchronize = async (row: any) => { + props.setSynchronizeLoading(true) const hide = message.loading({ content: formatMessage({ id: 'operation.synchronizing' }), duration: 0 }) - const { code, msg } = await syncSuite(row.id) - setSync(false) + const { code, data, msg } = await syncSuite(row.id).catch(()=> props.setSynchronizeLoading(false)) + props.setSynchronizeLoading(false) hide() - if (code !== 200) { - message.warning(`${formatMessage({ id: 'request.synchronize.failed' })},${msg}`) - return + // 判断无引用 + if (code === 200) { + message.success(formatMessage({ id: 'request.synchronize.success' })) + getList() + setAsyncTime(new Date().getTime()) + } else { + // 201 有引用 + const { id, name } = row + synchronizeRef.current?.show({ id, name, ...data }) } - message.success(formatMessage({ id: 'request.synchronize.success' })) - getList() - setAsyncTime(new Date().getTime()) } + + // const synchro = async (row: any) => { + // setSync(true) + // const hide = message.loading({ content: formatMessage({ id: 'operation.synchronizing' }), duration: 0 }) + // const { code, msg } = await syncSuite(row.id) + // setSync(false) + // hide() + // if (code !== 200) { + // message.warning(`${formatMessage({ id: 'request.synchronize.failed' })},${msg}`) + // return + // } + // message.success(formatMessage({ id: 'request.synchronize.success' })) + // getList() + // setAsyncTime(new Date().getTime()) + // } const wsMap = React.useMemo(() => { return (wsList || []).reduce((pre: any, cur: any) => { @@ -394,7 +418,7 @@ const SuiteManagement: React.ForwardRefRenderFunction = (props fixed: 'right', render: (_, row) => ( - synchro(row)}> + onSynchronize(row)}> editOuter(row)}> @@ -533,12 +557,8 @@ const SuiteManagement: React.ForwardRefRenderFunction = (props } - {/* 同步遮罩 */} - + {/* 同步 */} + {}}/> { const type = deleteState.action - - let newData: any = [] - selectedRow.map((item: any) => newData.push(item.name)) let pk if (type == 'multiple') { + let newData: any = selectedRow.map((item: any) => item.name) pk = await saveRefenerceData({ name: newData.join(','), id: selectedRowKeys.join(',') }) // window.open(`/refenerce/conf/?name=${newData.join(',')}&id=${selectedRowKeys.join(',')}`) } else { diff --git a/src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/components/MetricEditDrawer/index.tsx b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/components/MetricEditDrawer/index.tsx similarity index 100% rename from src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/components/MetricEditDrawer/index.tsx rename to src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/components/MetricEditDrawer/index.tsx diff --git a/src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/components/MetricTable/DeleteMetricPopover.less b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/components/MetricTable/DeleteMetricPopover.less similarity index 100% rename from src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/components/MetricTable/DeleteMetricPopover.less rename to src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/components/MetricTable/DeleteMetricPopover.less diff --git a/src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/components/MetricTable/DeleteMetricPopover.tsx b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/components/MetricTable/DeleteMetricPopover.tsx similarity index 100% rename from src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/components/MetricTable/DeleteMetricPopover.tsx rename to src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/components/MetricTable/DeleteMetricPopover.tsx diff --git a/src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/components/MetricTable/index.tsx b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/components/MetricTable/index.tsx similarity index 100% rename from src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/components/MetricTable/index.tsx rename to src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/components/MetricTable/index.tsx diff --git a/src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/index.less b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/index.less similarity index 100% rename from src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/index.less rename to src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/index.less diff --git a/src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/index.tsx b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/index.tsx similarity index 98% rename from src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/index.tsx rename to src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/index.tsx index 8f584c6a..df40ff88 100644 --- a/src/pages/SystemConf/TestSuite/BusinessTest/FuncOrPerfConfList/index.tsx +++ b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/FuncOrPerfConfList/index.tsx @@ -172,11 +172,9 @@ export default forwardRef(({ id, type: test_type, domainList }: any, ref: any) = } const handleDetail = async () => { - let newData: any = [] - selectedRow.foreach((item: any) => newData.push(item.name)) - let pk if (!deleteObj.id) { + let newData: any = selectedRow.map((item: any) => item.name) pk = await saveRefenerceData({ name: newData.join(','), id: selectedRowKeys.join(',') }) } else { const { name, id } = deleteObj @@ -360,13 +358,13 @@ export default forwardRef(({ id, type: test_type, domainList }: any, ref: any) = {/** 编辑说明 */} - {/** 200表示删除有引用;*/} + {/** 200表示有引用,不能直接删除;*/} } footer={[ - , + // , diff --git a/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/AddSuiteDrawer/index.tsx b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/AddSuiteDrawer/index.tsx index 1f9cd5c1..845846fb 100644 --- a/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/AddSuiteDrawer/index.tsx +++ b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/AddSuiteDrawer/index.tsx @@ -88,17 +88,17 @@ export default forwardRef((props: any, ref: any) => { setPadding(true) form.validateFields().then(async (values) => { const { business_id, id } = editData; + const domain_list_str = values.domain_list_str.join() if (id) { - const { code, msg } = await editSuite(id, { ...values, domain_list_str: values.domain_list_str.join() }) + const { code, msg } = await editSuite(id, { ...values, domain_list_str }) defaultOption(code, msg, 'edit') } else { - const { code, msg } = await addSuite2({ business_id, ...values, domain_list_str: values.domain_list_str.join() }) + const { code, msg } = await addSuite2({ business_id, ...values, domain_list_str }) defaultOption(code, msg, 'add') } setPadding(false) }).catch((err) => { setPadding(false) - // console.log(err) // 单独校验业务名称 err?.errorFields?.forEach((item: any)=> { if (item.name[0] === 'name') { diff --git a/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/index.tsx b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/index.tsx index 1064fc3b..7b87b654 100644 --- a/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/index.tsx +++ b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/index.tsx @@ -7,8 +7,9 @@ import CommonTable from '@/components/Public/CommonTable'; import { test_type_enum, runList, saveRefenerceData } from '@/utils/utils' import ConfList from '../ConfList'; import AddSuiteDrawer from './AddSuiteDrawer'; -import FuncOrPerfConfList from '../../../FuncOrPerfConfList'; +import FuncOrPerfConfList from '../FuncOrPerfConfList'; import { querySuiteList, getDomain, syncSuite, delSuite, queryDelSuiteAll, deleteBusinessSuiteAll } from '../../../../service'; +import SynchronizeModal from '../../../../BasicTest/components/SynchronizeModal'; import { queryConfirm } from '@/pages/WorkSpace/JobTypeManage/services'; import styles from './index.less'; import { ColumnEllipsisText } from '@/components/ColumnComponents'; @@ -35,6 +36,7 @@ export default forwardRef(({ business_id, rowSelectionCallback = () => { }, rest const [deleteState, setDeleteState] = useState({ visible: false, result: '', action: '' }) // action:单个/批量删除 const [deleteRow, setDeleteRow] = useState({}) const [deleteLoading, setDeleteLoading] = useState(false) + const synchronizeRef: any = useRef(null) // 1.请求列表数据 const getTableData = async (query: any) => { @@ -90,6 +92,7 @@ export default forwardRef(({ business_id, rowSelectionCallback = () => { }, rest setLoading(false) } } + // 4.单个删除 const getDelSuite = async () => { setDeleteLoading(true) @@ -154,22 +157,42 @@ export default forwardRef(({ business_id, rowSelectionCallback = () => { }, rest if (type === 'multiple') { const pk = await saveRefenerceData({ name: newData.join(','), id: selectedRowKeys.join(',') }) - // window.open(`/refenerce/conf/?name=${newData.join(',')}&id=${selectedRowKeys.join(',')}`) window.open(`/refenerce/conf/?pk=${pk}`) } else if (type === 'single') { const { name, id } = deleteRow const pk = await saveRefenerceData({ name, id }) - // window.open(`/refenerce/suite/?name=${deleteRow.name}&id=${deleteRow.id}`) window.open(`/refenerce/suite/?pk=${pk}`) } } + // 7.同步弹窗: 201有引用 + const onSynchronize = async (row: any) => { + const hide = message.loading({ content: formatMessage({ id: 'operation.synchronizing' }), duration: 0 }) + const res = await syncSuite(row.id) || {} + hide() + // 判断 200无引用 + if (res.code === 200) { + message.success(formatMessage({ id: 'request.synchronize.success' })) + getTableData({ page_num: data.page_num, page_size: data.page_size }) + // case2.刷新已展开的conf列表 + if (expandKeys.includes(row.id)) { + caseTable.current?.refresh({ refreshId: row.id }) + } else { + const ids = expandKeys.concat([row.id]) + setExpandKeys(ids) + } + } else { + // 判断 201有引用 + const { id, name } = row + synchronizeRef.current?.show({ id, name, ...res.data }) + } + } // 打开对话框 - const onOk = (data: any, record: any, action: any) => { + const onOk = (res: any, record: any, action: any) => { // 删除查询:200表示有引用,201表示可以直接删除 - if (data.code === 200) { + if (res.code === 200) { setDeleteState({ visible: true, result: 200, action }) - } else if (data.code === 201) { + } else if (res.code === 201) { setDeleteState({ visible: true, result: 201, action }) } setDeleteRow(record) @@ -243,9 +266,9 @@ export default forwardRef(({ business_id, rowSelectionCallback = () => { }, rest // 单个删除前查询 const queryDeleteSingle = async ({ record = {} }: any) => { try { - const data = await queryConfirm({ flag: 'pass', suite_id: record.id }) || {} - if (data.code) { - onOk(data, record, 'single') + const res = await queryConfirm({ flag: 'pass', suite_id: record.id }) || {} + if (res.code) { + onOk(res, record, 'single') } } catch (e) { console.log(e) @@ -254,9 +277,9 @@ export default forwardRef(({ business_id, rowSelectionCallback = () => { }, rest // 批量删除前查询 const queryDeleteAll = async () => { try { - const data = await queryDelSuiteAll({ flag: 'pass', suite_id_list: selectedRowKeys.join() }) || {} - if (data.code) { - onOk(data, {}, 'multiple') + const res = await queryDelSuiteAll({ flag: 'pass', suite_id_list: selectedRowKeys.join() }) || {} + if (res.code) { + onOk(res, {}, 'multiple') } } catch (e) { console.log(e) @@ -356,10 +379,10 @@ export default forwardRef(({ business_id, rowSelectionCallback = () => { }, rest render: (text: any, record: any) => { return ( - {(record.test_type === 'business') ? ( + {record.test_type === 'business' ? (    ) : ( - getSyncSuite(record.id)}> + onSynchronize(record)}> )} handelAddOrEdit({ type: 'edit', record })}> queryDeleteSingle({ record })}> @@ -427,10 +450,13 @@ export default forwardRef(({ business_id, rowSelectionCallback = () => { }, rest expanded ? ( onExpand(record, e)} />) : ( onExpand(record, e)} />) }} - // scrollType={1250} scroll={{ x: 1250 }} paginationBottom={true} /> + + {/* 同步弹窗 */} + {}}/> + } centered={true} okText={} @@ -473,7 +499,7 @@ export default forwardRef(({ business_id, rowSelectionCallback = () => { }, rest )} - + ) diff --git a/src/pages/SystemConf/TestSuite/index.tsx b/src/pages/SystemConf/TestSuite/index.tsx index e275adf0..c6ce2309 100644 --- a/src/pages/SystemConf/TestSuite/index.tsx +++ b/src/pages/SystemConf/TestSuite/index.tsx @@ -1,7 +1,7 @@ -import React, { useMemo, useRef } from 'react' +import React, { useState, useMemo, useRef } from 'react' import { TabCard } from '@/components/UpgradeUI' -import { Tabs, Button } from 'antd' +import { Tabs, Button, Spin } from 'antd' import { history, useLocation, useIntl, FormattedMessage } from 'umi' import BasicTest from './BasicTest' @@ -14,9 +14,10 @@ import { runList } from '@/utils/utils'; const TestSuite: React.FC = () => { const { formatMessage } = useIntl() const { query }: any = useLocation() - + const [synchronizeLoading, setSynchronizeLoading] = useState(false) + const testType = useMemo(() => { - return !query.test_type ? 'functional' : query.test_type + return query.test_type || 'functional' }, [query]) const domainList = useDomain() @@ -47,40 +48,43 @@ const TestSuite: React.FC = () => { ] }} > - - } key="functional" /> - } key="performance" /> - {!BUILD_APP_ENV ? } key="business" /> : null} - } key="domainconf" /> - - } - extra={ - - } - > - { - (testType !== 'business' && testType !== 'domainconf') && - - } - { - testType === 'business' && - - } - { - testType === 'domainconf' && - - } - + + + } key="functional" /> + } key="performance" /> + {!BUILD_APP_ENV ? } key="business" /> : null} + } key="domainconf" /> + + } + extra={ + + } + > + { + ['functional', 'performance'].includes(testType) && + + } + { + testType === 'business' && + + } + { + testType === 'domainconf' && + + } + + ) } -- Gitee From fa0823fe6856c802e5dc00d80cd9f610c395fee9 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Thu, 18 Apr 2024 17:45:07 +0800 Subject: [PATCH 03/31] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=96=87?= =?UTF-8?q?=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/RefenerceDetail/index.tsx | 14 +++++++------- .../TestSuite/BasicTest/components/DeleteTips.tsx | 11 +---------- .../BasicTest/components/SynchronizeModal.tsx | 3 ++- src/pages/SystemConf/TestSuite/locales/en-US.ts | 10 +++++----- src/pages/SystemConf/TestSuite/locales/zh-CN.ts | 10 +++++----- .../WorkspaceManagement/locales/en-US.ts | 2 +- .../BaselineManage/components/IntrRow.tsx | 2 +- .../WorkSpace/BaselineManage/locales/en-US.ts | 2 +- .../WorkSpace/BaselineManage/locales/zh-CN.ts | 2 +- src/utils/utils.ts | 2 +- 10 files changed, 25 insertions(+), 33 deletions(-) diff --git a/src/pages/RefenerceDetail/index.tsx b/src/pages/RefenerceDetail/index.tsx index 44c24475..240de358 100644 --- a/src/pages/RefenerceDetail/index.tsx +++ b/src/pages/RefenerceDetail/index.tsx @@ -47,7 +47,7 @@ const Wapper = styled.div` const { Panel } = Collapse; const Refenerce = (props: any) => { const { type: $type } = useParams() as any - const { query: { pk, case_id_list, visible_range } } = useLocation() as any + const { query: { pk, case_id_list } } = useLocation() as any const [JobTotal, setJobTotal] = useState(0) const [JobData, setJobData] = useState([]) const [TempTotal, setTempTotal] = useState(0) @@ -82,14 +82,14 @@ const Refenerce = (props: any) => { return false }, [JobTotal]) - const initData = async () => { + const init = async () => { const { data } = await queryFormDate({ pk }) if (!data) return setSource(data) } - const getListData = async () => { - const { id } = source + const queryListData = async () => { + const { id, visible_range, optionType } = source setLoading(true) const JobObj: any = { flag: 'job', ...params } const TempObj: any = { flag: 'template', ...tempParams } @@ -107,7 +107,7 @@ const Refenerce = (props: any) => { // 编辑操作传 visible_range; // 同步、删除操作不传 visible_range; - if (visible_range) { + if (optionType === "edit") { JobObj.visible_range = visible_range TempObj.visible_range = visible_range } @@ -132,12 +132,12 @@ const Refenerce = (props: any) => { React.useEffect(() => { if (!source) return - getListData() + queryListData() }, [source, params, tempParams]) useEffect(() => { if (!pk) return - initData() + init() }, [pk]) const JobColumns = [ diff --git a/src/pages/SystemConf/TestSuite/BasicTest/components/DeleteTips.tsx b/src/pages/SystemConf/TestSuite/BasicTest/components/DeleteTips.tsx index 08420ba9..caa2f54a 100644 --- a/src/pages/SystemConf/TestSuite/BasicTest/components/DeleteTips.tsx +++ b/src/pages/SystemConf/TestSuite/BasicTest/components/DeleteTips.tsx @@ -38,15 +38,6 @@ const DeleteTip: React.ForwardRefRenderFunction = (props, ref) => if (pk) window.open(`${basePath || "/refenerce/suite/"}?pk=${pk}`) } - const openRef = async () => { - if (!setting) return - const pk = await saveRefenerceData(setting) - // 编辑操作传 visible_range; - // 同步、删除操作不传 visible_range; - const { visible_range, optionType } = setting - if (pk) window.open(`${basePath || "/refenerce/suite/"}?pk=${pk}${optionType === 'edit'? `&visible_range=${visible_range}`: '' }`) - } - return ( = (props, ref) => diff --git a/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx b/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx index d3fefdf8..d0ae110d 100644 --- a/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx +++ b/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx @@ -31,8 +31,9 @@ const SynchronizeModal = (props: any, ref: any) => { const handleOpenRef = async () => { if (!setting) return const { name, id, delete_temp_case_id_list } = setting + const case_id_list = delete_temp_case_id_list?.join() const pk = await saveRefenerceData({ name, id }) - if (pk) window.open(`${props.basePath || "/refenerce/suite/"}?pk=${pk}&case_id_list=${delete_temp_case_id_list?.join()}`) + if (pk) window.open(`${props.basePath || "/refenerce/suite/"}?pk=${pk}${case_id_list? `&case_id_list=${case_id_list}`: ''}`) } return ( diff --git a/src/pages/SystemConf/TestSuite/locales/en-US.ts b/src/pages/SystemConf/TestSuite/locales/en-US.ts index 220aa649..c4821455 100644 --- a/src/pages/SystemConf/TestSuite/locales/en-US.ts +++ b/src/pages/SystemConf/TestSuite/locales/en-US.ts @@ -48,8 +48,8 @@ export default { 'TestSuite.please.enter.remarks': 'Enter Remark', 'TestSuite.gmt_created': 'Creation Time', 'TestSuite.gmt_modified': 'Modified Time', - 'TestSuite.suite.delete.warning': 'This Suite({data}) has been referenced by Worksapce,Deleting this Suite will affect the Test Suite management list in theWorkspace, as well as the jobs, templates, and plans that apply this Suite,Delete with caution!!', - 'TestSuite.have.suite.delete.warning': 'This Suite has been referenced by Worksapce,Deleting this Suite will affect the Test Suite management list in theWorkspace, as well as the jobs, templates, and plans that apply this Suite,Delete with caution!!', + 'TestSuite.suite.delete.warning': 'This Suite({data}) has been referenced by Workspace,Deleting this Suite will affect the Test Suite management list in theWorkspace, as well as the jobs, templates, and plans that apply this Suite,Delete with caution!!', + 'TestSuite.have.suite.delete.warning': 'This Suite has been referenced by Workspace,Deleting this Suite will affect the Test Suite management list in theWorkspace, as well as the jobs, templates, and plans that apply this Suite,Delete with caution!!', 'TestSuite.suite.delete.range': 'Remove the Suite impact areas: running jobs, test templates, and comparison reports', 'view.reference.details': 'View Reference Details', 'TestSuite.data.format.error': 'Variable data format error', @@ -63,10 +63,10 @@ export default { 'TestSuite.is_certified.ps': 'Only certificated case is synchronized to Testfarm', 'TestSuite.please.enter.desc': 'Enter Test Suite instructions', 'TestSuite.description.details': 'Instructions Details', - 'TestSuite.conf.delete.warning': 'This conf has been referenced by Worksapce,Deleting this conf will affect the Test Suite management list in theWorkspace, as well as the jobs, templates, and plans that apply this Suite,Delete with caution!!', + 'TestSuite.conf.delete.warning': 'This conf has been referenced by Workspace,Deleting this conf will affect the Test Suite management list in theWorkspace, as well as the jobs, templates, and plans that apply this Suite,Delete with caution!!', 'TestSuite.conf.delete.range': 'Remove the conf impact areas: running jobs, test templates, and comparison reports', - 'TestSuite.conf.name.delete.warning': 'This conf({data}) has been referenced by Worksapce,Deleting this conf will affect the Test Suite management list in theWorkspace, as well as the jobs, templates, and plans that apply this Suite,Delete with caution!!', - 'TestSuite.have.conf.delete.warning': 'This conf has been referenced by Worksapce,Deleting this conf will affect the Test Suite management list in theWorkspace, as well as the jobs, templates, and plans that apply this Suite,Delete with caution!!', + 'TestSuite.conf.name.delete.warning': 'This conf({data}) has been referenced by Workspace,Deleting this conf will affect the Test Suite management list in theWorkspace, as well as the jobs, templates, and plans that apply this Suite,Delete with caution!!', + 'TestSuite.have.conf.delete.warning': 'This conf has been referenced by Workspace,Deleting this conf will affect the Test Suite management list in theWorkspace, as well as the jobs, templates, and plans that apply this Suite,Delete with caution!!', 'TestSuite.conf.edit': 'Edit Test Conf', 'TestSuite.conf.metric': 'Metric', diff --git a/src/pages/SystemConf/TestSuite/locales/zh-CN.ts b/src/pages/SystemConf/TestSuite/locales/zh-CN.ts index fbcd1bd2..b489a6b2 100644 --- a/src/pages/SystemConf/TestSuite/locales/zh-CN.ts +++ b/src/pages/SystemConf/TestSuite/locales/zh-CN.ts @@ -48,8 +48,8 @@ export default { 'TestSuite.please.enter.remarks': '请输入备注信息', 'TestSuite.gmt_created': '创建时间', 'TestSuite.gmt_modified': '修改时间', - 'TestSuite.suite.delete.warning': '该Suite({data})已被Worksapce引用,删除后将影响以下Workspace的Test Suite管理列表,以及应用该Suite的Job、模板、计划,请谨慎删除!!', - 'TestSuite.have.suite.delete.warning': '有Suite已被Worksapce引用,删除后将影响以下Workspace的Test Suite管理列表,以及应用该Suite的Job、模板、计划,请谨慎删除!!', + 'TestSuite.suite.delete.warning': '该Suite({data})已被Workspace引用,删除后将影响以下Workspace的Test Suite管理列表,以及应用该Suite的Job、模板、计划,请谨慎删除!!', + 'TestSuite.have.suite.delete.warning': '有Suite已被Workspace引用,删除后将影响以下Workspace的Test Suite管理列表,以及应用该Suite的Job、模板、计划,请谨慎删除!!', 'TestSuite.suite.delete.range': '删除suite影响范围:运行中的job、测试模板、对比分析报告', 'view.reference.details': '查看引用详情', 'TestSuite.data.format.error': '变量数据格式错误', @@ -63,10 +63,10 @@ export default { 'TestSuite.is_certified.ps': '只有认证过得用例才能同步到Testfarm', 'TestSuite.please.enter.desc': '请输入Test Suite说明', 'TestSuite.description.details': '说明详情', - 'TestSuite.conf.delete.warning': 'conf已被Worksapce引用,删除后将影响以下Workspace的Test Suite管理列表,以及应用该Suite的Job、模板、计划,请谨慎删除!!', + 'TestSuite.conf.delete.warning': 'conf已被Workspace引用,删除后将影响以下Workspace的Test Suite管理列表,以及应用该Suite的Job、模板、计划,请谨慎删除!!', 'TestSuite.conf.delete.range': '删除conf影响范围:运行中的job、测试模板、对比分析报告', - 'TestSuite.conf.name.delete.warning': '该Conf({data})已被Worksapce引用,删除后将影响以下Workspace的Test Suite管理列表,以及应用该Suite的Job、模板、计划,请谨慎删除!!', - 'TestSuite.have.conf.delete.warning': '有Conf已被Worksapce引用,删除后将影响以下Workspace的Test Suite管理列表,以及应用该Suite的Job、模板、计划,请谨慎删除!!', + 'TestSuite.conf.name.delete.warning': '该Conf({data})已被Workspace引用,删除后将影响以下Workspace的Test Suite管理列表,以及应用该Suite的Job、模板、计划,请谨慎删除!!', + 'TestSuite.have.conf.delete.warning': '有Conf已被Workspace引用,删除后将影响以下Workspace的Test Suite管理列表,以及应用该Suite的Job、模板、计划,请谨慎删除!!', 'TestSuite.conf.edit': '编辑Test Conf', 'TestSuite.conf.metric': '指标', diff --git a/src/pages/SystemConf/WorkspaceManagement/locales/en-US.ts b/src/pages/SystemConf/WorkspaceManagement/locales/en-US.ts index 1910625b..fa0165c3 100644 --- a/src/pages/SystemConf/WorkspaceManagement/locales/en-US.ts +++ b/src/pages/SystemConf/WorkspaceManagement/locales/en-US.ts @@ -11,7 +11,7 @@ export default { 'workspace.number': 'Number of Member', 'workspace.is_public': 'Permission', // Public 'workspace.home.recommended': 'Home Page Recommendation', - 'workspace.recommended1': 'It will be displayed on the home page in the Recommended Worksapce module if choose "Yes" ', + 'workspace.recommended1': 'It will be displayed on the home page in the Recommended Workspace module if choose "Yes" ', 'workspace.recommended2': 'Drag up and down to adjust the display order. The home page displays the table in the same order', 'workspace.configure.up.recommended': 'A max of {numb} recommended workspaces can be configured', diff --git a/src/pages/WorkSpace/BaselineManage/components/IntrRow.tsx b/src/pages/WorkSpace/BaselineManage/components/IntrRow.tsx index e5b4fd8d..1c26fee4 100644 --- a/src/pages/WorkSpace/BaselineManage/components/IntrRow.tsx +++ b/src/pages/WorkSpace/BaselineManage/components/IntrRow.tsx @@ -41,7 +41,7 @@ const IntroRow: React.FC = (props) => { { formatMessage({ - id: "pages.worksapce.baseline.metric.expand.title", + id: "pages.Workspace.baseline.metric.expand.title", defaultMessage: "环境信息" }) } diff --git a/src/pages/WorkSpace/BaselineManage/locales/en-US.ts b/src/pages/WorkSpace/BaselineManage/locales/en-US.ts index a384d105..01a2e3f8 100644 --- a/src/pages/WorkSpace/BaselineManage/locales/en-US.ts +++ b/src/pages/WorkSpace/BaselineManage/locales/en-US.ts @@ -74,5 +74,5 @@ export default { 'pages.workspace.baseline.metric.table.view': 'View Info', 'pages.workspace.baseline.metric.table.expand': 'Collapse Info', - 'pages.worksapce.baseline.metric.expand.title': "Environment Info" + 'pages.Workspace.baseline.metric.expand.title': "Environment Info" } \ No newline at end of file diff --git a/src/pages/WorkSpace/BaselineManage/locales/zh-CN.ts b/src/pages/WorkSpace/BaselineManage/locales/zh-CN.ts index f5e5f7f9..7225f10d 100644 --- a/src/pages/WorkSpace/BaselineManage/locales/zh-CN.ts +++ b/src/pages/WorkSpace/BaselineManage/locales/zh-CN.ts @@ -79,5 +79,5 @@ export default { 'pages.workspace.baseline.metric.table.view': '查看信息', 'pages.workspace.baseline.metric.table.expand': '收起信息', - 'pages.worksapce.baseline.metric.expand.title': "环境信息" + 'pages.Workspace.baseline.metric.expand.title': "环境信息" }; \ No newline at end of file diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 3b408900..f9e988d1 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -483,7 +483,7 @@ export const requestCodeMessage = (code: number, msg: string) => { // export const role_type_enum = [ - { key: 'ws_member', name: 'worksapce成员' }, + { key: 'ws_member', name: 'workspace成员' }, { key: 'ws_tester', name: '测试人员' }, { key: 'ws_test_admin', name: '测试管理员' }, { key: 'sys_admin', name: '系统管理员' }, -- Gitee From 15d30ae561835778f5a1c99589b09e819fb8e394 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Wed, 8 May 2024 14:24:13 +0800 Subject: [PATCH 04/31] =?UTF-8?q?fix:=20=E5=90=8C=E6=AD=A5code=E6=98=AF201?= =?UTF-8?q?=E6=89=8D=E6=9C=89=E5=BC=95=E7=94=A8,=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E6=8C=89=E8=BF=94=E5=9B=9E=E7=9A=84=E9=94=99=E8=AF=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BasicTest/components/SynchronizeModal.tsx | 12 +++++++----- src/pages/SystemConf/TestSuite/BasicTest/index.tsx | 4 +++- .../BusinessList/components/SuiteList/index.tsx | 4 +++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx b/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx index d0ae110d..d23d422d 100644 --- a/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx +++ b/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx @@ -61,11 +61,13 @@ const SynchronizeModal = (props: any, ref: any) => { - - - + {setting?.id && setting?.name && + + + + } ) diff --git a/src/pages/SystemConf/TestSuite/BasicTest/index.tsx b/src/pages/SystemConf/TestSuite/BasicTest/index.tsx index 775c849b..e9f5ea6a 100644 --- a/src/pages/SystemConf/TestSuite/BasicTest/index.tsx +++ b/src/pages/SystemConf/TestSuite/BasicTest/index.tsx @@ -185,10 +185,12 @@ const SuiteManagement: React.ForwardRefRenderFunction = (props message.success(formatMessage({ id: 'request.synchronize.success' })) getList() setAsyncTime(new Date().getTime()) - } else { + } else if (code === 201) { // 201 有引用 const { id, name } = row synchronizeRef.current?.show({ id, name, ...data }) + } else { + synchronizeRef.current?.show({ code, msg }) } } diff --git a/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/index.tsx b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/index.tsx index 7b87b654..910f3e6f 100644 --- a/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/index.tsx +++ b/src/pages/SystemConf/TestSuite/BusinessTest/BusinessList/components/SuiteList/index.tsx @@ -180,10 +180,12 @@ export default forwardRef(({ business_id, rowSelectionCallback = () => { }, rest const ids = expandKeys.concat([row.id]) setExpandKeys(ids) } - } else { + } else if (res.code === 201) { // 判断 201有引用 const { id, name } = row synchronizeRef.current?.show({ id, name, ...res.data }) + } else { + synchronizeRef.current?.show({ code: res.code, msg: res.msg }) } } -- Gitee From 12224fca31847c22d0bb2f684f0516efdc9b38b2 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Tue, 9 Jul 2024 03:14:21 +0000 Subject: [PATCH 05/31] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tianweiweiliang <875658254@qq.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 24b4a698..4595d3b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tone-front", - "version": "1.18.0", + "version": "1.19.0", "private": true, "description": "Tone front", "scripts": { -- Gitee From 1fc74e17c88bf82cc4ef3674f53375ddc24608cd Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Tue, 9 Jul 2024 13:47:16 +0800 Subject: [PATCH 06/31] =?UTF-8?q?fix:=20=E5=86=85=E7=BD=91=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=BB=E3=80=81=E8=A2=AB=E5=8A=A8=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeviceManage/CloudManage/AddMachinePubilc/index.tsx | 6 ++++-- src/pages/WorkSpace/DeviceManage/locales/en-US.ts | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/WorkSpace/DeviceManage/CloudManage/AddMachinePubilc/index.tsx b/src/pages/WorkSpace/DeviceManage/CloudManage/AddMachinePubilc/index.tsx index d9d1a663..168ba723 100644 --- a/src/pages/WorkSpace/DeviceManage/CloudManage/AddMachinePubilc/index.tsx +++ b/src/pages/WorkSpace/DeviceManage/CloudManage/AddMachinePubilc/index.tsx @@ -1117,7 +1117,7 @@ const NewMachine: React.FC = (props) => { - {!is_instance && BUILD_APP_ENV === 'openanolis' && + {!is_instance && BUILD_APP_ENV !== 'opensource' && = (props) => { rules={[{ required: false, message: formatMessage({ id: 'please.select' }) }]} > - + {BUILD_APP_ENV === 'openanolis' && + + } diff --git a/src/pages/WorkSpace/DeviceManage/locales/en-US.ts b/src/pages/WorkSpace/DeviceManage/locales/en-US.ts index c2ddbdf8..31c912fa 100644 --- a/src/pages/WorkSpace/DeviceManage/locales/en-US.ts +++ b/src/pages/WorkSpace/DeviceManage/locales/en-US.ts @@ -155,8 +155,8 @@ export default { 'device.extended.fields': 'Extended Fields', 'device.aliyun.params': 'Alibaba Cloud openAPI parameters', 'device.toneagent.working.mode': 'Toneagent working mode', - 'device.active.mode': 'Active mode', - 'device.passive.mode': 'Passive mode', + 'device.active.mode': 'Active', + 'device.passive.mode': 'Passive', 'device.tips': 'Tips', 'device.delete.config': 'Are you sure you want to delete the configuration ({data})?', 'device.delete.instance': 'Are you sure you want to delete the instance({data})?', -- Gitee From c6cbae7c1f69d1bc1b00a2c37e9896117a557ea0 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Tue, 9 Jul 2024 14:17:22 +0800 Subject: [PATCH 07/31] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=8F=82=E6=95=B0=E8=A6=81=E4=BF=9D=E7=95=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header/components/JobModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Header/components/JobModal.tsx b/src/components/Header/components/JobModal.tsx index a159523b..ac027f7c 100644 --- a/src/components/Header/components/JobModal.tsx +++ b/src/components/Header/components/JobModal.tsx @@ -15,7 +15,7 @@ const JobTemplateModal: React.FC> = (props) => { const dataSourceCopy = props.getData(jobTemplates) return ( - + Date: Tue, 16 Jul 2024 16:28:31 +0800 Subject: [PATCH 08/31] =?UTF-8?q?fix:=20=E6=96=B0=E5=A2=9Enodejs20?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E6=8C=81=E4=BB=A5=E5=BA=94=E5=AF=B9node16?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E6=94=AF=E6=8C=81=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abc.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/abc.json b/abc.json index 06a1bce2..f340190a 100644 --- a/abc.json +++ b/abc.json @@ -3,11 +3,12 @@ "type": "command", "command": { "cmd": [ + "export NODE_OPTIONS=--openssl-legacy-provider", "pnpm install", "pnpm build", "mv ./dist $BUILD_DEST" ] } }, - "nodeVersion": 16 -} \ No newline at end of file + "nodeVersion": 20 +} -- Gitee From bff8c126549d3286e2ebedb948bc0d930856a0e4 Mon Sep 17 00:00:00 2001 From: wulibaibao <13366578180@163.com> Date: Tue, 16 Jul 2024 17:12:32 +0800 Subject: [PATCH 09/31] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=86=99?= =?UTF-8?q?=E6=B3=95=E5=AF=B9node16=E4=BB=A5=E4=B8=8A=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abc.json | 7 +------ package.json | 12 ++++++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/abc.json b/abc.json index f340190a..5d13b0f4 100644 --- a/abc.json +++ b/abc.json @@ -2,12 +2,7 @@ "assets": { "type": "command", "command": { - "cmd": [ - "export NODE_OPTIONS=--openssl-legacy-provider", - "pnpm install", - "pnpm build", - "mv ./dist $BUILD_DEST" - ] + "cmd": ["pnpm install", "pnpm build", "mv ./dist $BUILD_DEST"] } }, "nodeVersion": 20 diff --git a/package.json b/package.json index 4595d3b1..44bb0a4a 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,12 @@ "private": true, "description": "Tone front", "scripts": { - "start": "cross-env BUILD_APP_ENV=\"opensource\" PORT=8888 umi dev", - "build": "cross-env BUILD_APP_ENV=\"opensource\" umi build", - "start:openanolis": "cross-env PORT=8888 BUILD_APP_ENV=\"openanolis\" umi dev", - "build:openanolis": "cross-env BUILD_APP_ENV=\"openanolis\" umi build", - "start:tone": "cross-env BUILD_APP_ENV= PORT=8888 umi dev", - "build:tone": "cross-env BUILD_APP_ENV= PORT=8888 umi build", + "start": "cross-env NODE_OPTIONS=--openssl-legacy-provider BUILD_APP_ENV=\"opensource\" PORT=8888 umi dev", + "build": "cross-env NODE_OPTIONS=--openssl-legacy-provider BUILD_APP_ENV=\"opensource\" umi build", + "start:openanolis": "cross-env NODE_OPTIONS=--openssl-legacy-provider PORT=8888 BUILD_APP_ENV=\"openanolis\" umi dev", + "build:openanolis": "cross-env NODE_OPTIONS=--openssl-legacy-provider BUILD_APP_ENV=\"openanolis\" umi build", + "start:tone": "cross-env NODE_OPTIONS=--openssl-legacy-provider BUILD_APP_ENV= PORT=8888 umi dev", + "build:tone": "cross-env NODE_OPTIONS=--openssl-legacy-provider BUILD_APP_ENV= PORT=8888 umi build", "analyze": "cross-env ANALYZE=1 umi build", "deploy": "npm run site && npm run gh-pages", "dev": "npm run start:dev", -- Gitee From 729328a73acf1c4daea3588c2cce84403dbf49f5 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 2 Aug 2024 13:37:46 +0800 Subject: [PATCH 10/31] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=89=93?= =?UTF-8?q?=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/abc.json b/abc.json index 06a1bce2..546a0fd3 100644 --- a/abc.json +++ b/abc.json @@ -4,7 +4,7 @@ "command": { "cmd": [ "pnpm install", - "pnpm build", + "pnpm build:tone", "mv ./dist $BUILD_DEST" ] } -- Gitee From 729f99486b8d5ca3ec2bd9a95eae4bf6ab2029aa Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 2 Aug 2024 15:24:14 +0800 Subject: [PATCH 11/31] =?UTF-8?q?fix:=20=E6=8A=A5=E5=91=8A=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestAnalysis/AnalysisResult/index.tsx | 3 ++ .../WorkSpace/TestReport/NewReport/hooks.ts | 40 +++++++++++-------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx index fc97b55c..bbe8569c 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx @@ -47,6 +47,7 @@ const Report: React.FC = () => { // 请求对比数据 const queryCompareForm = async () => { const data = await queryForm({ form_id }) + console.log('对比数据:', data) if (data.code == 200) { if (!data?.data) return setTestDataParam(data?.data.testDataParam) @@ -193,6 +194,8 @@ const Report: React.FC = () => { } const creatReportCallback = (reportData: any) => { // suiteData:已选的 + console.log('对比数据--testDataParam:', testDataParam) + history.push({ pathname: `/ws/${ws_id}/test_create_report`, state: { diff --git a/src/pages/WorkSpace/TestReport/NewReport/hooks.ts b/src/pages/WorkSpace/TestReport/NewReport/hooks.ts index 05deedef..de9f5fa5 100644 --- a/src/pages/WorkSpace/TestReport/NewReport/hooks.ts +++ b/src/pages/WorkSpace/TestReport/NewReport/hooks.ts @@ -69,6 +69,7 @@ export const CreatePageData = (props: any) => { const handleData = async (data: any) => { setLoading(true) + console.log('testDataParam:', data) const { perf_suite_dic, func_suite_dic } = data let perfArr: any = [] let funcArr: any = [] @@ -80,25 +81,32 @@ export const CreatePageData = (props: any) => { } let resLen: any = [] resLen = perfArr.concat(funcArr) + console.log('resLen:', resLen) setSuiteLen(resLen.length) - resLen.map((item: any, i: number) => queryCompareResultFn(item) - .then(res => { - if (res.code === 200) { - setLoading(false) - if (res.data.test_type === 'functional') { - compareResult.func_data_result = compareResult.func_data_result.concat(res.data) + try { + resLen.map((item: any, i: number) => queryCompareResultFn(item) + .then(res => { + if (res.code === 200) { + setLoading(false) + if (res.data.test_type === 'functional') { + compareResult.func_data_result = compareResult.func_data_result.concat(res.data) + } + if (res.data.test_type === 'performance') { + compareResult.perf_data_result = compareResult.perf_data_result.concat(res.data) + } } - if (res.data.test_type === 'performance') { - compareResult.perf_data_result = compareResult.perf_data_result.concat(res.data) + setCompareResult({ ...compareResult }) + if (res.code !== 200) { + message.error(res.msg) + return } - } - setCompareResult({ ...compareResult }) - if (res.code !== 200) { - message.error(res.msg) - return - } - }) - ) + }) + ) + } catch (error) { + setLoading(false) + } finally { + setLoading(false) + } } useEffect(() => { -- Gitee From d57dfcc49f39082062ee1cce0c0de69cfafa7de7 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 2 Aug 2024 17:36:37 +0800 Subject: [PATCH 12/31] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E7=A9=BA=E5=AF=B9=E8=B1=A1=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.tsx | 2 +- src/components/Header/components/HeaderDropdown.tsx | 2 +- src/utils/hooks.tsx | 2 +- src/wrappers/WorkspaceAuth.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app.tsx b/src/app.tsx index 39700ab2..095287b8 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -101,7 +101,7 @@ export async function getInitialState(): Promise { redirectErrorPage(401) return baseAppState } - const ws: any = await enterWsAndGetList(ws_id) + const ws: any = await enterWsAndGetList(ws_id) || {} if (ws?.first_entry) { history.push(`/ws/${ws_id}/workspace/initSuccess`) } diff --git a/src/components/Header/components/HeaderDropdown.tsx b/src/components/Header/components/HeaderDropdown.tsx index 40e90da7..9bf4a31a 100644 --- a/src/components/Header/components/HeaderDropdown.tsx +++ b/src/components/Header/components/HeaderDropdown.tsx @@ -93,7 +93,7 @@ export const HearderDropdown: React.FC = (props) => { const current = React.useMemo(() => { if (!wsList) return {} - const [workspace] = wsList?.data?.filter(({ id }: any) => id === ws_id) + const [workspace] = (wsList?.data || [])?.filter(({ id }: any) => id === ws_id) // wsList?.data?.filter(({ id }: any) => id === ws_id) if (workspace) return workspace return {} }, [wsList, ws_id]) diff --git a/src/utils/hooks.tsx b/src/utils/hooks.tsx index 61198b72..d06795f8 100644 --- a/src/utils/hooks.tsx +++ b/src/utils/hooks.tsx @@ -10,7 +10,7 @@ const { document, location }: any = window export const enterWsAndGetList = async (ws_id: any) => { try { - const { data } = await enterWorkspaceHistroy({ ws_id }) + const { data } = await enterWorkspaceHistroy({ ws_id }) || {} const { code, ...historyWorkspaces } = await queryWorkspaceHistory({ page_num: 1, page_size: 20, diff --git a/src/wrappers/WorkspaceAuth.tsx b/src/wrappers/WorkspaceAuth.tsx index 32da761a..af06f33e 100644 --- a/src/wrappers/WorkspaceAuth.tsx +++ b/src/wrappers/WorkspaceAuth.tsx @@ -29,7 +29,7 @@ export default (props: any) => { /* 切换ws请求记录历史接口 */ /* getHistoryFetcher() */ - const ws = await enterWsAndGetList(ws_id) + const ws = await enterWsAndGetList(ws_id) || {} setInitialState((p: any) => ({ ...p, ...ws, -- Gitee From 2ff1aa69b76153c2eeac7678859cc2427df89080 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 2 Aug 2024 15:26:54 +0800 Subject: [PATCH 13/31] =?UTF-8?q?fix:=20=E7=94=A8=E6=88=B7=E8=A7=92?= =?UTF-8?q?=E8=89=B2=EF=BC=8C=E8=A7=92=E8=89=B2=E5=88=97=E8=A1=A8=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=BC=BA=E5=A4=B1=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SystemConf/UserManagement/components/RoleSelect/index.tsx | 4 +--- src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx | 3 --- src/pages/WorkSpace/TestReport/NewReport/hooks.ts | 2 -- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/pages/SystemConf/UserManagement/components/RoleSelect/index.tsx b/src/pages/SystemConf/UserManagement/components/RoleSelect/index.tsx index 16baefef..171c64d1 100644 --- a/src/pages/SystemConf/UserManagement/components/RoleSelect/index.tsx +++ b/src/pages/SystemConf/UserManagement/components/RoleSelect/index.tsx @@ -26,11 +26,9 @@ const RoleSelect: React.FC<{ row: any, select: any[], handleChange: (val: number } useEffect(() => { - setSelectValue(row.role_list.map((item: any) => (item.id))[0]) + setSelectValue(row?.role_list?.map((item: any) => (item.id))[0]) }, [row.role_list]) - // console.log('selectValue:', selectValue) - return (
diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx index bbe8569c..fc97b55c 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx @@ -47,7 +47,6 @@ const Report: React.FC = () => { // 请求对比数据 const queryCompareForm = async () => { const data = await queryForm({ form_id }) - console.log('对比数据:', data) if (data.code == 200) { if (!data?.data) return setTestDataParam(data?.data.testDataParam) @@ -194,8 +193,6 @@ const Report: React.FC = () => { } const creatReportCallback = (reportData: any) => { // suiteData:已选的 - console.log('对比数据--testDataParam:', testDataParam) - history.push({ pathname: `/ws/${ws_id}/test_create_report`, state: { diff --git a/src/pages/WorkSpace/TestReport/NewReport/hooks.ts b/src/pages/WorkSpace/TestReport/NewReport/hooks.ts index de9f5fa5..befa9fd4 100644 --- a/src/pages/WorkSpace/TestReport/NewReport/hooks.ts +++ b/src/pages/WorkSpace/TestReport/NewReport/hooks.ts @@ -69,7 +69,6 @@ export const CreatePageData = (props: any) => { const handleData = async (data: any) => { setLoading(true) - console.log('testDataParam:', data) const { perf_suite_dic, func_suite_dic } = data let perfArr: any = [] let funcArr: any = [] @@ -81,7 +80,6 @@ export const CreatePageData = (props: any) => { } let resLen: any = [] resLen = perfArr.concat(funcArr) - console.log('resLen:', resLen) setSuiteLen(resLen.length) try { resLen.map((item: any, i: number) => queryCompareResultFn(item) -- Gitee From 8f7533ed8cc8ec97a4071cc05497a811dcf3c895 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 16 Aug 2024 13:11:07 +0800 Subject: [PATCH 14/31] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=8F=8A=E7=BB=9F=E8=AE=A1=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnalysisTime/components/RenderChart.tsx | 31 ++++++- .../AnalysisTime/components/TabPaneCard.tsx | 8 +- .../components/statisticsChartOption.tsx | 69 ++++++++++++++++ .../Details/TestRsultTable/CaseTable.tsx | 82 +++++++++++++++---- .../Details/TestRsultTable/InfoResultFile.tsx | 11 ++- .../TestRsultTable/InfoResultTable.tsx | 19 ++++- .../TestRsultTable/MetricResultTable.tsx | 15 +++- .../Details/TestRsultTable/ResultInfo.tsx | 12 ++- .../TestResult/Details/locales/en-US.ts | 2 +- .../TestResult/Details/locales/zh-CN.ts | 2 +- 10 files changed, 223 insertions(+), 28 deletions(-) create mode 100644 src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/statisticsChartOption.tsx diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/RenderChart.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/RenderChart.tsx index 65f408d7..72182b1c 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/RenderChart.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/RenderChart.tsx @@ -7,6 +7,7 @@ import customChartOption from './customChartOption' import styled from 'styled-components' // import PerfLineOption from './PerfLineOption' import passRateLineOption from './passRateLineOption' +import statisticsChartOption from './statisticsChartOption' // import AliyunPerfLine from './AliyunPerfLine' import { targetJump } from '@/utils/utils' @@ -42,12 +43,29 @@ type RenderChartProps = { const RenderChart: React.FC = (props) => { const { formatMessage } = useIntl() - const { dataSource: chartDatas, title, provider_env, test_type, show_type } = props + const { + dataSource: chartDatas, title, provider_env, test_type, show_type, + statisticsData, + } = props const { ws_id }: any = useParams() - + const caseStatisticsChart: any = useRef() const chart: any = useRef() const [dataSource, setDataSource] = useState(undefined) + // 创建饼图图表 + const createCaseStatisticsChart = ()=> { + const pieChart = echarts.init(caseStatisticsChart.current) + pieChart.clear() + pieChart.showLoading() + if (dataSource && JSON.stringify(dataSource) !== '{}') { + const option = statisticsChartOption(statisticsData, ws_id, formatMessage) + pieChart.setOption(option) + } + pieChart.hideLoading() + return pieChart + } + + // 创建折线图表 React.useEffect(() => { const myChart = echarts.init(chart.current) myChart.clear() @@ -80,8 +98,11 @@ const RenderChart: React.FC = (props) => { }) } myChart.hideLoading() + + createCaseStatisticsChart() return () => { myChart.dispose() + // caseStatisticsChart?.dispose() } }, [dataSource, formatMessage, provider_env, show_type, test_type, ws_id]) @@ -107,7 +128,11 @@ const RenderChart: React.FC = (props) => { (test_type === 'functional' && show_type === 'pass_rate') && <FormattedMessage id="analysis.chart.title.resultTrend" /> } -
+
+
+ +
+
) } diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/TabPaneCard.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/TabPaneCard.tsx index 98bf7c32..c62792ca 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/TabPaneCard.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/TabPaneCard.tsx @@ -77,6 +77,8 @@ const TabPaneCard: React.ForwardRefRenderFunction = (props, re const { info, setInfo } = props const { show_type, provider_env, test_type } = info const [chartData, setChartData] = useState({}) + const [statisticsData, setStatisticsData] = useState({}) + const [tableData, setTableData] = useState([]) const [metricData, setMetricData] = useState(null) const [loading, setLoading] = useState(JSON.stringify(query) !== "{}") @@ -107,6 +109,7 @@ const TabPaneCard: React.ForwardRefRenderFunction = (props, re setLoading(true) setTableData([]) setChartData({}) + setStatisticsData({}) const { data, code } = test_type === 'performance' ? await queryPerfAnalysisList(params) : @@ -116,10 +119,11 @@ const TabPaneCard: React.ForwardRefRenderFunction = (props, re if (code !== 200) return if (!data) return - const { job_list, metric_map, case_map } = data + const { job_list, metric_map, case_map, case_statistics } = data if (job_list && job_list.length > 0) { setChartData(test_type === 'performance' ? metric_map : case_map) setTableData(job_list) + setStatisticsData(case_statistics) return } } @@ -475,6 +479,7 @@ const TabPaneCard: React.ForwardRefRenderFunction = (props, re provider_env={provider_env} show_type={show_type} dataSource={chartData} + statisticsData={statisticsData} /> } @@ -482,7 +487,6 @@ const TabPaneCard: React.ForwardRefRenderFunction = (props, re tableData?.length === 0 && } - { tableData?.length > 0 && { + + const baseicData = [ + { value: "Fail", color: "#C84C5A" }, + { value: "Skip", color: "#D9D9D9" }, + { value: "Pass", color: "#81BF84" } + ]; + + const data = Object.keys(dataSource).map((key: any) => { + const value = dataSource[key] + return { + name: key, + value, + } + }) + + const baseZoomLen = 25 + const yAxisLabel = ["Pass", "Skip", "Fail"]; + + const option = { + tooltip: { + trigger: 'item' + }, + legend: { + icon: "rect", + itemHeight: 6, + itemWidth: 15, + top: '5%', + data: yAxisLabel.map((i) => ({ + name: i, + textStyle: { color: baseicData.filter((v) => v.value === i)[0].color } + })) + }, + series: [ + { + name: '数量', + type: 'pie', + radius: '50%', + data: data, + // [ + // { value: 1048, name: 'Search Engine' }, + // { value: 735, name: 'Direct' }, + // { value: 580, name: 'Email' }, + // { value: 484, name: 'Union Ads' }, + // { value: 300, name: 'Video Ads' } + // ], + label: { + formatter: '{b}: ({d}%)' + }, + itemStyle: { + // color: yAxisLabel.map((i) => baseicData.filter((v) => v.value === i)[0].color, ) + }, + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + } + } + ] + } + return option +}; + +export default statisticsChartOption; diff --git a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/CaseTable.tsx b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/CaseTable.tsx index 79432be2..b964f090 100644 --- a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/CaseTable.tsx +++ b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/CaseTable.tsx @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/dot-notation */ /* eslint-disable react-hooks/exhaustive-deps */ -import { Table, Space, Row } from 'antd' +import { Table, Space, Row, Button, message } from 'antd' import React, { useEffect } from 'react' -import { Access, useAccess, useParams, FormattedMessage, getLocale } from 'umi' +import { Access, useAccess, useParams, FormattedMessage, useIntl, useModel, getLocale, request } from 'umi' import ServerLink from '@/components/MachineWebLink/index'; import { queryTestResultSuiteConfList } from '../service' import { CaretRightFilled, CaretDownFilled } from '@ant-design/icons'; @@ -21,6 +21,7 @@ import treeSvg from '@/assets/svg/tree.svg' import { AccessTootip } from '@/utils/utils'; import { getStorageState } from '@/utils/table.hooks'; import { MetricSelectProvider } from '.' +import { encode } from 'js-base64' // const treeSvg = require('@/assets/svg/tree.svg') const background = `url(${treeSvg}) center center / 38.6px 32px ` @@ -30,6 +31,8 @@ const CaseTable: React.FC> = (props) => { suite_id, testType, suite_name, server_provider, provider_name, creator, expandedState, expandedCaseRowKeys, openAllRows = false, setIndexExpandFlag, parentTableName, columnsChange } = props + const { formatMessage } = useIntl() + const { initialState } = useModel('@@initialState') const locale = getLocale() === 'en-US'; const { setOSuite, oSuite } = React.useContext(MetricSelectProvider) @@ -41,6 +44,7 @@ const CaseTable: React.FC> = (props) => { const [loading, setLoading] = React.useState(true) const [source, setSource] = React.useState([]) const [currentState, setCurrentState] = React.useState(expandedState) + // const [confLogInfo, setConfLogInfo] = React.useState({}) const init = async () => { setLoading(true) @@ -76,6 +80,39 @@ const CaseTable: React.FC> = (props) => { joinBaselineDrawer.current.show({ ..._, suite_id }) } + const handlePathClick = async (path: string, state: string) => { + let params: any = { + path: path, + job_id, share_id + } + + if (state === 'download') { + params.download = '1' + } + + if (BUILD_APP_ENV !== 'opensource') { + const username = initialState?.authList?.username; + const token = `${username}|${initialState?.token}|${new Date().getTime()}`; + const signature = encode(token); + + params.username = username; + params.signature = signature + } + + if (state === 'download_folder') { + params.download = '1'; + params.is_folder = '1' + const downloadUrl = location.origin + `/api/get/oss/url/?` + Object.keys(params).filter((item)=> params[item]).map((key)=> `${key}=${params[key]}`).join('&') + window.open(downloadUrl) + } else { + const data = await request(`/api/get/oss/url/`, { params }) + if (data) { + if (data.code === 200 && data.msg === 'ok') window.open(data.data) + else message.warn(`${['download', 'download_folder'].includes(state) ? formatMessage({ id: 'ws.result.details.failed.download.file' }): formatMessage({ id: 'ws.result.details.failed.get.file' })}`) + } + } + } + const columns = React.useMemo(() => [ { title: 'Test Suite', @@ -179,25 +216,39 @@ const CaseTable: React.FC> = (props) => { showTitle: false, }, render: (_: any, row: any) => ( - editRemarkDrawer.current.show({ - ...row, - suite_name: row.suite_name, - editor_obj: 'test_job_conf' - }) + ) }, !share_id && ['performance', 'business_performance'].includes(testType) && { title: , width: locale ? 180 : 145, - // fixed: 'right', render: (_: any) => { return ( @@ -302,6 +353,9 @@ const CaseTable: React.FC> = (props) => { expandedRowRender: (record: any) => ( = (props: any) => ( ) -export default ({ test_case_id, suite_id }: any) => { +export default ({ test_case_id, suite_id, confLogInfo }: any) => { const { formatMessage } = useIntl() const { initialState } = useModel('@@initialState') const { id: job_id, share_id } = useParams() as any @@ -95,12 +95,21 @@ export default ({ test_case_id, suite_id }: any) => { } ) + // 默认展开的文件 + // let defaultExpandedKeys = [] + // if (test_case_id === confLogInfo.test_case_id) { + // const str = confLogInfo.conf_log_path || '' + // const folder = str.indexOf('/') > -1 ? str.substring(0, str.lastIndexOf('/')): str + // defaultExpandedKeys = folder.split('/') + // } + return (
{ data.length > 0 ? { const { test_case_id, suite_id, testType, creator, server_provider, state = '', suite_name, conf_name, - refreshId, setRefreshId + refreshId, setRefreshId, lookPathCallback = ()=> {} } = props const editRemark: any = useRef(null) const joinBaseline: any = useRef(null) @@ -259,8 +259,8 @@ export default (props: any) => { !share_id && { title: , - fixed: "right", width: 200, + fixed: "right", render: (_: any, row: any) => { // 失败的 && 没有关联关系的才能“修改基线” const failFlag = _.result === 'Fail' && !row.skip_baseline_info @@ -284,7 +284,20 @@ export default (props: any) => { ) } - } + }, + { + title: '日志', + dataIndex: 'log', + width: 80, + fixed: "right", + ellipsis: true, + render: (_: any, row: any)=> { + const filePath = row.conf_log_path + return filePath ? + lookPathCallback(filePath, 'look') }>filePath + : '-' + } + }, ].filter(Boolean) return ( diff --git a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/MetricResultTable.tsx b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/MetricResultTable.tsx index 1f9860fd..63005696 100644 --- a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/MetricResultTable.tsx +++ b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/MetricResultTable.tsx @@ -15,7 +15,7 @@ import { MetricSelectProvider } from '.' export default (props: any) => { const { formatMessage } = useIntl() - const { test_case_id, suite_id, state: compare_result, refreshId, setRefreshId, testType } = props + const { test_case_id, suite_id, state: compare_result, refreshId, setRefreshId, testType, lookPathCallback = ()=> {}, } = props const { id: job_id, ws_id, share_id } = useParams() as any const { setOSuite, oSuite } = React.useContext(MetricSelectProvider) const defaultKeys = { @@ -194,6 +194,19 @@ export default (props: any) => { ellipsis: true, render: (_: any, row: any) => compareResultSpan(row.track_result, row.result, formatMessage) }, + { + title: '日志', + dataIndex: 'log', + width: 80, + fixed: "right", + ellipsis: true, + render: (_: any, row: any)=> { + const filePath = row.conf_log_path + return filePath ? + lookPathCallback(filePath, 'look') }>filePath + : '-' + } + }, ] const rowSelection: any = !share_id && testType === 'performance' ? { diff --git a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/ResultInfo.tsx b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/ResultInfo.tsx index 72d8807c..e1cee758 100644 --- a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/ResultInfo.tsx +++ b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/ResultInfo.tsx @@ -1,5 +1,5 @@ import { Tabs } from 'antd' -import React from 'react' +import React, { useEffect } from 'react' import { isUrl } from '@/utils/utils' import { FormattedMessage } from 'umi' @@ -41,13 +41,21 @@ const ResultInfo: React.FC = (props) => { const ciDetail = ci_detail ? JSON.parse(ci_detail) : {} const [tab, setTab] = React.useState("1") + + // useEffect(()=> { + // // 切换到日志文件tab + // if (confLogInfo.test_case_id && confLogInfo.test_case_id === test_case_id) { + // setTab('3') + // } + // }, [confLogInfo.test_case_id]) + // console.log('ciDetail:', ci_detail); return (
setTab(t)} + onTabClick={(t: any) => setTab(t) } activeKey={tab} /* @ts-ignore */ items={ diff --git a/src/pages/WorkSpace/TestResult/Details/locales/en-US.ts b/src/pages/WorkSpace/TestResult/Details/locales/en-US.ts index 2b54fc82..13fab750 100644 --- a/src/pages/WorkSpace/TestResult/Details/locales/en-US.ts +++ b/src/pages/WorkSpace/TestResult/Details/locales/en-US.ts @@ -55,7 +55,7 @@ const text = { 'tab.testProgress': 'Cases', 'tab.testConfig': 'Test Configurations', 'tab.monitor': 'Data Monitor', - 'tab.log': 'Logs', + 'tab.log': 'Log Details', 'tab.resultFile': 'Result File', 'tab.versionInfo': 'Version Info', 'tab.executionDetails': 'Execution Details', diff --git a/src/pages/WorkSpace/TestResult/Details/locales/zh-CN.ts b/src/pages/WorkSpace/TestResult/Details/locales/zh-CN.ts index a8de80ed..c94fc3e3 100644 --- a/src/pages/WorkSpace/TestResult/Details/locales/zh-CN.ts +++ b/src/pages/WorkSpace/TestResult/Details/locales/zh-CN.ts @@ -50,7 +50,7 @@ const text = { 'tab.testProgress': '执行过程', 'tab.testConfig': '测试配置', 'tab.monitor': '数据监控', - 'tab.log': '日志文件', + 'tab.log': '日志详情', 'tab.resultFile': '结果文件', 'tab.versionInfo': '版本信息', 'tab.executionDetails': '执行详情', -- Gitee From 1efa64bbcc42ca8500d7684da6d58e3b16850163 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 16 Aug 2024 13:53:23 +0800 Subject: [PATCH 15/31] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/statisticsChartOption.tsx | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/statisticsChartOption.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/statisticsChartOption.tsx index abb156ab..35f11ce5 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/statisticsChartOption.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/statisticsChartOption.tsx @@ -3,13 +3,8 @@ import { textTip, commitLinkTip } from '.' const statisticsChartOption: any = (dataSource: any, ws_id: any, formatMessage: any) => { - const baseicData = [ - { value: "Fail", color: "#C84C5A" }, - { value: "Skip", color: "#D9D9D9" }, - { value: "Pass", color: "#81BF84" } - ]; - const data = Object.keys(dataSource).map((key: any) => { + const data = Object.keys(dataSource || {}).map((key: any) => { const value = dataSource[key] return { name: key, @@ -19,6 +14,11 @@ const statisticsChartOption: any = (dataSource: any, ws_id: any, formatMessage: const baseZoomLen = 25 const yAxisLabel = ["Pass", "Skip", "Fail"]; + const baseicData = [ + { value: "Fail", color: "#C84C5A" }, + { value: "Skip", color: "#D9D9D9" }, + { value: "Pass", color: "#81BF84" } + ]; const option = { tooltip: { @@ -31,7 +31,9 @@ const statisticsChartOption: any = (dataSource: any, ws_id: any, formatMessage: top: '5%', data: yAxisLabel.map((i) => ({ name: i, - textStyle: { color: baseicData.filter((v) => v.value === i)[0].color } + textStyle: { + color: baseicData.filter((item) => item.value === i)[0]?.color + }, })) }, series: [ @@ -40,18 +42,13 @@ const statisticsChartOption: any = (dataSource: any, ws_id: any, formatMessage: type: 'pie', radius: '50%', data: data, - // [ - // { value: 1048, name: 'Search Engine' }, - // { value: 735, name: 'Direct' }, - // { value: 580, name: 'Email' }, - // { value: 484, name: 'Union Ads' }, - // { value: 300, name: 'Video Ads' } - // ], label: { formatter: '{b}: ({d}%)' }, itemStyle: { - // color: yAxisLabel.map((i) => baseicData.filter((v) => v.value === i)[0].color, ) + color: (params: any) => { + return baseicData.filter((item: any) => item.value === params?.name)[0]?.color || '#D9D9D9' + } }, emphasis: { itemStyle: { -- Gitee From 126b98ea6ee80087e21416a017a32d45b3111f7a Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 16 Aug 2024 15:07:18 +0800 Subject: [PATCH 16/31] =?UTF-8?q?fix:=20=E4=BB=A3=E7=A0=81=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestAnalysis/AnalysisTime/components/RenderChart.tsx | 4 ++-- .../TestResult/Details/TestRsultTable/InfoResultTable.tsx | 6 +++--- .../TestResult/Details/TestRsultTable/MetricResultTable.tsx | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/RenderChart.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/RenderChart.tsx index 72182b1c..992522eb 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/RenderChart.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisTime/components/RenderChart.tsx @@ -99,10 +99,10 @@ const RenderChart: React.FC = (props) => { } myChart.hideLoading() - createCaseStatisticsChart() + const pieChart = createCaseStatisticsChart() return () => { myChart.dispose() - // caseStatisticsChart?.dispose() + pieChart?.dispose() } }, [dataSource, formatMessage, provider_env, show_type, test_type, ws_id]) diff --git a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/InfoResultTable.tsx b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/InfoResultTable.tsx index f4462b92..016e3dc1 100644 --- a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/InfoResultTable.tsx +++ b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/InfoResultTable.tsx @@ -286,7 +286,7 @@ export default (props: any) => { } }, { - title: '日志', + title: , dataIndex: 'log', width: 80, fixed: "right", @@ -294,8 +294,8 @@ export default (props: any) => { render: (_: any, row: any)=> { const filePath = row.conf_log_path return filePath ? - lookPathCallback(filePath, 'look') }>filePath - : '-' + lookPathCallback(filePath, 'look') }>{formatMessage({ id: 'operation.log' })} + : null } }, ].filter(Boolean) diff --git a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/MetricResultTable.tsx b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/MetricResultTable.tsx index 63005696..1e1b1889 100644 --- a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/MetricResultTable.tsx +++ b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/MetricResultTable.tsx @@ -195,7 +195,7 @@ export default (props: any) => { render: (_: any, row: any) => compareResultSpan(row.track_result, row.result, formatMessage) }, { - title: '日志', + title: , dataIndex: 'log', width: 80, fixed: "right", @@ -203,8 +203,8 @@ export default (props: any) => { render: (_: any, row: any)=> { const filePath = row.conf_log_path return filePath ? - lookPathCallback(filePath, 'look') }>filePath - : '-' + lookPathCallback(filePath, 'look') }>{formatMessage({ id: 'operation.log' })} + : null } }, ] -- Gitee From f2759c64ee161edb39d6c5883e89143090415040 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 16 Aug 2024 17:02:59 +0800 Subject: [PATCH 17/31] =?UTF-8?q?fix:=20=E6=A0=B7=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Details/TestRsultTable/CaseTable.tsx | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/CaseTable.tsx b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/CaseTable.tsx index b964f090..c7723566 100644 --- a/src/pages/WorkSpace/TestResult/Details/TestRsultTable/CaseTable.tsx +++ b/src/pages/WorkSpace/TestResult/Details/TestRsultTable/CaseTable.tsx @@ -216,10 +216,10 @@ const CaseTable: React.FC> = (props) => { showTitle: false, }, render: (_: any, row: any) => ( -
+ ) -- Gitee From ae611ed0381c0b55e34b4969df91fcd927d3c100 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 16 Aug 2024 17:18:09 +0800 Subject: [PATCH 18/31] =?UTF-8?q?fix:=20=E5=88=86=E4=BA=AB=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=B7=BB=E5=8A=A0=E7=BB=9F=E8=AE=A1=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WorkSpace/TestAnalysis/AnalysisTime/SharePage.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisTime/SharePage.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisTime/SharePage.tsx index e51586c7..4ebe54f3 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisTime/SharePage.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisTime/SharePage.tsx @@ -72,15 +72,17 @@ const SharePage: React.FC = () => { const [loading, setLoading] = React.useState(true) const [cLoading, setCLoading] = React.useState(true) const [tableData, setTableData] = React.useState([]) + const [statisticsData, setStatisticsData] = React.useState({}) const getFuncChartData = async (params: any) => { setCLoading(true) const { data, code } = await queryFuncAnalysisList({ ...params, share_id }) setCLoading(false) if (code !== 200) return - const { case_map, job_list } = data + const { case_map, job_list, case_statistics } = data setSource((p: any) => ({ ...p, case_map })) setTableData(job_list) + setStatisticsData(case_statistics) } const init = async () => { @@ -89,7 +91,7 @@ const SharePage: React.FC = () => { setLoading(false) if (code !== 200) return - const { provider_env, test_type, metricList } = data + const { provider_env, test_type, metricList, case_statistics } = data setSource({ ...data, @@ -97,6 +99,7 @@ const SharePage: React.FC = () => { provider_name: formatMessage({ id: provider_env }), metric: metricList }) + setStatisticsData(case_statistics) if (test_type !== 'functional' && !data?.fetchData) { setCLoading(false) @@ -221,6 +224,7 @@ const SharePage: React.FC = () => {
-- Gitee From aa92819b81625e71170db50fed1dd0a8b04bb4d5 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Tue, 20 Aug 2024 17:05:33 +0800 Subject: [PATCH 19/31] =?UTF-8?q?fix:=20=E6=B5=8B=E8=AF=95=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E3=80=81=E5=88=86=E6=9E=90=E8=B7=A8ws=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnalysisCompare/AllJobTable.tsx | 94 +++++---- .../AnalysisCompare/Modals/AddGroupItem.tsx | 15 +- .../Modals/Tables/Baseline.tsx | 79 +++++--- .../AnalysisCompare/Modals/Tables/Job.tsx | 182 +++++++++++------- .../TestAnalysis/AnalysisCompare/index.less | 2 +- .../WorkSpace/TestAnalysis/locales/en-US.ts | 1 + .../WorkSpace/TestAnalysis/locales/zh-CN.ts | 1 + .../components/WsListSelect/index.less | 90 +++++++++ .../components/WsListSelect/index.tsx | 112 +++++++++++ 9 files changed, 443 insertions(+), 133 deletions(-) create mode 100644 src/pages/WorkSpace/TestReport/components/WsListSelect/index.less create mode 100644 src/pages/WorkSpace/TestReport/components/WsListSelect/index.tsx diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/AllJobTable.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/AllJobTable.tsx index 3cb20fd1..506aaaed 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/AllJobTable.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/AllJobTable.tsx @@ -20,9 +20,12 @@ import { Scrollbars } from 'react-custom-scrollbars'; import SelectRadio from '@/components/Public/SelectRadio'; import SelectUser from '@/components/Public/SelectUser'; import CommonPagination from '@/components/CommonPagination'; +import { ColumnEllipsisText } from '@/components/ColumnComponents'; +import WsListSelect from '@/pages/WorkSpace/TestReport/components/WsListSelect' + import { requestCodeMessage } from '@/utils/utils' import { ResizeHooksTable } from '@/utils/table.hooks'; -import { ColumnEllipsisText } from '@/components/ColumnComponents'; + const { RangePicker } = DatePicker const { Option } = Select @@ -68,8 +71,9 @@ const AllJobTable: React.ForwardRefRenderFunction = (props, re { id: 1, name: formatMessage({ id: 'header.test_type.functional' }) }, { id: 0, name: formatMessage({ id: 'header.test_type.performance' }) }, ] - const [pruductId, setPruductId] = useState() - const [pruductVersion, setPruductVersion] = useState() + const [selectedWsId, setSelectedWsId] = useState() + const [productId, setProductId] = useState() + const [productVersion, setProductVersion] = useState() const [dataSource, setDataSource] = useState(defaultResult) React.useImperativeHandle(ref, () => ({ @@ -86,28 +90,28 @@ const AllJobTable: React.ForwardRefRenderFunction = (props, re confirm?.() } - const getProductList = async (id: any) => { + const getProductList = async (q: any) => { setLoading(true) - const result = await queryProductList({ ws_id, product_id: id }) + const result = await queryProductList(q) if (result.code === 200) { let data = result.data.filter((val: any) => val?.trim()) data = data.map((item: any, index: number) => ({ label: index, value: item })) setAllVersion(data) - if (!!data.length && pruductId) setPruductVersion(data[0].value) - else setPruductVersion(undefined) + if (data.length && productId) setProductVersion(data[0].value) + else setProductVersion(undefined) } else { requestCodeMessage(result.code, result.msg) } setLoading(false) } - const getProductData = async () => { + const getProductData = async (q: any) => { setLoading(true) - const result = await queryProduct({ ws_id }) + const result = await queryProduct(q) if (result.code === 200) { const data = _.isArray(result.data) ? result.data : [] setAllProduct(data) - if (!!data.length) setPruductId(undefined) + setProductId(data[0].id) } else { requestCodeMessage(result.code, result.msg) } @@ -117,9 +121,9 @@ const AllJobTable: React.ForwardRefRenderFunction = (props, re const getJobList = async () => { setLoading(true) const data = await queryJobList(params) + setLoading(false) if (data.code === 200) { setDataSource(data) - setLoading(false) } else { setDataSource(defaultResult) requestCodeMessage(data.code, data.msg) @@ -257,43 +261,52 @@ const AllJobTable: React.ForwardRefRenderFunction = (props, re ] useEffect(() => { - getProductData() - getProductList(undefined) - }, []) + if (ws_id) { + setSelectedWsId(ws_id) + getProductData({ ws_id }) + } + }, [ws_id]) useEffect(() => { - if (pruductId) getProductList(pruductId) - }, [pruductId]) + if (productId) getProductList({ ws_id: selectedWsId, product_id: productId }) + }, [productId]) useEffect(() => { - getJobList() - }, [params]) + if (productId) { + setParams({ ...params, ws_id: selectedWsId, product_id: productId, product_version: productVersion || undefined }) + } + }, [productVersion]) useEffect(() => { - if (pruductId && !pruductVersion) { - setParams({ ...params, product_id: pruductId, product_version: undefined }) - } - if (pruductId && pruductVersion) { - setParams({ ...params, product_version: pruductVersion, product_id: pruductId }) - } - }, [pruductId, pruductVersion]) + getJobList() + }, [params]) const onVersionChange = (value: any) => { - setPruductVersion(value) + setProductVersion(value) + } + + const onWsChange = (value: any) => { + // 重置其他控件选项 + setProductId(undefined) + setProductVersion(undefined) + setDataSource(defaultResult) + // + setSelectedWsId(value) + getProductData({ ws_id: value }) } const onProductChange = (value: any) => { - setPruductId(value) + setProductId(value) } const handleClearVersion = () => { - setPruductVersion(undefined) + setProductVersion(undefined) setParams({ ...params, product_version: undefined }) } const handleClearProduct = () => { - setPruductId(undefined) - setPruductVersion(undefined) + setProductId(undefined) + setProductVersion(undefined) setParams(page_default_params) } @@ -350,7 +363,7 @@ const AllJobTable: React.ForwardRefRenderFunction = (props, re } }, }; - const handleSelectCancle = () => { + const handleSelectCancel = () => { setSelectedRowKeys([]); setSelectRowData([]); } @@ -386,14 +399,23 @@ const AllJobTable: React.ForwardRefRenderFunction = (props, re
- + + + + + - + { - getProductVersionsList(value) - .then((list: any) => { - const newVersion = list && list.length > 0 ? list[0] : undefined - setListParams((p: any) => ({ ...p, page_num: 1, product_id: value, product_version: newVersion })) - setProductVersions(list) - setSelectedRowDatas([]) - }) - }} - options={ - products?.map((item: any) => ({ - value: item.id, - label: item.name - })) - } - /> - - + +
+ + +
- - - - - { + getProductVersionsList(value) + .then((list: any) => { + const newVersion = list && list.length > 0 ? list[0] : undefined + setListParams((p: any) => ({ ...p, page_num: 1, product_id: value, product_version: newVersion })) + setProductVersions(list) + setSelectedRowDatas([]) + }) + }} + options={ + products?.map((item: any) => ({ + value: item.id, + label: item.name + })) + } + /> +
+ + +
+ + : null} + showSearch + onSearch={queryWorkspaceList} + onPopupScroll={listFetchLoading ? () => {}: handleScroll} // 防抖 + showArrow={false} + value={value} + onSelect={onSelect} + filterOption={(input, option: any) => + option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 + } + {...rest} + > + {wsList?.data?.map((item: any) => + + + + {item.show_name} + + )} + + ); +}; + +export default WsListSelect; -- Gitee From a815956b00653cb1782b564384d16fbdfa6406ce Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Wed, 21 Aug 2024 16:13:36 +0800 Subject: [PATCH 20/31] =?UTF-8?q?fix:=20=E6=8D=A2=E6=8E=89ws=E7=9A=84?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/WsListSelect/index.tsx | 61 ++++++++----------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/src/pages/WorkSpace/TestReport/components/WsListSelect/index.tsx b/src/pages/WorkSpace/TestReport/components/WsListSelect/index.tsx index 4d799df7..dac5da2a 100644 --- a/src/pages/WorkSpace/TestReport/components/WsListSelect/index.tsx +++ b/src/pages/WorkSpace/TestReport/components/WsListSelect/index.tsx @@ -1,7 +1,7 @@ /* eslint-disable react-hooks/exhaustive-deps */ import React, { useState, useEffect } from 'react'; import { Space, Avatar, Typography, Select, Spin } from 'antd'; -import { queryWorkspaceHistory } from '@/services/Workspace' +import { queryWorkspaceHistory, queryHomeWorkspace, queryWorkspaceTopList } from '@/services/Workspace' import { useModel } from 'umi' import { redirectErrorPage } from '@/utils/utils' import styled from 'styled-components' @@ -32,51 +32,43 @@ const WorkspaceCover: React.FC = ({ logo, show_name, theme_color }) => logo shape="square" size={24} src={logo} - /> : + /> + : {show_name?.slice(0, 1)} const WsListSelect: React.FC = ({ ws_id, onChange=()=> {}, onSelect=()=> {}, onClear=()=> {}, value, ...rest }) => { - const { initialState: { wsList, listFetchLoading }, setInitialState } = useModel("@@initialState") const [isOver, setIsOver] = useState(false) + const [loading, setLoading] = useState(false) + const [wsList, setWsList] = useState({ data: [], page_num: 1 }) - const queryWorkspaceList = async () => { - setInitialState((p: any) => ({ ...p, listFetchLoading: true })) - let num = isOver ? wsList?.page_num : wsList?.page_num + 1 - const { code, data, page_num, total_page } = await queryWorkspaceHistory({ - page_num: num, page_size: 20, call_page: 'menu', ws_id + const queryWorkspaceList = async (q?: any) => { + setLoading(true) + try { + const res = await queryWorkspaceTopList({ + page_num: wsList.page_num, page_size: 20, ws_id, ...q, // call_page: 'menu', }) - if (code !== 200) { - redirectErrorPage(500) - return - } - setIsOver(total_page === page_num) - if (Object.prototype.toString.call(data) === "[object Array]" && !!data.length) { - setInitialState((p: any) => { - const obj = p.wsList.data.concat(data).reduce((pre: any, cur: any) => { - pre[cur.id] = cur - return pre - }, {}) - return { - ...p, - listFetchLoading: false, - wsList: { - page_num, - data: Object.entries(obj).map((item: any) => { - const [, val] = item - return val - }) - } - } - }) + + if (res.code === 200) { + setIsOver(res.total_page === res.page_num) + setWsList({ + ...res, data: res.data || [] + }) + } else { + redirectErrorPage(500) } + setLoading(false) + } catch (err) { + setLoading(false) + } } + const handleScroll = ({ target }: any) => { const { clientHeight, scrollTop, scrollHeight } = target if (clientHeight + scrollTop === scrollHeight && !isOver && Object.prototype.toString.call(wsList?.next) === '[object String]') { - queryWorkspaceList() + queryWorkspaceList({ page_num: wsList.page_num + 1 }) } } @@ -86,10 +78,9 @@ const WsListSelect: React.FC = ({ ws_id, onChange=()=> {}, onSelect=()=> {} return ( : null} - showSearch - onPopupScroll={loading ? () => {}: handleScroll} // 防抖 - showArrow={false} + // showSearch + // onSearch={handleSearch} + // onPopupScroll={loading ? () => {}: handleScroll} // 防抖 value={value} onSelect={onSelect} - filterOption={(input, option: any) => - option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 - } {...rest} + filterOption={(input, option: any) => { + return ( + option?.key?.toLowerCase()?.indexOf(input?.toLowerCase()) >= 0 + ) + }} > {wsList?.data?.map((item: any) => - + {item.show_name} -- Gitee From 2edab07baad7e9ef2147aff3469900b6e6d6985f Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 23 Aug 2024 11:30:27 +0800 Subject: [PATCH 25/31] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=9F=A5=E8=AF=A2ws?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx index 891e9638..6a9ffbdc 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx @@ -69,7 +69,7 @@ const AddJobTable: React.FC = (props) => { } const getJobList = async () => { setLoading(true) - const data = await queryJobList(listParams) + const data = await queryJobList({ ...listParams, ws_id: selectedWsId }) setLoading(false) if (data.code === 200) { setJobs(data) -- Gitee From 7b2950d17aba262da4f47dcd3fe79b918470a2b8 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 23 Aug 2024 12:01:11 +0800 Subject: [PATCH 26/31] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=9F=A5=E8=AF=A2ws?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx index 6a9ffbdc..e97e696a 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx @@ -313,7 +313,7 @@ const AddJobTable: React.FC = (props) => { showSearch: true, allClear: true, optionFilterProp: "children", - disabled, + disabled: !!selectedRowDatas.length, style: { flex: 1 }, filterOption: (input: any, option: any) => option.label?.toLowerCase().indexOf(input.toLowerCase()) >= 0 } -- Gitee From fd8d39644b348435903aa1784518f2695e538dd6 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 23 Aug 2024 14:32:09 +0800 Subject: [PATCH 27/31] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=81=E6=80=A7=E8=83=BD=E8=B7=B3=E8=BD=AC=E6=97=B6?= =?UTF-8?q?=E7=9A=84ws=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/FunctionalTest.tsx | 2 +- .../components/PerformanceTest.tsx | 26 ++++++++----------- .../TestAnalysis/AnalysisResult/index.tsx | 20 +++++++------- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/FunctionalTest.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/FunctionalTest.tsx index 1dbe0fbd..8aa4b1ef 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/FunctionalTest.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/FunctionalTest.tsx @@ -301,7 +301,7 @@ const ReportTestFunc: React.FC = (props) => { {toShowNum(metric.fail_case)} { metric && !metric.is_baseline ? - : + : <> } diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/PerformanceTest.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/PerformanceTest.tsx index c0756f9e..f8075911 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/PerformanceTest.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/PerformanceTest.tsx @@ -245,20 +245,6 @@ const ReportTestPref: React.FC = (props) => { })) } } - const renderShare = (conf: any) => { - let obj = conf.conf_compare_data || conf.compare_conf_list || [] - return obj.map((item: any, idx: number) => { - return ( - - { - !getCompareType(item) ? - : -
- } - - ) - }) - } const containerScroll = useScroll(containerRef) return ( @@ -336,7 +322,17 @@ const ReportTestPref: React.FC = (props) => {
- {renderShare(conf)} + {(conf.conf_compare_data || conf.compare_conf_list || []).map((objItem: any, idx: number) => + + { + !getCompareType(objItem) ? + + : +
+ } + + )} { conf.metric_list.map((metric: any, idx: number) => ( diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx index fc97b55c..4fc64d78 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/index.tsx @@ -125,13 +125,15 @@ const Report: React.FC = () => { message.error(res.msg) return } - const { test_type } = data - if (code === 200 && JSON.stringify(data) !== '{}' && ["functional", "performance"].includes(test_type)) { - const field = test_type === "functional" ? "func_data_result" : "perf_data_result" - setCompareResult((p: any) => ({ - ...p, - [field]: p[field].concat(data) - })) + if (code === 200 && JSON.stringify(data) !== '{}') { + const { test_type } = data + if (["functional", "performance"].includes(test_type)) { + const field = test_type === "functional" ? "func_data_result" : "perf_data_result" + setCompareResult((p: any) => ({ + ...p, + [field]: p[field].concat(data) + })) + } } }) ) @@ -192,7 +194,7 @@ const Report: React.FC = () => { saveReportDraw.current?.show({}) } - const creatReportCallback = (reportData: any) => { // suiteData:已选的 + const createReportCallback = (reportData: any) => { // suiteData:已选的 history.push({ pathname: `/ws/${ws_id}/test_create_report`, state: { @@ -319,7 +321,7 @@ const Report: React.FC = () => { ws_id && } -- Gitee From 36fb9e5cce0fbae9229c5291b99d38fd02c0e53d Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 23 Aug 2024 16:49:24 +0800 Subject: [PATCH 28/31] =?UTF-8?q?fix:=20=E4=BB=A3=E7=A0=81=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Public/SelectUser/index.tsx | 6 ++-- .../AnalysisCompare/AllJobTable.tsx | 4 ++- .../AnalysisCompare/BaseGroupModal.tsx | 3 +- .../AnalysisCompare/CommonMethod.tsx | 2 +- .../AnalysisCompare/Modals/Tables/Job.tsx | 3 +- .../TestAnalysis/AnalysisCompare/index.tsx | 2 +- .../components/FunctionalTest.tsx | 32 +++++++++++-------- .../components/PerformanceTest.tsx | 24 ++++++++------ 8 files changed, 44 insertions(+), 32 deletions(-) diff --git a/src/components/Public/SelectUser/index.tsx b/src/components/Public/SelectUser/index.tsx index a68e8b22..7f46f690 100644 --- a/src/components/Public/SelectUser/index.tsx +++ b/src/components/Public/SelectUser/index.tsx @@ -5,7 +5,7 @@ import { FormattedMessage, useParams } from 'umi' import { queryMember } from '@/services/Workspace'; import styles from './style.less'; -const FilterRadio: React.FC = ({ confirm, onConfirm, value, page_size, mode = 'multiple' }) => { +const FilterRadio: React.FC = ({ confirm, onConfirm, value, page_size, mode = 'multiple', ws_id: selectedWsId }) => { const { ws_id } = useParams() as any const [user, setUser] = useState([]) const [keyword, setKeyword] = useState() @@ -19,14 +19,14 @@ const FilterRadio: React.FC = ({ confirm, onConfirm, value, page_size, mode if (keyword && keyword == param) return setKeyword(param) setFetching(true) - const { data } = await queryMember({ ws_id, keyword: param, page_size: page_size || 10, page_num: 1 }) + const { data } = await queryMember({ ws_id: selectedWsId || ws_id, keyword: param, page_size: page_size || 10, page_num: 1 }) setUser(Array.isArray(data) ? data : []) setFetching(false) } useEffect(() => { handleSearch() - }, []); + }, [selectedWsId]); const handleCancleSel = () => { handleSearch() diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/AllJobTable.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/AllJobTable.tsx index 1423b262..709038d7 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/AllJobTable.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/AllJobTable.tsx @@ -221,7 +221,9 @@ const AllJobTable: React.ForwardRefRenderFunction = (props, re shwoTitle: false, }, dataIndex: 'creator_name', - filterDropdown: ({ confirm }: any) => + setParams({ ...params, creators: val ? JSON.stringify([val]) : null })} page_size={9999} />, onFilterDropdownVisibleChange: (visible: any) => { diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/BaseGroupModal.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/BaseGroupModal.tsx index 58165cbf..bdaa0cfa 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/BaseGroupModal.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/BaseGroupModal.tsx @@ -227,7 +227,8 @@ const BaseGroupModal: React.ForwardRefRenderFunction = (props, const group_jobs = groupAll.map((item: any) => ({ group_name: item.name, is_baseline: item.type === 'baseline' ? 1 : 0, - test_job_id: [].concat(item.members.map((i: any) => i.id)) + test_job_id: [].concat(item.members.map((i: any) => i.id)), + // ws_id: item.selectedWsId, })) let rowKeys = tab === 'functional' ? selectedFuncRowKeys : selectedPerfRowKeys let selectdRows = suite_data.filter((i: any) => rowKeys.includes(String(i.suite_id))) diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/CommonMethod.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/CommonMethod.tsx index 7f0df2bf..b5ecde9f 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/CommonMethod.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/CommonMethod.tsx @@ -131,7 +131,7 @@ const getSelectedDataFn = ( } if (arr.length > 0) - group_jobs.push({ job_list: arr, is_baseline: item.type === 'baseline' ? 1 : 0 }) + group_jobs.push({ job_list: arr, is_baseline: item.type === 'baseline' ? 1 : 0, ws_id: item.selectedWsId }) }) Object.values(suite).forEach((obj: any) => { obj.base_index = baseIndex diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx index e97e696a..4d2b2405 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx @@ -241,6 +241,7 @@ const AddJobTable: React.FC = (props) => { dataIndex: 'creator_name', filterDropdown: ({ confirm }: any) => ( = (props) => { ws_id={ws_id} value={selectedWsId} onSelect={onWsChange} - style={{ flex: 1 }} + style={{ flex: 1, overflow: 'hidden' }} />
diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/index.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/index.tsx index b65891dc..f3a4e43d 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/index.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/index.tsx @@ -413,7 +413,7 @@ export default (props: any) => { const handleSureOk = (suiteData: any) => { // suiteData:已选的 const params: any = handleDomainList(suiteData) const paramEenvironment = handlEenvironment(suiteData) - + // console.log('paramEenvironment:', paramEenvironment) setLoading(true) Promise.all([queryDomainGroupFn(params)]) .then((result: any) => { diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/FunctionalTest.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/FunctionalTest.tsx index 8aa4b1ef..44206cd3 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/FunctionalTest.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/FunctionalTest.tsx @@ -236,6 +236,7 @@ const ReportTestFunc: React.FC = (props) => { { !!dataSource.length ? dataSource.map((item: any, idx: number) => { + const { group_jobs = [] } = item return ( @@ -293,20 +294,23 @@ const ReportTestFunc: React.FC = (props) => { { - conf_data?.slice(0, group)?.map((metric: any, idx: number) => ( - - - {toShowNum(metric.all_case)} - {toShowNum(metric.success_case)} - {toShowNum(metric.fail_case)} - { - metric && !metric.is_baseline ? - : - <> - } - - - )) + conf_data?.slice(0, group)?.map((metric: any, idx: number) => { + const selected_ws_id = group_jobs?.filter((jobObj: any)=> jobObj?.job_list?.includes(metric.obj_id))[0].ws_id || wsId + return ( + + + {toShowNum(metric.all_case)} + {toShowNum(metric.success_case)} + {toShowNum(metric.fail_case)} + { + metric && !metric.is_baseline ? + : + <> + } + + + ) + }) } = (props) => { { dataSource && !!dataSource.length ? dataSource.map((item: any, idx: number) => { + const { group_jobs = [] } = item + return ( @@ -322,16 +324,18 @@ const ReportTestPref: React.FC = (props) => {
- {(conf.conf_compare_data || conf.compare_conf_list || []).map((objItem: any, idx: number) => - - { - !getCompareType(objItem) ? - - : -
- } - + {(conf.conf_compare_data || conf.compare_conf_list || []).map((objItem: any, idx: number) => { + const selected_ws_id = group_jobs?.filter((jobObj: any)=> jobObj?.job_list?.includes(objItem.obj_id))[0].ws_id || wsId + return + + { + !getCompareType(objItem) ? + + : +
+ } + + } )} { -- Gitee From 614dd6c23332bcb86ca8c1c32861b0467aa6997c Mon Sep 17 00:00:00 2001 From: sahara Date: Thu, 5 Sep 2024 10:06:26 +0800 Subject: [PATCH 29/31] =?UTF-8?q?fix:=20=E6=B5=8B=E8=AF=95=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E6=A8=A1=E7=89=88=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E5=A5=97=E5=90=8D=E5=AD=97=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnalysisResult/components/PerformanceTest.tsx | 11 ++++++++++- .../PlanForm/components/ReportSetting/index.tsx | 2 +- .../components/TestDataChild/ChartTypeChild.tsx | 2 -- src/pages/WorkSpace/TestReport/NewReport/hooks.ts | 6 ++++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/PerformanceTest.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/PerformanceTest.tsx index c0756f9e..1c803deb 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/PerformanceTest.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisResult/components/PerformanceTest.tsx @@ -113,6 +113,7 @@ const ReportTestPref: React.FC = (props) => { const [btn, setBtn] = useState(true) const [btnName, setBtnName] = useState('') const [filterName, setFilterName] = useState('all') + const [chartType, setChartType] = useState('1') const sortRef = useRef(); const groupRowRef = useRef(null) const { perf_data_result } = compareResult @@ -291,7 +292,15 @@ const ReportTestPref: React.FC = (props) => { {item.suite_name} - + { diff --git a/src/pages/WorkSpace/TestPlan/PlanForm/components/ReportSetting/index.tsx b/src/pages/WorkSpace/TestPlan/PlanForm/components/ReportSetting/index.tsx index bd9a51bb..4ba9d272 100644 --- a/src/pages/WorkSpace/TestPlan/PlanForm/components/ReportSetting/index.tsx +++ b/src/pages/WorkSpace/TestPlan/PlanForm/components/ReportSetting/index.tsx @@ -168,7 +168,7 @@ export default forwardRef((props: any, ref: any) => { desc={ <> - {`{date} {plan_name} {plan_id} {product_version}`} + {`{Job_name}_report-{report_seq_id}`} } /> diff --git a/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/ChartTypeChild.tsx b/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/ChartTypeChild.tsx index 98747a69..65cf84c1 100644 --- a/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/ChartTypeChild.tsx +++ b/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/ChartTypeChild.tsx @@ -1,10 +1,8 @@ -import { useState, useEffect } from 'react'; import { Typography, Space, Select, } from 'antd'; import { FormattedMessage } from 'umi'; const ChartTypeChild = (props: any) => { const { btn, isReport, obj, suiteId, setPerData, chartType, setChartType } = props; - // const [chartType, setChartType] = useState('1') const onChange = (val: string) => { setChartType(val) if (isReport) { diff --git a/src/pages/WorkSpace/TestReport/NewReport/hooks.ts b/src/pages/WorkSpace/TestReport/NewReport/hooks.ts index befa9fd4..93700487 100644 --- a/src/pages/WorkSpace/TestReport/NewReport/hooks.ts +++ b/src/pages/WorkSpace/TestReport/NewReport/hooks.ts @@ -356,6 +356,7 @@ export const CreatePageData = (props: any) => { list.push({ ...item, test_suite_description: suite[b].test_tool, + suite_name: suite[b].suite_show_name, test_env: '', test_description: '', test_conclusion: '', @@ -395,6 +396,7 @@ export const CreatePageData = (props: any) => { list.push({ ...item, test_suite_description: suite[b].test_tool, + suite_name: suite[b].suite_show_name, rowKey: `${m}-${b}` }) } @@ -428,6 +430,7 @@ export const CreatePageData = (props: any) => { if (Number(item.suite_id) === Number(suite[b].test_suite_id)) { list.push({ ...item, + suite_name: suite[b].suite_show_name, rowKey: `${m}-${b}` }) } @@ -457,11 +460,11 @@ export const CreatePageData = (props: any) => { let list: any = [] let conf_list: any = [] for (let suite = res[m].list, b = 0; b < suite.length; b++) { //遍历项下面的suite - func_data_result?.map((item: any, idx: number) => { if (Number(item.suite_id) === Number(suite[b].test_suite_id)) { list.push({ ...item, + suite_name: suite[b].suite_show_name, rowKey: `${m}-${b}` }) } @@ -656,7 +659,6 @@ export const EditPageData = () => { } setDataSource(data) // window.document.title = data?.name || 'T-one' - // console.log(data) const { tmpl_id, creator, template_detail } = data setCreator(creator) let templateSource = template_detail -- Gitee From f1a5c4805713042c77fc9524deb5fce8b881a129 Mon Sep 17 00:00:00 2001 From: sahara Date: Fri, 6 Sep 2024 16:11:42 +0800 Subject: [PATCH 30/31] =?UTF-8?q?fix:=20=E6=96=87=E6=A1=88=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestPlan/PlanForm/components/ReportSetting/index.tsx | 4 ++-- src/pages/WorkSpace/TestPlan/locales/en-US.ts | 2 +- src/pages/WorkSpace/TestPlan/locales/zh-CN.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/WorkSpace/TestPlan/PlanForm/components/ReportSetting/index.tsx b/src/pages/WorkSpace/TestPlan/PlanForm/components/ReportSetting/index.tsx index 4ba9d272..e374c8a3 100644 --- a/src/pages/WorkSpace/TestPlan/PlanForm/components/ReportSetting/index.tsx +++ b/src/pages/WorkSpace/TestPlan/PlanForm/components/ReportSetting/index.tsx @@ -159,7 +159,7 @@ export default forwardRef((props: any, ref: any) => { }>
- +
{ desc={ <> - {`{Job_name}_report-{report_seq_id}`} + {`{date} {plan_name} {plan_id} {product_version}`} } /> diff --git a/src/pages/WorkSpace/TestPlan/locales/en-US.ts b/src/pages/WorkSpace/TestPlan/locales/en-US.ts index ae7cf6d1..20cd3331 100644 --- a/src/pages/WorkSpace/TestPlan/locales/en-US.ts +++ b/src/pages/WorkSpace/TestPlan/locales/en-US.ts @@ -114,7 +114,7 @@ export default { 'plan.custom.script.cannot.empty': 'Custom script cannot be empty', 'plan.checked': 'Checked', 'plan.unChecked': 'Unchecked', - 'plan.report_name.placeholder': 'Please enter a report name,for example:{Job_name}_report-{report_seq_id}', + 'plan.report_name.placeholder': 'Please enter a report name,for example:{date} {plan_name} {plan_id} {product_version}', 'plan.available.placeholders': 'Report names can be represented by placeholders:', 'plan.select.report.template': 'Select report template', 'plan.drawer.template_ellipsis.wraning': "The number of test templates in a single test phase shall not exceed 15!", diff --git a/src/pages/WorkSpace/TestPlan/locales/zh-CN.ts b/src/pages/WorkSpace/TestPlan/locales/zh-CN.ts index 8da2d27d..615d5571 100644 --- a/src/pages/WorkSpace/TestPlan/locales/zh-CN.ts +++ b/src/pages/WorkSpace/TestPlan/locales/zh-CN.ts @@ -117,7 +117,7 @@ export default { 'plan.custom.script.cannot.empty': '自定义脚本不能为空', 'plan.checked': '开', 'plan.unChecked': '关', - 'plan.report_name.placeholder': '请输入报告名称,例如:{Job_name}_report-{report_seq_id}', + 'plan.report_name.placeholder': '请输入报告名称,例如:{date} {plan_name} {plan_id} {product_version}', 'plan.available.placeholders': '报告名称可用占位符:', 'plan.select.report.template': '选择报告模板', 'plan.drawer.template_ellipsis.wraning': "单个测试阶段中测试模版数量不得超过15个!", -- Gitee From bfba8454b53ce0e0f8755031c0f629f673369f40 Mon Sep 17 00:00:00 2001 From: tianweiweiliang <875658254@qq.com> Date: Fri, 23 Aug 2024 18:06:53 +0800 Subject: [PATCH 31/31] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=B9?= =?UTF-8?q?=E6=AF=94=E5=88=86=E6=9E=90=E5=88=86=E7=BB=84=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E4=B8=8Bws=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestAnalysis/AnalysisCompare/CommonMethod.tsx | 9 +++++++-- .../AnalysisCompare/Modals/Tables/Job.tsx | 4 ++-- .../TestAnalysis/AnalysisCompare/PublicMethod.tsx | 1 + .../TestAnalysis/AnalysisCompare/index.tsx | 14 ++++++++------ .../NewReport/components/ReportFunction.tsx | 2 +- .../components/TestDataChild/FuncReview.tsx | 6 ++++-- .../components/TestDataChild/PrefReview.tsx | 8 +++++--- .../TestReport/components/WsListSelect/index.tsx | 2 +- .../WorkSpace/TestResult/CompareBar/index.tsx | 2 +- 9 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/CommonMethod.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/CommonMethod.tsx index b5ecde9f..3e180e4c 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/CommonMethod.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/CommonMethod.tsx @@ -130,8 +130,13 @@ const getSelectedDataFn = ( arr.push(item.id) } - if (arr.length > 0) - group_jobs.push({ job_list: arr, is_baseline: item.type === 'baseline' ? 1 : 0, ws_id: item.selectedWsId }) + if (arr.length > 0) { + group_jobs.push({ + job_list: arr, + is_baseline: item.type === 'baseline' ? 1 : 0, + ws_id: item.selectedWsId || item.ws_id, + }) + } }) Object.values(suite).forEach((obj: any) => { obj.base_index = baseIndex diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx index 4d2b2405..35893f8d 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/Modals/Tables/Job.tsx @@ -315,7 +315,7 @@ const AddJobTable: React.FC = (props) => { allClear: true, optionFilterProp: "children", disabled: !!selectedRowDatas.length, - style: { flex: 1 }, + style: { flex: 1, overflow: 'hidden' }, filterOption: (input: any, option: any) => option.label?.toLowerCase().indexOf(input.toLowerCase()) >= 0 } @@ -331,7 +331,7 @@ const AddJobTable: React.FC = (props) => { ws_id={ws_id} value={selectedWsId} onSelect={onWsChange} - style={{ flex: 1, overflow: 'hidden' }} + style={{ flex: 1 }} />
diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/PublicMethod.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/PublicMethod.tsx index 8e470c64..f5ace40a 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/PublicMethod.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/PublicMethod.tsx @@ -27,6 +27,7 @@ export const transformIdFn = (selectedJob: any) => { members } }) + // console.log('arr:', arr) return arr } diff --git a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/index.tsx b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/index.tsx index f3a4e43d..28fce7a4 100644 --- a/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/index.tsx +++ b/src/pages/WorkSpace/TestAnalysis/AnalysisCompare/index.tsx @@ -130,6 +130,7 @@ export default (props: any) => { members: brr, product_version: brr[0]?.['product_version'], product_id: brr[0]?.['product_id'], + ws_id: brr[0]?.['ws_id'], } }) newNoGroup.current = newGroup @@ -145,7 +146,7 @@ export default (props: any) => { if (remainArr.length) snGroupingFn(remainArr, newGroup) if (!remainArr.length) { newGroup = newGroup.map((brr: any) => { - return { members: brr, product_version: brr[0]['product_version'], server: brr[0]['server'] } + return { members: brr, product_version: brr[0]['product_version'], server: brr[0]['server'], ws_id: brr[0]?.['ws_id'] } }) newNoGroup.current = newGroup } @@ -169,6 +170,7 @@ export default (props: any) => { const addGroup = { product_version: obj.product_version, members: obj.members, + selectedWsId: obj.ws_id || ws_id, product_id: obj.product_id, name, type: 'job', @@ -210,6 +212,7 @@ export default (props: any) => { const addGroup = { product_version: obj.product_version, members: obj.members, + selectedWsId: obj.ws_id || ws_id, product_id: obj.product_id, name, type: 'job', @@ -260,6 +263,7 @@ export default (props: any) => { product_version: undefined, product_id: undefined, members: [], + selectedWsId: ws_id, name, type, id: uuid() @@ -413,7 +417,6 @@ export default (props: any) => { const handleSureOk = (suiteData: any) => { // suiteData:已选的 const params: any = handleDomainList(suiteData) const paramEenvironment = handlEenvironment(suiteData) - // console.log('paramEenvironment:', paramEenvironment) setLoading(true) Promise.all([queryDomainGroupFn(params)]) .then((result: any) => { @@ -574,7 +577,6 @@ export default (props: any) => { base_group, compare_groups } - // console.log(paramData) return paramData } @@ -684,11 +686,11 @@ export default (props: any) => { } } realGroup.type = groupArr[startGroupIndex].type + realGroup.selectedWsId = groupArr[startGroupIndex].selectedWsId return groupArr; }; const diferentDeorderTwo = (noGoupArr: any, groupArr: any, startIndex: number, endIndex: number, endGroupIndex: number) => { - // console.log(groupArr) const realGroup = groupArr[endGroupIndex] const arr = _.cloneDeep(realGroup.members) const [removed] = noGoupArr.splice(startIndex, 1); @@ -819,7 +821,7 @@ export default (props: any) => { const newGroupData = transformIdFn(_.cloneDeep(groupData)) const newNoGroupData = transformNoGroupIdFn(noGroupData) - + const scroll = { // 最大高度,内容超出该高度会出现滚动条 height: layoutHeight - 329 + 8 - 22 - 5, @@ -1259,7 +1261,7 @@ export default (props: any) => { ref={deleteGroupModalRef} onOk={handleDelGroup} /> - + { const { conf_id, conf_name, metric_list } = conf let baseJobList = isOldReport ? [conf?.obj_id || conf.conf_source?.obj_id] : [] - let compareJobList = (conf.conf_compare_data || conf.compare_conf_list).map((i: any) => ({ job_id: i?.obj_id || '', is_baseline: i?.is_baseline })) + let compareJobList = (conf.conf_compare_data || conf.compare_conf_list).map((i: any) => ({ job_id: i?.obj_id || '', is_baseline: i?.is_baseline, ws_id: i?.ws_id })) conf_list.push({ conf_id, conf_name, diff --git a/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/FuncReview.tsx b/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/FuncReview.tsx index 4c472a89..dd9f6b3b 100644 --- a/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/FuncReview.tsx +++ b/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/FuncReview.tsx @@ -377,7 +377,7 @@ const FuncDataIndex: React.FC = (props) => { else setExpandKeys(expandKeys.concat(id)) } - + const functionTable = Array.isArray(funcData.list) && !!funcData.list.length ? funcData?.list?.map((suite: any, idx: number) => { return ( @@ -506,6 +506,8 @@ const FuncDataIndex: React.FC = (props) => { { dataList?.map((item: any, idx: number) => { + // selected_ws_id 这段逻辑,用于兼容老数据,后续删除 + const selected_ws_id = suite.group_jobs?.filter((jobObj: any)=> jobObj?.job_list?.includes(item.obj_id))[0].ws_id || wsId return ( @@ -514,7 +516,7 @@ const FuncDataIndex: React.FC = (props) => { {toShowNum(item.fail_case)} { !share_id && !getCompareType(item) && - + } diff --git a/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/PrefReview.tsx b/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/PrefReview.tsx index 3d83a4e8..8624f4fb 100644 --- a/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/PrefReview.tsx +++ b/src/pages/WorkSpace/TestReport/NewReport/components/TestDataChild/PrefReview.tsx @@ -211,7 +211,7 @@ const Performance = (props: any) => { })) } - const renderShare = (conf: any) => { + const renderShare = (conf: any, group_jobs: any) => { let objList: any = [] let objConf = conf?.conf_source || conf allGroupData?.map((c: any, i: number) => { @@ -224,11 +224,13 @@ const Performance = (props: any) => { return ( arr.map((item: any, idx: number) => { if (!item) return <> + // selected_ws_id 这段逻辑,用于兼容老数据,后续删除 + const selected_ws_id = group_jobs?.filter((jobObj: any)=> jobObj?.job_list?.includes(item.obj_id))[0].ws_id || wsId return ( { !share_id && !getCompareType(item) ? - : + :
} @@ -349,7 +351,7 @@ const Performance = (props: any) => { - {renderShare(conf)} + {renderShare(conf, suite.group_jobs)} { conf.metric_list.map((metric: any, idx: number) => ( diff --git a/src/pages/WorkSpace/TestReport/components/WsListSelect/index.tsx b/src/pages/WorkSpace/TestReport/components/WsListSelect/index.tsx index 3068a847..9f469043 100644 --- a/src/pages/WorkSpace/TestReport/components/WsListSelect/index.tsx +++ b/src/pages/WorkSpace/TestReport/components/WsListSelect/index.tsx @@ -86,7 +86,7 @@ const WsListSelect: React.FC = ({ ws_id, onChange=()=> {}, onSelect=()=> {} return (