mockaton 8.8.1 → 8.8.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 CHANGED
@@ -23,9 +23,9 @@ other features such as delaying responses, or triggering an autogenerated
23
23
  which is handy for setting up tests (see **Commander API** below).
24
24
 
25
25
  <picture>
26
- <source media="(prefers-color-scheme: light)" srcset="./pixaton-tests/pic-for-readme.vp860x800.light.gold.png">
27
- <source media="(prefers-color-scheme: dark)" srcset="./pixaton-tests/pic-for-readme.vp860x800.dark.gold.png">
28
- <img alt="Mockaton Dashboard" src="./pixaton-tests/pic-for-readme.vp860x800.light.gold.png">
26
+ <source media="(prefers-color-scheme: light)" srcset="./pixaton-tests/pic-for-readme.vp830x800.light.gold.png">
27
+ <source media="(prefers-color-scheme: dark)" srcset="./pixaton-tests/pic-for-readme.vp830x800.dark.gold.png">
28
+ <img alt="Mockaton Dashboard" src="./pixaton-tests/pic-for-readme.vp830x800.light.gold.png">
29
29
  </picture>
30
30
 
31
31
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mockaton",
3
3
  "description": "A deterministic server-side for developing and testing frontend clients",
4
4
  "type": "module",
5
- "version": "8.8.1",
5
+ "version": "8.8.2",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
8
8
  "license": "MIT",
package/src/Dashboard.css CHANGED
@@ -1,13 +1,14 @@
1
1
  :root {
2
2
  --boxShadow1: 0 2px 1px -1px rgba(0, 0, 0, 0.15), 0 1px 1px 0 rgba(0, 0, 0, 0.15), 0 1px 3px 0 rgba(0, 0, 0, 0.1);
3
- --radius: 6px
3
+ --radius: 4px;
4
+ --radiusSmall: 2px;
4
5
  }
5
6
 
