From f9fea88541eab9986287b092593354e262717bd1 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 24 Nov 2021 19:10:10 +0000 Subject: [PATCH 1/4] refactor screen templates to include table name --- .../store/screenTemplates/newRowScreen.js | 1 + .../store/screenTemplates/rowDetailScreen.js | 1 + .../store/screenTemplates/rowListScreen.js | 1 + .../design/NavigationPanel/NewScreenModal.svelte | 12 +++++------- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js b/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js index c2dffef4b6..7370ee6c6a 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js +++ b/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js @@ -15,6 +15,7 @@ export default function (tables) { name: `${table.name} - New`, create: () => createScreen(table), id: NEW_ROW_TEMPLATE, + table: table.name } }) } diff --git a/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js b/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js index 3ba8be10b5..1b20e33b64 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js +++ b/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js @@ -17,6 +17,7 @@ export default function (tables) { name: `${table.name} - Detail`, create: () => createScreen(table), id: ROW_DETAIL_TEMPLATE, + table: table.name } }) } diff --git a/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js b/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js index 188682ed3f..e26e81ec45 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js +++ b/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js @@ -10,6 +10,7 @@ export default function (tables) { name: `${table.name} - List`, create: () => createScreen(table), id: ROW_LIST_TEMPLATE, + table: table.name } }) } diff --git a/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte b/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte index 1483517c20..57a40b9081 100644 --- a/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte +++ b/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte @@ -21,13 +21,13 @@ $: autoSelected = selectedScreens?.length > 0 && !blankSelected let templates = getTemplates($store, $tables.list) const toggleScreenSelection = table => { - if (selectedScreens.find(s => s.name.includes(table.name))) { + if (selectedScreens.find(s => s.table === table.name)) { selectedScreens = selectedScreens.filter( - screen => !screen.name.includes(table.name) + screen => screen.table !== table.name ) } else { let partialTemplates = getTemplates($store, $tables.list).filter( - template => template.name.includes(table.name) + template => template.table === table.name ) selectedScreens = [...partialTemplates, ...selectedScreens] } @@ -75,9 +75,7 @@ {#each $tables.list.filter(table => table._id !== "ta_users") as table}
- x.name.includes(table.name) - )} + class:selected={selectedScreens.find(x => x.table === table.name)} on:click={() => toggleScreenSelection(table)} class="item" > @@ -87,7 +85,7 @@
- {#if selectedScreens.find(x => x.name.includes(table.name))} + {#if selectedScreens.find(x => x.table === table.name)}
From f8f191570da136a09a5c58685542133edefff4c0 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 24 Nov 2021 19:26:07 +0000 Subject: [PATCH 2/4] refactor screen templates to include table name --- .../src/builderStore/store/screenTemplates/newRowScreen.js | 2 +- .../src/builderStore/store/screenTemplates/rowDetailScreen.js | 2 +- .../src/builderStore/store/screenTemplates/rowListScreen.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js b/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js index 7370ee6c6a..2b9d2bc663 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js +++ b/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js @@ -15,7 +15,7 @@ export default function (tables) { name: `${table.name} - New`, create: () => createScreen(table), id: NEW_ROW_TEMPLATE, - table: table.name + table: table.name, } }) } diff --git a/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js b/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js index 1b20e33b64..8ab4a2bea7 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js +++ b/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js @@ -17,7 +17,7 @@ export default function (tables) { name: `${table.name} - Detail`, create: () => createScreen(table), id: ROW_DETAIL_TEMPLATE, - table: table.name + table: table.name, } }) } diff --git a/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js b/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js index e26e81ec45..c369f99f68 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js +++ b/packages/builder/src/builderStore/store/screenTemplates/rowListScreen.js @@ -10,7 +10,7 @@ export default function (tables) { name: `${table.name} - List`, create: () => createScreen(table), id: ROW_LIST_TEMPLATE, - table: table.name + table: table.name, } }) } From 3e6d858d3a7ca9f516a9c97ebc0c5f287a2f2dc2 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 25 Nov 2021 09:30:10 +0000 Subject: [PATCH 3/4] fix automation --- .../store/screenTemplates/createFromScratchScreen.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/builder/src/builderStore/store/screenTemplates/createFromScratchScreen.js b/packages/builder/src/builderStore/store/screenTemplates/createFromScratchScreen.js index d4b78740d0..eee423ef86 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/createFromScratchScreen.js +++ b/packages/builder/src/builderStore/store/screenTemplates/createFromScratchScreen.js @@ -4,6 +4,7 @@ export default { name: `Create from scratch`, id: `createFromScratch`, create: () => createScreen(), + table: `Create from scratch`, } const createScreen = () => { From 591d0bb7d8f1b9ecc73ec69863eb938bb8d1d2c1 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 25 Nov 2021 09:41:40 +0000 Subject: [PATCH 4/4] re-add analytics --- .../src/components/design/NavigationPanel/ScreenWizard.svelte | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte b/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte index 62843ccc91..262f042afe 100644 --- a/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte +++ b/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte @@ -5,6 +5,7 @@ import { Modal } from "@budibase/bbui" import { store, selectedAccessRole, allScreens } from "builderStore" import { onDestroy } from "svelte" + import analytics, { Events } from "analytics" let newScreenModal let navigationSelectionModal @@ -21,6 +22,9 @@ for (let screen of selectedScreens) { let test = screen.create() createdScreens.push(test) + analytics.captureEvent(Events.SCREEN.CREATED, { + template: screen.id || screen.name, + }) } }