From 0e24780a9167f8d90236c5ca2b027e715b656144 Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Tue, 21 Dec 2021 15:37:23 +0500 Subject: [PATCH] =?UTF-8?q?*=20=D0=94=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BD=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=BB=D0=B5=D0=B9=20TelemetryView=20*=20=D0=92?= =?UTF-8?q?=D1=8B=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=20=D0=BC=D0=B5=D1=82=D0=BE?= =?UTF-8?q?=D0=B4=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=BB=D0=B5=D0=B9=D0=B1=D0=BB=D0=B0=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?TelemetryInfo=20*=20=D0=A1=D0=BC=D0=B5=D0=BD=D1=91=D0=BD=20?= =?UTF-8?q?=D1=82=D0=B8=D0=BF=20=D1=81=D0=BC=D0=B5=D1=88=D0=B8=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=BE=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B0=D0=BC=20?= =?UTF-8?q?=D0=B8=20=D1=80=D0=BE=D0=BB=D1=8F=D0=BC=20*=20WellIconState=20?= =?UTF-8?q?=D1=8D=D0=BA=D1=81=D0=BF=D0=BE=D1=80=D1=82=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=20=D0=B8=D0=B7=20=D0=B3=D0=BB=D0=B0=D0=B2?= =?UTF-8?q?=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20?= =?UTF-8?q?=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8F=20components/icons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Private/PrivateMenuItem.tsx | 2 +- src/components/UserMenu.tsx | 2 +- src/components/Views/TelemetryView.tsx | 11 +++++++++-- src/components/icons/index.ts | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/Private/PrivateMenuItem.tsx b/src/components/Private/PrivateMenuItem.tsx index dc6fe32..e764522 100644 --- a/src/components/Private/PrivateMenuItem.tsx +++ b/src/components/Private/PrivateMenuItem.tsx @@ -10,4 +10,4 @@ type PrivateMenuItemProps = { } export const PrivateMenuItem: React.FC = ({ roles, permission, mixing, ...props }) => - hasPermission(permission) || isInRole(roles) ? : null + hasPermission(permission) && isInRole(roles) ? : null diff --git a/src/components/UserMenu.tsx b/src/components/UserMenu.tsx index 0877eb2..aefba66 100644 --- a/src/components/UserMenu.tsx +++ b/src/components/UserMenu.tsx @@ -53,7 +53,7 @@ export const UserMenu: React.FC = ({ isAdmin }) => { placement={'bottomRight'} overlay={( - + {isAdmin ? ( Вернуться на сайт ) : ( diff --git a/src/components/Views/TelemetryView.tsx b/src/components/Views/TelemetryView.tsx index bc0c229..3d4170c 100644 --- a/src/components/Views/TelemetryView.tsx +++ b/src/components/Views/TelemetryView.tsx @@ -4,20 +4,27 @@ import { TelemetryInfoDto } from '../../services/api' import { Grid, GridItem } from '../Grid' const lables: { [labelKey: string]: string } = { + timeZoneId: 'Временная зона', timeZoneOffsetTotalHours: 'Сдвиг временной зоны', drillingStartDate: 'Начало бурения', deposit: 'Месторождение', cluster: 'Куст', well: 'Скважина', customer: 'Заказчик', + comment: 'Комментарий', + hmiVersion: 'Версия HMI', + saubPlcVersion: 'Версия САУБ', + spinPlcVersion: 'Версия Спин Мастер', } +export const getTelemetryLabel = (info?: TelemetryInfoDto) => info ? `${info.deposit} / ${info.cluster} / ${info.well}` : '---' + export type TelemetryViewProps = { info?: TelemetryInfoDto } export const TelemetryView = memo(({ info }) => info ? ( - {(Object.keys(info) as Array).map((key, i) => ( <> @@ -27,7 +34,7 @@ export const TelemetryView = memo(({ info }) => info ? ( ))} }> - {info.deposit}/{info.cluster}/{info.well} + {getTelemetryLabel(info)} ) : ( - diff --git a/src/components/icons/index.ts b/src/components/icons/index.ts index 3dce827..b290f4a 100644 --- a/src/components/icons/index.ts +++ b/src/components/icons/index.ts @@ -1,5 +1,5 @@ export type { PointerIconColors, PointerIconProps } from './PointerIcon' -export type { WellIconColors, WellIconProps } from './WellIcon' +export type { WellIconColors, WellIconProps, WellIconState } from './WellIcon' export { PointerIcon } from './PointerIcon' export { WellIcon } from './WellIcon'