mockaton 10.6.3 → 10.6.4
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.js +10 -6
package/package.json
CHANGED
package/src/Dashboard.js
CHANGED
|
@@ -85,6 +85,9 @@ const state = /** @type {State} */ {
|
|
|
85
85
|
chosenLink: { method: '', urlMask: '' },
|
|
86
86
|
setChosenLink(method, urlMask) {
|
|
87
87
|
state.chosenLink = { method, urlMask }
|
|
88
|
+
},
|
|
89
|
+
get hasChosenLink() {
|
|
90
|
+
return state.chosenLink.method && state.chosenLink.urlMask
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
|
|
@@ -107,10 +110,8 @@ async function updateState() {
|
|
|
107
110
|
if (focusedElem)
|
|
108
111
|
document.querySelector(focusedElem)?.focus()
|
|
109
112
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
await previewMock(method, urlMask)
|
|
113
|
-
|
|
113
|
+
if (state.hasChosenLink)
|
|
114
|
+
await previewMock(state.chosenLink.method, state.chosenLink.urlMask)
|
|
114
115
|
}
|
|
115
116
|
catch (error) {
|
|
116
117
|
onError(error)
|
|
@@ -710,11 +711,14 @@ const payloadViewerTitleRef = useRef()
|
|
|
710
711
|
const payloadViewerCodeRef = useRef()
|
|
711
712
|
|
|
712
713
|
function PayloadViewer() {
|
|
714
|
+
const { hasChosenLink } = state
|
|
713
715
|
return (
|
|
714
716
|
r('div', className(CSS.PayloadViewer),
|
|
715
|
-
r('h2', { ref: payloadViewerTitleRef },
|
|
717
|
+
r('h2', { ref: payloadViewerTitleRef },
|
|
718
|
+
!hasChosenLink && t`Preview`),
|
|
716
719
|
r('pre', null,
|
|
717
|
-
r('code', { ref: payloadViewerCodeRef },
|
|
720
|
+
r('code', { ref: payloadViewerCodeRef },
|
|
721
|
+
!hasChosenLink && t`Click a link to preview it`))))
|
|
718
722
|
}
|
|
719
723
|
|
|
720
724
|
function PayloadViewerTitle({ file, statusText }) {
|