whistle.mock-plugins 1.0.0

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.
Files changed (68) hide show
  1. package/API.md +247 -0
  2. package/README.md +91 -0
  3. package/app/cgi-bin/features.js +285 -0
  4. package/app/cgi-bin/index.js +31 -0
  5. package/app/cgi-bin/interfaces.js +409 -0
  6. package/app/cgi-bin/logs.js +151 -0
  7. package/app/cgi-bin/test-interface.js +152 -0
  8. package/app/public/index.html +1 -0
  9. package/app/public/js/index.js +2 -0
  10. package/app/public/js/index.js.LICENSE.txt +150 -0
  11. package/app/util/index.js +24 -0
  12. package/index.html +52 -0
  13. package/initialize.js +32 -0
  14. package/lib/dataManager.js +500 -0
  15. package/lib/index.js +3 -0
  16. package/lib/models.js +64 -0
  17. package/lib/routes/features.js +213 -0
  18. package/lib/routes/interfaces.js +304 -0
  19. package/lib/routes/proxy.js +239 -0
  20. package/lib/ruleManager.js +551 -0
  21. package/lib/rules-server.js +267 -0
  22. package/lib/server.js +805 -0
  23. package/lib/storage.js +16 -0
  24. package/lib/ui-server.js +68 -0
  25. package/package.json +51 -0
  26. package/public/bundle.js +2 -0
  27. package/public/bundle.js.LICENSE.txt +38 -0
  28. package/public/index.html +1 -0
  29. package/public/plugin.mock-plugin.html +14 -0
  30. package/rules.txt +22 -0
  31. package/test/rulesServer.test.js +120 -0
  32. package/ui/src/App.css +173 -0
  33. package/ui/src/App.js +24 -0
  34. package/ui/src/components/AppLayout.js +149 -0
  35. package/ui/src/components/FeatureCard.js +53 -0
  36. package/ui/src/components/Layout.js +94 -0
  37. package/ui/src/components/MainNav.js +42 -0
  38. package/ui/src/components/PageContainer.js +16 -0
  39. package/ui/src/index.html +11 -0
  40. package/ui/src/index.js +43 -0
  41. package/ui/src/pages/FileProxy.js +235 -0
  42. package/ui/src/pages/FilesPage.js +292 -0
  43. package/ui/src/pages/Home.js +128 -0
  44. package/ui/src/pages/HomePage.js +195 -0
  45. package/ui/src/pages/InterfaceManagement.js +829 -0
  46. package/ui/src/pages/InterfacePage.js +342 -0
  47. package/ui/src/pages/MockData.js +472 -0
  48. package/ui/src/pages/Settings.js +192 -0
  49. package/ui/src/pages/SettingsPage.js +165 -0
  50. package/ui/src/pages/UrlRedirect.js +225 -0
  51. package/ui/src/pages/Welcome.js +155 -0
  52. package/ui/src/services/api.js +186 -0
  53. package/ui/src/styles/app-layout.css +337 -0
  54. package/ui/src/styles/feature-card.css +172 -0
  55. package/ui/src/styles/file-proxy.css +301 -0
  56. package/ui/src/styles/global.css +224 -0
  57. package/ui/src/styles/home.css +123 -0
  58. package/ui/src/styles/index.css +419 -0
  59. package/ui/src/styles/interface-management.css +694 -0
  60. package/ui/src/styles/layout.css +159 -0
  61. package/ui/src/styles/logs-page.css +427 -0
  62. package/ui/src/styles/main-nav.css +52 -0
  63. package/ui/src/styles/mock-data.css +850 -0
  64. package/ui/src/styles/page-container.css +11 -0
  65. package/ui/src/styles/settings.css +208 -0
  66. package/ui/src/styles/url-redirect.css +279 -0
  67. package/ui/src/styles/welcome.css +282 -0
  68. package/webpack.config.js +49 -0
