feat: nicer mocks
This commit is contained in:
+120
-66
@@ -691,14 +691,11 @@
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
grid-template-columns:
|
grid-template-columns:
|
||||||
minmax(150px, 1fr)
|
minmax(150px, 1fr)
|
||||||
minmax(180px, 1.1fr)
|
minmax(240px, 1.3fr)
|
||||||
120px
|
|
||||||
minmax(220px, 1.2fr)
|
minmax(220px, 1.2fr)
|
||||||
minmax(180px, 1fr)
|
minmax(180px, 1fr)
|
||||||
120px
|
minmax(260px, 1.3fr);
|
||||||
120px
|
align-items: stretch;
|
||||||
minmax(220px, 1.2fr);
|
|
||||||
align-items: start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.function-mocks-header {
|
.function-mocks-header {
|
||||||
@@ -731,6 +728,27 @@
|
|||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.function-mock-cell-stack {
|
||||||
|
display: grid;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-mock-subfield {
|
||||||
|
display: grid;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-mock-json-cell {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function-mock-json-cell .native-textarea {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 248px;
|
||||||
|
}
|
||||||
|
|
||||||
.function-mocks-note {
|
.function-mocks-note {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
@@ -1161,6 +1179,12 @@
|
|||||||
label="Reload Current"
|
label="Reload Current"
|
||||||
@click="loadRelative(currentDataset.key)"
|
@click="loadRelative(currentDataset.key)"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
|
<q-btn
|
||||||
|
color="accent"
|
||||||
|
outline
|
||||||
|
label="Save"
|
||||||
|
@click="saveDataset(currentDataset.key)"
|
||||||
|
></q-btn>
|
||||||
<q-btn
|
<q-btn
|
||||||
color="accent"
|
color="accent"
|
||||||
outline
|
outline
|
||||||
@@ -1776,13 +1800,10 @@
|
|||||||
<div class="function-mocks-table">
|
<div class="function-mocks-table">
|
||||||
<div class="function-mocks-header function-mocks-table-grid">
|
<div class="function-mocks-header function-mocks-table-grid">
|
||||||
<div class="function-mocks-heading">Mock Name</div>
|
<div class="function-mocks-heading">Mock Name</div>
|
||||||
<div class="function-mocks-heading">URI</div>
|
|
||||||
<div class="function-mocks-heading">Method</div>
|
<div class="function-mocks-heading">Method</div>
|
||||||
<div class="function-mocks-heading">Headers JSON</div>
|
<div class="function-mocks-heading">Headers JSON</div>
|
||||||
<div class="function-mocks-heading">Query Params JSON</div>
|
<div class="function-mocks-heading">Query Params JSON</div>
|
||||||
<div class="function-mocks-heading">Request Type</div>
|
<div class="function-mocks-heading">Response</div>
|
||||||
<div class="function-mocks-heading">Response Type</div>
|
|
||||||
<div class="function-mocks-heading">Response JSON</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -1801,6 +1822,9 @@
|
|||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
@blur="persistFunctionMocks()"
|
@blur="persistFunctionMocks()"
|
||||||
/>
|
/>
|
||||||
|
<div class="settings-hint q-mt-sm">
|
||||||
|
Mock Name: Stable mock identifier used inside this function's fixture map.
|
||||||
|
</div>
|
||||||
<div class="function-mock-primary-actions">
|
<div class="function-mock-primary-actions">
|
||||||
<q-btn
|
<q-btn
|
||||||
color="negative"
|
color="negative"
|
||||||
@@ -1811,31 +1835,55 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="function-mock-cell-stack">
|
||||||
<input
|
<div class="function-mock-subfield">
|
||||||
:id="`function-mock-uri-${mockRow.id}`"
|
<input
|
||||||
v-model="mockRow.uri"
|
:id="`function-mock-request-type-${mockRow.id}`"
|
||||||
class="native-input"
|
v-model="mockRow.requestType"
|
||||||
type="text"
|
class="native-input"
|
||||||
placeholder="/path"
|
type="text"
|
||||||
spellcheck="false"
|
placeholder="json"
|
||||||
@blur="persistFunctionMocks()"
|
spellcheck="false"
|
||||||
/>
|
@blur="persistFunctionMocks()"
|
||||||
|
/>
|
||||||
|
<div class="settings-hint">
|
||||||
|
Request Type: Optional request payload format such as
|
||||||
|
<code>json</code>.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="function-mock-subfield">
|
||||||
|
<input
|
||||||
|
:id="`function-mock-method-${mockRow.id}`"
|
||||||
|
v-model="mockRow.method"
|
||||||
|
class="native-input"
|
||||||
|
type="text"
|
||||||
|
placeholder="GET"
|
||||||
|
spellcheck="false"
|
||||||
|
@blur="persistFunctionMocks()"
|
||||||
|
/>
|
||||||
|
<div class="settings-hint">
|
||||||
|
Method: HTTP verb or RPC method name used by this reusable mock.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="function-mock-subfield">
|
||||||
|
<input
|
||||||
|
:id="`function-mock-uri-${mockRow.id}`"
|
||||||
|
v-model="mockRow.uri"
|
||||||
|
class="native-input"
|
||||||
|
type="text"
|
||||||
|
placeholder="/path"
|
||||||
|
spellcheck="false"
|
||||||
|
@blur="persistFunctionMocks()"
|
||||||
|
/>
|
||||||
|
<div class="settings-hint">
|
||||||
|
Path: Request path or URI matcher for REST mocks.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="function-mock-json-cell">
|
||||||
<input
|
|
||||||
:id="`function-mock-method-${mockRow.id}`"
|
|
||||||
v-model="mockRow.method"
|
|
||||||
class="native-input"
|
|
||||||
type="text"
|
|
||||||
placeholder="GET"
|
|
||||||
spellcheck="false"
|
|
||||||
@blur="persistFunctionMocks()"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<textarea
|
<textarea
|
||||||
:id="`function-mock-headers-${mockRow.id}`"
|
:id="`function-mock-headers-${mockRow.id}`"
|
||||||
v-model="mockRow.headersText"
|
v-model="mockRow.headersText"
|
||||||
@@ -1844,9 +1892,12 @@
|
|||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
@blur="persistFunctionMocks()"
|
@blur="persistFunctionMocks()"
|
||||||
></textarea>
|
></textarea>
|
||||||
|
<div class="settings-hint q-mt-sm">
|
||||||
|
Headers JSON: JSON object of request headers that must match.
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="function-mock-json-cell">
|
||||||
<textarea
|
<textarea
|
||||||
:id="`function-mock-query-${mockRow.id}`"
|
:id="`function-mock-query-${mockRow.id}`"
|
||||||
v-model="mockRow.queryParamsText"
|
v-model="mockRow.queryParamsText"
|
||||||
@@ -1855,41 +1906,44 @@
|
|||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
@blur="persistFunctionMocks()"
|
@blur="persistFunctionMocks()"
|
||||||
></textarea>
|
></textarea>
|
||||||
|
<div class="settings-hint q-mt-sm">
|
||||||
|
Query Params JSON: JSON object of expected query-string parameters.
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="function-mock-cell-stack">
|
||||||
<input
|
<div class="function-mock-subfield">
|
||||||
:id="`function-mock-request-type-${mockRow.id}`"
|
<input
|
||||||
v-model="mockRow.requestType"
|
:id="`function-mock-response-type-${mockRow.id}`"
|
||||||
class="native-input"
|
v-model="mockRow.responseType"
|
||||||
type="text"
|
class="native-input"
|
||||||
placeholder="function"
|
type="text"
|
||||||
spellcheck="false"
|
placeholder="json"
|
||||||
@blur="persistFunctionMocks()"
|
spellcheck="false"
|
||||||
/>
|
@blur="persistFunctionMocks()"
|
||||||
</div>
|
/>
|
||||||
|
<div class="settings-hint">
|
||||||
|
Response Type: Optional response mode such as
|
||||||
|
<code>json</code>,
|
||||||
|
<code>data</code>,
|
||||||
|
or
|
||||||
|
<code>exception</code>.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="function-mock-subfield">
|
||||||
<input
|
<textarea
|
||||||
:id="`function-mock-response-type-${mockRow.id}`"
|
:id="`function-mock-response-${mockRow.id}`"
|
||||||
v-model="mockRow.responseType"
|
v-model="mockRow.responseText"
|
||||||
class="native-input"
|
class="native-textarea"
|
||||||
type="text"
|
placeholder='{"field":"value"}'
|
||||||
placeholder="data"
|
spellcheck="false"
|
||||||
spellcheck="false"
|
@blur="persistFunctionMocks()"
|
||||||
@blur="persistFunctionMocks()"
|
></textarea>
|
||||||
/>
|
<div class="settings-hint">
|
||||||
</div>
|
Response Body: JSON payload, data object, or exception body returned by the mock.
|
||||||
|
</div>
|
||||||
<div>
|
</div>
|
||||||
<textarea
|
|
||||||
:id="`function-mock-response-${mockRow.id}`"
|
|
||||||
v-model="mockRow.responseText"
|
|
||||||
class="native-textarea"
|
|
||||||
placeholder='{"field":"value"}'
|
|
||||||
spellcheck="false"
|
|
||||||
@blur="persistFunctionMocks()"
|
|
||||||
></textarea>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user