From d0fc4329aa47fa3fdcc3a9f3af31e977ad21b979 Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Wed, 12 Feb 2020 09:08:39 +0100 Subject: Update odlux Fix scrolling and resizing bug in all tables, update the ui, minior bugfixes Issue-ID: SDNC-1067 Signed-off-by: Aijana Schumann Change-Id: I6322d5f612dcbc0c044b4b67ef3c73d6d2c90949 --- .../src/components/material-table/index.tsx | 67 ++++++++++++++++------ .../framework/src/components/navigationMenu.tsx | 2 +- .../framework/src/components/routing/appFrame.tsx | 36 ++++++------ .../framework/src/services/forceLogoutService.ts | 9 ++- .../framework/src/services/notificationService.ts | 11 ++-- sdnr/wt/odlux/framework/src/views/frame.tsx | 2 +- 6 files changed, 84 insertions(+), 43 deletions(-) (limited to 'sdnr/wt/odlux/framework/src') diff --git a/sdnr/wt/odlux/framework/src/components/material-table/index.tsx b/sdnr/wt/odlux/framework/src/components/material-table/index.tsx index 520674441..b85319b40 100644 --- a/sdnr/wt/odlux/framework/src/components/material-table/index.tsx +++ b/sdnr/wt/odlux/framework/src/components/material-table/index.tsx @@ -21,6 +21,7 @@ import { withStyles, WithStyles, createStyles, Theme } from '@material-ui/core/s import Table from '@material-ui/core/Table'; import TableBody from '@material-ui/core/TableBody'; import TableCell from '@material-ui/core/TableCell'; +import TableContainer from '@material-ui/core/TableContainer'; import TablePagination from '@material-ui/core/TablePagination'; import TableRow from '@material-ui/core/TableRow'; import Paper from '@material-ui/core/Paper'; @@ -31,10 +32,13 @@ import { EnhancedTableHead } from './tableHead'; import { EnhancedTableFilter } from './tableFilter'; import { ColumnModel, ColumnType } from './columnModel'; -import { Omit } from '@material-ui/core'; +import { Omit, Menu } from '@material-ui/core'; + import { SvgIconProps } from '@material-ui/core/SvgIcon/SvgIcon'; -import { replaceHyphen } from '../../utilities/yangHelper'; -import { string } from 'prop-types'; + +import { DividerTypeMap } from '@material-ui/core/Divider'; +import { MenuItemProps } from '@material-ui/core/MenuItem'; +import { flexbox } from '@material-ui/system'; export { ColumnModel, ColumnType } from './columnModel'; type propType = string | number | null | undefined | (string | number)[]; @@ -70,14 +74,19 @@ function getSorting(order: 'asc' | 'desc' | null, orderBy: string) { const styles = (theme: Theme) => createStyles({ root: { width: '100%', + overflow: "hidden", marginTop: theme.spacing(3), + position: "relative", + boxSizing: "border-box", + display: "flex", + flexDirection: "column", }, - table: { - minWidth: 1020, - }, - tableWrapper: { - overflowX: 'auto', + container: { + flex: "1 1 100%" }, + pagination: { + overflow: "hidden" + } }); export type MaterialTableComponentState = { @@ -100,11 +109,13 @@ type MaterialTableComponentBaseProps = WithStyles & { idProperty: keyof TData | ((data: TData) => React.Key); tableId?: string; title?: string; + stickyHeader?: boolean; enableSelection?: boolean; disableSorting?: boolean; disableFilter?: boolean; customActionButtons?: { icon: React.ComponentType, tooltip?: string, onClick: () => void }[]; onHandleClick?(event: React.MouseEvent, rowData: TData): void; + createContextMenu?: (row: TData) => React.ReactElement, React.ComponentType>>[]; }; type MaterialTableComponentPropsWithRows = MaterialTableComponentBaseProps & { rows: TData[]; asynchronus?: boolean; }; @@ -139,7 +150,7 @@ function isMaterialTableComponentPropsWithRowsAndRequestData(props: MaterialTabl propsWithExternalState.onHandleRequestSort instanceof Function } -class MaterialTableComponent extends React.Component { +class MaterialTableComponent extends React.Component { constructor(props: MaterialTableComponentProps) { super(props); @@ -148,6 +159,7 @@ class MaterialTableComponent extends React.Component extends React.Component { !this.props.disableFilter && this.setState({ showFilter: !showFilter }, this.update) } return ( - -
- + + +
extends React.Component { const entryId = getId(entry); const isSelected = this.isSelected(entryId); + const contextMenu = (this.props.createContextMenu && this.state.contextMenuInfo.index === index && this.props.createContextMenu(entry)) || null; return ( this.handleClick(event, entry, entryId)} + onClick={event => { + if (this.props.createContextMenu) { + this.setState({ + contextMenuInfo: { + index: -1 + } + }); + } + this.handleClick(event, entry, entryId); + }} + onContextMenu={event => { + if (this.props.createContextMenu) { + event.preventDefault(); + event.stopPropagation(); + this.setState({ contextMenuInfo: { index, mouseX: event.clientX - 2, mouseY: event.clientY - 4 } }); + } + }} role="checkbox" aria-checked={isSelected} aria-label={`${(this.props.tableId ? this.props.tableId : 'table')}-row-${(index + 1)}`} @@ -230,6 +259,10 @@ class MaterialTableComponent extends React.Component this.setState({ contextMenuInfo: { index: -1 } })} anchorReference="anchorPosition" keepMounted + anchorPosition={this.state.contextMenuInfo.mouseY != null && this.state.contextMenuInfo.mouseX != null ? { top: this.state.contextMenuInfo.mouseY, left: this.state.contextMenuInfo.mouseX } : undefined}> + {contextMenu} + || null} ); })} @@ -240,8 +273,8 @@ class MaterialTableComponent extends React.Component
-
- + extends React.Component createStyles({ position: 'relative', width: drawerWidth, }, - toolbar: theme.mixins.toolbar, + toolbar: theme.mixins.toolbar as any, drawerOpen: { width: drawerWidth, transition: theme.transitions.create('width', { diff --git a/sdnr/wt/odlux/framework/src/components/routing/appFrame.tsx b/sdnr/wt/odlux/framework/src/components/routing/appFrame.tsx index e6af2eb5d..d212257c8 100644 --- a/sdnr/wt/odlux/framework/src/components/routing/appFrame.tsx +++ b/sdnr/wt/odlux/framework/src/components/routing/appFrame.tsx @@ -1,20 +1,20 @@ -/** - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt odlux - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - */ +/** + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt odlux + * ================================================================================================= + * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * ============LICENSE_END========================================================================== + */ import * as React from 'react'; import connect, { Connect } from '../../flux/connect'; @@ -38,7 +38,7 @@ export class AppFrame extends React.Component { public render(): JSX.Element { return ( -
+
{ this.props.children }
) diff --git a/sdnr/wt/odlux/framework/src/services/forceLogoutService.ts b/sdnr/wt/odlux/framework/src/services/forceLogoutService.ts index ce4faab6b..0c7c38dff 100644 --- a/sdnr/wt/odlux/framework/src/services/forceLogoutService.ts +++ b/sdnr/wt/odlux/framework/src/services/forceLogoutService.ts @@ -27,11 +27,16 @@ let tickTimer = 15; export const startForceLogoutService = (store: ApplicationStore) => { applicationStore = store; - createForceLogoutInterval(); + if (process.env.NODE_ENV === "development") { + console.warn("logout timer not started in development mode"); + } else { + createForceLogoutInterval(); + } + }; const createForceLogoutInterval = () => { - console.log("logout timer running...") + console.log("logout timer running..."); return setInterval(function () { if (applicationStore && applicationStore.state.framework.authenticationState.user) { diff --git a/sdnr/wt/odlux/framework/src/services/notificationService.ts b/sdnr/wt/odlux/framework/src/services/notificationService.ts index 85d3f716b..c90da0946 100644 --- a/sdnr/wt/odlux/framework/src/services/notificationService.ts +++ b/sdnr/wt/odlux/framework/src/services/notificationService.ts @@ -179,10 +179,13 @@ export const startWebsocketSession = () => { } export const endWebsocketSession = () => { - socketReady.then(websocket => { - websocket.close(); - userLoggedOut = true; - }) + if (socketReady) { + socketReady.then(websocket => { + websocket.close(); + userLoggedOut = true; + }); + } + } diff --git a/sdnr/wt/odlux/framework/src/views/frame.tsx b/sdnr/wt/odlux/framework/src/views/frame.tsx index b93b7ee01..f2f6f66cc 100644 --- a/sdnr/wt/odlux/framework/src/views/frame.tsx +++ b/sdnr/wt/odlux/framework/src/views/frame.tsx @@ -52,7 +52,7 @@ const styles = (theme: Theme) => createStyles({ padding: theme.spacing(3), minWidth: 0, // So the Typography noWrap works }, - toolbar: theme.mixins.toolbar + toolbar: theme.mixins.toolbar as any }); type FrameProps = WithStyles; -- cgit 1.2.3-korg