From 628412ffc5f7eccec89dc576f0e6a3c649fa22e5 Mon Sep 17 00:00:00 2001 From: Pavel Gnedov Date: Thu, 6 Mar 2025 08:13:57 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D1=8B=20=D0=BB?= =?UTF-8?q?=D0=B8=D1=88=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D1=82=D1=8B.=20=D0=94=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5=20=D1=81=20=D0=BC=D0=B5=D1=82=D1=80=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0=D0=BC=D0=B8=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=D1=8F=D1=82?= =?UTF-8?q?=D1=81=D1=8F=20=D1=81=D0=BF=D0=B8=D1=81=D0=BE=D0=BA=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/dashboard/widgets/daily-eccm-v2.tsx | 241 +----------------- 1 file changed, 5 insertions(+), 236 deletions(-) diff --git a/frontend/src/dashboard/widgets/daily-eccm-v2.tsx b/frontend/src/dashboard/widgets/daily-eccm-v2.tsx index dfeec16..9c4ba80 100644 --- a/frontend/src/dashboard/widgets/daily-eccm-v2.tsx +++ b/frontend/src/dashboard/widgets/daily-eccm-v2.tsx @@ -3,7 +3,6 @@ import * as DashboardStoreNs from '../dashboard-store'; import { observer } from 'mobx-react-lite'; import { DebugInfo } from '../../misc-components/debug-info'; import { Instance, onSnapshot, types } from 'mobx-state-tree'; -import { v4 as uuidv4 } from 'uuid'; import { text2id } from '../../utils/text-to-id'; export const DailyEccmV2Data = types.model({ @@ -29,139 +28,6 @@ export const DailyEccmV2Store = types export type IDailyEccmV2Store = Instance; -const SimpleCounterViewComponent = (props: { - id: string; - label: string; - count: number; - issueIds?: number[]; - detailsLabel?: string; - details?: Record; -}): JSX.Element => { - let detailsHintComponent = <>; - if (props.details) { - const parentKey = props.id - ? props.id - : `simple-counter-component-${uuidv4()}`; - const detailsKey = `${parentKey}-details`; - detailsHintComponent = ( - - ); - } - return ( - - {props.label}: {props.count} {detailsHintComponent} - - ); -}; - -const DetailsHintViewComponent = (props: { - id: string; - mainLabel: string; - details: Record; -}): JSX.Element => { - return ( - - ({props.mainLabel}: {JSON.stringify(props.details)}) - - ); -}; - -const ChangesCounterTotalViewComponent = (props: { - id: string; - data: Record; -}): JSX.Element => { - if (!props.id) return <>; - const titles: Record = { - byIssue: 'По задачам', - byStatus: 'По статусам', - byVersion: 'По версиям', - byUserName: 'По работникам', - }; - const groups = Object.keys(titles); - const details: JSX.Element[] = []; - groups.forEach((groupName) => { - const groupKey = `${props.id}-details-${groupName}`; - const groupTitle = titles[groupName]; - const groupData = props.data[groupName]; - const cmp = ( - - ); - details.push(cmp); - }); - return ( -
    -
  • Итого изменений: {props.data?.totalChanges ?? 0}
  • -
  • Итого комментариев: {props.data?.totalComments ?? 0}
  • - {details} -
- ); -}; - -const ChangesCounterListViewComponent = (props: { - id: string; - title: string; - data?: Record; -}): JSX.Element => { - if (!props.data || !props.id) return <>; - const dataKeys = Object.keys(props.data ?? {}); - if (!dataKeys || dataKeys.length <= 0) return <>; - - const res: JSX.Element[] = []; - - dataKeys.forEach((itemKey) => { - const itemData = props.data && props.data[itemKey]; - if (!itemData) return; - const key = `${props.id}-${text2id(props.title)}-${text2id(itemKey)}`; - res.push( -
  • - -
  • , - ); - }); - - return ( - <> - {props.title}:
      {res}
    - - ); -}; - -const ChangesCounterItemViewComponent = (props: { - id: string; - type: 'issue' | 'other'; - label: string; - changes: number; - comments: number; -}): JSX.Element => { - return ( - - - {props.type == 'issue' ? '#' : ''} - {props.label}:  - - все изменения - {props.changes},  - комментарии - {props.comments} - - ); -}; - const VerySimpleCounterViewComponent = (props: { id: string; title: string; @@ -213,15 +79,6 @@ export const DailyEccmV2 = observer( const keyPrefix = `dashboard-${dashboardId}-widget-${widgetId}`; - const issuesByStatusCount: Record = - props.store?.data?.issuesMetrics?.issuesByStatusCount ?? {}; - const issuesByVersionsCount: Record = - props.store?.data?.issuesMetrics?.issuesByVersionsCount ?? {}; - const issuesByUsername: Record = - props.store?.data?.issuesMetrics?.issuesByUsername ?? {}; - const changesCount: Record = - props.store?.data?.issuesMetrics?.changesCount ?? {}; - const otherData: { title: string; value: number | string; @@ -447,104 +304,16 @@ export const DailyEccmV2 = observer( ); } - const byStatusLi: JSX.Element[] = []; - - Object.keys(issuesByStatusCount).forEach((statusName) => { - const byStatusData = issuesByStatusCount[statusName]; - const keyPrefixForCurrentStatusBlock = `${keyPrefix}-issuesByStatusCount-${statusName}`; - byStatusLi.push( -
  • - -
  • , - ); - }); - - const byVersionsLi: JSX.Element[] = []; - - Object.keys(issuesByVersionsCount).forEach((versionName) => { - const byVersionData = issuesByVersionsCount[versionName]; - const keyPrefixForCurrentVersionBlock = `${keyPrefix}-issuesByVersionCount-${versionName}`; - byVersionsLi.push( -
  • - -
  • , - ); - }); - - const byUsersLi: JSX.Element[] = []; - - Object.keys(issuesByUsername).forEach((username) => { - const byUserNameData = issuesByUsername[username]; - const keyPrefixForCurrentUserBlock = `${keyPrefix}-issuesByUsername-${username}`; - byUsersLi.push( -
  • - -
  • , - ); - }); - return (

    Daily ECCM V2

    Дата выгрузки: {props.store?.data?.datetimeFormatted}

    Метрики:

    -
      -
    • - Простые счётчики: -
        -
      • - По статусам: -
          {byStatusLi}
        -
      • -
      • - По версиям: -
          {byVersionsLi}
        -
      • -
      • - По работникам: -
          {byUsersLi}
        -
      • -
      -
    • -
    • - По изменениям в задачах за период: - -
    • -
    • - Другие счётчики: - -
    • -
    +
    );