|
|
|
@ -4,10 +4,11 @@ import { getTreeComponents } from '@/api/componentTestCase';
|
|
|
|
import { runStatusConstant, runStatusDic, runTypeConstant, runTypeDic } from '@/const/isdp/componentDeploy';
|
|
|
|
import { runStatusConstant, runStatusDic, runTypeConstant, runTypeDic } from '@/const/isdp/componentDeploy';
|
|
|
|
import dayjs from 'dayjs';
|
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
|
|
|
|
|
|
const InstanceList = ({ identifier, refreshKey, onGoToTest }: {
|
|
|
|
const InstanceList = ({ identifier, refreshKey, onGoToTest, searchValue }: {
|
|
|
|
identifier: string;
|
|
|
|
identifier: string;
|
|
|
|
refreshKey: number;
|
|
|
|
refreshKey: number;
|
|
|
|
onGoToTest: (instance: any) => void;
|
|
|
|
onGoToTest: (instance: any) => void;
|
|
|
|
|
|
|
|
searchValue?: string;
|
|
|
|
}) => {
|
|
|
|
}) => {
|
|
|
|
const [data, setData] = useState([]);
|
|
|
|
const [data, setData] = useState([]);
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
@ -39,6 +40,20 @@ const InstanceList = ({ identifier, refreshKey, onGoToTest }: {
|
|
|
|
fetchInstanceData(identifier);
|
|
|
|
fetchInstanceData(identifier);
|
|
|
|
}, [identifier, refreshKey]);
|
|
|
|
}, [identifier, refreshKey]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据搜索值过滤数据
|
|
|
|
|
|
|
|
const filteredData = React.useMemo(() => {
|
|
|
|
|
|
|
|
if (!searchValue || searchValue.trim() === '') {
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const searchTerm = searchValue.toLowerCase().trim();
|
|
|
|
|
|
|
|
return data.filter((item: any) => {
|
|
|
|
|
|
|
|
const identifier = (item.identifier || '').toLowerCase();
|
|
|
|
|
|
|
|
const name = (item.name || '').toLowerCase();
|
|
|
|
|
|
|
|
return identifier.includes(searchTerm) || name.includes(searchTerm);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}, [data, searchValue]);
|
|
|
|
|
|
|
|
|
|
|
|
// 定义表格列
|
|
|
|
// 定义表格列
|
|
|
|
const columns: TableColumnProps[] = [
|
|
|
|
const columns: TableColumnProps[] = [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -95,7 +110,7 @@ const InstanceList = ({ identifier, refreshKey, onGoToTest }: {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Table
|
|
|
|
<Table
|
|
|
|
columns={columns}
|
|
|
|
columns={columns}
|
|
|
|
data={data}
|
|
|
|
data={filteredData}
|
|
|
|
loading={loading}
|
|
|
|
loading={loading}
|
|
|
|
pagination={false}
|
|
|
|
pagination={false}
|
|
|
|
rowKey="id"
|
|
|
|
rowKey="id"
|
|
|
|
|