From 5ed7c9a46e159f1123a226fc76b9a0e268364567 Mon Sep 17 00:00:00 2001 From: Palash Gupta Date: Fri, 13 Jan 2023 12:01:46 +0530 Subject: [PATCH] feat: react is updated to v18 (#2030) --- frontend/package.json | 12 +- .../src/components/Logs/LogItem/index.tsx | 35 +++--- .../src/components/Logs/LogItem/styles.ts | 4 + frontend/src/container/AllError/index.tsx | 28 +++-- frontend/src/container/AllError/types.ts | 9 ++ .../GeneralSettings/GeneralSettings.tsx | 26 ++-- .../src/container/LogsSearchFilter/index.tsx | 2 +- .../LogsSearchFilter/useSearchParser.ts | 11 +- frontend/src/container/MetricsTable/index.tsx | 117 ++++++++++-------- .../EditMembersDetails/index.tsx | 9 +- .../Panel/PanelBody/Duration/index.tsx | 2 +- frontend/src/index.tsx | 37 +++--- frontend/src/pages/Trace/index.tsx | 2 +- frontend/yarn.lock | 72 +++++------ 14 files changed, 201 insertions(+), 165 deletions(-) create mode 100644 frontend/src/container/AllError/types.ts diff --git a/frontend/package.json b/frontend/package.json index af2bc52a6b..5b68d6060e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -70,8 +70,8 @@ "less-loader": "^10.2.0", "lodash-es": "^4.17.21", "mini-css-extract-plugin": "2.4.5", - "react": "17.0.0", - "react-dom": "17.0.0", + "react": "18.2.0", + "react-dom": "18.2.0", "react-force-graph": "^1.41.0", "react-graph-vis": "^1.0.5", "react-grid-layout": "^1.3.4", @@ -132,8 +132,8 @@ "@types/lodash-es": "^4.17.4", "@types/mini-css-extract-plugin": "^2.5.1", "@types/node": "^16.10.3", - "@types/react": "^17.0.0", - "@types/react-dom": "^16.9.9", + "@types/react": "18.0.26", + "@types/react-dom": "18.0.10", "@types/react-grid-layout": "^1.1.2", "@types/react-redux": "^7.1.11", "@types/react-router-dom": "^5.1.6", @@ -186,7 +186,7 @@ ] }, "resolutions": { - "@types/react": "17.0.0", - "@types/react-dom": "17.0.0" + "@types/react": "18.0.26", + "@types/react-dom": "18.0.10" } } diff --git a/frontend/src/components/Logs/LogItem/index.tsx b/frontend/src/components/Logs/LogItem/index.tsx index 618248c755..6ff69aa068 100644 --- a/frontend/src/components/Logs/LogItem/index.tsx +++ b/frontend/src/components/Logs/LogItem/index.tsx @@ -14,7 +14,7 @@ import { ILogsReducer } from 'types/reducer/logs'; import AddToQueryHOC from '../AddToQueryHOC'; import CopyClipboardHOC from '../CopyClipboardHOC'; -import { Container, Text, TextContainer } from './styles'; +import { Container, LogContainer, Text, TextContainer } from './styles'; import { isValidLogField } from './util'; interface LogFieldProps { @@ -90,27 +90,30 @@ function LogItem({ logData }: LogItemProps): JSX.Element { const handleCopyJSON = (): void => { setCopy(JSON.stringify(logData, null, 2)); }; + return ( -
+
{'{'} -
- - {flattenLogData.stream && ( + + <> - )} - -
+ {flattenLogData.stream && ( + + )} + + + {'}'}
diff --git a/frontend/src/components/Logs/LogItem/styles.ts b/frontend/src/components/Logs/LogItem/styles.ts index 9d884272c3..ff913cae9c 100644 --- a/frontend/src/components/Logs/LogItem/styles.ts +++ b/frontend/src/components/Logs/LogItem/styles.ts @@ -29,3 +29,7 @@ export const TextContainer = styled.div` overflow: hidden; width: 100%; `; + +export const LogContainer = styled.div` + margin-left: 0.5rem; +`; diff --git a/frontend/src/container/AllError/index.tsx b/frontend/src/container/AllError/index.tsx index e7f2e64bcc..afb7517ae3 100644 --- a/frontend/src/container/AllError/index.tsx +++ b/frontend/src/container/AllError/index.tsx @@ -10,7 +10,8 @@ import { Tooltip, Typography, } from 'antd'; -import { ColumnType } from 'antd/es/table'; +import { ColumnType, TablePaginationConfig } from 'antd/es/table'; +import { FilterValue, SorterResult } from 'antd/es/table/interface'; import { ColumnsType } from 'antd/lib/table'; import { FilterConfirmProps } from 'antd/lib/table/interface'; import getAll from 'api/errors/getAll'; @@ -30,6 +31,7 @@ import { ErrorResponse, SuccessResponse } from 'types/api'; import { Exception, PayloadProps } from 'types/api/errors/getAll'; import { GlobalReducer } from 'types/reducer/globalTime'; +import { FilterDropdownExtendsProps } from './types'; import { extractFilterValues, getDefaultFilterValue, @@ -176,7 +178,13 @@ function AllErrors(): JSX.Element { ); const filterDropdownWrapper = useCallback( - ({ setSelectedKeys, selectedKeys, confirm, placeholder, filterKey }) => { + ({ + setSelectedKeys, + selectedKeys, + confirm, + placeholder, + filterKey, + }: FilterDropdownExtendsProps) => { return ( @@ -192,11 +200,11 @@ function AllErrors(): JSX.Element { getUpdatedServiceName, getUpdatedExceptionType, )} - onPressEnter={handleSearch(confirm, selectedKeys[0], filterKey)} + onPressEnter={handleSearch(confirm, String(selectedKeys[0]), filterKey)} />