6
7
  @media (prefers-color-scheme: light) {
7
8
  :root {
8
9
  --color4xxBackground: #ffedd1;
9
10
  --colorAccent: #0075db;
10
- --colorAccentAlt: #068564;
11
+ --colorAccentAlt: #068185;
11
12
  --colorBackground: #fff;
12
13
  --colorComboBoxHeaderBackground: #fff;
13
14
  --colorComboBoxBackground: #f7f7f7;
@@ -183,13 +184,14 @@ select {
183
184
  }
184
185
 
185
186
  .ResetButton {
186
- padding: 4px 12px;
187
+ padding: 6px 12px;
187
188
  border: 1px solid var(--colorRed);
188
- margin-bottom: 4px;
189
+ margin-left: 4px;
189
190
  background: transparent;
190
191
  color: var(--colorRed);
191
192
  border-radius: 50px;
192
193
 
194
+
193
195
  &:hover {
194
196
  background: var(--colorRed);
195
197
  color: white;
@@ -255,7 +257,7 @@ select {
255
257
  position: relative;
256
258
  left: -6px;
257
259
  display: inline-block;
258
- width: 300px;
260
+ width: 278px;
259
261
  padding: 8px 6px;
260
262
  border-radius: var(--radius);
261
263
  color: var(--colorAccent);
@@ -280,6 +282,10 @@ select {
280
282
  text-overflow: ellipsis;
281
283
  font-size: 12px;
282
284
 
285
+ &.nonDefault {
286
+ font-weight: bold;
287
+ font-size: 0.92rem;
288
+ }
283
289
  &.status4xx {
284
290
  background: var(--color4xxBackground);
285
291
  }
@@ -315,32 +321,37 @@ select {
315
321
  }
316
322
 
317
323
  &:checked ~ svg {
324
+ border-color: transparent;
318
325
  background: var(--colorAccent);
319
326
  fill: white;
327
+ box-shadow: var(--boxShadow1);
320
328
  }
321
329
 
322
330
  &:disabled ~ svg {
323
331
  opacity: .5;
324
332
  cursor: not-allowed;
333
+ box-shadow: none;
325
334
  }
326
335
  }
327
336
 
328
337
  > svg {
329
- width: 20px;
330
- height: 20px;
338
+ width: 18px;
339
+ height: 18px;
340
+ border: 1px solid var(--colorSecondaryAction);
331
341
  vertical-align: bottom;
332
342
  fill: var(--colorSecondaryAction);
333
343
  border-radius: 50%;
334
344
  background: var(--colorSecondaryButtonBackground);
335
- box-shadow: var(--boxShadow1);
336
345
  }
337
346
  }
338
347
 
339
348
  .ProxyToggler {
349
+ margin-left: 4px;
340
350
  > svg {
341
- width: 24px;
342
- padding: 3px;
343
- border-radius: 4px;
351
+ width: 22px;
352
+ padding: 1px;
353
+ border-color: transparent;
354
+ border-radius: var(--radiusSmall);
344
355
  }
345
356
  }
346
357
 
@@ -362,18 +373,19 @@ select {
362
373
  &:checked ~ span {
363
374
  color: white;
364
375
  background: var(--colorRed);
376
+ box-shadow: var(--boxShadow1);
365
377
  }
366
378
  }
367
379
 
368
380
  > span {
369
381
  padding: 5px 4px;
370
- box-shadow: var(--boxShadow1);
371
382
  font-size: 10px;
372
383
  color: var(--colorSecondaryAction);
373
- border-radius: 4px;
384
+ border-radius: var(--radiusSmall);
374
385
  background: var(--colorSecondaryButtonBackground);
375
386
 
376
387
  &:hover {
388
+ box-shadow: var(--boxShadow1);
377
389
  background: var(--colorLightRed);
378
390
  color: var(--colorRed);
379
391
  }
@@ -406,10 +418,6 @@ select {
406
418
  }
407
419
  }
408
420
 
409
- .bold {
410
- font-weight: bold;
411
- }
412
-
413
421
  .StaticFilesList {
414
422
  margin-top: 20px;
415
423
 
package/src/Dashboard.js CHANGED
@@ -16,7 +16,7 @@ const Strings = {
16
16
  bulk_select_disabled_title: 'No mock files have comments, which are anything within parentheses on the filename.',
17
17
  click_link_to_preview: 'Click a link to preview it',
18
18
  cookie: 'Cookie',
19
- cookie_disabled_title: 'No cookies specified in Config.cookies',
19
+ cookie_disabled_title: 'No cookies specified in config.cookies',
20
20
  delay: 'Delay',
21
21
  empty_response_body: '/* Empty Response Body */',
22
22
  fallback_server: 'Fallback Backend',
@@ -50,10 +50,10 @@ const CSS = {
50
50
  SaveProxiedCheckbox: 'SaveProxiedCheckbox',
51
51
  StaticFilesList: 'StaticFilesList',
52
52
 
53
- bold: 'bold',
54
53
  empty: 'empty',
55
54
  chosen: 'chosen',
56
- status4xx: 'status4xx'
55
+ status4xx: 'status4xx',
56
+ nonDefault: 'nonDefault'
57
57
  }
58
58
 
59
59
  const r = createElement
@@ -106,8 +106,7 @@ function Logo() {
106
106
 
107
107
  function CookieSelector({ cookies }) {
108
108
  function onChange() {
109
- mockaton.selectCookie(this.value)
110
- .catch(onError)
109
+ mockaton.selectCookie(this.value).catch(onError)
111
110
  }
112
111
  const disabled = cookies.length <= 1
113
112
  return (
@@ -166,9 +165,7 @@ function ProxyFallbackField({ fallbackAddress, collectProxied }) {
166
165
  return (
167
166
  r('div', { className: cssClass(CSS.Field, CSS.FallbackBackend) },
168
167
  r('label', null,
169
- r('span', null,
170
- r(CloudIcon),
171
- Strings.fallback_server),
168
+ r('span', null, r(CloudIcon), Strings.fallback_server),
172
169
  r('input', {
173
170
  type: 'url',
174
171
  autocomplete: 'none',
@@ -268,9 +265,6 @@ function PreviewLink({ method, urlMask }) {
268
265
  function MockSelector({ broker }) {
269
266
  function onChange() {
270
267
  const { urlMask, method } = parseFilename(this.value)
271
- this.style.fontWeight = this.value === this.options[0].value // default is selected
272
- ? 'normal'
273
- : 'bold'
274
268
  mockaton.select(this.value)
275
269
  .then(init)
276
270
  .then(() => linkFor(method, urlMask)?.click())
@@ -289,14 +283,14 @@ function MockSelector({ broker }) {
289
283
 
290
284
  return (
291
285
  r('select', {
292
- 'data-qaid': urlMask,
286
+ onChange,
293
287
  autocomplete: 'off',
288
+ 'data-qaid': urlMask,
289
+ disabled: files.length <= 1,
294
290
  className: cssClass(
295
291
  CSS.MockSelector,
296
- selected !== files[0] && CSS.bold,
297
- status >= 400 && status < 500 && CSS.status4xx),
298
- disabled: files.length <= 1,
299
- onChange
292
+ selected !== files[0] && CSS.nonDefault,
293
+ status >= 400 && status < 500 && CSS.status4xx)
300
294
  }, files.map(file =>
301
295
  r('option', {
302
296
  value: file,
@@ -304,12 +298,10 @@ function MockSelector({ broker }) {
304
298
  }, file))))
305
299
  }
306
300
 
307
-
308
301
  function DelayRouteToggler({ broker }) {
309
302
  function onChange() {
310
- const { method, urlMask } = parseFilename(this.name)
311
- mockaton.setRouteIsDelayed(method, urlMask, this.checked)
312
- .catch(onError)
303
+ const { method, urlMask } = parseFilename(broker.mocks[0])
304
+ mockaton.setRouteIsDelayed(method, urlMask, this.checked).catch(onError)
313
305
  }
314
306
  return (
315
307
  r('label', {
@@ -318,7 +310,6 @@ function DelayRouteToggler({ broker }) {
318
310
  },
319
311
  r('input', {
320
312
  type: 'checkbox',
321
- name: broker.currentMock.file,
322
313
  checked: Boolean(broker.currentMock.delay),
323
314
  onChange
324
315
  }),
@@ -348,14 +339,13 @@ function InternalServerErrorToggler({ broker }) {
348
339
  checked: parseFilename(broker.currentMock.file).status === 500,
349
340
  onChange
350
341
  }),
351
- r('span', null, '500')
352
- )
353
- )
342
+ r('span', null, '500')))
354
343
  }
355
344
 
345
+
356
346
  function ProxyToggler({ broker, disabled }) {
357
347
  function onChange() {
358
- const { urlMask, method } = parseFilename(this.name)
348
+ const { urlMask, method } = parseFilename(broker.mocks[0])
359
349
  mockaton.setRouteIsProxied(method, urlMask, this.checked)
360
350
  .then(init)
361
351
  .then(() => linkFor(method, urlMask)?.click())
@@ -369,7 +359,6 @@ function ProxyToggler({ broker, disabled }) {
369
359
  r('input', {
370
360
  type: 'checkbox',
371
361
  disabled,
372
- name: broker.currentMock.file,
373
362
  checked: !broker.currentMock.file,
374
363
  onChange
375
364
  }),
@@ -490,6 +479,7 @@ function StaticFilesList({ staticFiles }) {
490
479
  }
491
480
 
492
481
 
482
+ // Misc ===============
493
483
 
494
484
  function onError(error) {
495
485
  if (error?.message === 'Failed to fetch')
@@ -497,7 +487,6 @@ function onError(error) {
497
487
  console.error(error)
498
488
  }
499
489
 
500
-
501
490
  function TimerIcon() {
502
491
  return (
503
492
  r('svg', { viewBox: '0 0 24 24' },
@@ -2,7 +2,7 @@
2
2
  <svg version="1.1" viewBox="0 0 570 100" xmlns="http://www.w3.org/2000/svg">
3
3
  <style>
4
4
  :root { --color: #000000; }
5
- @media (prefers-color-scheme: light) { :root { --color: #555 } }
5
+ @media (prefers-color-scheme: light) { :root { --color: #444 } }
6
6
  @media (prefers-color-scheme: dark) { :root { --color: #eee } }
7
7
  path { fill: var(--color) }
8
8
  </style>