diff --git a/frontend/app/components/Dashboard/components/WidgetOptions.tsx b/frontend/app/components/Dashboard/components/WidgetOptions.tsx
index 3bec940c1..72a6aa706 100644
--- a/frontend/app/components/Dashboard/components/WidgetOptions.tsx
+++ b/frontend/app/components/Dashboard/components/WidgetOptions.tsx
@@ -1,12 +1,28 @@
import React from 'react';
-import { FUNNEL, HEATMAP, TABLE, TIMESERIES, USER_PATH } from "App/constants/card";
-import { Select, Space, Switch, Dropdown, Button} from 'antd';
+import {
+ FUNNEL,
+ HEATMAP,
+ TABLE,
+ TIMESERIES,
+ USER_PATH,
+} from 'App/constants/card';
+import { Select, Space, Switch, Dropdown, Button } from 'antd';
import { DownOutlined } from '@ant-design/icons';
import { useStore } from 'App/mstore';
import ClickMapRagePicker from 'Components/Dashboard/components/ClickMapRagePicker/ClickMapRagePicker';
import { FilterKey } from 'Types/filter/filterType';
import { observer } from 'mobx-react-lite';
-import { ChartLine, ChartArea, ChartColumn, ChartBar, ChartPie, Table, Hash } from 'lucide-react'
+import {
+ ChartLine,
+ ChartArea,
+ ChartColumn,
+ ChartBar,
+ ChartPie,
+ Table,
+ Hash,
+ Users,
+ Library,
+} from 'lucide-react';
function WidgetOptions() {
const { metricStore } = useStore();
@@ -16,26 +32,8 @@ function WidgetOptions() {
metric.update({ metricFormat: value });
};
- const chartTypes = {
- lineChart: 'Chart',
- barChart: 'Column',
- areaChart: 'Area',
- pieChart: 'Pie',
- progressChart: 'Bar',
- table: 'Table',
- metric: 'Metric',
- }
- const chartIcons = {
- lineChart: ,
- barChart: ,
- areaChart: ,
- pieChart: ,
- progressChart: ,
- table:
,
- metric: ,
- }
return (
-
+
{metric.metricType === USER_PATH && (
({
- key,
- label:
- {chartIcons[key]}
-
{name}
-
,
- })),
- onClick: ({ key }: any) => {
- metric.updateKey('viewType', key);
- },
- }}
- >
-
-
+ <>
+
+
+ >
) : null}
{(metric.metricType === FUNNEL || metric.metricType === TABLE) &&
metric.metricOf != FilterKey.USERID &&
@@ -94,4 +74,89 @@ function WidgetOptions() {
);
}
+const SeriesTypeOptions = observer(({ metric }: { metric: any }) => {
+ const items = {
+ sessionCount: 'Total Sessions',
+ userCount: 'Unique Users',
+ }
+ const chartIcons = {
+ sessionCount: ,
+ userCount: ,
+ } as const;
+
+ return (
+ ({
+ key,
+ label: (
+
+ {chartIcons[key]}
+
{name}
+
+ ),
+ })),
+ onClick: ({ key }: any) => {
+ metric.updateKey('metricOf', key);
+ },
+ }}
+ >
+
+
+ );
+})
+
+const WidgetViewTypeOptions = observer(({ metric }: { metric: any }) => {
+ const chartTypes = {
+ lineChart: 'Chart',
+ barChart: 'Column',
+ areaChart: 'Area',
+ pieChart: 'Pie',
+ progressChart: 'Bar',
+ table: 'Table',
+ metric: 'Metric',
+ };
+ const chartIcons = {
+ lineChart: ,
+ barChart: ,
+ areaChart: ,
+ pieChart: ,
+ progressChart: ,
+ table: ,
+ metric:
,
+ };
+ return (
+
({
+ key,
+ label: (
+
+ {chartIcons[key]}
+
{name}
+
+ ),
+ })),
+ onClick: ({ key }: any) => {
+ metric.updateKey('viewType', key);
+ },
+ }}
+ >
+
+
+ );
+})
+
export default observer(WidgetOptions);
diff --git a/frontend/app/components/hocs/withPermissions.js b/frontend/app/components/hocs/withPermissions.js
index 42a4986ac..3bec89d9a 100644
--- a/frontend/app/components/hocs/withPermissions.js
+++ b/frontend/app/components/hocs/withPermissions.js
@@ -1,7 +1,7 @@
import { useStore } from "App/mstore";
import React from 'react';
import { NoPermission, NoSessionPermission } from 'UI';
-
+import { observer } from 'mobx-react-lite'
export default (requiredPermissions, className, isReplay = false, andEd = true) => (BaseComponent) => {
@@ -14,6 +14,8 @@ export default (requiredPermissions, className, isReplay = false, andEd = true)
requiredPermissions.some((permission) => permissions.includes(permission)
);
+ console.log(isEnterprise, hasPermission, userStore.account, userStore.authStore)
+
return !isEnterprise || hasPermission ? (
) : (
@@ -26,5 +28,5 @@ export default (requiredPermissions, className, isReplay = false, andEd = true)
);
}
- return WrapperClass;
+ return observer(WrapperClass);
}
diff --git a/frontend/app/mstore/userStore.ts b/frontend/app/mstore/userStore.ts
index 0679de2c8..b188aa768 100644
--- a/frontend/app/mstore/userStore.ts
+++ b/frontend/app/mstore/userStore.ts
@@ -618,7 +618,7 @@ type AuthDetails = {
sso: string | null;
ssoProvider: string | null;
enforceSSO: boolean | null;
- edition: 'foss' | 'ee' | 'msaas';
+ edition?: 'foss' | 'ee' | 'msaas';
};
class AuthStore {
@@ -640,10 +640,13 @@ class AuthStore {
{
key: 'authDetails',
serialize: (ad) => {
+ delete ad['edition']
return Object.keys(ad).length > 0 ? JSON.stringify(ad) : JSON.stringify({});
},
deserialize: (json) => {
- return JSON.parse(json);
+ const ad = JSON.parse(json)
+ delete ad['edition']
+ return ad;
}
}
],