Remove todos

This commit is contained in:
Rory Powell 2022-06-06 11:11:13 +01:00
parent 4e77571ddb
commit 4cdfb3c110
27 changed files with 2 additions and 30 deletions

View File

@ -1,5 +1,5 @@
export const Events = {
//
// TODO: Remove most UI events
BUILDER: {
STARTED: "Builder Started",
},

View File

@ -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]

View File

@ -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)

View File

@ -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,

View File

@ -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,
})

View File

@ -426,7 +426,6 @@ export const getFrontendStore = () => {
})
// Log event
// todo: move to api
analytics.captureEvent(Events.COMPONENT.CREATED, {
name: componentInstance._component,
})

View File

@ -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")

View File

@ -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) {

View File

@ -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")

View File

@ -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) {

View File

@ -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),
})

View File

@ -72,7 +72,6 @@
}
notifications.success(`Imported successfully.`)
// todo: move to api
analytics.captureEvent(Events.QUERIES.REST.IMPORTED, {
importType: lastTouched,
newDatasource: createDatasource,

View File

@ -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()
}

View File

@ -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

View File

@ -42,7 +42,6 @@
asyncModal.hide()
publishCompleteModal.show()
} catch (error) {
// todo: move to api
analytics.captureException(error)
notifications.error("Error publishing app")
}

View File

@ -43,7 +43,6 @@
// Analytics
if (screen.template) {
// todo: move to api
analytics.captureEvent(Events.SCREEN.CREATED, {
template: "createFromScratch",
})

View File

@ -67,7 +67,6 @@
// Analytics
if (screen.template) {
// todo: move to api
analytics.captureEvent(Events.SCREEN.CREATED, {
template: screen.template,
datasource: screen.datasource,

View File

@ -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,

View File

@ -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,

View File

@ -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(

View File

@ -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")

View File

@ -57,7 +57,6 @@ export function createAuthStore() {
analytics
.activate()
.then(() => {
// todo: move to api
analytics.identify(user._id, user)
analytics.showChat({
email: user.email,

View File

@ -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, {

View File

@ -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() {

View File

@ -9,7 +9,6 @@ exports.InitTypes = {
DIGITAL_OCEAN: "do",
}
// todo: use backend core
exports.AnalyticsEvents = {
OptOut: "analytics_opt_out",
OptIn: "analytics_opt_in",

View File

@ -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 = [

View File

@ -1,4 +1,3 @@
// todo: audit
export const buildAnalyticsEndpoints = API => ({
/**
* Gets the current status of analytics for this environment