diff --git a/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte b/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte index e7c9ef6ff2..1483517c20 100644 --- a/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte +++ b/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte @@ -1,13 +1,20 @@ - (autoSelected ? save() : chooseModal(1))} - disabled={!selectedScreens.length} - size="L" -> - Please select the screens you would like to add to your application. - Autogenerated screens come with CRUD functionality. + (autoSelected ? save() : chooseModal(1))} + disabled={!selectedScreens.length} + size="L" > - - - Blank screen -
x.id.includes(blankScreen))} - on:click={() => - toggleScreenSelection(templates.find(t => t.id === blankScreen))} - class:disabled={autoSelected} + Please select the screens you would like to add to your application. + Autogenerated screens come with CRUD functionality. -
- Blank -
-
- {#if selectedScreens.find(x => x.id === blankScreen)} - - {/if} -
-
- Autogenerated Screens - {#each $tables.list.filter(table => table._id !== "ta_users") as table} + + Blank screen
x.name.includes(table.name))} - on:click={() => toggleScreenSelection(table)} class="item" + class:selected={selectedScreens.find(x => x.id.includes(blankScreen))} + on:click={() => + toggleScreenSelection(templates.find(t => t.id === blankScreen))} + class:disabled={autoSelected} > -
- {table.name} +
+
Blank
- {#if selectedScreens.find(x => x.name.includes(table.name))} - + {#if selectedScreens.find(x => x.id === blankScreen)} +
+ +
{/if}
- {/each} - - + Autogenerated Screens + + {#each $tables.list.filter(table => table._id !== "ta_users") as table} +
+ x.name.includes(table.name) + )} + on:click={() => toggleScreenSelection(table)} + class="item" + > +
+
{table.name}
+
+
+ {#if selectedScreens.find(x => x.name.includes(table.name))} +
+ +
+ {/if} +
+
+ {/each} + +
+ {#if showProgressCircle} + + {/if} +
+ +
diff --git a/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte b/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte index 7018bc2ed4..a86f0c2d75 100644 --- a/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte +++ b/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte @@ -12,34 +12,39 @@ let screenName = "" let url = "" let selectedScreens = [] - let roleId = $selectedAccessRole || "BASIC" - + let showProgressCircle = false let routeError let createdScreens = [] - $: { - selectedScreens?.forEach(screen => { - createdScreens = [...createdScreens, screen.create()] - }) + + const createScreens = async () => { + for (let screen of selectedScreens) { + let test = screen.create() + createdScreens.push(test) + } } const save = async () => { + showProgressCircle = true + await createScreens() for (let screen of createdScreens) { await saveScreens(screen) } await store.actions.routing.fetch() selectedScreens = [] + createdScreens = [] screenName = "" url = "" + showProgressCircle = false } const saveScreens = async draftScreen => { let existingScreenCount = $store.screens.filter( s => s.props._instanceName == draftScreen.props._instanceName ).length - if (existingScreenCount > 0) { let oldUrlArr = draftScreen.routing.route.split("/") + console.log(oldUrlArr) oldUrlArr[1] = `${oldUrlArr[1]}-${existingScreenCount + 1}` draftScreen.routing.route = oldUrlArr.join("/") } @@ -86,6 +91,7 @@ selectedScreens = [] screenName = "" url = "" + createdScreens = [] }) export const showModal = () => { @@ -109,9 +115,20 @@ - + - +