* chore: added code split for the analytics store * chore: done some refactor * refactor: update entity keys in analytics and translations * chore: updated the translations * refactor: simplify AnalyticsStoreV2 class by removing unnecessary constructor * feat: add AnalyticsStoreV2 class and interface for enhanced analytics functionality * feat: enhance WorkItemsModal and analytics store with isEpic functionality * feat: integrate isEpic state into TotalInsights and WorkItemsModal components * refactor: remove isEpic state from WorkItemsModalMainContent component * refactor: removed old analytics components and related services * refactor: new analytics * refactor: removed all nivo chart dependencies * chore: resolved coderabbit comments * fix: update processUrl to handle custom-work-items in peek view * feat: implement CSV export functionality in InsightTable component * feat: enhance analytics service with filter parameters and improve data handling in InsightTable * feat: add new translation keys for various statuses across multiple languages * [WEB-4246] fix: enhance analytics components to include 'isEpic' parameter for improved data fetching * chore: update yarn.lock to remove deprecated @nivo packages and clean up unused dependencies
178 lines
3.6 KiB
TypeScript
178 lines
3.6 KiB
TypeScript
import { TAnalyticsTabsBase } from "@plane/types";
|
|
import { ChartXAxisProperty, ChartYAxisMetric } from "../chart";
|
|
|
|
export interface IInsightField {
|
|
key: string;
|
|
i18nKey: string;
|
|
i18nProps?: {
|
|
entity?: string;
|
|
entityPlural?: string;
|
|
[key: string]: any;
|
|
};
|
|
}
|
|
|
|
export const insightsFields: Record<TAnalyticsTabsBase, IInsightField[]> = {
|
|
overview: [
|
|
{
|
|
key: "total_users",
|
|
i18nKey: "workspace_analytics.total",
|
|
i18nProps: {
|
|
entity: "common.users",
|
|
},
|
|
},
|
|
{
|
|
key: "total_admins",
|
|
i18nKey: "workspace_analytics.total",
|
|
i18nProps: {
|
|
entity: "common.admins",
|
|
},
|
|
},
|
|
{
|
|
key: "total_members",
|
|
i18nKey: "workspace_analytics.total",
|
|
i18nProps: {
|
|
entity: "common.members",
|
|
},
|
|
},
|
|
{
|
|
key: "total_guests",
|
|
i18nKey: "workspace_analytics.total",
|
|
i18nProps: {
|
|
entity: "common.guests",
|
|
},
|
|
},
|
|
{
|
|
key: "total_projects",
|
|
i18nKey: "workspace_analytics.total",
|
|
i18nProps: {
|
|
entity: "common.projects",
|
|
},
|
|
},
|
|
{
|
|
key: "total_work_items",
|
|
i18nKey: "workspace_analytics.total",
|
|
i18nProps: {
|
|
entity: "common.work_items",
|
|
},
|
|
},
|
|
{
|
|
key: "total_cycles",
|
|
i18nKey: "workspace_analytics.total",
|
|
i18nProps: {
|
|
entity: "common.cycles",
|
|
},
|
|
},
|
|
{
|
|
key: "total_intake",
|
|
i18nKey: "workspace_analytics.total",
|
|
i18nProps: {
|
|
entity: "sidebar.intake",
|
|
},
|
|
},
|
|
],
|
|
"work-items": [
|
|
{
|
|
key: "total_work_items",
|
|
i18nKey: "workspace_analytics.total",
|
|
},
|
|
{
|
|
key: "started_work_items",
|
|
i18nKey: "workspace_analytics.started_work_items",
|
|
},
|
|
{
|
|
key: "backlog_work_items",
|
|
i18nKey: "workspace_analytics.backlog_work_items",
|
|
},
|
|
{
|
|
key: "un_started_work_items",
|
|
i18nKey: "workspace_analytics.un_started_work_items",
|
|
},
|
|
{
|
|
key: "completed_work_items",
|
|
i18nKey: "workspace_analytics.completed_work_items",
|
|
},
|
|
],
|
|
};
|
|
|
|
export const ANALYTICS_DURATION_FILTER_OPTIONS = [
|
|
{
|
|
name: "Yesterday",
|
|
value: "yesterday",
|
|
},
|
|
{
|
|
name: "Last 7 days",
|
|
value: "last_7_days",
|
|
},
|
|
{
|
|
name: "Last 30 days",
|
|
value: "last_30_days",
|
|
},
|
|
{
|
|
name: "Last 3 months",
|
|
value: "last_3_months",
|
|
},
|
|
];
|
|
|
|
export const ANALYTICS_X_AXIS_VALUES: { value: ChartXAxisProperty; label: string }[] = [
|
|
{
|
|
value: ChartXAxisProperty.STATES,
|
|
label: "State name",
|
|
},
|
|
{
|
|
value: ChartXAxisProperty.STATE_GROUPS,
|
|
label: "State group",
|
|
},
|
|
{
|
|
value: ChartXAxisProperty.PRIORITY,
|
|
label: "Priority",
|
|
},
|
|
{
|
|
value: ChartXAxisProperty.LABELS,
|
|
label: "Label",
|
|
},
|
|
{
|
|
value: ChartXAxisProperty.ASSIGNEES,
|
|
label: "Assignee",
|
|
},
|
|
{
|
|
value: ChartXAxisProperty.ESTIMATE_POINTS,
|
|
label: "Estimate point",
|
|
},
|
|
{
|
|
value: ChartXAxisProperty.CYCLES,
|
|
label: "Cycle",
|
|
},
|
|
{
|
|
value: ChartXAxisProperty.MODULES,
|
|
label: "Module",
|
|
},
|
|
{
|
|
value: ChartXAxisProperty.COMPLETED_AT,
|
|
label: "Completed date",
|
|
},
|
|
{
|
|
value: ChartXAxisProperty.TARGET_DATE,
|
|
label: "Due date",
|
|
},
|
|
{
|
|
value: ChartXAxisProperty.START_DATE,
|
|
label: "Start date",
|
|
},
|
|
{
|
|
value: ChartXAxisProperty.CREATED_AT,
|
|
label: "Created date",
|
|
},
|
|
];
|
|
|
|
export const ANALYTICS_Y_AXIS_VALUES: { value: ChartYAxisMetric; label: string }[] = [
|
|
{
|
|
value: ChartYAxisMetric.WORK_ITEM_COUNT,
|
|
label: "Work item",
|
|
},
|
|
{
|
|
value: ChartYAxisMetric.ESTIMATE_POINT_COUNT,
|
|
label: "Estimate",
|
|
},
|
|
];
|
|
|
|
export const ANALYTICS_V2_DATE_KEYS = ["completed_at", "target_date", "start_date", "created_at"];
|