Remove todos
This commit is contained in:
parent
4e77571ddb
commit
4cdfb3c110
|
@ -1,5 +1,5 @@
|
||||||
export const Events = {
|
export const Events = {
|
||||||
//
|
// TODO: Remove most UI events
|
||||||
BUILDER: {
|
BUILDER: {
|
||||||
STARTED: "Builder Started",
|
STARTED: "Builder Started",
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,7 +11,7 @@ const posthog = new PosthogClient(
|
||||||
const sentry = new SentryClient(process.env.SENTRY_DSN)
|
const sentry = new SentryClient(process.env.SENTRY_DSN)
|
||||||
const intercom = new IntercomClient(process.env.INTERCOM_TOKEN)
|
const intercom = new IntercomClient(process.env.INTERCOM_TOKEN)
|
||||||
|
|
||||||
//
|
// TODO: Remove most UI events
|
||||||
class AnalyticsHub {
|
class AnalyticsHub {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.clients = [posthog, sentry, intercom]
|
this.clients = [posthog, sentry, intercom]
|
||||||
|
|
|
@ -22,9 +22,6 @@ export const API = createAPIClient({
|
||||||
onError: error => {
|
onError: error => {
|
||||||
const { url, message, status, method, handled } = 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
|
// Log any errors that we haven't manually handled
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
console.error("Unhandled error from API client", error)
|
console.error("Unhandled error from API client", error)
|
||||||
|
|
|
@ -31,7 +31,6 @@ export async function saveDatasource(config, skipFetch = false) {
|
||||||
// update the tables incase data source plus
|
// update the tables incase data source plus
|
||||||
await tables.fetch()
|
await tables.fetch()
|
||||||
await datasources.select(resp._id)
|
await datasources.select(resp._id)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.DATASOURCE.CREATED, {
|
analytics.captureEvent(Events.DATASOURCE.CREATED, {
|
||||||
name: resp.name,
|
name: resp.name,
|
||||||
source: resp.source,
|
source: resp.source,
|
||||||
|
|
|
@ -125,7 +125,6 @@ const automationActions = store => ({
|
||||||
state.selectedBlock = newBlock
|
state.selectedBlock = newBlock
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.AUTOMATION.BLOCK_ADDED, {
|
analytics.captureEvent(Events.AUTOMATION.BLOCK_ADDED, {
|
||||||
name: block.name,
|
name: block.name,
|
||||||
})
|
})
|
||||||
|
|
|
@ -426,7 +426,6 @@ export const getFrontendStore = () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Log event
|
// Log event
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.COMPONENT.CREATED, {
|
analytics.captureEvent(Events.COMPONENT.CREATED, {
|
||||||
name: componentInstance._component,
|
name: componentInstance._component,
|
||||||
})
|
})
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
notifications.success(`Automation ${name} created`)
|
notifications.success(`Automation ${name} created`)
|
||||||
|
|
||||||
$goto(`./${$automationStore.selectedAutomation.automation._id}`)
|
$goto(`./${$automationStore.selectedAutomation.automation._id}`)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.AUTOMATION.CREATED, { name })
|
analytics.captureEvent(Events.AUTOMATION.CREATED, { name })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error creating automation")
|
notifications.error("Error creating automation")
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
}
|
}
|
||||||
await automationStore.actions.save(updatedAutomation)
|
await automationStore.actions.save(updatedAutomation)
|
||||||
notifications.success(`Automation ${name} updated successfully`)
|
notifications.success(`Automation ${name} updated successfully`)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.AUTOMATION.SAVED, { name })
|
analytics.captureEvent(Events.AUTOMATION.SAVED, { name })
|
||||||
hide()
|
hide()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
try {
|
try {
|
||||||
views.save(view)
|
views.save(view)
|
||||||
notifications.success(`View ${view.name} saved`)
|
notifications.success(`View ${view.name} saved`)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.VIEW.ADDED_CALCULATE, { field: view.field })
|
analytics.captureEvent(Events.VIEW.ADDED_CALCULATE, { field: view.field })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error saving view")
|
notifications.error("Error saving view")
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
field,
|
field,
|
||||||
})
|
})
|
||||||
notifications.success(`View ${name} created`)
|
notifications.success(`View ${name} created`)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.VIEW.CREATED, { name })
|
analytics.captureEvent(Events.VIEW.CREATED, { name })
|
||||||
$goto(`../../view/${name}`)
|
$goto(`../../view/${name}`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -75,7 +75,6 @@
|
||||||
try {
|
try {
|
||||||
views.save(view)
|
views.save(view)
|
||||||
notifications.success(`View ${view.name} saved`)
|
notifications.success(`View ${view.name} saved`)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.VIEW.ADDED_FILTER, {
|
analytics.captureEvent(Events.VIEW.ADDED_FILTER, {
|
||||||
filters: JSON.stringify(view.filters),
|
filters: JSON.stringify(view.filters),
|
||||||
})
|
})
|
||||||
|
|
|
@ -72,7 +72,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
notifications.success(`Imported successfully.`)
|
notifications.success(`Imported successfully.`)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.QUERIES.REST.IMPORTED, {
|
analytics.captureEvent(Events.QUERIES.REST.IMPORTED, {
|
||||||
importType: lastTouched,
|
importType: lastTouched,
|
||||||
newDatasource: createDatasource,
|
newDatasource: createDatasource,
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
}
|
}
|
||||||
await datasources.save(updatedDatasource)
|
await datasources.save(updatedDatasource)
|
||||||
notifications.success(`Datasource ${name} updated successfully.`)
|
notifications.success(`Datasource ${name} updated successfully.`)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.DATASOURCE.UPDATED, updatedDatasource)
|
analytics.captureEvent(Events.DATASOURCE.UPDATED, updatedDatasource)
|
||||||
hide()
|
hide()
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
try {
|
try {
|
||||||
table = await tables.save(newTable)
|
table = await tables.save(newTable)
|
||||||
notifications.success(`Table ${name} created successfully.`)
|
notifications.success(`Table ${name} created successfully.`)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.TABLE.CREATED, { name })
|
analytics.captureEvent(Events.TABLE.CREATED, { name })
|
||||||
|
|
||||||
// Navigate to new table
|
// Navigate to new table
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
asyncModal.hide()
|
asyncModal.hide()
|
||||||
publishCompleteModal.show()
|
publishCompleteModal.show()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// todo: move to api
|
|
||||||
analytics.captureException(error)
|
analytics.captureException(error)
|
||||||
notifications.error("Error publishing app")
|
notifications.error("Error publishing app")
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
|
|
||||||
// Analytics
|
// Analytics
|
||||||
if (screen.template) {
|
if (screen.template) {
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.SCREEN.CREATED, {
|
analytics.captureEvent(Events.SCREEN.CREATED, {
|
||||||
template: "createFromScratch",
|
template: "createFromScratch",
|
||||||
})
|
})
|
||||||
|
|
|
@ -67,7 +67,6 @@
|
||||||
|
|
||||||
// Analytics
|
// Analytics
|
||||||
if (screen.template) {
|
if (screen.template) {
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.SCREEN.CREATED, {
|
analytics.captureEvent(Events.SCREEN.CREATED, {
|
||||||
template: screen.template,
|
template: screen.template,
|
||||||
datasource: screen.datasource,
|
datasource: screen.datasource,
|
||||||
|
|
|
@ -103,7 +103,6 @@
|
||||||
|
|
||||||
// Create App
|
// Create App
|
||||||
const createdApp = await API.createApp(data)
|
const createdApp = await API.createApp(data)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.APP.CREATED, {
|
analytics.captureEvent(Events.APP.CREATED, {
|
||||||
name: $values.name,
|
name: $values.name,
|
||||||
appId: createdApp.instance._id,
|
appId: createdApp.instance._id,
|
||||||
|
|
|
@ -138,7 +138,6 @@
|
||||||
|
|
||||||
// Create App
|
// Create App
|
||||||
const createdApp = await API.createApp(data)
|
const createdApp = await API.createApp(data)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.APP.CREATED, {
|
analytics.captureEvent(Events.APP.CREATED, {
|
||||||
name: appName,
|
name: appName,
|
||||||
appId: createdApp.instance._id,
|
appId: createdApp.instance._id,
|
||||||
|
|
|
@ -60,7 +60,6 @@
|
||||||
smtpConfig._id = savedConfig._id
|
smtpConfig._id = savedConfig._id
|
||||||
await admin.getChecklist()
|
await admin.getChecklist()
|
||||||
notifications.success(`Settings saved`)
|
notifications.success(`Settings saved`)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.SMTP.SAVED)
|
analytics.captureEvent(Events.SMTP.SAVED)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error(
|
notifications.error(
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
try {
|
try {
|
||||||
const res = await users.invite({ email: $email, builder, admin })
|
const res = await users.invite({ email: $email, builder, admin })
|
||||||
notifications.success(res.message)
|
notifications.success(res.message)
|
||||||
// todo: move to api
|
|
||||||
analytics.captureEvent(Events.USER.INVITE, { type: selected })
|
analytics.captureEvent(Events.USER.INVITE, { type: selected })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error inviting user")
|
notifications.error("Error inviting user")
|
||||||
|
|
|
@ -57,7 +57,6 @@ export function createAuthStore() {
|
||||||
analytics
|
analytics
|
||||||
.activate()
|
.activate()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// todo: move to api
|
|
||||||
analytics.identify(user._id, user)
|
analytics.identify(user._id, user)
|
||||||
analytics.showChat({
|
analytics.showChat({
|
||||||
email: user.email,
|
email: user.email,
|
||||||
|
|
|
@ -6,7 +6,6 @@ const {
|
||||||
} = require("../constants")
|
} = require("../constants")
|
||||||
const ConfigManager = require("../structures/ConfigManager")
|
const ConfigManager = require("../structures/ConfigManager")
|
||||||
|
|
||||||
// use backend core
|
|
||||||
class AnalyticsClient {
|
class AnalyticsClient {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.client = new PostHog(BUDIBASE_POSTHOG_TOKEN, {
|
this.client = new PostHog(BUDIBASE_POSTHOG_TOKEN, {
|
||||||
|
|
|
@ -3,8 +3,6 @@ const { CommandWords } = require("../constants")
|
||||||
const { success, error } = require("../utils")
|
const { success, error } = require("../utils")
|
||||||
const AnalyticsClient = require("./Client")
|
const AnalyticsClient = require("./Client")
|
||||||
|
|
||||||
// use backend core
|
|
||||||
|
|
||||||
const client = new AnalyticsClient()
|
const client = new AnalyticsClient()
|
||||||
|
|
||||||
async function optOut() {
|
async function optOut() {
|
||||||
|
|
|
@ -9,7 +9,6 @@ exports.InitTypes = {
|
||||||
DIGITAL_OCEAN: "do",
|
DIGITAL_OCEAN: "do",
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: use backend core
|
|
||||||
exports.AnalyticsEvents = {
|
exports.AnalyticsEvents = {
|
||||||
OptOut: "analytics_opt_out",
|
OptOut: "analytics_opt_out",
|
||||||
OptIn: "analytics_opt_in",
|
OptIn: "analytics_opt_in",
|
||||||
|
|
|
@ -15,7 +15,6 @@ const makeEnv = require("./makeEnv")
|
||||||
const axios = require("axios")
|
const axios = require("axios")
|
||||||
const AnalyticsClient = require("../analytics/Client")
|
const AnalyticsClient = require("../analytics/Client")
|
||||||
|
|
||||||
// todo: use backend core
|
|
||||||
const BUDIBASE_SERVICES = ["app-service", "worker-service", "proxy-service"]
|
const BUDIBASE_SERVICES = ["app-service", "worker-service", "proxy-service"]
|
||||||
const ERROR_FILE = "docker-error.log"
|
const ERROR_FILE = "docker-error.log"
|
||||||
const FILE_URLS = [
|
const FILE_URLS = [
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// todo: audit
|
|
||||||
export const buildAnalyticsEndpoints = API => ({
|
export const buildAnalyticsEndpoints = API => ({
|
||||||
/**
|
/**
|
||||||
* Gets the current status of analytics for this environment
|
* Gets the current status of analytics for this environment
|
||||||
|
|
Loading…
Reference in New Issue