Beta tab initial test for E2E, needs styled

This commit is contained in:
Martin McKeaveney 2022-06-08 10:20:47 +01:00
parent 75c599ce70
commit 02320c0ee0
3 changed files with 15 additions and 3 deletions

View File

@ -1,13 +1,13 @@
<script> <script>
import { Body, Button, Layout, Heading } from "@budibase/bbui" import { Body, Button, Layout, Heading } from "@budibase/bbui"
import { CookieUtils } from "@budibase/frontend-core" import { flags } from "stores/backend"
function openFeedbackApp() { function openFeedbackApp() {
window.open(`https://bb.budibase.app/betauifeedback`) window.open(`https://bb.budibase.app/betauifeedback`)
} }
function revertToOldBuilder() { async function revertToOldBuilder() {
CookieUtils.removeCookie("beta:new_design_ui") await flags.toggleUiFeature("design_ui")
window.location.reload() window.location.reload()
} }
</script> </script>

View File

@ -16,6 +16,9 @@ export function createFlagsStore() {
}) })
await actions.fetch() await actions.fetch()
}, },
toggleUiFeature: async feature => {
await API.toggleUiFeature({ value: feature })
},
} }
return { return {

View File

@ -22,4 +22,13 @@ export const buildFlagEndpoints = API => ({
}, },
}) })
}, },
/**
* Allows us to experimentally toggle a beta UI feature through a cookie.
* @param value the feature to toggle
*/
toggleUiFeature: async ({ value }) => {
return await API.post({
url: `/api/beta/${value}`,
})
},
}) })