diff --git a/src/pages/RefenerceDetail/index.tsx b/src/pages/RefenerceDetail/index.tsx index cfb165abbe91447f459c4c0585ad875f980cda75..240de358850830dd0b69cfa661f282d8abab0b89 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 } } = useLocation() as any const [JobTotal, setJobTotal] = useState(0) const [JobData, setJobData] = useState([]) const [TempTotal, setTempTotal] = useState(0) @@ -89,17 +89,28 @@ const Refenerce = (props: any) => { } const queryListData = async () => { - const { id } = source + const { id, visible_range, optionType } = 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 (optionType === "edit") { + JobObj.visible_range = visible_range + TempObj.visible_range = visible_range + } const { total, data, code, msg } = await queryConfirm(JobObj) if (code !== 200) { requestCodeMessage(code, msg) diff --git a/src/pages/SystemConf/TestSuite/BasicTest/components/AddSuiteTest.tsx b/src/pages/SystemConf/TestSuite/BasicTest/components/AddSuiteTest.tsx index 462c9e8bf5a5250358e7ae8b6b9575164cc370fb..920157ed5a85429ec92fa023b77d561b586a61b8 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 d5c3d4ad964b399db5da11eab276557bcb6231a8..caa2f54a5a8da5e66b03e0a8cec44d688b2ccffb 100644 --- a/src/pages/SystemConf/TestSuite/BasicTest/components/DeleteTips.tsx +++ b/src/pages/SystemConf/TestSuite/BasicTest/components/DeleteTips.tsx @@ -34,8 +34,7 @@ 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}`) } @@ -47,11 +46,11 @@ const DeleteTip: React.ForwardRefRenderFunction = (props, ref) => open={visible} onCancel={hanldeCancel} footer={[ - , + // , 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 0000000000000000000000000000000000000000..d0ae110db9d88c578c32dd9907333ee3c79fc4a8 --- /dev/null +++ b/src/pages/SystemConf/TestSuite/BasicTest/components/SynchronizeModal.tsx @@ -0,0 +1,74 @@ +/* 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 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? `&case_id_list=${case_id_list}`: ''}`) + } + + 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 efd4563c37d9f0545d90cf677924690cc5c32012..775c849bfdf60416031e1d3dc39d0c56f2e49b93 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 8f584c6a00901e3dbc5b81d61ab4f2205c750838..df40ff88d08f474c9df93630f8dd7603648a014e 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 1f9cd5c1997635485d65968ba36b0a9f9001a599..845846fb7fdba1206cd0e773fa30e29bce452678 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 1064fc3b4540ff2e58ce92a333422d59bbc8d8bd..7b87b654252b157ac926e35f93deb27d4abf1aab 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 e275adf0ce940391c9cfefd24a7679209c22f19a..c6ce2309881a0d8ebcba2324887d5af1e53bfa5b 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' && + + } + + ) } diff --git a/src/pages/SystemConf/TestSuite/locales/en-US.ts b/src/pages/SystemConf/TestSuite/locales/en-US.ts index 220aa6493736d772431bc6e269fb4cb4c0ae339c..c482145508e8b4e4478c019edcf188f9c19d5623 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 fbcd1bd2e9aa114236a7531e7e5f98e58f93a7b0..b489a6b21b88eab060161cfb4b784428f85b1738 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 1910625b112eaa41f605188a6404f4c0ff3cc48e..fa0165c3f35ae9218457d3f9731f5e6aa45622d7 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 e5b4fd8dcb70b5317fe7747bdc11a7ee2b029bee..1c26fee42fc5b4c94dc6e916d7484cda2e2ee3b2 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 a384d105bc0a8e6a10ffdec71961ed6d8249f9ec..01a2e3f8b0ed48dac0f9226dfef861875523e812 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 f5e5f7f9e5ffd7c0e75d8bdef91979581000740a..7225f10d4e4f8e5efcd8858d898acbe1236da590 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/pages/WorkSpace/Dashboard/Project/components/JobTable.tsx b/src/pages/WorkSpace/Dashboard/Project/components/JobTable.tsx index a1f8c9991ad8b634d599fbd8ed35aac965c2dd65..ff4e7c1868980d1f40063a403578c5fcb23f0231 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; diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 3b408900ab8e3c22fe10ec139897002194c15d2c..f9e988d1ba329176a753b6fdb5f787c2c1fa210b 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: '系统管理员' },