whistle.mock-plugins 1.4.0-beta.0 → 1.4.0-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 +14 -0
- package/app/cgi-bin/interfaces.js +2 -0
- package/app/cgi-bin/stats.js +22 -12
- package/app/public/index.html +1 -1
- package/app/public/js/11.index.js +2 -0
- package/app/public/js/11.index.js.LICENSE.txt +5 -0
- package/app/public/js/704.index.js +2 -0
- package/app/public/js/704.index.js.LICENSE.txt +1 -0
- package/app/public/js/798.index.js +2 -0
- package/app/public/js/798.index.js.LICENSE.txt +53 -0
- package/app/public/js/807.index.js +2 -0
- package/app/public/js/807.index.js.LICENSE.txt +1 -0
- package/app/public/js/968.index.js +2 -0
- package/app/public/js/968.index.js.LICENSE.txt +12 -0
- package/app/public/js/index.js +1 -1
- package/app/public/js/index.js.LICENSE.txt +0 -185
- package/package.json +9 -2
- package/API.md +0 -247
- package/COLUMN_RESIZE_IMPLEMENTATION.md +0 -162
- package/FEATURE_ENHANCEMENT.md +0 -157
- package/TEST_GUIDE.md +0 -156
- package/data/features.json +0 -1
- package/data/interfaces.json +0 -1
- package/index.html +0 -52
- package/initialize.js +0 -32
- package/public/bundle.js +0 -2
- package/public/bundle.js.LICENSE.txt +0 -38
- package/public/index.html +0 -1
- package/public/plugin.mock-plugin.html +0 -14
- package/rules.txt +0 -22
- package/test/api-error.test.js +0 -29
- package/test/webdav-sync.test.js +0 -428
- package/ui/src/App.css +0 -173
- package/ui/src/components/AppLayout.js +0 -407
- package/ui/src/components/FeatureCard.js +0 -58
- package/ui/src/components/KeyboardShortcutsHelp.js +0 -58
- package/ui/src/components/Layout.js +0 -94
- package/ui/src/components/MainNav.js +0 -42
- package/ui/src/components/PageContainer.js +0 -16
- package/ui/src/components/VersionModal.js +0 -99
- package/ui/src/components/WebDavSyncModal.js +0 -516
- package/ui/src/components/interface-management/DataManagementDrawer.js +0 -115
- package/ui/src/components/interface-management/DataManagementModal.js +0 -110
- package/ui/src/components/interface-management/InterfaceTestModal.js +0 -313
- package/ui/src/components/interface-management/PreviewModal.js +0 -48
- package/ui/src/components/interface-management/README.md +0 -184
- package/ui/src/components/interface-management/RealResponseRecorder.js +0 -165
- package/ui/src/components/interface-management/ResponseContentEditor.js +0 -645
- package/ui/src/components/interface-management/constants.js +0 -36
- package/ui/src/components/interface-management/index.js +0 -7
- package/ui/src/components/interface-management/utils.js +0 -103
- package/ui/src/hooks/useKeyboardShortcuts.js +0 -99
- package/ui/src/index.html +0 -14
- package/ui/src/index.js +0 -50
- package/ui/src/pages/InterfaceManagementV2.js +0 -2351
- package/ui/src/pages/MockDataV2.js +0 -1122
- package/ui/src/pages/Settings.js +0 -341
- package/ui/src/pages/Sniffer.js +0 -521
- package/ui/src/pages/Stats.js +0 -288
- package/ui/src/services/del_api.js +0 -192
- package/ui/src/styles/app-layout.css +0 -373
- package/ui/src/styles/cyber-theme.css +0 -1234
- package/ui/src/styles/earth-theme.css +0 -618
- package/ui/src/styles/global.css +0 -224
- package/ui/src/styles/interface-management.css +0 -1321
- package/ui/src/styles/mock-data.css +0 -1185
- package/ui/src/styles/settings.css +0 -252
- package/ui/src/styles/version-modal.css +0 -116
- package/ui/src/styles/webdav-sync.css +0 -408
- package/ui/src/utils/api-error.js +0 -57
- package/webpack.config.js +0 -54
package/ui/src/App.css
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
.App {
|
|
2
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
|
|
3
|
-
height: 100%;
|
|
4
|
-
width: 100%;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/* 页面容器样式 */
|
|
8
|
-
.page-container {
|
|
9
|
-
width: 100%;
|
|
10
|
-
height: 100%;
|
|
11
|
-
background-color: #fff;
|
|
12
|
-
border-radius: 8px;
|
|
13
|
-
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
|
|
14
|
-
padding: 24px;
|
|
15
|
-
transition: all 0.3s;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/* 页面标题栏样式 */
|
|
19
|
-
.page-title-bar {
|
|
20
|
-
display: flex;
|
|
21
|
-
justify-content: space-between;
|
|
22
|
-
align-items: center;
|
|
23
|
-
margin-bottom: 24px;
|
|
24
|
-
padding-bottom: 16px;
|
|
25
|
-
border-bottom: 1px solid #f0f0f0;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.page-title {
|
|
29
|
-
margin: 0;
|
|
30
|
-
color: rgba(0, 0, 0, 0.85);
|
|
31
|
-
font-weight: 600;
|
|
32
|
-
font-size: 20px;
|
|
33
|
-
line-height: 32px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.page-description {
|
|
37
|
-
margin-top: 8px;
|
|
38
|
-
color: rgba(0, 0, 0, 0.45);
|
|
39
|
-
font-size: 14px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.page-actions {
|
|
43
|
-
display: flex;
|
|
44
|
-
gap: 12px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/* 卡片样式 */
|
|
48
|
-
.custom-card {
|
|
49
|
-
border-radius: 8px;
|
|
50
|
-
overflow: hidden;
|
|
51
|
-
transition: all 0.3s;
|
|
52
|
-
height: 100%;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.custom-card:hover {
|
|
56
|
-
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
|
|
57
|
-
transform: translateY(-3px);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/* 表格样式 */
|
|
61
|
-
.custom-table {
|
|
62
|
-
border-radius: 8px;
|
|
63
|
-
overflow: hidden;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.custom-table .ant-table-thead > tr > th {
|
|
67
|
-
background: #fafafa;
|
|
68
|
-
font-weight: 600;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/* 表单样式 */
|
|
72
|
-
.custom-form-item-label {
|
|
73
|
-
font-weight: 500;
|
|
74
|
-
color: rgba(0, 0, 0, 0.85);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.custom-form-item-hint {
|
|
78
|
-
color: rgba(0, 0, 0, 0.45);
|
|
79
|
-
font-size: 13px;
|
|
80
|
-
margin-top: 4px;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/* 按钮样式 */
|
|
84
|
-
.custom-button {
|
|
85
|
-
border-radius: 4px;
|
|
86
|
-
display: inline-flex;
|
|
87
|
-
align-items: center;
|
|
88
|
-
justify-content: center;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.custom-button-icon {
|
|
92
|
-
margin-right: 8px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/* 状态标签样式 */
|
|
96
|
-
.status-tag {
|
|
97
|
-
border-radius: 10px;
|
|
98
|
-
padding: 2px 8px;
|
|
99
|
-
font-size: 12px;
|
|
100
|
-
line-height: 1.5;
|
|
101
|
-
display: inline-flex;
|
|
102
|
-
align-items: center;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.status-tag-success {
|
|
106
|
-
background-color: #f6ffed;
|
|
107
|
-
border: 1px solid #b7eb8f;
|
|
108
|
-
color: #52c41a;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.status-tag-warning {
|
|
112
|
-
background-color: #fffbe6;
|
|
113
|
-
border: 1px solid #ffe58f;
|
|
114
|
-
color: #faad14;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.status-tag-error {
|
|
118
|
-
background-color: #fff2f0;
|
|
119
|
-
border: 1px solid #ffccc7;
|
|
120
|
-
color: #ff4d4f;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/* 动画效果 */
|
|
124
|
-
.fade-in {
|
|
125
|
-
animation: fadeIn 0.3s ease-in-out;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
@keyframes fadeIn {
|
|
129
|
-
from {
|
|
130
|
-
opacity: 0;
|
|
131
|
-
}
|
|
132
|
-
to {
|
|
133
|
-
opacity: 1;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/* 滚动条样式 */
|
|
138
|
-
::-webkit-scrollbar {
|
|
139
|
-
width: 6px;
|
|
140
|
-
height: 6px;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
::-webkit-scrollbar-track {
|
|
144
|
-
background: #f1f1f1;
|
|
145
|
-
border-radius: 3px;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
::-webkit-scrollbar-thumb {
|
|
149
|
-
background: #c1c1c1;
|
|
150
|
-
border-radius: 3px;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
::-webkit-scrollbar-thumb:hover {
|
|
154
|
-
background: #a8a8a8;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/* 响应式调整 */
|
|
158
|
-
@media (max-width: 576px) {
|
|
159
|
-
.page-container {
|
|
160
|
-
padding: 16px;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.page-title-bar {
|
|
164
|
-
flex-direction: column;
|
|
165
|
-
align-items: flex-start;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.page-actions {
|
|
169
|
-
margin-top: 16px;
|
|
170
|
-
width: 100%;
|
|
171
|
-
justify-content: flex-start;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
@@ -1,407 +0,0 @@
|
|
|
1
|
-
import React, { useState, useMemo, useEffect } from 'react';
|
|
2
|
-
import { Layout, Menu, Button, Breadcrumb, Space, ConfigProvider, theme } from 'antd';
|
|
3
|
-
import {
|
|
4
|
-
AppstoreOutlined,
|
|
5
|
-
ApiOutlined,
|
|
6
|
-
SettingOutlined,
|
|
7
|
-
FileTextOutlined,
|
|
8
|
-
MenuFoldOutlined,
|
|
9
|
-
MenuUnfoldOutlined,
|
|
10
|
-
ExperimentOutlined,
|
|
11
|
-
BarChartOutlined,
|
|
12
|
-
ThunderboltOutlined
|
|
13
|
-
} from '@ant-design/icons';
|
|
14
|
-
import { Link, useLocation } from 'react-router-dom';
|
|
15
|
-
import VersionModal from './VersionModal';
|
|
16
|
-
import KeyboardShortcutsHelp from './KeyboardShortcutsHelp';
|
|
17
|
-
import { useKeyboardShortcuts } from '../hooks/useKeyboardShortcuts';
|
|
18
|
-
import '../styles/app-layout.css';
|
|
19
|
-
|
|
20
|
-
const { Header, Content, Sider } = Layout;
|
|
21
|
-
|
|
22
|
-
const THEMES = ['light', 'cyber', 'earth'];
|
|
23
|
-
|
|
24
|
-
const AppLayout = ({ children }) => {
|
|
25
|
-
const location = useLocation();
|
|
26
|
-
const currentPath = location.pathname;
|
|
27
|
-
const [collapsed, setCollapsed] = useState(false);
|
|
28
|
-
const [versionModalVisible, setVersionModalVisible] = useState(false);
|
|
29
|
-
const [shortcutsHelpVisible, setShortcutsHelpVisible] = useState(false);
|
|
30
|
-
|
|
31
|
-
// 注册全局键盘快捷键
|
|
32
|
-
useKeyboardShortcuts();
|
|
33
|
-
|
|
34
|
-
// 监听快捷键帮助事件
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
const handleHelp = () => setShortcutsHelpVisible(true);
|
|
37
|
-
window.addEventListener('keyboard-shortcuts-help', handleHelp);
|
|
38
|
-
return () => window.removeEventListener('keyboard-shortcuts-help', handleHelp);
|
|
39
|
-
}, []);
|
|
40
|
-
|
|
41
|
-
// 主题切换(兼容旧版 cyberTheme 存储)
|
|
42
|
-
const [currentTheme, setCurrentTheme] = useState(() => {
|
|
43
|
-
const saved = localStorage.getItem('theme');
|
|
44
|
-
if (saved && THEMES.includes(saved)) return saved;
|
|
45
|
-
// 兼容旧版 boolean 存储
|
|
46
|
-
const oldCyber = localStorage.getItem('cyberTheme');
|
|
47
|
-
return oldCyber === 'false' ? 'light' : oldCyber === 'true' ? 'cyber' : 'light';
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
document.body.classList.remove('cyber-theme', 'earth-theme');
|
|
52
|
-
if (currentTheme !== 'light') {
|
|
53
|
-
document.body.classList.add(`${currentTheme}-theme`);
|
|
54
|
-
}
|
|
55
|
-
}, [currentTheme]);
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
const handleStorage = () => {
|
|
59
|
-
const saved = localStorage.getItem('theme');
|
|
60
|
-
if (saved && THEMES.includes(saved)) {
|
|
61
|
-
setCurrentTheme(saved);
|
|
62
|
-
} else {
|
|
63
|
-
const oldCyber = localStorage.getItem('cyberTheme');
|
|
64
|
-
setCurrentTheme(oldCyber === 'false' ? 'light' : 'cyber');
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
window.addEventListener('storage', handleStorage);
|
|
68
|
-
return () => window.removeEventListener('storage', handleStorage);
|
|
69
|
-
}, []);
|
|
70
|
-
|
|
71
|
-
const cyberTheme = useMemo(() => ({
|
|
72
|
-
token: {
|
|
73
|
-
colorPrimary: '#00f0ff',
|
|
74
|
-
colorPrimaryHover: '#33f3ff',
|
|
75
|
-
colorPrimaryActive: '#00c2cc',
|
|
76
|
-
colorSuccess: '#00ff41',
|
|
77
|
-
colorWarning: '#f0e800',
|
|
78
|
-
colorError: '#ff4d4f',
|
|
79
|
-
colorInfo: '#00f0ff',
|
|
80
|
-
colorText: '#e0e0e0',
|
|
81
|
-
colorTextSecondary: '#a0a0a0',
|
|
82
|
-
colorTextTertiary: '#6b7280',
|
|
83
|
-
colorBorder: '#1a1a2e',
|
|
84
|
-
colorBorderSecondary: '#1a1a2e',
|
|
85
|
-
colorBgBase: '#050508',
|
|
86
|
-
colorBgContainer: '#0f0f1a',
|
|
87
|
-
colorBgElevated: '#141420',
|
|
88
|
-
colorBgLayout: '#0a0a12',
|
|
89
|
-
colorBgSpotlight: '#141420',
|
|
90
|
-
borderRadius: 6,
|
|
91
|
-
borderRadiusSM: 4,
|
|
92
|
-
borderRadiusLG: 8,
|
|
93
|
-
wireframe: false,
|
|
94
|
-
fontFamily: "'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
95
|
-
fontFamilyCode: "'Share Tech Mono', 'SFMono-Regular', Consolas, monospace",
|
|
96
|
-
},
|
|
97
|
-
algorithm: theme.darkAlgorithm,
|
|
98
|
-
}), []);
|
|
99
|
-
|
|
100
|
-
const earthTheme = useMemo(() => ({
|
|
101
|
-
token: {
|
|
102
|
-
colorPrimary: '#b87333',
|
|
103
|
-
colorPrimaryHover: '#c9894d',
|
|
104
|
-
colorPrimaryActive: '#9a5f2a',
|
|
105
|
-
colorSuccess: '#6b8e23',
|
|
106
|
-
colorWarning: '#d4a017',
|
|
107
|
-
colorError: '#c0392b',
|
|
108
|
-
colorInfo: '#8d6e63',
|
|
109
|
-
colorText: '#3d3630',
|
|
110
|
-
colorTextSecondary: '#6d6459',
|
|
111
|
-
colorTextTertiary: '#9e9488',
|
|
112
|
-
colorBorder: '#e0d8cf',
|
|
113
|
-
colorBorderSecondary: '#d5cdc2',
|
|
114
|
-
colorBgBase: '#faf6f0',
|
|
115
|
-
colorBgContainer: '#fdfcfa',
|
|
116
|
-
colorBgElevated: '#f5f0e8',
|
|
117
|
-
colorBgLayout: '#f0ebe3',
|
|
118
|
-
colorBgSpotlight: '#f5f0e8',
|
|
119
|
-
borderRadius: 6,
|
|
120
|
-
borderRadiusSM: 4,
|
|
121
|
-
borderRadiusLG: 8,
|
|
122
|
-
wireframe: false,
|
|
123
|
-
fontFamily: "'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
124
|
-
fontFamilyCode: "'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",
|
|
125
|
-
},
|
|
126
|
-
algorithm: theme.defaultAlgorithm,
|
|
127
|
-
}), []);
|
|
128
|
-
|
|
129
|
-
const lightTheme = useMemo(() => ({
|
|
130
|
-
token: {
|
|
131
|
-
borderRadius: 6,
|
|
132
|
-
borderRadiusSM: 4,
|
|
133
|
-
borderRadiusLG: 8,
|
|
134
|
-
},
|
|
135
|
-
algorithm: theme.defaultAlgorithm,
|
|
136
|
-
}), []);
|
|
137
|
-
|
|
138
|
-
const activeTheme = useMemo(() => {
|
|
139
|
-
if (currentTheme === 'cyber') return cyberTheme;
|
|
140
|
-
if (currentTheme === 'earth') return earthTheme;
|
|
141
|
-
return lightTheme;
|
|
142
|
-
}, [currentTheme, cyberTheme, earthTheme, lightTheme]);
|
|
143
|
-
|
|
144
|
-
// 主题颜色映射(用于 inline style)
|
|
145
|
-
const t = useMemo(() => {
|
|
146
|
-
switch (currentTheme) {
|
|
147
|
-
case 'cyber':
|
|
148
|
-
return {
|
|
149
|
-
headerBg: '#0f0f1a',
|
|
150
|
-
headerBorder: '#1a1a2e',
|
|
151
|
-
logoIcon: '#00ff41',
|
|
152
|
-
logoGradient: 'linear-gradient(135deg, #00f0ff, #00ff41)',
|
|
153
|
-
versionColor: '#6b7280',
|
|
154
|
-
siderBg: '#0f0f1a',
|
|
155
|
-
wrapperBg: '#0a0a12',
|
|
156
|
-
breadcrumbLink: '#a0a0a0',
|
|
157
|
-
breadcrumbCurrent: '#e0e0e0',
|
|
158
|
-
titleColor: '#e0e0e0',
|
|
159
|
-
titleFont: "'Orbitron', sans-serif",
|
|
160
|
-
titleLetterSpacing: '0.5px',
|
|
161
|
-
contentBg: '#0f0f1a',
|
|
162
|
-
contentBorder: '#1a1a2e',
|
|
163
|
-
};
|
|
164
|
-
case 'earth':
|
|
165
|
-
return {
|
|
166
|
-
headerBg: '#fdfcfa',
|
|
167
|
-
headerBorder: '#e0d8cf',
|
|
168
|
-
logoIcon: '#b87333',
|
|
169
|
-
logoGradient: 'linear-gradient(135deg, #b87333, #d4a017)',
|
|
170
|
-
versionColor: '#6d6459',
|
|
171
|
-
siderBg: '#f5f0e8',
|
|
172
|
-
wrapperBg: '#f0ebe3',
|
|
173
|
-
breadcrumbLink: '#6d6459',
|
|
174
|
-
breadcrumbCurrent: '#3d3630',
|
|
175
|
-
titleColor: '#3d3630',
|
|
176
|
-
titleFont: undefined,
|
|
177
|
-
titleLetterSpacing: undefined,
|
|
178
|
-
contentBg: '#fdfcfa',
|
|
179
|
-
contentBorder: '#e0d8cf',
|
|
180
|
-
};
|
|
181
|
-
default: // light
|
|
182
|
-
return {
|
|
183
|
-
headerBg: '#ffffff',
|
|
184
|
-
headerBorder: '#f0f0f0',
|
|
185
|
-
logoIcon: '#52c41a',
|
|
186
|
-
logoGradient: 'linear-gradient(135deg, #1890ff, #52c41a)',
|
|
187
|
-
versionColor: '#000000d9',
|
|
188
|
-
siderBg: '#ffffff',
|
|
189
|
-
wrapperBg: '#f5f5f5',
|
|
190
|
-
breadcrumbLink: '#000000d9',
|
|
191
|
-
breadcrumbCurrent: '#000000d9',
|
|
192
|
-
titleColor: '#000000d9',
|
|
193
|
-
titleFont: undefined,
|
|
194
|
-
titleLetterSpacing: undefined,
|
|
195
|
-
contentBg: '#ffffff',
|
|
196
|
-
contentBorder: '#f0f0f0',
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
}, [currentTheme]);
|
|
200
|
-
|
|
201
|
-
// 版本弹窗控制方法
|
|
202
|
-
const showVersionModal = () => setVersionModalVisible(true);
|
|
203
|
-
const hideVersionModal = () => setVersionModalVisible(false);
|
|
204
|
-
|
|
205
|
-
// 根据当前路径获取选中的菜单项和面包屑
|
|
206
|
-
const getSelectedKeys = () => {
|
|
207
|
-
if (currentPath === '/' || currentPath === '#/') return ['1'];
|
|
208
|
-
if (currentPath.startsWith('/interface') || currentPath.includes('/interface')) return ['2'];
|
|
209
|
-
if (currentPath === '/stats' || currentPath.includes('/stats')) return ['4'];
|
|
210
|
-
if (currentPath === '/sniffer' || currentPath.includes('/sniffer')) return ['5'];
|
|
211
|
-
if (currentPath === '/settings' || currentPath.includes('/settings')) return ['3'];
|
|
212
|
-
return [];
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
// 根据当前路径获取面包屑
|
|
216
|
-
const getBreadcrumbs = () => {
|
|
217
|
-
const breadcrumbs = [
|
|
218
|
-
{ path: '/', title: '首页' }
|
|
219
|
-
];
|
|
220
|
-
|
|
221
|
-
if (currentPath.startsWith('/interface')) {
|
|
222
|
-
breadcrumbs.push({ path: '/interface', title: '接口管理' });
|
|
223
|
-
|
|
224
|
-
// 如果有featureId参数,添加特定功能模块名称
|
|
225
|
-
if (currentPath.includes('/interface/') && currentPath !== '/interface/') {
|
|
226
|
-
breadcrumbs.push({ path: currentPath, title: '功能接口详情' });
|
|
227
|
-
}
|
|
228
|
-
} else if (currentPath === '/stats') {
|
|
229
|
-
breadcrumbs.push({ path: '/stats', title: '请求统计' });
|
|
230
|
-
} else if (currentPath === '/sniffer') {
|
|
231
|
-
breadcrumbs.push({ path: '/sniffer', title: '接口嗅探' });
|
|
232
|
-
} else if (currentPath === '/settings') {
|
|
233
|
-
breadcrumbs.push({ path: '/settings', title: '系统设置' });
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return breadcrumbs;
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
// 获取当前页面标题
|
|
240
|
-
const getPageTitle = () => {
|
|
241
|
-
if (currentPath === '/' || currentPath === '#/') return '功能模块管理';
|
|
242
|
-
if (currentPath.startsWith('/interface')) return '接口配置管理';
|
|
243
|
-
if (currentPath === '/stats') return '请求统计';
|
|
244
|
-
if (currentPath === '/sniffer') return '接口嗅探';
|
|
245
|
-
if (currentPath === '/settings') return '系统设置';
|
|
246
|
-
return 'Whistle Mock Plugin';
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
// 菜单配置
|
|
250
|
-
const menuItems = [
|
|
251
|
-
{
|
|
252
|
-
key: '1',
|
|
253
|
-
icon: <AppstoreOutlined />,
|
|
254
|
-
label: <Link to="/">功能模块</Link>,
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
key: '2',
|
|
258
|
-
icon: <ApiOutlined />,
|
|
259
|
-
label: <Link to="/interface">接口管理</Link>,
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
key: '4',
|
|
263
|
-
icon: <BarChartOutlined />,
|
|
264
|
-
label: <Link to="/stats">请求统计</Link>,
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
key: '5',
|
|
268
|
-
icon: <ThunderboltOutlined />,
|
|
269
|
-
label: <Link to="/sniffer">接口嗅探</Link>,
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
key: '3',
|
|
273
|
-
icon: <SettingOutlined />,
|
|
274
|
-
label: <Link to="/settings">系统设置</Link>,
|
|
275
|
-
}
|
|
276
|
-
];
|
|
277
|
-
|
|
278
|
-
const breadcrumbs = getBreadcrumbs();
|
|
279
|
-
|
|
280
|
-
return (
|
|
281
|
-
<ConfigProvider theme={activeTheme}>
|
|
282
|
-
<Layout className="app-layout">
|
|
283
|
-
{/* 顶部导航栏 */}
|
|
284
|
-
<Header className="app-header" style={{ background: t.headerBg, borderBottom: `1px solid ${t.headerBorder}` }}>
|
|
285
|
-
<div className="header-left">
|
|
286
|
-
<div className="logo-container">
|
|
287
|
-
<div className="logo-icon-group">
|
|
288
|
-
<ExperimentOutlined className="logo-icon logo-icon-secondary" style={{ color: t.logoIcon }} />
|
|
289
|
-
</div>
|
|
290
|
-
<div
|
|
291
|
-
className="logo-text"
|
|
292
|
-
style={{
|
|
293
|
-
background: t.logoGradient,
|
|
294
|
-
WebkitBackgroundClip: 'text',
|
|
295
|
-
WebkitTextFillColor: 'transparent',
|
|
296
|
-
}}
|
|
297
|
-
>
|
|
298
|
-
MockMaster
|
|
299
|
-
</div>
|
|
300
|
-
</div>
|
|
301
|
-
<Button
|
|
302
|
-
type="text"
|
|
303
|
-
icon={collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
|
|
304
|
-
onClick={() => setCollapsed(!collapsed)}
|
|
305
|
-
className="collapse-button"
|
|
306
|
-
/>
|
|
307
|
-
</div>
|
|
308
|
-
<div className="header-right">
|
|
309
|
-
<Space>
|
|
310
|
-
<Button
|
|
311
|
-
type="text"
|
|
312
|
-
size="small"
|
|
313
|
-
className="version-button"
|
|
314
|
-
onClick={showVersionModal}
|
|
315
|
-
>
|
|
316
|
-
<span style={{ color: t.versionColor, fontFamily: "'Share Tech Mono', monospace" }}>
|
|
317
|
-
v{__APP_VERSION__}
|
|
318
|
-
</span>
|
|
319
|
-
</Button>
|
|
320
|
-
</Space>
|
|
321
|
-
</div>
|
|
322
|
-
</Header>
|
|
323
|
-
|
|
324
|
-
<Layout>
|
|
325
|
-
{/* 侧边导航 */}
|
|
326
|
-
<Sider
|
|
327
|
-
width={220}
|
|
328
|
-
className="app-sider"
|
|
329
|
-
collapsed={collapsed}
|
|
330
|
-
collapsible
|
|
331
|
-
trigger={null}
|
|
332
|
-
style={{ background: t.siderBg }}
|
|
333
|
-
>
|
|
334
|
-
<Menu
|
|
335
|
-
mode="inline"
|
|
336
|
-
selectedKeys={getSelectedKeys()}
|
|
337
|
-
items={menuItems}
|
|
338
|
-
style={{
|
|
339
|
-
height: '100%',
|
|
340
|
-
borderRight: 0,
|
|
341
|
-
padding: '8px',
|
|
342
|
-
background: t.siderBg,
|
|
343
|
-
}}
|
|
344
|
-
/>
|
|
345
|
-
</Sider>
|
|
346
|
-
|
|
347
|
-
{/* 主内容区 */}
|
|
348
|
-
<Layout className="app-content-wrapper" style={{ padding: 0, background: t.wrapperBg }}>
|
|
349
|
-
{/* 面包屑和标题 */}
|
|
350
|
-
<div style={{ padding: '16px 24px 0' }}>
|
|
351
|
-
<Breadcrumb className="app-breadcrumb" style={{ marginBottom: 16 }}>
|
|
352
|
-
{breadcrumbs.map((crumb, index) => (
|
|
353
|
-
<Breadcrumb.Item key={index}>
|
|
354
|
-
{index < breadcrumbs.length - 1 ? (
|
|
355
|
-
<Link to={crumb.path} style={{ color: t.breadcrumbLink }}>{crumb.title}</Link>
|
|
356
|
-
) : (
|
|
357
|
-
<span style={{ color: t.breadcrumbCurrent, fontWeight: 500 }}>{crumb.title}</span>
|
|
358
|
-
)}
|
|
359
|
-
</Breadcrumb.Item>
|
|
360
|
-
))}
|
|
361
|
-
</Breadcrumb>
|
|
362
|
-
<h1 style={{
|
|
363
|
-
margin: 0,
|
|
364
|
-
fontSize: 22,
|
|
365
|
-
fontWeight: 700,
|
|
366
|
-
color: t.titleColor,
|
|
367
|
-
fontFamily: t.titleFont,
|
|
368
|
-
letterSpacing: t.titleLetterSpacing,
|
|
369
|
-
}}>
|
|
370
|
-
{getPageTitle()}
|
|
371
|
-
</h1>
|
|
372
|
-
</div>
|
|
373
|
-
|
|
374
|
-
{/* 内容区 */}
|
|
375
|
-
<Content
|
|
376
|
-
className="app-content"
|
|
377
|
-
style={{
|
|
378
|
-
background: t.contentBg,
|
|
379
|
-
padding: 24,
|
|
380
|
-
borderRadius: 6,
|
|
381
|
-
minHeight: 280,
|
|
382
|
-
margin: '16px 24px 24px',
|
|
383
|
-
border: `1px solid ${t.contentBorder}`,
|
|
384
|
-
}}
|
|
385
|
-
>
|
|
386
|
-
{children}
|
|
387
|
-
</Content>
|
|
388
|
-
</Layout>
|
|
389
|
-
</Layout>
|
|
390
|
-
|
|
391
|
-
{/* 版本信息弹窗 */}
|
|
392
|
-
<VersionModal
|
|
393
|
-
visible={versionModalVisible}
|
|
394
|
-
onCancel={hideVersionModal}
|
|
395
|
-
/>
|
|
396
|
-
|
|
397
|
-
{/* 快捷键帮助弹窗 */}
|
|
398
|
-
<KeyboardShortcutsHelp
|
|
399
|
-
visible={shortcutsHelpVisible}
|
|
400
|
-
onClose={() => setShortcutsHelpVisible(false)}
|
|
401
|
-
/>
|
|
402
|
-
</Layout>
|
|
403
|
-
</ConfigProvider>
|
|
404
|
-
);
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
export default AppLayout;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import '../styles/feature-card.css';
|
|
3
|
-
|
|
4
|
-
const FeatureCard = ({ feature }) => {
|
|
5
|
-
const { name, description, active, interfaceCount, createdAt } = feature;
|
|
6
|
-
|
|
7
|
-
// 生成随机的主题色(根据当前主题选择色系)
|
|
8
|
-
const getRandomColor = () => {
|
|
9
|
-
const isEarth = document.body.classList.contains('earth-theme');
|
|
10
|
-
if (isEarth) {
|
|
11
|
-
const colors = ['#b87333', '#6b8e23', '#d4a017', '#8d6e63', '#c0392b'];
|
|
12
|
-
return colors[Math.floor(Math.random() * colors.length)];
|
|
13
|
-
}
|
|
14
|
-
const colors = ['#00f0ff', '#00ff41', '#f0e800', '#ff00a0', '#bd00ff'];
|
|
15
|
-
return colors[Math.floor(Math.random() * colors.length)];
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const themeColor = getRandomColor();
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div className="feature-card">
|
|
22
|
-
<div className="feature-card-color-bar" style={{ backgroundColor: themeColor }}></div>
|
|
23
|
-
<div className="feature-card-header">
|
|
24
|
-
<h3 className="feature-card-title">{name}</h3>
|
|
25
|
-
<span className={`feature-card-badge ${active ? 'active' : 'inactive'}`}>
|
|
26
|
-
{active ? '已启用' : '未启用'}
|
|
27
|
-
</span>
|
|
28
|
-
</div>
|
|
29
|
-
<div className="feature-card-content">
|
|
30
|
-
<p className="feature-card-description">{description || '没有描述'}</p>
|
|
31
|
-
<div className="feature-card-stats">
|
|
32
|
-
<div className="feature-stat">
|
|
33
|
-
<span className="feature-stat-value">{interfaceCount}</span>
|
|
34
|
-
<span className="feature-stat-label">接口数量</span>
|
|
35
|
-
</div>
|
|
36
|
-
{createdAt && (
|
|
37
|
-
<div className="feature-stat">
|
|
38
|
-
<span className="feature-stat-label">创建于</span>
|
|
39
|
-
<span className="feature-stat-value feature-date">{createdAt}</span>
|
|
40
|
-
</div>
|
|
41
|
-
)}
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
<div className="feature-card-footer">
|
|
45
|
-
<button className="card-btn edit-btn">
|
|
46
|
-
<i className="icon-edit"></i>
|
|
47
|
-
编辑
|
|
48
|
-
</button>
|
|
49
|
-
<button className="card-btn primary-btn" style={{ borderColor: themeColor, color: themeColor }}>
|
|
50
|
-
<i className="icon-manage"></i>
|
|
51
|
-
管理接口
|
|
52
|
-
</button>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default FeatureCard;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Modal, Table } from 'antd';
|
|
3
|
-
import { getShortcutsList } from '../hooks/useKeyboardShortcuts';
|
|
4
|
-
|
|
5
|
-
const KeyboardShortcutsHelp = ({ visible, onClose }) => {
|
|
6
|
-
const shortcuts = getShortcutsList();
|
|
7
|
-
|
|
8
|
-
const columns = [
|
|
9
|
-
{
|
|
10
|
-
title: '快捷键',
|
|
11
|
-
dataIndex: 'key',
|
|
12
|
-
key: 'key',
|
|
13
|
-
width: 180,
|
|
14
|
-
render: (text) => (
|
|
15
|
-
<kbd style={{
|
|
16
|
-
display: 'inline-block',
|
|
17
|
-
padding: '4px 8px',
|
|
18
|
-
fontSize: '12px',
|
|
19
|
-
fontFamily: 'monospace',
|
|
20
|
-
lineHeight: 1,
|
|
21
|
-
color: '#333',
|
|
22
|
-
background: '#f5f5f5',
|
|
23
|
-
border: '1px solid #d9d9d9',
|
|
24
|
-
borderRadius: '4px',
|
|
25
|
-
boxShadow: '0 1px 0 rgba(0,0,0,0.1)',
|
|
26
|
-
}}>
|
|
27
|
-
{text}
|
|
28
|
-
</kbd>
|
|
29
|
-
),
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
title: '功能',
|
|
33
|
-
dataIndex: 'desc',
|
|
34
|
-
key: 'desc',
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<Modal
|
|
40
|
-
title="⌨️ 键盘快捷键"
|
|
41
|
-
open={visible}
|
|
42
|
-
onCancel={onClose}
|
|
43
|
-
footer={null}
|
|
44
|
-
width={480}
|
|
45
|
-
>
|
|
46
|
-
<Table
|
|
47
|
-
dataSource={shortcuts.map((s, i) => ({ ...s, id: i }))}
|
|
48
|
-
columns={columns}
|
|
49
|
-
rowKey="id"
|
|
50
|
-
pagination={false}
|
|
51
|
-
size="small"
|
|
52
|
-
showHeader={false}
|
|
53
|
-
/>
|
|
54
|
-
</Modal>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default KeyboardShortcutsHelp;
|