update some naming
This commit is contained in:
parent
af0c722af1
commit
5ca1f17d74
|
@ -8,7 +8,7 @@
|
||||||
TooltipPosition,
|
TooltipPosition,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { previewStore, selectedScreen } from "@/stores/builder"
|
import { previewStore, selectedScreen } from "@/stores/builder"
|
||||||
import { ComponentContext } from "@budibase/types"
|
import type { ComponentContext } from "@budibase/types"
|
||||||
|
|
||||||
export let baseRoute = ""
|
export let baseRoute = ""
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const onVariableChange = (e: CustomEvent) => {
|
const onVariableChange = (e: CustomEvent) => {
|
||||||
previewStore.updateUrl({ route: baseRoute, testValue: e.detail })
|
previewStore.setUrlTestData({ route: baseRoute, testValue: e.detail })
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
@ -91,11 +91,7 @@
|
||||||
<Input disabled={true} value={baseInput} />
|
<Input disabled={true} value={baseInput} />
|
||||||
</div>
|
</div>
|
||||||
<div class="variable-input">
|
<div class="variable-input">
|
||||||
<Input
|
<Input value={testValue} on:change={onVariableChange} {placeholder} />
|
||||||
value={testValue}
|
|
||||||
on:change={onVariableChange}
|
|
||||||
placeholder={`${placeholder}`}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -85,8 +85,8 @@ export class PreviewStore extends BudiStore<PreviewState> {
|
||||||
this.sendEvent("builder-state", data)
|
this.sendEvent("builder-state", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUrl(data: Record<string, any>) {
|
setUrlTestData(data: Record<string, any>) {
|
||||||
this.sendEvent("builder-test-url", data)
|
this.sendEvent("builder-url-test-data", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
requestComponentContext() {
|
requestComponentContext() {
|
||||||
|
|
|
@ -109,7 +109,7 @@ const loadBudibase = async () => {
|
||||||
} else if (type === "builder-state") {
|
} else if (type === "builder-state") {
|
||||||
const [[key, value]] = Object.entries(data)
|
const [[key, value]] = Object.entries(data)
|
||||||
stateStore.actions.setValue(key, value)
|
stateStore.actions.setValue(key, value)
|
||||||
} else if (type === "builder-test-url") {
|
} else if (type === "builder-url-test-data") {
|
||||||
const { route, testValue } = data
|
const { route, testValue } = data
|
||||||
routeStore.actions.setTestUrlParams(route, testValue)
|
routeStore.actions.setTestUrlParams(route, testValue)
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ const createRouteStore = () => {
|
||||||
const [pathPart, queryPart] = testValue.split("?")
|
const [pathPart, queryPart] = testValue.split("?")
|
||||||
const routeSegments = route.split("/").filter(Boolean)
|
const routeSegments = route.split("/").filter(Boolean)
|
||||||
|
|
||||||
// If first segment is a parameter (e.g. /:foo), include it in processing
|
// If first segment happens to be a parameter (e.g. /:foo), include it
|
||||||
const startIndex = routeSegments[0]?.startsWith(":") ? 0 : 1
|
const startIndex = routeSegments[0]?.startsWith(":") ? 0 : 1
|
||||||
const segments = routeSegments.slice(startIndex)
|
const segments = routeSegments.slice(startIndex)
|
||||||
const testSegments = pathPart.split("/")
|
const testSegments = pathPart.split("/")
|
||||||
|
|
Loading…
Reference in New Issue