whistle.mock-plugins 1.2.0-beta.8 → 1.2.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import AppLayout from '../components/AppLayout';
|
|
|
4
4
|
import {
|
|
5
5
|
Table, Button, Modal, Form, Input, Select, message, Switch,
|
|
6
6
|
Popconfirm, Alert, Space, Card, Badge, Tooltip, Row, Col,
|
|
7
|
-
Popover, Checkbox, Tag, Input as AntInput, Radio, Drawer
|
|
7
|
+
Popover, Checkbox, Tag, Input as AntInput, Radio, Drawer, Divider
|
|
8
8
|
} from 'antd';
|
|
9
9
|
import {
|
|
10
10
|
PlusOutlined, EditOutlined, DeleteOutlined,
|
|
@@ -64,6 +64,7 @@ const InterfaceManagement = () => {
|
|
|
64
64
|
const [groups, setGroups] = useState([]);
|
|
65
65
|
const [selectedGroup, setSelectedGroup] = useState(null);
|
|
66
66
|
const [groupActionLoading, setGroupActionLoading] = useState(false);
|
|
67
|
+
const [newGroupName, setNewGroupName] = useState('');
|
|
67
68
|
|
|
68
69
|
// 模态框状态
|
|
69
70
|
const [modalVisible, setModalVisible] = useState(false);
|
|
@@ -216,6 +217,17 @@ const InterfaceManagement = () => {
|
|
|
216
217
|
setSelectedGroup(null);
|
|
217
218
|
}
|
|
218
219
|
};
|
|
220
|
+
|
|
221
|
+
// 添加新分组
|
|
222
|
+
const addNewGroup = () => {
|
|
223
|
+
if (newGroupName.trim() && !groups.includes(newGroupName.trim())) {
|
|
224
|
+
const updatedGroups = [...groups, newGroupName.trim()].sort();
|
|
225
|
+
setGroups(updatedGroups);
|
|
226
|
+
setNewGroupName('');
|
|
227
|
+
return newGroupName.trim();
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
230
|
+
};
|
|
219
231
|
|
|
220
232
|
// 根据分组和搜索关键词筛选接口
|
|
221
233
|
const getFilteredInterfaces = () => {
|
|
@@ -1312,6 +1324,41 @@ const InterfaceManagement = () => {
|
|
|
1312
1324
|
e.stopPropagation();
|
|
1313
1325
|
}
|
|
1314
1326
|
}}
|
|
1327
|
+
dropdownRender={(menu) => (
|
|
1328
|
+
<div>
|
|
1329
|
+
{menu}
|
|
1330
|
+
<Divider style={{ margin: '4px 0' }} />
|
|
1331
|
+
<div style={{ display: 'flex', flexWrap: 'nowrap', padding: 8 }}>
|
|
1332
|
+
<Input
|
|
1333
|
+
style={{ flex: 'auto' }}
|
|
1334
|
+
value={newGroupName}
|
|
1335
|
+
onChange={(e) => setNewGroupName(e.target.value)}
|
|
1336
|
+
placeholder="输入新分组名称"
|
|
1337
|
+
onPressEnter={(e) => {
|
|
1338
|
+
e.stopPropagation();
|
|
1339
|
+
const groupName = addNewGroup();
|
|
1340
|
+
if (groupName) {
|
|
1341
|
+
form.setFieldsValue({ group: groupName });
|
|
1342
|
+
}
|
|
1343
|
+
}}
|
|
1344
|
+
/>
|
|
1345
|
+
<Button
|
|
1346
|
+
type="text"
|
|
1347
|
+
icon={<PlusOutlined />}
|
|
1348
|
+
style={{ flex: 'none', padding: '4px 8px', cursor: 'pointer' }}
|
|
1349
|
+
onClick={(e) => {
|
|
1350
|
+
e.stopPropagation();
|
|
1351
|
+
const groupName = addNewGroup();
|
|
1352
|
+
if (groupName) {
|
|
1353
|
+
form.setFieldsValue({ group: groupName });
|
|
1354
|
+
}
|
|
1355
|
+
}}
|
|
1356
|
+
>
|
|
1357
|
+
添加
|
|
1358
|
+
</Button>
|
|
1359
|
+
</div>
|
|
1360
|
+
</div>
|
|
1361
|
+
)}
|
|
1315
1362
|
>
|
|
1316
1363
|
{Array.from(new Set(interfaces.map(item => item.group).filter(Boolean))).map(group => (
|
|
1317
1364
|
<Option key={group} value={group}>{group}</Option>
|
|
@@ -10,7 +10,7 @@ import AppLayout from '../components/AppLayout';
|
|
|
10
10
|
import {
|
|
11
11
|
Table, Button, Modal, Form, Input, Select, message, Switch,
|
|
12
12
|
Popconfirm, Alert, Space, Card, Badge, Tooltip, Row, Col,
|
|
13
|
-
Popover, Checkbox, Tag, Input as AntInput, Radio, Drawer, Dropdown, Menu, Collapse
|
|
13
|
+
Popover, Checkbox, Tag, Input as AntInput, Radio, Drawer, Dropdown, Menu, Collapse, Divider
|
|
14
14
|
} from 'antd';
|
|
15
15
|
import {
|
|
16
16
|
PlusOutlined, EditOutlined, DeleteOutlined,
|
|
@@ -70,6 +70,7 @@ const InterfaceManagement = () => {
|
|
|
70
70
|
const [groups, setGroups] = useState([]);
|
|
71
71
|
const [selectedGroup, setSelectedGroup] = useState(null);
|
|
72
72
|
const [groupActionLoading, setGroupActionLoading] = useState(false);
|
|
73
|
+
const [newGroupName, setNewGroupName] = useState('');
|
|
73
74
|
|
|
74
75
|
// 模态框状态
|
|
75
76
|
const [modalVisible, setModalVisible] = useState(false);
|
|
@@ -222,6 +223,17 @@ const InterfaceManagement = () => {
|
|
|
222
223
|
setSelectedGroup(null);
|
|
223
224
|
}
|
|
224
225
|
};
|
|
226
|
+
|
|
227
|
+
// 添加新分组
|
|
228
|
+
const addNewGroup = () => {
|
|
229
|
+
if (newGroupName.trim() && !groups.includes(newGroupName.trim())) {
|
|
230
|
+
const updatedGroups = [...groups, newGroupName.trim()].sort();
|
|
231
|
+
setGroups(updatedGroups);
|
|
232
|
+
setNewGroupName('');
|
|
233
|
+
return newGroupName.trim();
|
|
234
|
+
}
|
|
235
|
+
return null;
|
|
236
|
+
};
|
|
225
237
|
|
|
226
238
|
// 根据分组和搜索关键词筛选接口
|
|
227
239
|
const getFilteredInterfaces = () => {
|
|
@@ -1367,6 +1379,41 @@ const InterfaceManagement = () => {
|
|
|
1367
1379
|
e.stopPropagation();
|
|
1368
1380
|
}
|
|
1369
1381
|
}}
|
|
1382
|
+
dropdownRender={(menu) => (
|
|
1383
|
+
<div>
|
|
1384
|
+
{menu}
|
|
1385
|
+
<Divider style={{ margin: '4px 0' }} />
|
|
1386
|
+
<div style={{ display: 'flex', flexWrap: 'nowrap', padding: 8 }}>
|
|
1387
|
+
<Input
|
|
1388
|
+
style={{ flex: 'auto' }}
|
|
1389
|
+
value={newGroupName}
|
|
1390
|
+
onChange={(e) => setNewGroupName(e.target.value)}
|
|
1391
|
+
placeholder="输入新分组名称"
|
|
1392
|
+
onPressEnter={(e) => {
|
|
1393
|
+
e.stopPropagation();
|
|
1394
|
+
const groupName = addNewGroup();
|
|
1395
|
+
if (groupName) {
|
|
1396
|
+
form.setFieldsValue({ group: groupName });
|
|
1397
|
+
}
|
|
1398
|
+
}}
|
|
1399
|
+
/>
|
|
1400
|
+
<Button
|
|
1401
|
+
type="text"
|
|
1402
|
+
icon={<PlusOutlined />}
|
|
1403
|
+
style={{ flex: 'none', padding: '4px 8px', cursor: 'pointer' }}
|
|
1404
|
+
onClick={(e) => {
|
|
1405
|
+
e.stopPropagation();
|
|
1406
|
+
const groupName = addNewGroup();
|
|
1407
|
+
if (groupName) {
|
|
1408
|
+
form.setFieldsValue({ group: groupName });
|
|
1409
|
+
}
|
|
1410
|
+
}}
|
|
1411
|
+
>
|
|
1412
|
+
添加
|
|
1413
|
+
</Button>
|
|
1414
|
+
</div>
|
|
1415
|
+
</div>
|
|
1416
|
+
)}
|
|
1370
1417
|
>
|
|
1371
1418
|
{Array.from(new Set(interfaces.map(item => item.group).filter(Boolean))).map(group => (
|
|
1372
1419
|
<Option key={group} value={group}>{group}</Option>
|