whistle.mock-plugins 1.1.1-beta.8 → 1.1.1-dev.11
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/lib/routes/interfaces.js
CHANGED
|
@@ -23,7 +23,6 @@ const processInterfaceData = (data) => {
|
|
|
23
23
|
console.log('=== 开始处理接口数据 ===');
|
|
24
24
|
console.log('原始数据:', JSON.stringify({
|
|
25
25
|
name: result.name,
|
|
26
|
-
group: result.group, // 添加分组信息的日志
|
|
27
26
|
hasResponses: !!result.responses,
|
|
28
27
|
responsesType: typeof result.responses,
|
|
29
28
|
responsesLength: result.responses ? result.responses.length : 0,
|
|
@@ -109,7 +108,6 @@ const processInterfaceData = (data) => {
|
|
|
109
108
|
console.log('=== 处理后的最终接口数据 ===');
|
|
110
109
|
console.log('最终数据:', JSON.stringify({
|
|
111
110
|
name: result.name,
|
|
112
|
-
group: result.group, // 添加分组信息的日志
|
|
113
111
|
responsesLength: result.responses.length,
|
|
114
112
|
responses: result.responses,
|
|
115
113
|
activeResponseId: result.activeResponseId,
|
package/package.json
CHANGED
|
@@ -299,16 +299,10 @@ const InterfaceManagement = () => {
|
|
|
299
299
|
}));
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
// 处理分组值,确保它是字符串而不是数组
|
|
303
|
-
let groupValue = record.group;
|
|
304
|
-
if (Array.isArray(groupValue)) {
|
|
305
|
-
groupValue = groupValue.length > 0 ? groupValue[0] : undefined;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
302
|
// 设置表单值
|
|
309
303
|
form.setFieldsValue({
|
|
310
304
|
name: record.name,
|
|
311
|
-
group:
|
|
305
|
+
group: record.group || undefined, // 使用undefined而不是空字符串
|
|
312
306
|
pattern: record.urlPattern,
|
|
313
307
|
proxyType: record.proxyType || 'response',
|
|
314
308
|
statusCode: (record.httpStatus || record.statusCode || 200).toString(),
|
|
@@ -322,7 +316,7 @@ const InterfaceManagement = () => {
|
|
|
322
316
|
responseDelay: record.responseDelay ? record.responseDelay.toString() : '0'
|
|
323
317
|
});
|
|
324
318
|
|
|
325
|
-
console.log('编辑接口时设置的分组值:',
|
|
319
|
+
console.log('编辑接口时设置的分组值:', record.group);
|
|
326
320
|
|
|
327
321
|
setCurrentResponseId(activeResponseId);
|
|
328
322
|
setEditingInterface(record);
|
|
@@ -383,16 +377,10 @@ const InterfaceManagement = () => {
|
|
|
383
377
|
});
|
|
384
378
|
}
|
|
385
379
|
|
|
386
|
-
// 处理分组值,确保它是字符串而不是数组
|
|
387
|
-
let groupValue = values.group;
|
|
388
|
-
if (Array.isArray(groupValue)) {
|
|
389
|
-
groupValue = groupValue.length > 0 ? groupValue[0] : '';
|
|
390
|
-
}
|
|
391
|
-
|
|
392
380
|
// 构建接口数据
|
|
393
381
|
const interfaceData = {
|
|
394
382
|
name: values.name,
|
|
395
|
-
group:
|
|
383
|
+
group: values.group || '', // 确保group不为undefined
|
|
396
384
|
urlPattern: values.pattern,
|
|
397
385
|
proxyType: values.proxyType,
|
|
398
386
|
featureId: selectedFeatureId,
|
|
@@ -405,7 +393,7 @@ const InterfaceManagement = () => {
|
|
|
405
393
|
active: true
|
|
406
394
|
};
|
|
407
395
|
|
|
408
|
-
console.log('提交的分组值:',
|
|
396
|
+
console.log('提交的分组值:', values.group);
|
|
409
397
|
|
|
410
398
|
// 根据代理类型添加不同字段
|
|
411
399
|
if (values.proxyType === 'redirect' || values.proxyType === 'url_redirect') {
|
|
@@ -441,8 +429,6 @@ const InterfaceManagement = () => {
|
|
|
441
429
|
const response = await axios.post('/cgi-bin/interfaces', interfaceData);
|
|
442
430
|
if (response.data && response.data.code === 0) {
|
|
443
431
|
message.success('接口创建成功');
|
|
444
|
-
console.log('接口创建成功,返回数据:', response.data);
|
|
445
|
-
console.log('返回的接口数据中的分组信息:', response.data.data?.group);
|
|
446
432
|
setModalVisible(false);
|
|
447
433
|
fetchInterfaces();
|
|
448
434
|
|
|
@@ -1178,17 +1164,6 @@ const InterfaceManagement = () => {
|
|
|
1178
1164
|
showSearch
|
|
1179
1165
|
allowClear
|
|
1180
1166
|
style={{ width: '100%' }}
|
|
1181
|
-
mode="tags"
|
|
1182
|
-
maxTagCount="responsive"
|
|
1183
|
-
maxTagTextLength={10}
|
|
1184
|
-
onChange={(value) => {
|
|
1185
|
-
// 如果值是数组(tags模式),只取第一个元素
|
|
1186
|
-
if (Array.isArray(value) && value.length > 0) {
|
|
1187
|
-
// 如果第一个元素是空字符串,则设置为undefined
|
|
1188
|
-
const groupValue = value[0] === '' ? undefined : value[0];
|
|
1189
|
-
form.setFieldsValue({ group: groupValue });
|
|
1190
|
-
}
|
|
1191
|
-
}}
|
|
1192
1167
|
onInputKeyDown={(e) => {
|
|
1193
1168
|
// 防止回车键提交表单
|
|
1194
1169
|
if (e.key === 'Enter') {
|