whistle.mock-plugins 1.1.1-dev.10 → 1.1.1-dev.12
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
|
@@ -172,6 +172,7 @@ const InterfaceManagement = () => {
|
|
|
172
172
|
|
|
173
173
|
setInterfaces(processedInterfaces);
|
|
174
174
|
console.log('处理后的接口列表:', processedInterfaces);
|
|
175
|
+
console.log('接口分组信息:', processedInterfaces.map(item => ({ id: item.id, name: item.name, group: item.group })));
|
|
175
176
|
|
|
176
177
|
// 提取并更新分组列表
|
|
177
178
|
updateGroups(processedInterfaces);
|
|
@@ -250,7 +251,8 @@ const InterfaceManagement = () => {
|
|
|
250
251
|
activeResponseId: defaultResponseId,
|
|
251
252
|
httpMethod: 'ALL',
|
|
252
253
|
headerItems: [], // 初始化为空数组
|
|
253
|
-
paramMatchers: [] // 初始化为空数组
|
|
254
|
+
paramMatchers: [], // 初始化为空数组
|
|
255
|
+
group: undefined // 确保分组字段为undefined,而不是空字符串
|
|
254
256
|
});
|
|
255
257
|
|
|
256
258
|
setCurrentResponseId(defaultResponseId);
|
|
@@ -297,10 +299,16 @@ const InterfaceManagement = () => {
|
|
|
297
299
|
}));
|
|
298
300
|
}
|
|
299
301
|
|
|
302
|
+
// 处理分组值,确保它是字符串而不是数组
|
|
303
|
+
let groupValue = record.group;
|
|
304
|
+
if (Array.isArray(groupValue)) {
|
|
305
|
+
groupValue = groupValue.length > 0 ? groupValue[0] : undefined;
|
|
306
|
+
}
|
|
307
|
+
|
|
300
308
|
// 设置表单值
|
|
301
309
|
form.setFieldsValue({
|
|
302
310
|
name: record.name,
|
|
303
|
-
group:
|
|
311
|
+
group: groupValue || undefined, // 使用undefined而不是空字符串
|
|
304
312
|
pattern: record.urlPattern,
|
|
305
313
|
proxyType: record.proxyType || 'response',
|
|
306
314
|
statusCode: (record.httpStatus || record.statusCode || 200).toString(),
|
|
@@ -314,6 +322,8 @@ const InterfaceManagement = () => {
|
|
|
314
322
|
responseDelay: record.responseDelay ? record.responseDelay.toString() : '0'
|
|
315
323
|
});
|
|
316
324
|
|
|
325
|
+
console.log('编辑接口时设置的分组值:', groupValue);
|
|
326
|
+
|
|
317
327
|
setCurrentResponseId(activeResponseId);
|
|
318
328
|
setEditingInterface(record);
|
|
319
329
|
setModalVisible(true);
|
|
@@ -373,10 +383,16 @@ const InterfaceManagement = () => {
|
|
|
373
383
|
});
|
|
374
384
|
}
|
|
375
385
|
|
|
386
|
+
// 处理分组值,确保它是字符串而不是数组
|
|
387
|
+
let groupValue = values.group;
|
|
388
|
+
if (Array.isArray(groupValue)) {
|
|
389
|
+
groupValue = groupValue.length > 0 ? groupValue[0] : '';
|
|
390
|
+
}
|
|
391
|
+
|
|
376
392
|
// 构建接口数据
|
|
377
393
|
const interfaceData = {
|
|
378
394
|
name: values.name,
|
|
379
|
-
group:
|
|
395
|
+
group: groupValue || '', // 确保group不为undefined
|
|
380
396
|
urlPattern: values.pattern,
|
|
381
397
|
proxyType: values.proxyType,
|
|
382
398
|
featureId: selectedFeatureId,
|
|
@@ -389,6 +405,8 @@ const InterfaceManagement = () => {
|
|
|
389
405
|
active: true
|
|
390
406
|
};
|
|
391
407
|
|
|
408
|
+
console.log('提交的分组值:', groupValue);
|
|
409
|
+
|
|
392
410
|
// 根据代理类型添加不同字段
|
|
393
411
|
if (values.proxyType === 'redirect' || values.proxyType === 'url_redirect') {
|
|
394
412
|
interfaceData.targetUrl = values.targetUrl;
|
|
@@ -1157,8 +1175,18 @@ const InterfaceManagement = () => {
|
|
|
1157
1175
|
placeholder="选择或创建分组"
|
|
1158
1176
|
showSearch
|
|
1159
1177
|
allowClear
|
|
1178
|
+
style={{ width: '100%' }}
|
|
1160
1179
|
mode="tags"
|
|
1161
|
-
|
|
1180
|
+
maxTagCount="responsive"
|
|
1181
|
+
maxTagTextLength={10}
|
|
1182
|
+
onChange={(value) => {
|
|
1183
|
+
// 如果值是数组(tags模式),只取第一个元素
|
|
1184
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
1185
|
+
// 如果第一个元素是空字符串,则设置为undefined
|
|
1186
|
+
const groupValue = value[0] === '' ? undefined : value[0];
|
|
1187
|
+
form.setFieldsValue({ group: groupValue });
|
|
1188
|
+
}
|
|
1189
|
+
}}
|
|
1162
1190
|
onInputKeyDown={(e) => {
|
|
1163
1191
|
// 防止回车键提交表单
|
|
1164
1192
|
if (e.key === 'Enter') {
|