From a8f23f082f8916e7d7349c8e0afc9493805267c7 Mon Sep 17 00:00:00 2001 From: muhammad-ammar Date: Wed, 9 Oct 2024 15:27:59 +0500 Subject: [PATCH] feat: ship analytics 2.0 --- src/components/AdvanceAnalyticsV2/AnalyticsV2Page.jsx | 2 +- src/components/EnterpriseApp/EnterpriseAppRoutes.jsx | 8 ++++---- .../EnterpriseApp/EnterpriseAppRoutes.test.jsx | 9 +-------- src/components/EnterpriseApp/data/constants.js | 2 +- src/components/Sidebar/index.jsx | 6 ------ src/config/index.js | 1 - 6 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/components/AdvanceAnalyticsV2/AnalyticsV2Page.jsx b/src/components/AdvanceAnalyticsV2/AnalyticsV2Page.jsx index 1401e6e9a..49e2cc3b9 100644 --- a/src/components/AdvanceAnalyticsV2/AnalyticsV2Page.jsx +++ b/src/components/AdvanceAnalyticsV2/AnalyticsV2Page.jsx @@ -16,7 +16,7 @@ import Skills from './tabs/Skills'; import { useEnterpriseAnalyticsAggregatesData } from './data/hooks'; import { GRANULARITY, CALCULATION } from './data/constants'; -const PAGE_TITLE = 'AnalyticsV2'; +const PAGE_TITLE = 'Analytics'; const AnalyticsV2Page = ({ enterpriseId }) => { const [activeTab, setActiveTab] = useState('enrollments'); diff --git a/src/components/EnterpriseApp/EnterpriseAppRoutes.jsx b/src/components/EnterpriseApp/EnterpriseAppRoutes.jsx index 972f7b77f..a44e9f05f 100644 --- a/src/components/EnterpriseApp/EnterpriseAppRoutes.jsx +++ b/src/components/EnterpriseApp/EnterpriseAppRoutes.jsx @@ -82,17 +82,17 @@ const EnterpriseAppRoutes = ({ /> )} - {enableAnalyticsPage && enterpriseAppPage === ROUTE_NAMES.analytics && ( + {enableAnalyticsPage && enterpriseAppPage === ROUTE_NAMES.legacyAnalytics && ( : } /> )} - {enableAnalyticsPage && enterpriseAppPage === ROUTE_NAMES.analyticsv2 && ( + {enableAnalyticsPage && enterpriseAppPage === ROUTE_NAMES.analytics && ( diff --git a/src/components/EnterpriseApp/EnterpriseAppRoutes.test.jsx b/src/components/EnterpriseApp/EnterpriseAppRoutes.test.jsx index d706470f4..22a7d6cc2 100644 --- a/src/components/EnterpriseApp/EnterpriseAppRoutes.test.jsx +++ b/src/components/EnterpriseApp/EnterpriseAppRoutes.test.jsx @@ -16,7 +16,7 @@ jest.mock('../PlotlyAnalytics', () => ({ PlotlyAnalyticsPage: () =>
PlotlyAnalyticsPage Mock Component
, })); -let mockEnterpriseAppPage = 'analyticsv2'; +let mockEnterpriseAppPage = 'analytics'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), @@ -67,11 +67,4 @@ describe('EnterpriseAppRoutes', () => { renderWithProviders(defaultProps); expect(screen.getByText('AdminPage Mock Component')).toBeInTheDocument(); }); - - it('renders Analytics when ANALYTICS_SUPPORTED is true', () => { - mockEnterpriseAppPage = 'analytics'; - features.ANALYTICS_SUPPORTED = true; - renderWithProviders(defaultProps); - expect(screen.getByText('PlotlyAnalyticsPage Mock Component')).toBeInTheDocument(); - }); }); diff --git a/src/components/EnterpriseApp/data/constants.js b/src/components/EnterpriseApp/data/constants.js index 93bd9412d..71ca6764f 100644 --- a/src/components/EnterpriseApp/data/constants.js +++ b/src/components/EnterpriseApp/data/constants.js @@ -1,8 +1,8 @@ /* eslint-disable import/prefer-default-export */ export const ROUTE_NAMES = { + legacyAnalytics: 'legacy-analytics', analytics: 'analytics', - analyticsv2: 'analyticsv2', appearance: 'appearance', bulkEnrollment: 'enrollment', bulkEnrollmentResults: 'bulk-enrollment-results', diff --git a/src/components/Sidebar/index.jsx b/src/components/Sidebar/index.jsx index bb5f0891f..3913813a5 100644 --- a/src/components/Sidebar/index.jsx +++ b/src/components/Sidebar/index.jsx @@ -125,12 +125,6 @@ const Sidebar = ({ icon: , hidden: !features.ANALYTICS || !enableAnalyticsScreen, }, - { - title: 'AnalyticsV2', - to: `${baseUrl}/admin/${ROUTE_NAMES.analyticsv2}`, - icon: , - hidden: !features.ANALYTICS_V2, - }, { title: 'Code Management', to: `${baseUrl}/admin/${ROUTE_NAMES.codeManagement}`, diff --git a/src/config/index.js b/src/config/index.js index cc3b930b9..b2f4f57f2 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -44,7 +44,6 @@ const features = { CODE_MANAGEMENT: process.env.FEATURE_CODE_MANAGEMENT || hasFeatureFlagEnabled('CODE_MANAGEMENT'), REPORTING_CONFIGURATIONS: process.env.FEATURE_REPORTING_CONFIGURATIONS || hasFeatureFlagEnabled('REPORTING_CONFIGURATIONS'), ANALYTICS: process.env.FEATURE_ANALYTICS || hasFeatureFlagEnabled('ANALYTICS'), - ANALYTICS_V2: process.env.FEATURE_ANALYTICS_V2 || hasFeatureFlagEnabled('ANALYTICS_V2'), ANALYTICS_SUPPORTED: process.env.ANALYTICS_SUPPORTED || hasFeatureFlagEnabled('ANALYTICS_SUPPORTED'), SAML_CONFIGURATION: process.env.FEATURE_SAML_CONFIGURATION || hasFeatureFlagEnabled('SAML_CONFIGURATION'), SUPPORT: process.env.FEATURE_SUPPORT || hasFeatureFlagEnabled('SUPPORT'),