@@ -0,0 +1,282 @@
1
+ .welcome-container {
2
+ height: 100%;
3
+ padding: 0 0 20px 0;
4
+ overflow-y: auto;
5
+ }
6
+
7
+ .welcome-header {
8
+ margin-bottom: 24px;
9
+ }
10
+
11
+ .welcome-header h1 {
12
+ font-size: 24px;
13
+ font-weight: 600;
14
+ color: #262626;
15
+ margin: 0 0 8px 0;
16
+ }
17
+
18
+ .welcome-header p {
19
+ font-size: 16px;
20
+ color: #595959;
21
+ margin: 0;
22
+ }
23
+
24
+ .cards-container {
25
+ display: grid;
26
+ grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
27
+ gap: 20px;
28
+ margin-bottom: 24px;
29
+ }
30
+
31
+ .card {
32
+ background-color: white;
33
+ border-radius: 4px;
34
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
35
+ overflow: hidden;
36
+ height: 100%;
37
+ display: flex;
38
+ flex-direction: column;
39
+ }
40
+
41
+ .card-header {
42
+ display: flex;
43
+ align-items: center;
44
+ padding: 16px;
45
+ border-bottom: 1px solid #f0f0f0;
46
+ }
47
+
48
+ .card-icon {
49
+ width: 36px;
50
+ height: 36px;
51
+ border-radius: 50%;
52
+ background-color: #e6f7ff;
53
+ color: #1890ff;
54
+ display: flex;
55
+ align-items: center;
56
+ justify-content: center;
57
+ font-size: 20px;
58
+ margin-right: 12px;
59
+ }
60
+
61
+ .stats-card .card-icon {
62
+ background-color: #e6f7ff;
63
+ color: #1890ff;
64
+ }
65
+
66
+ .quickstart-card .card-icon {
67
+ background-color: #f6ffed;
68
+ color: #52c41a;
69
+ }
70
+
71
+ .usage-card .card-icon {
72
+ background-color: #f0f5ff;
73
+ color: #597ef7;
74
+ }
75
+
76
+ .card-header h2 {
77
+ font-size: 16px;
78
+ font-weight: 600;
79
+ color: #262626;
80
+ margin: 0;
81
+ }
82
+
83
+ .card-content {
84
+ padding: 16px;
85
+ flex: 1;
86
+ }
87
+
88
+ /* 统计卡片样式 */
89
+ .stat-item {
90
+ display: flex;
91
+ flex-direction: column;
92
+ align-items: center;
93
+ text-align: center;
94
+ margin-bottom: 16px;
95
+ }
96
+
97
+ .stats-card .card-content {
98
+ display: grid;
99
+ grid-template-columns: repeat(2, 1fr);
100
+ gap: 16px;
101
+ }
102
+
103
+ .stat-value {
104
+ font-size: 24px;
105
+ font-weight: 600;
106
+ color: #262626;
107
+ margin-bottom: 4px;
108
+ }
109
+
110
+ .stat-label {
111
+ font-size: 14px;
112
+ color: #8c8c8c;
113
+ }
114
+
115
+ /* 快速开始卡片样式 */
116
+ .steps {
117
+ margin-bottom: 20px;
118
+ }
119
+
120
+ .step {
121
+ display: flex;
122
+ margin-bottom: 16px;
123
+ }
124
+
125
+ .step:last-child {
126
+ margin-bottom: 0;
127
+ }
128
+
129
+ .step-number {
130
+ width: 24px;
131
+ height: 24px;
132
+ border-radius: 50%;
133
+ background-color: #1890ff;
134
+ color: white;
135
+ display: flex;
136
+ align-items: center;
137
+ justify-content: center;
138
+ font-size: 14px;
139
+ margin-right: 12px;
140
+ flex-shrink: 0;
141
+ }
142
+
143
+ .step-content {
144
+ flex: 1;
145
+ }
146
+
147
+ .step-title {
148
+ font-weight: 500;
149
+ color: #262626;
150
+ margin-bottom: 4px;
151
+ }
152
+
153
+ .step-desc {
154
+ font-size: 14px;
155
+ color: #595959;
156
+ }
157
+
158
+ .quickstart-actions {
159
+ margin-top: auto;
160
+ text-align: center;
161
+ }
162
+
163
+ .quickstart-button {
164
+ background-color: #1890ff;
165
+ color: white;
166
+ border: none;
167
+ border-radius: 4px;
168
+ padding: 0 16px;
169
+ height: 32px;
170
+ cursor: pointer;
171
+ font-size: 14px;
172
+ }
173
+
174
+ .quickstart-button:hover {
175
+ background-color: #40a9ff;
176
+ }
177
+
178
+ /* 使用说明卡片样式 */
179
+ .usage-item {
180
+ margin-bottom: 16px;
181
+ }
182
+
183
+ .usage-item:last-child {
184
+ margin-bottom: 0;
185
+ }
186
+
187
+ .usage-title {
188
+ font-weight: 500;
189
+ color: #262626;
190
+ margin-bottom: 8px;
191
+ }
192
+
193
+ .usage-desc {
194
+ font-size: 14px;
195
+ color: #595959;
196
+ }
197
+
198
+ .code-block {
199
+ background-color: #f5f5f5;
200
+ padding: 8px 12px;
201
+ border-radius: 4px;
202
+ margin: 8px 0;
203
+ font-family: monospace;
204
+ overflow-x: auto;
205
+ }
206
+
207
+ .usage-list {
208
+ margin: 8px 0;
209
+ padding-left: 20px;
210
+ }
211
+
212
+ .usage-list li {
213
+ margin-bottom: 4px;
214
+ }
215
+
216
+ .usage-list code {
217
+ background-color: #f5f5f5;
218
+ padding: 2px 4px;
219
+ border-radius: 2px;
220
+ font-family: monospace;
221
+ }
222
+
223
+ /* 最近活动样式 */
224
+ .recent-activities {
225
+ background-color: white;
226
+ border-radius: 4px;
227
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
228
+ overflow: hidden;
229
+ }
230
+
231
+ .section-header {
232
+ padding: 16px;
233
+ border-bottom: 1px solid #f0f0f0;
234
+ }
235
+
236
+ .section-header h2 {
237
+ font-size: 16px;
238
+ font-weight: 600;
239
+ color: #262626;
240
+ margin: 0;
241
+ }
242
+
243
+ .activities-list {
244
+ padding: 0 16px;
245
+ }
246
+
247
+ .activity-item {
248
+ display: flex;
249
+ align-items: flex-start;
250
+ padding: 12px 0;
251
+ border-bottom: 1px solid #f0f0f0;
252
+ }
253
+
254
+ .activity-item:last-child {
255
+ border-bottom: none;
256
+ }
257
+
258
+ .activity-icon {
259
+ width: 32px;
260
+ height: 32px;
261
+ display: flex;
262
+ align-items: center;
263
+ justify-content: center;
264
+ font-size: 18px;
265
+ margin-right: 12px;
266
+ flex-shrink: 0;
267
+ }
268
+
269
+ .activity-content {
270
+ flex: 1;
271
+ }
272
+
273
+ .activity-title {
274
+ font-size: 14px;
275
+ color: #262626;
276
+ margin-bottom: 4px;
277
+ }
278
+
279
+ .activity-time {
280
+ font-size: 12px;
281
+ color: #8c8c8c;
282
+ }
@@ -0,0 +1,49 @@
1
+ const path = require('path');
2
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
3
+
4
+ module.exports = {
5
+ mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
6
+ entry: './ui/src/index.js',
7
+ output: {
8
+ path: path.resolve(__dirname, 'app/public'),
9
+ filename: 'js/index.js',
10
+ publicPath: '/'
11
+ },
12
+ resolve: {
13
+ extensions: ['.js', '.jsx', '.ts', '.tsx']
14
+ },
15
+ module: {
16
+ rules: [
17
+ {
18
+ test: /\.(js|jsx|ts|tsx)$/,
19
+ exclude: /node_modules/,
20
+ use: {
21
+ loader: 'babel-loader',
22
+ options: {
23
+ presets: ['@babel/preset-env', '@babel/preset-react']
24
+ }
25
+ }
26
+ },
27
+ {
28
+ test: /\.css$/,
29
+ use: ['style-loader', 'css-loader']
30
+ }
31
+ ]
32
+ },
33
+ plugins: [
34
+ new HtmlWebpackPlugin({
35
+ template: './ui/src/index.html',
36
+ filename: 'index.html'
37
+ })
38
+ ],
39
+ devServer: {
40
+ static: {
41
+ directory: path.join(__dirname, 'app/public')
42
+ },
43
+ port: 8080,
44
+ hot: true,
45
+ proxy: {
46
+ '/api': 'http://localhost:8899'
47
+ }
48
+ }
49
+ };