whistle.mock-plugins 1.1.1-beta.8 → 1.1.1-dev.10

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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whistle.mock-plugins",
3
- "version": "1.1.1-beta.8",
3
+ "version": "1.1.1-dev.10",
4
4
  "description": "Whistle 插件,用于快速创建 API 模拟数据",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -172,7 +172,6 @@ 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 })));
176
175
 
177
176
  // 提取并更新分组列表
178
177
  updateGroups(processedInterfaces);
@@ -251,8 +250,7 @@ const InterfaceManagement = () => {
251
250
  activeResponseId: defaultResponseId,
252
251
  httpMethod: 'ALL',
253
252
  headerItems: [], // 初始化为空数组
254
- paramMatchers: [], // 初始化为空数组
255
- group: undefined // 确保分组字段为undefined,而不是空字符串
253
+ paramMatchers: [] // 初始化为空数组
256
254
  });
257
255
 
258
256
  setCurrentResponseId(defaultResponseId);
@@ -299,16 +297,10 @@ const InterfaceManagement = () => {
299
297
  }));
300
298
  }
301
299
 
302
- // 处理分组值,确保它是字符串而不是数组
303
- let groupValue = record.group;
304
- if (Array.isArray(groupValue)) {
305
- groupValue = groupValue.length > 0 ? groupValue[0] : undefined;
306
- }
307
-
308
300
  // 设置表单值
309
301
  form.setFieldsValue({
310
302
  name: record.name,
311
- group: groupValue || undefined, // 使用undefined而不是空字符串
303
+ group: record.group || '',
312
304
  pattern: record.urlPattern,
313
305
  proxyType: record.proxyType || 'response',
314
306
  statusCode: (record.httpStatus || record.statusCode || 200).toString(),
@@ -322,8 +314,6 @@ const InterfaceManagement = () => {
322
314
  responseDelay: record.responseDelay ? record.responseDelay.toString() : '0'
323
315
  });
324
316
 
325
- console.log('编辑接口时设置的分组值:', groupValue);
326
-
327
317
  setCurrentResponseId(activeResponseId);
328
318
  setEditingInterface(record);
329
319
  setModalVisible(true);
@@ -383,16 +373,10 @@ const InterfaceManagement = () => {
383
373
  });
384
374
  }
385
375
 
386
- // 处理分组值,确保它是字符串而不是数组
387
- let groupValue = values.group;
388
- if (Array.isArray(groupValue)) {
389
- groupValue = groupValue.length > 0 ? groupValue[0] : '';
390
- }
391
-
392
376
  // 构建接口数据
393
377
  const interfaceData = {
394
378
  name: values.name,
395
- group: groupValue || '', // 确保group不为undefined
379
+ group: values.group,
396
380
  urlPattern: values.pattern,
397
381
  proxyType: values.proxyType,
398
382
  featureId: selectedFeatureId,
@@ -405,8 +389,6 @@ const InterfaceManagement = () => {
405
389
  active: true
406
390
  };
407
391
 
408
- console.log('提交的分组值:', groupValue);
409
-
410
392
  // 根据代理类型添加不同字段
411
393
  if (values.proxyType === 'redirect' || values.proxyType === 'url_redirect') {
412
394
  interfaceData.targetUrl = values.targetUrl;
@@ -441,8 +423,6 @@ const InterfaceManagement = () => {
441
423
  const response = await axios.post('/cgi-bin/interfaces', interfaceData);
442
424
  if (response.data && response.data.code === 0) {
443
425
  message.success('接口创建成功');
444
- console.log('接口创建成功,返回数据:', response.data);
445
- console.log('返回的接口数据中的分组信息:', response.data.data?.group);
446
426
  setModalVisible(false);
447
427
  fetchInterfaces();
448
428
 
@@ -1177,18 +1157,8 @@ const InterfaceManagement = () => {
1177
1157
  placeholder="选择或创建分组"
1178
1158
  showSearch
1179
1159
  allowClear
1180
- style={{ width: '100%' }}
1181
1160
  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
- }}
1161
+ tokenSeparators={[',']}
1192
1162
  onInputKeyDown={(e) => {
1193
1163
  // 防止回车键提交表单
1194
1164
  if (e.key === 'Enter') {