From d0071a97fd056041f8e16e964241e46bd7d9e015 Mon Sep 17 00:00:00 2001 From: tacigar Date: Fri, 23 Dec 2022 16:49:33 +0900 Subject: [PATCH] Adjust styling of Dependencies page --- .../DependenciesPage/DependenciesGraph.tsx | 169 ++++++++---------- .../DependenciesPage/DependenciesPage.tsx | 77 ++++---- .../DependenciesPage/NodeDetailData.tsx | 163 ++++++----------- .../DependenciesPage/{Edge.ts => types.ts} | 6 +- .../DiscoverPage/DiscoverPageContent.tsx | 20 ++- .../src/components/common/ExplainBox.tsx | 8 +- 6 files changed, 178 insertions(+), 265 deletions(-) rename zipkin-lens/src/components/DependenciesPage/{Edge.ts => types.ts} (88%) diff --git a/zipkin-lens/src/components/DependenciesPage/DependenciesGraph.tsx b/zipkin-lens/src/components/DependenciesPage/DependenciesGraph.tsx index f91d27f937a..29cc1ae3dc2 100644 --- a/zipkin-lens/src/components/DependenciesPage/DependenciesGraph.tsx +++ b/zipkin-lens/src/components/DependenciesPage/DependenciesGraph.tsx @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 The OpenZipkin Authors + * Copyright 2015-2022 The OpenZipkin Authors * * 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 @@ -16,7 +16,6 @@ import { Box, - Grid, Theme, createStyles, makeStyles, @@ -25,12 +24,10 @@ import { import moment from 'moment'; import React, { CSSProperties, useState, useCallback, useMemo } from 'react'; import ReactSelect, { ValueType, ActionMeta } from 'react-select'; -import { AutoSizer } from 'react-virtualized'; - -import Edge from './Edge'; +import Dependencies from '../../models/Dependencies'; import NodeDetailData from './NodeDetailData'; +import { Edge } from './types'; import VizceralWrapper from './VizceralWrapper'; -import Dependencies from '../../models/Dependencies'; // These filter functions use any type because they are passed directly to untyped JS code. const filterConnections = (object: any, value: any) => { @@ -108,22 +105,10 @@ const reactSelectStyles = { const useStyles = makeStyles((theme: Theme) => createStyles({ - containerGrid: { - height: '100%', - }, - graphItemGrid: { - height: '100%', - }, - nodeDetailDataItemGrid: { - height: '100%', - boxShadow: theme.shadows[10], - zIndex: 1, - }, - vizceralWrapper: { - // In Firefox, 100% height does not work... - '& .vizceral': { - height: '99%', - }, + detailWrapper: { + flex: '0 0 420px', + width: 420, + borderLeft: `1px solid ${theme.palette.divider}`, }, }), ); @@ -238,82 +223,70 @@ const DependenciesGraph: React.FC = ({ ); return ( - - - - - {({ width, height }) => ( - - - - )} - - - - - - {focusedNodeName ? ( - - - - ) : null} - + + + + + + + + {focusedNodeName ? ( + + + + ) : null} ); }; diff --git a/zipkin-lens/src/components/DependenciesPage/DependenciesPage.tsx b/zipkin-lens/src/components/DependenciesPage/DependenciesPage.tsx index 3384f61371f..885933a3e3f 100644 --- a/zipkin-lens/src/components/DependenciesPage/DependenciesPage.tsx +++ b/zipkin-lens/src/components/DependenciesPage/DependenciesPage.tsx @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 The OpenZipkin Authors + * Copyright 2015-2022 The OpenZipkin Authors * * 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 @@ -12,7 +12,7 @@ * the License. */ -import { faSearch, faProjectDiagram } from '@fortawesome/free-solid-svg-icons'; +import { faProjectDiagram, faSync } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { t, Trans } from '@lingui/macro'; import { useLingui } from '@lingui/react'; @@ -30,35 +30,28 @@ import moment from 'moment'; import React, { useEffect, useState, useCallback, useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { withRouter, RouteComponentProps } from 'react-router-dom'; - -import DependenciesGraph from './DependenciesGraph'; -import { clearAlert, setAlert } from '../App/slice'; -import ExplainBox from '../common/ExplainBox'; import { clearDependencies, loadDependencies, } from '../../slices/dependenciesSlice'; import { RootState } from '../../store'; +import { clearAlert, setAlert } from '../App/slice'; +import ExplainBox from '../common/ExplainBox'; import { LoadingIndicator } from '../common/LoadingIndicator'; +import DependenciesGraph from './DependenciesGraph'; const useStyles = makeStyles((theme: Theme) => createStyles({ + searchWrapper: { + backgroundColor: theme.palette.background.paper, + padding: theme.spacing(2), + flex: '0 0', + borderBottom: `1px solid ${theme.palette.divider}`, + }, dateTimePicker: { marginLeft: theme.spacing(1), marginRight: theme.spacing(1), }, - dateTimePickerInput: { - fontSize: '1rem', - height: '1.8rem', - padding: `${theme.spacing(0.4)}px ${theme.spacing(0.6)}px`, - }, - searchButton: { - fontSize: '1.2rem', - padding: theme.spacing(1), - minWidth: 0, - width: 32, - height: 32, - }, }), ); @@ -209,39 +202,41 @@ const DependenciesPageImpl: React.FC = ({ display="flex" flexDirection="column" > - + - - - - + + + - + + - + {content} diff --git a/zipkin-lens/src/components/DependenciesPage/NodeDetailData.tsx b/zipkin-lens/src/components/DependenciesPage/NodeDetailData.tsx index 03d18a74fc4..2ff44486bbd 100644 --- a/zipkin-lens/src/components/DependenciesPage/NodeDetailData.tsx +++ b/zipkin-lens/src/components/DependenciesPage/NodeDetailData.tsx @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 The OpenZipkin Authors + * Copyright 2015-2022 The OpenZipkin Authors * * 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 @@ -17,11 +17,9 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { Box, Button, - Paper, Table, TableBody, TableCell, - TableHead, TableRow, Theme, Typography, @@ -30,41 +28,36 @@ import { } from '@material-ui/core'; import React, { useCallback } from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; -import { PieChart, Pie, Cell, ResponsiveContainer } from 'recharts'; - -import Edge from './Edge'; +import { PieChart, Pie, Cell, ResponsiveContainer, Tooltip } from 'recharts'; +import { Edge } from './types'; import { selectServiceColor } from '../../constants/color'; const useStyles = makeStyles((theme: Theme) => createStyles({ title: { - overflowWrap: 'break-word', - flexGrow: 1, - minWidth: 10, // break-word in flex-box - }, - searchTracesButton: { - display: 'flex', - }, - noDataMessage: { - opacity: 0.8, + wordWrap: 'break-word', + flex: '1 1', + minWidth: 0, }, - tablePaper: { - marginRight: theme.spacing(2), - marginLeft: theme.spacing(2), - maxHeight: 180, - overflowY: 'auto', - borderRadius: 3, + table: { + tableLayout: 'fixed', }, - tableHeadCell: { - top: 0, - position: 'sticky', - padding: `${theme.spacing(1)}px ${theme.spacing(2)}px`, - backgroundColor: theme.palette.grey[200], - zIndex: 1, + tableRow: { + '&:first-child > *': { + borderTop: `1px solid ${theme.palette.divider}`, + }, }, tableCell: { - wordBreak: 'break-all', - padding: `${theme.spacing(1)}px ${theme.spacing(2)}px`, + wordWrap: 'break-word', + }, + contentWrapper: { + flex: '1 1', + borderTop: `1px solid ${theme.palette.divider}`, + overflow: 'auto', + '& > :not(:last-child)': { + marginBottom: theme.spacing(2), + }, + paddingBottom: theme.spacing(2), }, }), ); @@ -121,69 +114,34 @@ const NodeDetailDataImpl: React.FC = ({ return ( - - - - - - - {serviceName} - - - + + - + {shownDataList.map((d) => ( - - - - - {d.title} - - - (traced requests) - + + + + + {d.title} (traced requests) + - - + + {d.formatter(d.edges.length)} - + @@ -194,7 +152,7 @@ const NodeDetailDataImpl: React.FC = ({ }))} nameKey="name" dataKey="value" - outerRadius={60} + outerRadius={70} > {d.edges.map((edge) => ( = ({ /> ))} + - - - - - - Service Name - - - Call - - - Error - - - + +
{d.edges.map((edge) => ( - + = ({ {d.selectNodeName(edge)} - + {edge.metrics.normal} - + {edge.metrics.danger} ))}
-
+
))}
diff --git a/zipkin-lens/src/components/DependenciesPage/Edge.ts b/zipkin-lens/src/components/DependenciesPage/types.ts similarity index 88% rename from zipkin-lens/src/components/DependenciesPage/Edge.ts rename to zipkin-lens/src/components/DependenciesPage/types.ts index dabb7f03aed..b8349bb3572 100644 --- a/zipkin-lens/src/components/DependenciesPage/Edge.ts +++ b/zipkin-lens/src/components/DependenciesPage/types.ts @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 The OpenZipkin Authors + * Copyright 2015-2022 The OpenZipkin Authors * * 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 @@ -12,7 +12,7 @@ * the License. */ -type Edge = { +export type Edge = { source: string; target: string; metrics: { @@ -20,5 +20,3 @@ type Edge = { danger: number; }; }; - -export default Edge; diff --git a/zipkin-lens/src/components/DiscoverPage/DiscoverPageContent.tsx b/zipkin-lens/src/components/DiscoverPage/DiscoverPageContent.tsx index 84d8198edbe..6e08f996076 100644 --- a/zipkin-lens/src/components/DiscoverPage/DiscoverPageContent.tsx +++ b/zipkin-lens/src/components/DiscoverPage/DiscoverPageContent.tsx @@ -559,14 +559,16 @@ const DiscoverPageContent: React.FC = ({ ); } else { content = ( - - - + + + + + ); } @@ -694,7 +696,7 @@ const DiscoverPageContent: React.FC = ({ )}
- {content} + {content}
); diff --git a/zipkin-lens/src/components/common/ExplainBox.tsx b/zipkin-lens/src/components/common/ExplainBox.tsx index 45b251fbcaf..818772f7162 100644 --- a/zipkin-lens/src/components/common/ExplainBox.tsx +++ b/zipkin-lens/src/components/common/ExplainBox.tsx @@ -26,17 +26,13 @@ interface ExplainBoxProps { const ExplainBox = React.memo(({ icon, headerText, text }) => { return (