From 656b26897cd86a0bc8ff0cd90e880a50c2b2a1cb Mon Sep 17 00:00:00 2001 From: Pavel Gnedov Date: Fri, 14 Feb 2025 08:08:21 +0700 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BD=D0=B0=20=D0=B2=D0=B8=D0=B4?= =?UTF-8?q?=D0=B6=D0=B5=D1=82=20=D1=81=20=D0=BF=D0=BE=D0=BC=D0=BE=D1=89?= =?UTF-8?q?=D1=8C=D1=8E=20=D0=B2=D1=81=D0=BF=D0=BE=D0=BC=D0=BE=D0=B3=D0=B0?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=D0=B0=20SimpleCounte?= =?UTF-8?q?rViewComponent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/package-lock.json | 46 ++++-- frontend/package.json | 1 + .../src/dashboard/widgets/daily-eccm-v2.tsx | 134 ++++++++++++------ 3 files changed, 121 insertions(+), 60 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index f00f493..364dfae 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -26,6 +26,7 @@ "react-router-dom": "^6.11.1", "react-scripts": "5.0.1", "typescript": "^4.9.5", + "uuid": "^11.0.5", "web-vitals": "^2.1.4" }, "devDependencies": { @@ -14049,9 +14050,9 @@ } }, "node_modules/react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "dependencies": { "loose-envify": "^1.1.0" }, @@ -15109,6 +15110,14 @@ "websocket-driver": "^0.7.4" } }, + "node_modules/sockjs/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/source-list-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", @@ -16142,11 +16151,15 @@ } }, "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.5.tgz", + "integrity": "sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { - "uuid": "dist/bin/uuid" + "uuid": "dist/esm/bin/uuid" } }, "node_modules/v8-to-istanbul": { @@ -26959,9 +26972,9 @@ } }, "react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "requires": { "loose-envify": "^1.1.0" } @@ -27727,6 +27740,13 @@ "faye-websocket": "^0.11.3", "uuid": "^8.3.2", "websocket-driver": "^0.7.4" + }, + "dependencies": { + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + } } }, "source-list-map": { @@ -28496,9 +28516,9 @@ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" }, "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.5.tgz", + "integrity": "sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==" }, "v8-to-istanbul": { "version": "8.1.1", diff --git a/frontend/package.json b/frontend/package.json index 9dccb5e..026f9c5 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -21,6 +21,7 @@ "react-router-dom": "^6.11.1", "react-scripts": "5.0.1", "typescript": "^4.9.5", + "uuid": "^11.0.5", "web-vitals": "^2.1.4" }, "scripts": { diff --git a/frontend/src/dashboard/widgets/daily-eccm-v2.tsx b/frontend/src/dashboard/widgets/daily-eccm-v2.tsx index 63862ca..b44978d 100644 --- a/frontend/src/dashboard/widgets/daily-eccm-v2.tsx +++ b/frontend/src/dashboard/widgets/daily-eccm-v2.tsx @@ -3,6 +3,7 @@ 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'; export const DailyEccmV2Data = types.model({ id: types.string, @@ -27,6 +28,47 @@ export const DailyEccmV2Store = types export type IDailyEccmV2Store = Instance; +const SimpleCounterViewComponent = (props: { + key?: string; + label: string; + count: number; + issueIds?: number[]; + detailsLabel?: string; + details?: Record; +}): JSX.Element => { + let detailsHintComponent = <>; + if (props.details) { + const parentKey = props.key + ? props.key + : `simple-counter-component-${uuidv4()}`; + const detailsKey = `${parentKey}-details`; + detailsHintComponent = ( + + ); + } + return ( + + {props.label}: {props.count} {detailsHintComponent} + + ); +}; + +const DetailsHintViewComponent = (props: { + key?: string; + mainLabel: string; + details: Record; +}): JSX.Element => { + return ( + + ({props.mainLabel}: {JSON.stringify(props.details)}) + + ); +}; + export const DailyEccmV2 = observer( (props: { store: IDailyEccmV2Store }): JSX.Element => { const dashboardId = props.store?.data?.dashboardId; @@ -42,61 +84,55 @@ export const DailyEccmV2 = observer( const byStatusLi: JSX.Element[] = []; - Object.keys(issuesByStatusCount).forEach((status) => { - let byStatusHint: JSX.Element; - const byVersion = issuesByStatusCount[status]?.byVersion; - const keyPrefixForCurrentStatusBlock = `${keyPrefix}-issuesByStatusCount-${status}`; - if (byVersion && Object.keys(byVersion).length > 0) { - const byVersionSimple = Object.keys(byVersion).reduce( - (acc: Record, version) => { - acc[version] = byVersion[version].count; - return acc; - }, - {} as Record, - ); - byStatusHint = ( - - (Версии: {JSON.stringify(byVersionSimple)}) - - ); - } else { - byStatusHint = <>; - } + Object.keys(issuesByStatusCount).forEach((statusName) => { + const byStatusData = issuesByStatusCount[statusName]; + const keyPrefixForCurrentStatusBlock = `${keyPrefix}-issuesByStatusCount-${statusName}`; byStatusLi.push( -
  • - {status}: {issuesByStatusCount[status].count} {byStatusHint} +
  • +
  • , ); }); const byVersionsLi: JSX.Element[] = []; - Object.keys(issuesByVersionsCount).forEach((version) => { - const byStatus = issuesByVersionsCount[version].byStatus; - const keyPrefixForCurrentVersionBlock = `${keyPrefix}-issuesByVersionsCount-${version}`; - - let byStatusHint: JSX.Element = <>; - if (byStatus && Object.keys(byStatus).length > 0) { - const byStatusSimple = Object.keys(byStatus).reduce((acc, status) => { - acc[status] = byStatus[status].count; - return acc; - }, {} as Record); - byStatusHint = ( - - (Статусы: {JSON.stringify(byStatusSimple)}) - - ); - } - + Object.keys(issuesByVersionsCount).forEach((versionName) => { + const byVersionData = issuesByVersionsCount[versionName]; + const keyPrefixForCurrentVersionBlock = `${keyPrefix}-issuesByVersionCount-${versionName}`; byVersionsLi.push( -
  • - {version}: {issuesByVersionsCount[version].count} {byStatusHint} +
  • + +
  • , + ); + }); + + const byUsersLi: JSX.Element[] = []; + + Object.keys(issuesByUsername).forEach((username) => { + const byUserNameData = issuesByUsername[username]; + const keyPrefixForCurrentUserBlock = `${keyPrefix}-issuesByUsername-${username}`; + byUsersLi.push( +
  • +
  • , ); }); @@ -118,6 +154,10 @@ export const DailyEccmV2 = observer( По версиям:
      {byVersionsLi}
    +
  • + По работникам: +
      {byUsersLi}
    +