From 33f44f6ee7a3e0cb397fdc7cd63800fe13918e8e Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 6 Jun 2022 11:11:13 +0100 Subject: [PATCH] Remove todos --- packages/builder/src/analytics/constants.js | 2 +- packages/builder/src/analytics/index.js | 2 +- packages/builder/src/api.js | 3 --- packages/builder/src/builderStore/datasource.js | 1 - packages/builder/src/builderStore/store/automation/index.js | 1 - packages/builder/src/builderStore/store/frontend.js | 1 - .../automation/AutomationPanel/CreateAutomationModal.svelte | 1 - .../automation/AutomationPanel/UpdateAutomationModal.svelte | 1 - .../components/backend/DataTable/modals/CalculateModal.svelte | 1 - .../components/backend/DataTable/modals/CreateViewModal.svelte | 1 - .../src/components/backend/DataTable/modals/FilterModal.svelte | 1 - .../DatasourceNavigator/modals/ImportRestQueriesModal.svelte | 1 - .../DatasourceNavigator/modals/UpdateDatasourceModal.svelte | 1 - .../backend/TableNavigator/modals/CreateTableModal.svelte | 1 - packages/builder/src/components/deploy/DeployModal.svelte | 1 - .../ComponentNavigationTree/ScreenDropdownMenu.svelte | 1 - .../src/components/design/NavigationPanel/ScreenWizard.svelte | 1 - packages/builder/src/components/start/CreateAppModal.svelte | 1 - packages/builder/src/pages/builder/portal/apps/index.svelte | 1 - .../builder/src/pages/builder/portal/manage/email/index.svelte | 1 - .../portal/manage/users/_components/AddUserModal.svelte | 1 - packages/builder/src/stores/portal/auth.js | 1 - packages/cli/src/analytics/Client.js | 1 - packages/cli/src/analytics/index.js | 2 -- packages/cli/src/constants.js | 1 - packages/cli/src/hosting/index.js | 1 - packages/frontend-core/src/api/analytics.js | 1 - 27 files changed, 2 insertions(+), 30 deletions(-) diff --git a/packages/builder/src/analytics/constants.js b/packages/builder/src/analytics/constants.js index 4e7ecc6535..d800ae2c3f 100644 --- a/packages/builder/src/analytics/constants.js +++ b/packages/builder/src/analytics/constants.js @@ -1,5 +1,5 @@ export const Events = { - // + // TODO: Remove most UI events BUILDER: { STARTED: "Builder Started", }, diff --git a/packages/builder/src/analytics/index.js b/packages/builder/src/analytics/index.js index 1283bce649..1b03b0855e 100644 --- a/packages/builder/src/analytics/index.js +++ b/packages/builder/src/analytics/index.js @@ -11,7 +11,7 @@ const posthog = new PosthogClient( const sentry = new SentryClient(process.env.SENTRY_DSN) const intercom = new IntercomClient(process.env.INTERCOM_TOKEN) -// +// TODO: Remove most UI events class AnalyticsHub { constructor() { this.clients = [posthog, sentry, intercom] diff --git a/packages/builder/src/api.js b/packages/builder/src/api.js index 808f434f1e..0f61dba4e1 100644 --- a/packages/builder/src/api.js +++ b/packages/builder/src/api.js @@ -22,9 +22,6 @@ export const API = createAPIClient({ onError: error => { const { url, message, status, method, handled } = error || {} - // Log all API errors to Sentry - // todo: move to api - // analytics.captureException(error) // Log any errors that we haven't manually handled if (!handled) { console.error("Unhandled error from API client", error) diff --git a/packages/builder/src/builderStore/datasource.js b/packages/builder/src/builderStore/datasource.js index cae0116d54..cfdeeac23e 100644 --- a/packages/builder/src/builderStore/datasource.js +++ b/packages/builder/src/builderStore/datasource.js @@ -31,7 +31,6 @@ export async function saveDatasource(config, skipFetch = false) { // update the tables incase data source plus await tables.fetch() await datasources.select(resp._id) - // todo: move to api analytics.captureEvent(Events.DATASOURCE.CREATED, { name: resp.name, source: resp.source, diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index 2b57f212d4..5252d4b06a 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -125,7 +125,6 @@ const automationActions = store => ({ state.selectedBlock = newBlock return state }) - // todo: move to api analytics.captureEvent(Events.AUTOMATION.BLOCK_ADDED, { name: block.name, }) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 836e4c3d24..3ffc890c7d 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -426,7 +426,6 @@ export const getFrontendStore = () => { }) // Log event - // todo: move to api analytics.captureEvent(Events.COMPONENT.CREATED, { name: componentInstance._component, }) diff --git a/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte b/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte index abf43a4691..4fb912939a 100644 --- a/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte @@ -47,7 +47,6 @@ notifications.success(`Automation ${name} created`) $goto(`./${$automationStore.selectedAutomation.automation._id}`) - // todo: move to api analytics.captureEvent(Events.AUTOMATION.CREATED, { name }) } catch (error) { notifications.error("Error creating automation") diff --git a/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte b/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte index 16e981657c..bceff0ef2e 100644 --- a/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte @@ -27,7 +27,6 @@ } await automationStore.actions.save(updatedAutomation) notifications.success(`Automation ${name} updated successfully`) - // todo: move to api analytics.captureEvent(Events.AUTOMATION.SAVED, { name }) hide() } catch (error) { diff --git a/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte b/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte index 852b91a7a0..81f54032f6 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte @@ -41,7 +41,6 @@ try { views.save(view) notifications.success(`View ${view.name} saved`) - // todo: move to api analytics.captureEvent(Events.VIEW.ADDED_CALCULATE, { field: view.field }) } catch (error) { notifications.error("Error saving view") diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateViewModal.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateViewModal.svelte index 9ce7a283bf..2ea0c1b63b 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateViewModal.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateViewModal.svelte @@ -22,7 +22,6 @@ field, }) notifications.success(`View ${name} created`) - // todo: move to api analytics.captureEvent(Events.VIEW.CREATED, { name }) $goto(`../../view/${name}`) } catch (error) { diff --git a/packages/builder/src/components/backend/DataTable/modals/FilterModal.svelte b/packages/builder/src/components/backend/DataTable/modals/FilterModal.svelte index 2bfd6f0726..d7976cd387 100644 --- a/packages/builder/src/components/backend/DataTable/modals/FilterModal.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/FilterModal.svelte @@ -75,7 +75,6 @@ try { views.save(view) notifications.success(`View ${view.name} saved`) - // todo: move to api analytics.captureEvent(Events.VIEW.ADDED_FILTER, { filters: JSON.stringify(view.filters), }) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/modals/ImportRestQueriesModal.svelte b/packages/builder/src/components/backend/DatasourceNavigator/modals/ImportRestQueriesModal.svelte index 292325edfa..cbf4274690 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/modals/ImportRestQueriesModal.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/modals/ImportRestQueriesModal.svelte @@ -72,7 +72,6 @@ } notifications.success(`Imported successfully.`) - // todo: move to api analytics.captureEvent(Events.QUERIES.REST.IMPORTED, { importType: lastTouched, newDatasource: createDatasource, diff --git a/packages/builder/src/components/backend/DatasourceNavigator/modals/UpdateDatasourceModal.svelte b/packages/builder/src/components/backend/DatasourceNavigator/modals/UpdateDatasourceModal.svelte index 8dd39200d6..28625aa86e 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/modals/UpdateDatasourceModal.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/modals/UpdateDatasourceModal.svelte @@ -35,7 +35,6 @@ } await datasources.save(updatedDatasource) notifications.success(`Datasource ${name} updated successfully.`) - // todo: move to api analytics.captureEvent(Events.DATASOURCE.UPDATED, updatedDatasource) hide() } diff --git a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte index 5c96445c4c..7830fd0246 100644 --- a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte +++ b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte @@ -59,7 +59,6 @@ try { table = await tables.save(newTable) notifications.success(`Table ${name} created successfully.`) - // todo: move to api analytics.captureEvent(Events.TABLE.CREATED, { name }) // Navigate to new table diff --git a/packages/builder/src/components/deploy/DeployModal.svelte b/packages/builder/src/components/deploy/DeployModal.svelte index 0018d644ac..0d9bfb7539 100644 --- a/packages/builder/src/components/deploy/DeployModal.svelte +++ b/packages/builder/src/components/deploy/DeployModal.svelte @@ -42,7 +42,6 @@ asyncModal.hide() publishCompleteModal.show() } catch (error) { - // todo: move to api analytics.captureException(error) notifications.error("Error publishing app") } diff --git a/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte b/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte index 65f8309cda..76bb48a26c 100644 --- a/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte +++ b/packages/builder/src/components/design/NavigationPanel/ComponentNavigationTree/ScreenDropdownMenu.svelte @@ -43,7 +43,6 @@ // Analytics if (screen.template) { - // todo: move to api analytics.captureEvent(Events.SCREEN.CREATED, { template: "createFromScratch", }) diff --git a/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte b/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte index 5606c41ade..1859ba93b6 100644 --- a/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte +++ b/packages/builder/src/components/design/NavigationPanel/ScreenWizard.svelte @@ -67,7 +67,6 @@ // Analytics if (screen.template) { - // todo: move to api analytics.captureEvent(Events.SCREEN.CREATED, { template: screen.template, datasource: screen.datasource, diff --git a/packages/builder/src/components/start/CreateAppModal.svelte b/packages/builder/src/components/start/CreateAppModal.svelte index 05cb3b42bb..c88c2fe035 100644 --- a/packages/builder/src/components/start/CreateAppModal.svelte +++ b/packages/builder/src/components/start/CreateAppModal.svelte @@ -103,7 +103,6 @@ // Create App const createdApp = await API.createApp(data) - // todo: move to api analytics.captureEvent(Events.APP.CREATED, { name: $values.name, appId: createdApp.instance._id, diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte index 946ae03446..2685881973 100644 --- a/packages/builder/src/pages/builder/portal/apps/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/index.svelte @@ -138,7 +138,6 @@ // Create App const createdApp = await API.createApp(data) - // todo: move to api analytics.captureEvent(Events.APP.CREATED, { name: appName, appId: createdApp.instance._id, diff --git a/packages/builder/src/pages/builder/portal/manage/email/index.svelte b/packages/builder/src/pages/builder/portal/manage/email/index.svelte index 1a7a71f171..3e5b35db41 100644 --- a/packages/builder/src/pages/builder/portal/manage/email/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/email/index.svelte @@ -60,7 +60,6 @@ smtpConfig._id = savedConfig._id await admin.getChecklist() notifications.success(`Settings saved`) - // todo: move to api analytics.captureEvent(Events.SMTP.SAVED) } catch (error) { notifications.error( diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/AddUserModal.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/AddUserModal.svelte index 6086c3b21b..0255784a7b 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/_components/AddUserModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/AddUserModal.svelte @@ -24,7 +24,6 @@ try { const res = await users.invite({ email: $email, builder, admin }) notifications.success(res.message) - // todo: move to api analytics.captureEvent(Events.USER.INVITE, { type: selected }) } catch (error) { notifications.error("Error inviting user") diff --git a/packages/builder/src/stores/portal/auth.js b/packages/builder/src/stores/portal/auth.js index b346b8d330..4a90323144 100644 --- a/packages/builder/src/stores/portal/auth.js +++ b/packages/builder/src/stores/portal/auth.js @@ -57,7 +57,6 @@ export function createAuthStore() { analytics .activate() .then(() => { - // todo: move to api analytics.identify(user._id, user) analytics.showChat({ email: user.email, diff --git a/packages/cli/src/analytics/Client.js b/packages/cli/src/analytics/Client.js index cdf345198e..a3b43b5ea1 100644 --- a/packages/cli/src/analytics/Client.js +++ b/packages/cli/src/analytics/Client.js @@ -6,7 +6,6 @@ const { } = require("../constants") const ConfigManager = require("../structures/ConfigManager") -// use backend core class AnalyticsClient { constructor() { this.client = new PostHog(BUDIBASE_POSTHOG_TOKEN, { diff --git a/packages/cli/src/analytics/index.js b/packages/cli/src/analytics/index.js index 514cbf60fd..d85323d1d0 100644 --- a/packages/cli/src/analytics/index.js +++ b/packages/cli/src/analytics/index.js @@ -3,8 +3,6 @@ const { CommandWords } = require("../constants") const { success, error } = require("../utils") const AnalyticsClient = require("./Client") -// use backend core - const client = new AnalyticsClient() async function optOut() { diff --git a/packages/cli/src/constants.js b/packages/cli/src/constants.js index 0fdd7560c7..7a3b1463ca 100644 --- a/packages/cli/src/constants.js +++ b/packages/cli/src/constants.js @@ -9,7 +9,6 @@ exports.InitTypes = { DIGITAL_OCEAN: "do", } -// todo: use backend core exports.AnalyticsEvents = { OptOut: "analytics_opt_out", OptIn: "analytics_opt_in", diff --git a/packages/cli/src/hosting/index.js b/packages/cli/src/hosting/index.js index 839dc7e6f2..2ebcee43a5 100644 --- a/packages/cli/src/hosting/index.js +++ b/packages/cli/src/hosting/index.js @@ -15,7 +15,6 @@ const makeEnv = require("./makeEnv") const axios = require("axios") const AnalyticsClient = require("../analytics/Client") -// todo: use backend core const BUDIBASE_SERVICES = ["app-service", "worker-service", "proxy-service"] const ERROR_FILE = "docker-error.log" const FILE_URLS = [ diff --git a/packages/frontend-core/src/api/analytics.js b/packages/frontend-core/src/api/analytics.js index 1a174b2edd..5aa35469ae 100644 --- a/packages/frontend-core/src/api/analytics.js +++ b/packages/frontend-core/src/api/analytics.js @@ -1,4 +1,3 @@ -// todo: audit export const buildAnalyticsEndpoints = API => ({ /** * Gets the current status of analytics for this environment