mockaton 10.3.0 → 10.3.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/README.md +3 -3
- package/package.json +1 -1
- package/src/Dashboard.css +27 -33
- package/src/Dashboard.js +60 -46
- package/src/mockBrokersCollection.js +2 -0
package/README.md
CHANGED
|
@@ -60,9 +60,9 @@ Nonetheless, there’s a programmatic API, which is handy
|
|
|
60
60
|
for setting up tests (see **Commander API** section below).
|
|
61
61
|
|
|
62
62
|
<picture>
|
|
63
|
-
<source media="(prefers-color-scheme: light)" srcset="pixaton-tests/macos/pic-for-readme.
|
|
64
|
-
<source media="(prefers-color-scheme: dark)" srcset="pixaton-tests/macos/pic-for-readme.
|
|
65
|
-
<img alt="Mockaton Dashboard" src="pixaton-tests/macos/pic-for-readme.
|
|
63
|
+
<source media="(prefers-color-scheme: light)" srcset="pixaton-tests/macos/pic-for-readme.vp761x790.light.gold.png">
|
|
64
|
+
<source media="(prefers-color-scheme: dark)" srcset="pixaton-tests/macos/pic-for-readme.vp761x790.dark.gold.png">
|
|
65
|
+
<img alt="Mockaton Dashboard" src="pixaton-tests/macos/pic-for-readme.vp761x790.light.gold.png">
|
|
66
66
|
</picture>
|
|
67
67
|
|
|
68
68
|
|
package/package.json
CHANGED
package/src/Dashboard.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--radius:
|
|
2
|
+
--radius: 16px;
|
|
3
3
|
--boxShadow1: rgba(0, 0, 0, 0.18) 0 2px 1px -1px, rgba(0, 0, 0, 0.12) 0 1px 1px 0, rgba(0, 0, 0, 0.1) 0 1px 3px 0px;
|
|
4
4
|
}
|
|
5
5
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
--colorSecondaryAction: #666;
|
|
17
17
|
--colorDisabledMockSelector: #444;
|
|
18
18
|
--colorHover: #dfefff;
|
|
19
|
-
--colorLabel: #
|
|
19
|
+
--colorLabel: #555;
|
|
20
20
|
--colorLightRed: #ffe4ee;
|
|
21
21
|
--colorRed: #da0f00;
|
|
22
22
|
--colorText: #000;
|
|
@@ -111,7 +111,7 @@ a {
|
|
|
111
111
|
a,
|
|
112
112
|
button,
|
|
113
113
|
input[type=checkbox],
|
|
114
|
-
input[type=checkbox]
|
|
114
|
+
input[type=checkbox] + svg {
|
|
115
115
|
cursor: pointer;
|
|
116
116
|
|
|
117
117
|
&:active {
|
|
@@ -128,7 +128,7 @@ select {
|
|
|
128
128
|
appearance: none;
|
|
129
129
|
background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23888888'><path d='M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z'/></svg>") no-repeat;
|
|
130
130
|
background-size: 16px;
|
|
131
|
-
background-position: 100% center;
|
|
131
|
+
background-position: calc(100% - 3px) center;
|
|
132
132
|
|
|
133
133
|
&:enabled {
|
|
134
134
|
border-color: var(--colorSecondaryActionBorder);
|
|
@@ -155,9 +155,9 @@ header {
|
|
|
155
155
|
display: flex;
|
|
156
156
|
flex-wrap: wrap;
|
|
157
157
|
align-items: flex-end;
|
|
158
|
-
gap: 16px
|
|
158
|
+
gap: 16px 8px;
|
|
159
159
|
|
|
160
|
-
@media (max-width:
|
|
160
|
+
@media (max-width: 760px) {
|
|
161
161
|
max-width: 400px;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -175,18 +175,10 @@ header {
|
|
|
175
175
|
span {
|
|
176
176
|
display: flex;
|
|
177
177
|
align-items: center;
|
|
178
|
+
margin-left: 8px;
|
|
178
179
|
color: var(--colorLabel);
|
|
179
180
|
font-size: 11px;
|
|
180
181
|
gap: 4px;
|
|
181
|
-
|
|
182
|
-
svg {
|
|
183
|
-
width: 14px;
|
|
184
|
-
height: 14px;
|
|
185
|
-
stroke: var(--colorLabel);
|
|
186
|
-
stroke-width: 1.5px;
|
|
187
|
-
fill: none;
|
|
188
|
-
opacity: .7;
|
|
189
|
-
}
|
|
190
182
|
}
|
|
191
183
|
|
|
192
184
|
input[type=url],
|
|
@@ -209,10 +201,10 @@ header {
|
|
|
209
201
|
}
|
|
210
202
|
|
|
211
203
|
&.GlobalDelayField {
|
|
212
|
-
width:
|
|
204
|
+
width: 76px;
|
|
213
205
|
|
|
214
206
|
input[type=number] {
|
|
215
|
-
padding-right:
|
|
207
|
+
padding-right: 6px;
|
|
216
208
|
}
|
|
217
209
|
|
|
218
210
|
svg {
|
|
@@ -243,6 +235,9 @@ header {
|
|
|
243
235
|
font-size: 11px;
|
|
244
236
|
gap: 4px;
|
|
245
237
|
|
|
238
|
+
input + span {
|
|
239
|
+
margin: 0;
|
|
240
|
+
}
|
|
246
241
|
input:disabled + span {
|
|
247
242
|
opacity: 0.8;
|
|
248
243
|
}
|
|
@@ -285,13 +280,14 @@ header {
|
|
|
285
280
|
}
|
|
286
281
|
}
|
|
287
282
|
|
|
288
|
-
|
|
283
|
+
.SettingsMenu {
|
|
289
284
|
position: absolute;
|
|
290
285
|
top: 62px;
|
|
291
286
|
right: 10px;
|
|
292
287
|
left: auto;
|
|
293
288
|
padding: 20px;
|
|
294
289
|
border: 1px solid var(--colorSecondaryActionBorder);
|
|
290
|
+
text-align: left;
|
|
295
291
|
color: var(--colorText);
|
|
296
292
|
border-radius: var(--radius);
|
|
297
293
|
box-shadow: var(--boxShadow1);
|
|
@@ -305,7 +301,7 @@ header {
|
|
|
305
301
|
display: flex;
|
|
306
302
|
align-items: center;
|
|
307
303
|
margin-bottom: 12px;
|
|
308
|
-
gap:
|
|
304
|
+
gap: 6px;
|
|
309
305
|
}
|
|
310
306
|
}
|
|
311
307
|
|
|
@@ -315,7 +311,7 @@ main {
|
|
|
315
311
|
min-width: 0;
|
|
316
312
|
min-height: 0;
|
|
317
313
|
|
|
318
|
-
@media (max-width:
|
|
314
|
+
@media (max-width: 760px) {
|
|
319
315
|
flex-direction: column;
|
|
320
316
|
|
|
321
317
|
.Resizer {
|
|
@@ -367,7 +363,7 @@ table {
|
|
|
367
363
|
border-collapse: collapse;
|
|
368
364
|
|
|
369
365
|
tr {
|
|
370
|
-
border-top:
|
|
366
|
+
border-top: 3px solid transparent;
|
|
371
367
|
}
|
|
372
368
|
|
|
373
369
|
th {
|
|
@@ -413,7 +409,6 @@ table {
|
|
|
413
409
|
padding-left: 8px;
|
|
414
410
|
text-overflow: ellipsis;
|
|
415
411
|
font-size: 12px;
|
|
416
|
-
background-position: calc(100% - 4px) center;
|
|
417
412
|
|
|
418
413
|
&.nonDefault {
|
|
419
414
|
font-weight: bold;
|
|
@@ -446,7 +441,7 @@ table {
|
|
|
446
441
|
|
|
447
442
|
&:focus {
|
|
448
443
|
outline: 0;
|
|
449
|
-
&
|
|
444
|
+
& + svg {
|
|
450
445
|
outline: 2px solid var(--colorAccent)
|
|
451
446
|
}
|
|
452
447
|
}
|
|
@@ -461,14 +456,14 @@ table {
|
|
|
461
456
|
|
|
462
457
|
.DelayToggler {
|
|
463
458
|
> input {
|
|
464
|
-
&:checked
|
|
459
|
+
&:checked + svg {
|
|
465
460
|
border-color: var(--colorAccent);
|
|
466
461
|
fill: var(--colorAccent);
|
|
467
462
|
background: var(--colorAccent);
|
|
468
463
|
stroke: var(--colorBackground);
|
|
469
464
|
}
|
|
470
465
|
|
|
471
|
-
&:enabled:hover:not(:checked)
|
|
466
|
+
&:enabled:hover:not(:checked) + svg {
|
|
472
467
|
border-color: var(--colorHover);
|
|
473
468
|
background: var(--colorHover);
|
|
474
469
|
stroke: var(--colorText);
|
|
@@ -496,7 +491,7 @@ table {
|
|
|
496
491
|
}
|
|
497
492
|
|
|
498
493
|
> input {
|
|
499
|
-
&:checked
|
|
494
|
+
&:checked + svg {
|
|
500
495
|
fill: var(--colorAccent);
|
|
501
496
|
stroke: var(--colorAccent);
|
|
502
497
|
|
|
@@ -506,12 +501,12 @@ table {
|
|
|
506
501
|
transform: scale(1.1);
|
|
507
502
|
}
|
|
508
503
|
|
|
509
|
-
&:enabled:hover:not(:checked)
|
|
504
|
+
&:enabled:hover:not(:checked) + svg {
|
|
510
505
|
fill: var(--colorHover);
|
|
511
506
|
stroke: var(--colorText);
|
|
512
507
|
}
|
|
513
508
|
|
|
514
|
-
&:disabled
|
|
509
|
+
&:disabled + svg {
|
|
515
510
|
stroke-opacity: 0.4;
|
|
516
511
|
cursor: not-allowed;
|
|
517
512
|
box-shadow: none;
|
|
@@ -525,9 +520,8 @@ table {
|
|
|
525
520
|
}
|
|
526
521
|
|
|
527
522
|
> svg {
|
|
528
|
-
width:
|
|
529
|
-
|
|
530
|
-
padding: 1px 3px;
|
|
523
|
+
width: 26px;
|
|
524
|
+
padding: 1px 4px;
|
|
531
525
|
stroke-width: 2px;
|
|
532
526
|
border-radius: var(--radius);
|
|
533
527
|
}
|
|
@@ -545,12 +539,12 @@ table {
|
|
|
545
539
|
|
|
546
540
|
&:focus {
|
|
547
541
|
outline: 0;
|
|
548
|
-
&
|
|
542
|
+
& + span {
|
|
549
543
|
outline: 2px solid var(--colorAccent)
|
|
550
544
|
}
|
|
551
545
|
}
|
|
552
546
|
|
|
553
|
-
&:checked
|
|
547
|
+
&:checked + span {
|
|
554
548
|
border-color: var(--colorRed);
|
|
555
549
|
color: white;
|
|
556
550
|
background: var(--colorRed);
|
package/src/Dashboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AUTOGENERATED_500_COMMENT, HEADER_FOR_502
|
|
1
|
+
import { AUTOGENERATED_500_COMMENT, HEADER_FOR_502 } from './ApiConstants.js'
|
|
2
2
|
import { parseFilename, extractComments } from './Filename.js'
|
|
3
3
|
import { Commander } from './ApiCommander.js'
|
|
4
4
|
|
|
@@ -53,6 +53,7 @@ const CSS = {
|
|
|
53
53
|
ResetButton: null,
|
|
54
54
|
Resizer: null,
|
|
55
55
|
SaveProxiedCheckbox: null,
|
|
56
|
+
SettingsMenu: null,
|
|
56
57
|
StaticFilesList: null,
|
|
57
58
|
|
|
58
59
|
chosen: null,
|
|
@@ -132,7 +133,6 @@ function App() {
|
|
|
132
133
|
const { leftSideWidth } = state
|
|
133
134
|
return [
|
|
134
135
|
Header(),
|
|
135
|
-
Menu(),
|
|
136
136
|
r('main', null,
|
|
137
137
|
r('div', {
|
|
138
138
|
ref: leftSideRef,
|
|
@@ -162,36 +162,50 @@ function Header() {
|
|
|
162
162
|
BulkSelector(),
|
|
163
163
|
ProxyFallbackField(),
|
|
164
164
|
ResetButton()),
|
|
165
|
-
|
|
166
|
-
className: CSS.MenuTrigger,
|
|
167
|
-
popovertarget: 'Menu'
|
|
168
|
-
}, SettingsIcon())
|
|
169
|
-
))
|
|
165
|
+
SettingsMenu()))
|
|
170
166
|
}
|
|
171
167
|
|
|
172
|
-
function
|
|
168
|
+
function SettingsMenu() {
|
|
169
|
+
const id = '_SettingsMenu_'
|
|
170
|
+
|
|
171
|
+
function MenuContent() {
|
|
172
|
+
return (
|
|
173
|
+
r('menu', {
|
|
174
|
+
id,
|
|
175
|
+
popover: '',
|
|
176
|
+
className: CSS.SettingsMenu,
|
|
177
|
+
onToggle(event) {
|
|
178
|
+
if (event.newState === 'closed')
|
|
179
|
+
this.parentNode.removeChild(this)
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
r('label', className(CSS.GroupByMethod),
|
|
183
|
+
r('input', {
|
|
184
|
+
type: 'checkbox',
|
|
185
|
+
checked: state.groupByMethod,
|
|
186
|
+
onChange() {
|
|
187
|
+
state.toggleGroupByMethod()
|
|
188
|
+
updateState()
|
|
189
|
+
}
|
|
190
|
+
}),
|
|
191
|
+
r('span', null, Strings.group_by_method)),
|
|
192
|
+
|
|
193
|
+
r('a', {
|
|
194
|
+
href: 'https://github.com/ericfortis/mockaton',
|
|
195
|
+
target: '_blank',
|
|
196
|
+
rel: 'noopener noreferrer'
|
|
197
|
+
}, 'Documentation')))
|
|
198
|
+
}
|
|
199
|
+
|
|
173
200
|
return (
|
|
174
|
-
r('
|
|
175
|
-
|
|
176
|
-
|
|
201
|
+
r('button', {
|
|
202
|
+
onClick() {
|
|
203
|
+
if (!this.querySelector('menu'))
|
|
204
|
+
this.appendChild(MenuContent())
|
|
177
205
|
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
checked: state.groupByMethod,
|
|
182
|
-
onChange() {
|
|
183
|
-
state.toggleGroupByMethod()
|
|
184
|
-
updateState()
|
|
185
|
-
}
|
|
186
|
-
}),
|
|
187
|
-
r('span', null, Strings.group_by_method)),
|
|
188
|
-
|
|
189
|
-
r('a', {
|
|
190
|
-
href: 'https://github.com/ericfortis/mockaton',
|
|
191
|
-
target: '_blank',
|
|
192
|
-
rel: 'noopener noreferrer'
|
|
193
|
-
}, 'Documentation')
|
|
194
|
-
))
|
|
206
|
+
className: CSS.MenuTrigger,
|
|
207
|
+
popovertarget: id
|
|
208
|
+
}, SettingsIcon()))
|
|
195
209
|
}
|
|
196
210
|
|
|
197
211
|
function CookieSelector() {
|
|
@@ -228,24 +242,24 @@ function BulkSelector() {
|
|
|
228
242
|
.catch(onError)
|
|
229
243
|
}
|
|
230
244
|
const disabled = !comments.length
|
|
231
|
-
const list = disabled
|
|
232
|
-
? []
|
|
233
|
-
: [firstOption, ...comments].map(c => [
|
|
234
|
-
c,
|
|
235
|
-
c === AUTOGENERATED_500_COMMENT ? Strings.auto500 : c
|
|
236
|
-
])
|
|
237
245
|
return (
|
|
238
246
|
r('label', className(CSS.Field),
|
|
239
247
|
r('span', null, Strings.bulk_select),
|
|
240
248
|
r('select', {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
r('option', { value },
|
|
249
|
+
className: CSS.BulkSelector,
|
|
250
|
+
'data-qaid': 'BulkSelector',
|
|
251
|
+
autocomplete: 'off',
|
|
252
|
+
disabled,
|
|
253
|
+
title: disabled ? Strings.bulk_select_disabled_title : '',
|
|
254
|
+
onChange
|
|
255
|
+
},
|
|
256
|
+
r('option', { value: firstOption }, firstOption),
|
|
257
|
+
r('hr'),
|
|
258
|
+
comments.map(value =>
|
|
259
|
+
r('option', { value }, value)),
|
|
260
|
+
r('hr'),
|
|
261
|
+
r('option', { value: AUTOGENERATED_500_COMMENT }, Strings.auto500)
|
|
262
|
+
)))
|
|
249
263
|
}
|
|
250
264
|
|
|
251
265
|
function GlobalDelayField() {
|
|
@@ -258,7 +272,7 @@ function GlobalDelayField() {
|
|
|
258
272
|
}
|
|
259
273
|
return (
|
|
260
274
|
r('label', className(CSS.Field, CSS.GlobalDelayField),
|
|
261
|
-
r('span', null,
|
|
275
|
+
r('span', null, Strings.delay_ms),
|
|
262
276
|
r('input', {
|
|
263
277
|
type: 'number',
|
|
264
278
|
min: 0,
|
|
@@ -286,7 +300,7 @@ function ProxyFallbackField() {
|
|
|
286
300
|
return (
|
|
287
301
|
r('div', className(CSS.Field, CSS.FallbackBackend),
|
|
288
302
|
r('label', null,
|
|
289
|
-
r('span', null,
|
|
303
|
+
r('span', null, Strings.fallback_server),
|
|
290
304
|
r('input', {
|
|
291
305
|
type: 'url',
|
|
292
306
|
autocomplete: 'none',
|
|
@@ -966,7 +980,7 @@ function dittoSplitPaths(paths) {
|
|
|
966
980
|
|
|
967
981
|
|
|
968
982
|
function syntaxJSON(json) {
|
|
969
|
-
const MAX_NODES =
|
|
983
|
+
const MAX_NODES = 50_000
|
|
970
984
|
let nNodes = 0
|
|
971
985
|
const frag = document.createDocumentFragment()
|
|
972
986
|
|
|
@@ -1014,7 +1028,7 @@ syntaxJSON.regex = /("(?:\\u[a-fA-F0-9]{4}|\\[^u]|[^\\"])*")(\s*:)?|([{}\[\],:\s
|
|
|
1014
1028
|
|
|
1015
1029
|
|
|
1016
1030
|
function syntaxXML(xml) {
|
|
1017
|
-
const MAX_NODES =
|
|
1031
|
+
const MAX_NODES = 50_000
|
|
1018
1032
|
let nNodes = 0
|
|
1019
1033
|
const frag = document.createDocumentFragment()
|
|
1020
1034
|
|
|
@@ -6,6 +6,7 @@ import { MockBroker } from './MockBroker.js'
|
|
|
6
6
|
import { listFilesRecursively } from './utils/fs.js'
|
|
7
7
|
import { config, isFileAllowed } from './config.js'
|
|
8
8
|
import { parseFilename, validateFilename } from './Filename.js'
|
|
9
|
+
import { AUTOGENERATED_500_COMMENT } from './ApiConstants.js'
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -116,6 +117,7 @@ export function extractAllComments() {
|
|
|
116
117
|
comments.add(c)
|
|
117
118
|
})
|
|
118
119
|
return Array.from(comments)
|
|
120
|
+
.filter(c => c !== AUTOGENERATED_500_COMMENT)
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
export function setMocksMatchingComment(comment) {
|