Merge pull request #8016 from Budibase/feature/redirect-after-modal-close
Allow screen redirect after modal close
This commit is contained in:
commit
a6c5079190
|
@ -1,16 +1,31 @@
|
||||||
<script>
|
<script>
|
||||||
import { Body } from "@budibase/bbui"
|
import { Label, Body } from "@budibase/bbui"
|
||||||
|
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
|
||||||
|
|
||||||
|
export let parameters
|
||||||
|
export let bindings = []
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Body size="S">Navigate To screen, or leave blank.</Body>
|
||||||
|
<br />
|
||||||
<div class="root">
|
<div class="root">
|
||||||
<Body size="S">This action doesn't require any additional settings.</Body>
|
<Label small>Screen</Label>
|
||||||
<Body size="S">
|
<DrawerBindableInput
|
||||||
This action won't do anything if there isn't a screen modal open.
|
title="Destination URL"
|
||||||
</Body>
|
placeholder="/screen"
|
||||||
|
value={parameters.url}
|
||||||
|
on:change={value => (parameters.url = value.detail)}
|
||||||
|
{bindings}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.root {
|
.root {
|
||||||
|
display: grid;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--spacing-m);
|
||||||
|
grid-template-columns: auto 1fr;
|
||||||
|
max-width: 400px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -45,6 +45,9 @@
|
||||||
},
|
},
|
||||||
[MessageTypes.CLOSE_SCREEN_MODAL]: () => {
|
[MessageTypes.CLOSE_SCREEN_MODAL]: () => {
|
||||||
peekStore.actions.hidePeek()
|
peekStore.actions.hidePeek()
|
||||||
|
if (message.data?.url) {
|
||||||
|
routeStore.actions.navigate(message.data.url)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[MessageTypes.INVALIDATE_DATASOURCE]: () => {
|
[MessageTypes.INVALIDATE_DATASOURCE]: () => {
|
||||||
proxyInvalidation(message.data)
|
proxyInvalidation(message.data)
|
||||||
|
|
|
@ -224,10 +224,11 @@ const changeFormStepHandler = async (action, context) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const closeScreenModalHandler = () => {
|
const closeScreenModalHandler = action => {
|
||||||
|
let { url } = action.parameters
|
||||||
// Emit this as a window event, so parent screens which are iframing us in
|
// Emit this as a window event, so parent screens which are iframing us in
|
||||||
// can close the modal
|
// can close the modal
|
||||||
window.parent.postMessage({ type: "close-screen-modal" })
|
window.parent.postMessage({ type: "close-screen-modal", url })
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateStateHandler = action => {
|
const updateStateHandler = action => {
|
||||||
|
|
Loading…
Reference in New Issue