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}
        -
      • -
      -
    • -
    • - По изменениям в задачах за период: - -
    • -
    • - Другие счётчики: - -
    • -
    +
    );