mockaton 10.3.0 → 10.3.1
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/package.json +1 -1
- package/src/Dashboard.css +3 -2
- package/src/Dashboard.js +56 -42
- package/src/mockBrokersCollection.js +2 -0
package/package.json
CHANGED
package/src/Dashboard.css
CHANGED
|
@@ -285,13 +285,14 @@ header {
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
|
|
288
|
+
.SettingsMenu {
|
|
289
289
|
position: absolute;
|
|
290
290
|
top: 62px;
|
|
291
291
|
right: 10px;
|
|
292
292
|
left: auto;
|
|
293
293
|
padding: 20px;
|
|
294
294
|
border: 1px solid var(--colorSecondaryActionBorder);
|
|
295
|
+
text-align: left;
|
|
295
296
|
color: var(--colorText);
|
|
296
297
|
border-radius: var(--radius);
|
|
297
298
|
box-shadow: var(--boxShadow1);
|
|
@@ -305,7 +306,7 @@ header {
|
|
|
305
306
|
display: flex;
|
|
306
307
|
align-items: center;
|
|
307
308
|
margin-bottom: 12px;
|
|
308
|
-
gap:
|
|
309
|
+
gap: 6px;
|
|
309
310
|
}
|
|
310
311
|
}
|
|
311
312
|
|
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() {
|
|
@@ -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) {
|