From ada380982bf2ff9d8ec81b2eb5442d9f6aea7253 Mon Sep 17 00:00:00 2001 From: Grace Guo Date: Wed, 12 May 2021 08:25:46 -0700 Subject: [PATCH] fix: bring back dashboard perf logger (#14584) * fix: bring back dashboard perf logger * add test --- .../cypress-base/cypress/integration/dashboard/load.test.ts | 5 +++++ superset-frontend/src/dashboard/actions/hydrate.js | 3 --- superset-frontend/src/views/store.ts | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/load.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/load.test.ts index 99f5f729f9..9fb84f70c9 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/load.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/load.test.ts @@ -47,4 +47,9 @@ describe('Dashboard load', () => { cy.get('[data-test="discard-changes-button"]').should('be.visible'); cy.get('#app-menu').should('not.exist'); }); + + it('should send log data', () => { + cy.visit(WORLD_HEALTH_DASHBOARD); + cy.intercept('/superset/log/?explode=events&dashboard_id=*'); + }); }); diff --git a/superset-frontend/src/dashboard/actions/hydrate.js b/superset-frontend/src/dashboard/actions/hydrate.js index 64eaeca141..4f1bd4cdc8 100644 --- a/superset-frontend/src/dashboard/actions/hydrate.js +++ b/superset-frontend/src/dashboard/actions/hydrate.js @@ -18,7 +18,6 @@ */ /* eslint-disable camelcase */ import { isString, keyBy } from 'lodash'; -import shortid from 'shortid'; import { Behavior, CategoricalColorNamespace, @@ -376,8 +375,6 @@ export const hydrateDashboard = (dashboardData, chartData, datasourcesData) => ( lastModifiedTime: dashboardData.changed_on, }, dashboardLayout, - messageToasts: [], - impressionId: shortid.generate(), }, }); }; diff --git a/superset-frontend/src/views/store.ts b/superset-frontend/src/views/store.ts index 3b488f9bea..ac66d3cced 100644 --- a/superset-frontend/src/views/store.ts +++ b/superset-frontend/src/views/store.ts @@ -29,6 +29,8 @@ import nativeFilters from 'src/dashboard/reducers/nativeFilters'; import datasources from 'src/dashboard/reducers/datasources'; import sliceEntities from 'src/dashboard/reducers/sliceEntities'; import dashboardLayout from 'src/dashboard/reducers/undoableDashboardLayout'; +import logger from 'src/middleware/loggerMiddleware'; +import shortid from 'shortid'; // Some reducers don't do anything, and redux is just used to reference the initial "state". // This may change later, as the client application takes on more responsibilities. @@ -57,12 +59,12 @@ export const rootReducer = combineReducers({ messageToasts: messageToastReducer, common: noopReducer(bootstrap.common || {}), user: noopReducer(bootstrap.user || {}), - impressionId: noopReducer(''), + impressionId: noopReducer(shortid.generate()), ...dashboardReducers, }); export const store = createStore( rootReducer, {}, - compose(applyMiddleware(thunk), initEnhancer(false)), + compose(applyMiddleware(thunk, logger), initEnhancer(false)), );