From b255b65dc42bbfc4dd1273daf4c455a68961acc6 Mon Sep 17 00:00:00 2001 From: Proddy Date: Thu, 11 May 2023 00:16:03 +0200 Subject: [PATCH] experiment with a pop up device data table --- interface/src/project/DashboardDevices.tsx | 118 ++++++++++----------- 1 file changed, 56 insertions(+), 62 deletions(-) diff --git a/interface/src/project/DashboardDevices.tsx b/interface/src/project/DashboardDevices.tsx index 23d632f3d..917ca0f24 100644 --- a/interface/src/project/DashboardDevices.tsx +++ b/interface/src/project/DashboardDevices.tsx @@ -1,3 +1,4 @@ +import CancelIcon from '@mui/icons-material/Cancel'; import CommentsDisabledOutlinedIcon from '@mui/icons-material/CommentsDisabledOutlined'; import EditIcon from '@mui/icons-material/Edit'; import EditOffOutlinedIcon from '@mui/icons-material/EditOffOutlined'; @@ -7,9 +8,9 @@ import KeyboardArrowDownOutlinedIcon from '@mui/icons-material/KeyboardArrowDown import KeyboardArrowUpOutlinedIcon from '@mui/icons-material/KeyboardArrowUpOutlined'; import PlayArrowIcon from '@mui/icons-material/PlayArrow'; import RefreshIcon from '@mui/icons-material/Refresh'; -import SettingsBackupRestoreIcon from '@mui/icons-material/SettingsBackupRestore'; import StarIcon from '@mui/icons-material/Star'; import UnfoldMoreOutlinedIcon from '@mui/icons-material/UnfoldMoreOutlined'; + import { Button, Dialog, @@ -22,7 +23,9 @@ import { ListItemText, FormControlLabel, Checkbox, - Box + Box, + Grid, + Typography } from '@mui/material'; import { useRowSelect } from '@table-library/react-table-library/select'; import { useSort, SortToggleType } from '@table-library/react-table-library/sort'; @@ -48,9 +51,6 @@ import { AuthenticatedContext } from 'contexts/authentication'; import { useI18nContext } from 'i18n/i18n-react'; import { extractErrorMessage } from 'utils'; -const topOffset = () => document.getElementById('devices-window')?.getBoundingClientRect().bottom || 0; -const leftOffset = () => document.getElementById('devices-window')?.getBoundingClientRect().left || 0; - const DashboardDevices: FC = () => { const { me } = useContext(AuthenticatedContext); const { LL } = useI18nContext(); @@ -134,12 +134,9 @@ const DashboardDevices: FC = () => { common_theme, { Table: ` - --data-table-library_grid-template-columns: minmax(0, 1fr) 30% 40px; - `, - BaseRow: ` - .td { - height: 32px; - } + --data-table-library_grid-template-columns: 300px 150px 40px; + height: auto; + max-height: 92%; `, BaseCell: ` &:nth-of-type(2) { @@ -148,7 +145,7 @@ const DashboardDevices: FC = () => { `, HeaderRow: ` .th { - height: 36px; + border-top: 1px solid #565656; } `, Row: ` @@ -365,12 +362,7 @@ const DashboardDevices: FC = () => { )} - dv.id === selectedDevice) : coreData.devices }} - select={device_select} - theme={device_theme} - layout={{ custom: true }} - > +
{(tableList: any) => ( <>
@@ -436,24 +428,49 @@ const DashboardDevices: FC = () => { leftOffset(), - top: () => topOffset() + right: 32, + bottom: 8, + top: 128, + border: '1px solid #177ac9', + zIndex: 'modal' }} > - setOnlyFav(!onlyFav)} />} - label={ - - {LL.SHOW_FAV()} ( - ) - - } - labelPlacement="start" - /> + + + {deviceData.label} + + + + +
{ }} theme={data_theme} sort={dv_sort} - layout={{ custom: true }} + layout={{ custom: true, fixedHeader: true }} > {(tableList: any) => ( <> @@ -522,7 +539,6 @@ const DashboardDevices: FC = () => { {renderCoreData()} {renderDeviceData()} {renderDeviceDetails()} - {selectedDeviceValue && ( { validator={deviceValueItemValidation(selectedDeviceValue)} /> )} - - - - - - {device_select.state.id && device_select.state.id !== 'sensor' && ( - - )} - - - - - - - - + + + ); };