whistle.mock-plugins 1.1.3-beta.3 → 1.1.3-dev.5
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.
|
@@ -73,8 +73,6 @@
|
|
|
73
73
|
|
|
74
74
|
/** */
|
|
75
75
|
|
|
76
|
-
/** */
|
|
77
|
-
|
|
78
76
|
/** */
|
|
79
77
|
|
|
80
78
|
/** */
|
|
@@ -93,8 +91,6 @@
|
|
|
93
91
|
|
|
94
92
|
/** */
|
|
95
93
|
|
|
96
|
-
/** */
|
|
97
|
-
|
|
98
94
|
/** */
|
|
99
95
|
|
|
100
96
|
/** */
|
|
@@ -129,6 +125,8 @@
|
|
|
129
125
|
|
|
130
126
|
/** */
|
|
131
127
|
|
|
128
|
+
/** */
|
|
129
|
+
|
|
132
130
|
/** */
|
|
133
131
|
|
|
134
132
|
/** */
|
|
@@ -160,5 +158,3 @@
|
|
|
160
158
|
/** */
|
|
161
159
|
|
|
162
160
|
/** */
|
|
163
|
-
|
|
164
|
-
/** */
|
package/package.json
CHANGED
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
PlusOutlined, EditOutlined, DeleteOutlined,
|
|
11
11
|
FileTextOutlined, PlusCircleOutlined, SettingOutlined,
|
|
12
|
-
SearchOutlined, FilterOutlined,
|
|
13
|
-
UnorderedListOutlined, ReloadOutlined
|
|
12
|
+
SearchOutlined, FilterOutlined, ReloadOutlined
|
|
14
13
|
} from '@ant-design/icons';
|
|
15
14
|
import '../styles/interface-management.css';
|
|
16
15
|
import axios from 'axios';
|
|
@@ -78,9 +77,8 @@ const InterfaceManagement = () => {
|
|
|
78
77
|
const [previewContent, setPreviewContent] = useState(null);
|
|
79
78
|
const [currentResponseId, setCurrentResponseId] = useState(null);
|
|
80
79
|
|
|
81
|
-
//
|
|
80
|
+
// 搜索状态
|
|
82
81
|
const [searchValue, setSearchValue] = useState('');
|
|
83
|
-
const [viewMode, setViewMode] = useState('table'); // 'table' or 'card'
|
|
84
82
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
85
83
|
const [drawerVisible, setDrawerVisible] = useState(false);
|
|
86
84
|
|
|
@@ -605,10 +603,7 @@ const InterfaceManagement = () => {
|
|
|
605
603
|
setSelectedRowKeys(selectedKeys);
|
|
606
604
|
};
|
|
607
605
|
|
|
608
|
-
|
|
609
|
-
const toggleViewMode = () => {
|
|
610
|
-
setViewMode(viewMode === 'table' ? 'card' : 'table');
|
|
611
|
-
};
|
|
606
|
+
|
|
612
607
|
|
|
613
608
|
// 刷新数据
|
|
614
609
|
const refreshData = () => {
|
|
@@ -1004,12 +999,7 @@ const InterfaceManagement = () => {
|
|
|
1004
999
|
loading={interfacesLoading}
|
|
1005
1000
|
/>
|
|
1006
1001
|
</Tooltip>
|
|
1007
|
-
|
|
1008
|
-
<Button
|
|
1009
|
-
icon={viewMode === 'table' ? <AppstoreOutlined /> : <UnorderedListOutlined />}
|
|
1010
|
-
onClick={toggleViewMode}
|
|
1011
|
-
/>
|
|
1012
|
-
</Tooltip>
|
|
1002
|
+
|
|
1013
1003
|
<Button
|
|
1014
1004
|
type="primary"
|
|
1015
1005
|
icon={<PlusOutlined />}
|
|
@@ -1232,154 +1222,32 @@ const InterfaceManagement = () => {
|
|
|
1232
1222
|
</div>
|
|
1233
1223
|
|
|
1234
1224
|
<Card className="list-container-card" bordered={false} bodyStyle={{ padding: 0 }}>
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
/>
|
|
1262
|
-
</div>
|
|
1263
|
-
)}
|
|
1264
|
-
|
|
1265
|
-
{/* 卡片视图 */}
|
|
1266
|
-
{viewMode === 'card' && (
|
|
1267
|
-
<div className="interface-card-view">
|
|
1268
|
-
<Row gutter={[16, 16]} style={{ padding: 16 }}>
|
|
1269
|
-
{interfacesLoading ? (
|
|
1270
|
-
[1,2,3,4,5,6].map(i => (
|
|
1271
|
-
<Col xs={24} sm={12} md={8} lg={8} xl={6} key={`loading-${i}`}>
|
|
1272
|
-
<Card loading style={{ height: 180 }} />
|
|
1273
|
-
</Col>
|
|
1274
|
-
))
|
|
1275
|
-
) : filteredInterfaces.length === 0 ? (
|
|
1276
|
-
<Col span={24}>
|
|
1277
|
-
<div className="empty-data">暂无接口配置</div>
|
|
1278
|
-
</Col>
|
|
1279
|
-
) : (
|
|
1280
|
-
filteredInterfaces.map(item => (
|
|
1281
|
-
<Col xs={24} sm={12} md={8} lg={8} xl={6} key={item.id}>
|
|
1282
|
-
<Card
|
|
1283
|
-
className={`interface-card ${item.active === false ? 'inactive' : ''}`}
|
|
1284
|
-
hoverable
|
|
1285
|
-
>
|
|
1286
|
-
<div className="interface-card-header">
|
|
1287
|
-
<Switch
|
|
1288
|
-
checked={item.active !== false}
|
|
1289
|
-
onChange={(checked) => handleToggleActive(item.id, item.active !== false)}
|
|
1290
|
-
size="small"
|
|
1291
|
-
className="interface-card-switch"
|
|
1292
|
-
/>
|
|
1293
|
-
<div className="interface-card-title">{item.name}</div>
|
|
1294
|
-
{item.group && (
|
|
1295
|
-
<Tag
|
|
1296
|
-
color="blue"
|
|
1297
|
-
className="interface-card-group"
|
|
1298
|
-
onClick={() => setSelectedGroup(item.group)}
|
|
1299
|
-
>
|
|
1300
|
-
{item.group}
|
|
1301
|
-
</Tag>
|
|
1302
|
-
)}
|
|
1303
|
-
</div>
|
|
1304
|
-
|
|
1305
|
-
<div className="interface-card-content">
|
|
1306
|
-
<div className="url-pattern-container">
|
|
1307
|
-
<Tooltip title={item.urlPattern}>
|
|
1308
|
-
<div className="url-pattern">{item.urlPattern}</div>
|
|
1309
|
-
</Tooltip>
|
|
1310
|
-
</div>
|
|
1311
|
-
|
|
1312
|
-
<div className="interface-card-info">
|
|
1313
|
-
<div className="info-item">
|
|
1314
|
-
<span className="info-label">处理方式:</span>
|
|
1315
|
-
<Badge
|
|
1316
|
-
color={proxyTypes.find(t => t.value === item.proxyType)?.color || '#999'}
|
|
1317
|
-
text={proxyTypes.find(t => t.value === item.proxyType)?.label || item.proxyType}
|
|
1318
|
-
className="info-value"
|
|
1319
|
-
/>
|
|
1320
|
-
</div>
|
|
1321
|
-
<div className="info-item">
|
|
1322
|
-
<span className="info-label">状态码:</span>
|
|
1323
|
-
<span className={`status-badge status-${item.httpStatus >= 400 ? 'error' : item.httpStatus >= 300 ? 'warning' : 'success'}`}>
|
|
1324
|
-
{item.httpStatus || 200}
|
|
1325
|
-
</span>
|
|
1326
|
-
</div>
|
|
1327
|
-
</div>
|
|
1328
|
-
</div>
|
|
1329
|
-
|
|
1330
|
-
<div className="interface-card-actions">
|
|
1331
|
-
<Button
|
|
1332
|
-
type="primary"
|
|
1333
|
-
size="small"
|
|
1334
|
-
icon={<EditOutlined />}
|
|
1335
|
-
onClick={() => handleEditInterface(item)}
|
|
1336
|
-
>
|
|
1337
|
-
编辑
|
|
1338
|
-
</Button>
|
|
1339
|
-
<Popconfirm
|
|
1340
|
-
title="确定要删除此接口吗?"
|
|
1341
|
-
onConfirm={() => handleDeleteInterface(item.id)}
|
|
1342
|
-
okText="确定"
|
|
1343
|
-
cancelText="取消"
|
|
1344
|
-
>
|
|
1345
|
-
<Button
|
|
1346
|
-
danger
|
|
1347
|
-
size="small"
|
|
1348
|
-
icon={<DeleteOutlined />}
|
|
1349
|
-
>
|
|
1350
|
-
删除
|
|
1351
|
-
</Button>
|
|
1352
|
-
</Popconfirm>
|
|
1353
|
-
</div>
|
|
1354
|
-
</Card>
|
|
1355
|
-
</Col>
|
|
1356
|
-
))
|
|
1357
|
-
)}
|
|
1358
|
-
</Row>
|
|
1359
|
-
|
|
1360
|
-
{/* 卡片视图分页 */}
|
|
1361
|
-
{filteredInterfaces.length > 0 && (
|
|
1362
|
-
<div className="card-pagination">
|
|
1363
|
-
<Pagination
|
|
1364
|
-
current={tableConfig.current}
|
|
1365
|
-
pageSize={tableConfig.pageSize}
|
|
1366
|
-
total={filteredInterfaces.length}
|
|
1367
|
-
showSizeChanger
|
|
1368
|
-
showQuickJumper
|
|
1369
|
-
showTotal={(total, range) => `共 ${total} 个接口,显示第 ${range[0]}-${range[1]} 个`}
|
|
1370
|
-
pageSizeOptions={['10', '20', '50', '100']}
|
|
1371
|
-
size="default"
|
|
1372
|
-
onChange={(page, pageSize) => {
|
|
1373
|
-
saveTableConfig({
|
|
1374
|
-
current: page,
|
|
1375
|
-
pageSize: pageSize
|
|
1376
|
-
});
|
|
1377
|
-
}}
|
|
1378
|
-
/>
|
|
1379
|
-
</div>
|
|
1380
|
-
)}
|
|
1381
|
-
</div>
|
|
1382
|
-
)}
|
|
1225
|
+
<div className="interface-list-container">
|
|
1226
|
+
<Table
|
|
1227
|
+
columns={columns}
|
|
1228
|
+
dataSource={filteredInterfaces}
|
|
1229
|
+
rowKey="id"
|
|
1230
|
+
loading={interfacesLoading}
|
|
1231
|
+
onChange={handleTableChange}
|
|
1232
|
+
rowSelection={{
|
|
1233
|
+
selectedRowKeys,
|
|
1234
|
+
onChange: onSelectChange,
|
|
1235
|
+
}}
|
|
1236
|
+
size="middle"
|
|
1237
|
+
pagination={{
|
|
1238
|
+
current: tableConfig.current,
|
|
1239
|
+
pageSize: tableConfig.pageSize,
|
|
1240
|
+
showSizeChanger: true,
|
|
1241
|
+
showQuickJumper: true,
|
|
1242
|
+
showTotal: (total, range) => `共 ${total} 个接口,显示第 ${range[0]}-${range[1]} 个`,
|
|
1243
|
+
pageSizeOptions: ['10', '20', '50', '100'],
|
|
1244
|
+
size: 'default'
|
|
1245
|
+
}}
|
|
1246
|
+
locale={{ emptyText: '暂无接口配置' }}
|
|
1247
|
+
sortDirections={['ascend', 'descend']}
|
|
1248
|
+
className="interface-table"
|
|
1249
|
+
/>
|
|
1250
|
+
</div>
|
|
1383
1251
|
</Card>
|
|
1384
1252
|
|
|
1385
1253
|
{/* 接口编辑/创建模态框 */}
|