diff --git a/frontend/src/metabase/entities/dashboards.js b/frontend/src/metabase/entities/dashboards.js index 7a26a497039041c670e19acc3be8ffc28f550991..6bc1e14f43b595e7de1d71c140a94d4762f06c85 100644 --- a/frontend/src/metabase/entities/dashboards.js +++ b/frontend/src/metabase/entities/dashboards.js @@ -18,7 +18,6 @@ import { import { compose, withAction, - withAnalytics, withNormalize, withRequestState, } from "metabase/lib/redux"; @@ -129,7 +128,6 @@ const Dashboards = createEntity({ dashboard.id, "copy", ]), - withAnalytics("entities", "dashboard", "copy"), )( (entityObject, overrides, { notify } = {}) => async (dispatch, getState) => { diff --git a/frontend/src/metabase/lib/entities.js b/frontend/src/metabase/lib/entities.js index f827d8889285c77f4402138f7d37735fc42a323f..8efdf0e196c6ec301bebe83fd79b961e494bad5c 100644 --- a/frontend/src/metabase/lib/entities.js +++ b/frontend/src/metabase/lib/entities.js @@ -81,7 +81,6 @@ import { handleEntities, compose, withAction, - withAnalytics, withRequestState, withCachedDataAndRequestState, } from "metabase/lib/redux"; @@ -195,16 +194,6 @@ export function createEntity(def) { ]); } - // same as withRequestState, but with category/label - function withEntityAnalytics(action) { - return withAnalytics( - "entities", - entity.name, - action, - entity.getAnalyticsMetadata, - ); - } - function withEntityActionDecorators(action) { return entity.actionDecorators[action] || (_ => _); } @@ -230,7 +219,6 @@ export function createEntity(def) { create: compose( withAction(CREATE_ACTION), - withEntityAnalytics("create"), withEntityRequestState(() => ["create"]), withEntityActionDecorators("create"), )(entityObject => async (dispatch, getState) => { @@ -245,7 +233,6 @@ export function createEntity(def) { update: compose( withAction(UPDATE_ACTION), - withEntityAnalytics("update"), withEntityRequestState(object => [object.id, "update"]), withEntityActionDecorators("update"), )( @@ -301,7 +288,6 @@ export function createEntity(def) { delete: compose( withAction(DELETE_ACTION), - withEntityAnalytics("delete"), withEntityRequestState(object => [object.id, "delete"]), withEntityActionDecorators("delete"), )(entityObject => async (dispatch, getState) => { diff --git a/frontend/src/metabase/lib/redux/utils.js b/frontend/src/metabase/lib/redux/utils.js index cff5748732eeb0cf047d063feee10caf1078b191..8a987275cb227be87f33a554adc70da6c8d1e011 100644 --- a/frontend/src/metabase/lib/redux/utils.js +++ b/frontend/src/metabase/lib/redux/utils.js @@ -4,7 +4,6 @@ import moment from "moment-timezone"; // eslint-disable-line no-restricted-impor import { normalize } from "normalizr"; import _ from "underscore"; -import * as MetabaseAnalytics from "metabase/lib/analytics"; import { delay } from "metabase/lib/promise"; import { setRequestLoading, @@ -336,31 +335,6 @@ function withCachedData( }; } -export function withAnalytics(categoryOrFn, actionOrFn, labelOrFn, valueOrFn) { - // thunk decorator: - return thunkCreator => - // thunk creator: - (...args) => - // thunk: - (dispatch, getState) => { - function get(valueOrFn, extra = {}) { - if (typeof valueOrFn === "function") { - return valueOrFn(args, { ...extra }, getState); - } - } - try { - const category = get(categoryOrFn); - const action = get(actionOrFn, { category }); - const label = get(labelOrFn, { category, action }); - const value = get(valueOrFn, { category, action, label }); - MetabaseAnalytics.trackStructEvent(category, action, label, value); - } catch (error) { - console.warn("withAnalytics threw an error:", error); - } - return thunkCreator(...args)(dispatch, getState); - }; -} - export function withNormalize(schema) { return thunkCreator => (...args) =>