whistle.mock-plugins 1.1.2 → 1.1.3-beta.2
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/VERSION.md +0 -4
- package/app/cgi-bin/interfaces.js +5 -42
- package/app/public/js/index.js +1 -1
- package/app/public/js/index.js.LICENSE.txt +4 -6
- package/lib/ui-server.js +1 -15
- package/package.json +1 -1
- package/ui/src/index.js +24 -4
- package/ui/src/pages/InterfaceManagement.js +2 -2
- package/ui/src/pages/InterfaceManagementV2.js +334 -0
- package/ui/src/pages/MockDataV2.js +702 -0
- package/ui/src/pages/Settings.js +79 -157
- package/ui/src/del_App.js +0 -24
- package/ui/src/pages/del_FileProxy.js +0 -235
- package/ui/src/pages/del_FilesPage.js +0 -292
- package/ui/src/pages/del_Home.js +0 -128
- package/ui/src/pages/del_HomePage.js +0 -195
- package/ui/src/pages/del_InterfacePage.js +0 -342
- package/ui/src/pages/del_SettingsPage.js +0 -165
- package/ui/src/pages/del_UrlRedirect.js +0 -225
- package/ui/src/pages/del_Welcome.js +0 -155
- package/ui/src/styles/del_feature-card.css +0 -168
- package/ui/src/styles/del_file-proxy.css +0 -301
- package/ui/src/styles/del_home.css +0 -123
- package/ui/src/styles/del_index.css +0 -419
- package/ui/src/styles/del_layout.css +0 -159
- package/ui/src/styles/del_logs-page.css +0 -427
- package/ui/src/styles/del_main-nav.css +0 -52
- package/ui/src/styles/del_page-container.css +0 -11
- package/ui/src/styles/del_url-redirect.css +0 -279
- package/ui/src/styles/del_welcome.css +0 -282
package/VERSION.md
CHANGED
|
@@ -383,27 +383,9 @@ module.exports = function(req, res) {
|
|
|
383
383
|
|
|
384
384
|
// 处理 PATCH 请求 - 部分更新接口(如启用/禁用状态)
|
|
385
385
|
if (req.method === 'PATCH') {
|
|
386
|
-
|
|
387
|
-
let id = req.query.id;
|
|
388
|
-
|
|
389
|
-
// 检查路径,支持 /cgi-bin/interfaces/123 形式的请求
|
|
390
|
-
const pathMatch = req.path.match(/\/interfaces\/([^\/]+)$/);
|
|
391
|
-
if (pathMatch && pathMatch[1]) {
|
|
392
|
-
id = pathMatch[1];
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
const { active } = req.query;
|
|
386
|
+
const { id, active } = req.query;
|
|
396
387
|
const patchData = req.body;
|
|
397
388
|
|
|
398
|
-
// 记录请求信息
|
|
399
|
-
console.log('PATCH请求:', {
|
|
400
|
-
path: req.path,
|
|
401
|
-
pathMatch: pathMatch ? pathMatch[1] : null,
|
|
402
|
-
id,
|
|
403
|
-
active,
|
|
404
|
-
body: patchData
|
|
405
|
-
});
|
|
406
|
-
|
|
407
389
|
// 读取接口数据
|
|
408
390
|
let interfacesData;
|
|
409
391
|
try {
|
|
@@ -420,8 +402,8 @@ module.exports = function(req, res) {
|
|
|
420
402
|
});
|
|
421
403
|
}
|
|
422
404
|
|
|
423
|
-
// 批量更新接口状态
|
|
424
|
-
if (active !== undefined
|
|
405
|
+
// 批量更新接口状态
|
|
406
|
+
if (active !== undefined) {
|
|
425
407
|
const { featureId, group } = patchData;
|
|
426
408
|
|
|
427
409
|
if (!featureId) {
|
|
@@ -432,12 +414,6 @@ module.exports = function(req, res) {
|
|
|
432
414
|
});
|
|
433
415
|
}
|
|
434
416
|
|
|
435
|
-
console.log('批量更新接口状态:', {
|
|
436
|
-
active,
|
|
437
|
-
featureId,
|
|
438
|
-
group
|
|
439
|
-
});
|
|
440
|
-
|
|
441
417
|
// 根据分组筛选要更新的接口
|
|
442
418
|
let updatedCount = 0;
|
|
443
419
|
interfacesData.interfaces = interfacesData.interfaces.map(item => {
|
|
@@ -481,9 +457,8 @@ module.exports = function(req, res) {
|
|
|
481
457
|
});
|
|
482
458
|
}
|
|
483
459
|
|
|
484
|
-
//
|
|
460
|
+
// 单个接口更新
|
|
485
461
|
if (!id) {
|
|
486
|
-
console.error('单个接口更新错误: 缺少接口ID');
|
|
487
462
|
return res.status(400).json({
|
|
488
463
|
code: 400,
|
|
489
464
|
message: '接口ID不能为空',
|
|
@@ -491,19 +466,13 @@ module.exports = function(req, res) {
|
|
|
491
466
|
});
|
|
492
467
|
}
|
|
493
468
|
|
|
494
|
-
console.log('更新单个接口状态,ID:', id, '数据:', patchData);
|
|
495
|
-
|
|
496
469
|
// 查找接口
|
|
497
470
|
const index = interfacesData.interfaces.findIndex(item => item.id === id);
|
|
498
471
|
|
|
499
472
|
if (index === -1) {
|
|
500
|
-
console.error(`接口不存在,ID: ${id},当前共有 ${interfacesData.interfaces.length} 个接口`);
|
|
501
|
-
if (interfacesData.interfaces.length > 0) {
|
|
502
|
-
console.log('所有接口ID:', interfacesData.interfaces.map(i => i.id));
|
|
503
|
-
}
|
|
504
473
|
return res.status(404).json({
|
|
505
474
|
code: 404,
|
|
506
|
-
message:
|
|
475
|
+
message: '接口不存在',
|
|
507
476
|
data: null
|
|
508
477
|
});
|
|
509
478
|
}
|
|
@@ -515,12 +484,6 @@ module.exports = function(req, res) {
|
|
|
515
484
|
updatedAt: new Date().toISOString()
|
|
516
485
|
};
|
|
517
486
|
|
|
518
|
-
console.log('接口更新成功,接口数据:', {
|
|
519
|
-
id: updatedInterface.id,
|
|
520
|
-
name: updatedInterface.name,
|
|
521
|
-
active: updatedInterface.active
|
|
522
|
-
});
|
|
523
|
-
|
|
524
487
|
interfacesData.interfaces[index] = updatedInterface;
|
|
525
488
|
fs.writeJsonSync(interfacesFile, interfacesData, { spaces: 2 });
|
|
526
489
|
|