π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
[WEB-4133] fix: analytics release bugs (#7086)
JayashTripathy5c9bdb1cea35
diff --git a/apiserver/plane/app/views/analytic/advance.py b/apiserver/plane/app/views/analytic/advance.pyindex a79ab98c58..8a2aea90b7 100644--- a/apiserver/plane/app/views/analytic/advance.py+++ b/apiserver/plane/app/views/analytic/advance.py@@ -16,6 +16,9 @@ from plane.db.models import (IssueView,ProjectPage,Workspace,+ CycleIssue,+ ModuleIssue,+ ProjectMember,)from plane.utils.build_chart import build_analytics_chartfrom plane.utils.date_utils import (@@ -69,32 +72,27 @@ class AdvanceAnalyticsEndpoint(AdvanceAnalyticsBaseView):}def get_overview_data(self) -> Dict[str, Dict[str, int]]:+ members_query = WorkspaceMember.objects.filter(+ workspace__slug=self._workspace_slug, is_active=True+ )++ if self.request.GET.get("project_ids", None):+ project_ids = self.request.GET.get("project_ids", None)+ project_ids = [str(project_id) for project_id in project_ids.split(",")]+ members_query = ProjectMember.objects.filter(+ project_id__in=project_ids, is_active=True+ )+return {- "total_users": self.get_filtered_counts(- WorkspaceMember.objects.filter(- workspace__slug=self._workspace_slug, is_active=True- )- ),+ "total_users": self.get_filtered_counts(members_query),"total_admins": self.get_filtered_counts(- WorkspaceMember.objects.filter(- workspace__slug=self._workspace_slug,- role=ROLE.ADMIN.value,- is_active=True,- )+ members_query.filter(role=ROLE.ADMIN.value)),"total_members": self.get_filtered_counts(- WorkspaceMember.objects.filter(- workspace__slug=self._workspace_slug,- role=ROLE.MEMBER.value,- is_active=True,- )+ members_query.filter(role=ROLE.MEMBER.value)),"total_guests": self.get_filtered_counts(- WorkspaceMember.objects.filter(- workspace__slug=self._workspace_slug,- role=ROLE.GUEST.value,- is_active=True,- )+ members_query.filter(role=ROLE.GUEST.value)),"total_projects": self.get_filtered_counts(Project.objects.filter(**self.filters["project_filters"])@@ -107,7 +105,7 @@ class AdvanceAnalyticsEndpoint(AdvanceAnalyticsBaseView):),"total_intake": self.get_filtered_counts(Issue.objects.filter(**self.filters["base_filters"]).filter(- issue_intake__isnull=False+ issue_intake__status__in=["-2", "0"])),}diff --git a/web/core/components/analytics-v2/insight-table/root.tsx b/web/core/components/analytics-v2/insight-table/root.tsxindex 8e6e8422ef..1ee90c726a 100644--- a/web/core/components/analytics-v2/insight-table/root.tsx+++ b/web/core/components/analytics-v2/insight-table/root.tsx@@ -13,12 +13,13 @@ interface InsightTableProps<T extends Exclude<TAnalyticsTabsV2Base, "overview">>isLoading?: boolean;columns: ColumnDef<AnalyticsTableDataMap[T]>[];columnsLabels?: Record<string, string>;+ headerText: string;}export const InsightTable = <T extends Exclude<TAnalyticsTabsV2Base, "overview">>(props: InsightTableProps<T>): React.ReactElement => {- const { data, isLoading, columns, columnsLabels } = props;+ const { data, isLoading, columns, columnsLabels, headerText } = props;const params = useParams();const { t } = useTranslation();const workspaceSlug = params.workspaceSlug.toString();@@ -55,7 +56,7 @@ export const InsightTable = <T extends Exclude<TAnalyticsTabsV2Base, "overview"><DataTablecolumns={columns}data={data}- searchPlaceholder={`${data.length} Projects`}+ searchPlaceholder={`${data.length} ${headerText}`}actions={(table: Table<AnalyticsTableDataMap[T]>) => (<Buttonvariant="accent-primary"diff --git a/web/core/components/analytics-v2/overview/active-projects.tsx b/web/core/components/analytics-v2/overview/active-projects.tsxindex 2d5d711166..cb1e2ef693 100644--- a/web/core/components/analytics-v2/overview/active-projects.tsx+++ b/web/core/components/analytics-v2/overview/active-projects.tsx@@ -31,7 +31,7 @@ const ActiveProjects = observer(() => {subtitle={selectedDurationLabel}className="md:col-span-2">- <div className="flex flex-col gap-4">+ <div className="flex flex-col gap-4 h-[350px] overflow-auto">{isProjectAnalyticsCountLoading &&Array.from({ length: 5 }).map((_, index) => <Loader.Item key={index} height="40px" width="100%" />)}{!isProjectAnalyticsCountLoading &&diff --git a/web/core/components/analytics-v2/work-items/priority-chart.tsx b/web/core/components/analytics-v2/work-items/priority-chart.tsxindex c5b31bb168..9d10c2b6ad 100644--- a/web/core/components/analytics-v2/work-items/priority-chart.tsx+++ b/web/core/components/analytics-v2/work-items/priority-chart.tsx@@ -131,11 +131,20 @@ const PriorityChart = observer((props: Props) => {return parsedBars;}, [chart_model, group_by, parsedData, resolvedTheme, workspaceStates, x_axis, y_axis]);+ const yAxisLabel = useMemo(+ () => ANALYTICS_V2_Y_AXIS_VALUES.find((item) => item.value === props.y_axis)?.label ?? props.y_axis,+ [props.y_axis]+ );+ const xAxisLabel = useMemo(+ () => ANALYTICS_V2_X_AXIS_VALUES.find((item) => item.value === props.x_axis)?.label ?? props.x_axis,+ [props.x_axis]+ );+const defaultColumns: ColumnDef<TChartDatum>[] = useMemo(() => [{accessorKey: "name",- header: () => "Name",+ header: () => xAxisLabel,},{accessorKey: "count",@@ -143,7 +152,7 @@ const PriorityChart = observer((props: Props) => {cell: ({ row }) => <div className="text-right">{row.original.count}</div>,},],- []+ [xAxisLabel]);const columns: ColumnDef<TChartDatum>[] = useMemo(@@ -187,15 +196,6 @@ const PriorityChart = observer((props: Props) => {download(csvConfig)(csv);};- const yAxisLabel = useMemo(- () => ANALYTICS_V2_Y_AXIS_VALUES.find((item) => item.value === props.y_axis)?.label ?? props.y_axis,- [props.y_axis]- );- const xAxisLabel = useMemo(- () => ANALYTICS_V2_X_AXIS_VALUES.find((item) => item.value === props.x_axis)?.label ?? props.x_axis,- [props.x_axis]- );-return (<div className="flex flex-col gap-12 ">{priorityChartLoading ? (@@ -224,7 +224,7 @@ const PriorityChart = observer((props: Props) => {<DataTabledata={parsedData.data}columns={[...defaultColumns, ...columns]}- searchPlaceholder={`${parsedData.data.length} ${yAxisLabel}`}+ searchPlaceholder={`${parsedData.data.length} ${xAxisLabel}`}actions={(table: Table<TChartDatum>) => (<Buttonvariant="accent-primary"diff --git a/web/core/components/analytics-v2/work-items/workitems-insight-table.tsx b/web/core/components/analytics-v2/work-items/workitems-insight-table.tsxindex 1fd8343296..6dca7d9293 100644--- a/web/core/components/analytics-v2/work-items/workitems-insight-table.tsx+++ b/web/core/components/analytics-v2/work-items/workitems-insight-table.tsx@@ -142,6 +142,7 @@ const WorkItemsInsightTable = observer(() => {isLoading={isLoading}columns={columns}columnsLabels={columnsLabels}+ headerText={isPeekView ? columnsLabels["display_name"] : columnsLabels["project__name"]}/>);});